~ubuntu-branches/ubuntu/saucy/texworks/saucy

« back to all changes in this revision

Viewing changes to src/TWApp.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA
  • Date: 2011-08-18 11:22:40 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20110818112240-d2vmclt5llf8vano
Tags: 0.5~svn930-1
New upstream release (rev 930).

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
#define SETUP_FILE_NAME "texworks-setup.ini"
75
75
 
76
 
#define DEFAULT_ENGINE_NAME "pdfLaTeX"
77
 
 
78
76
const int kDefaultMaxRecentFiles = 20;
79
77
 
80
78
TWApp *TWApp::theAppInstance = NULL;
474
472
{
475
473
        // The strings here are deliberately NOT localizable!
476
474
        QString address("texworks@tug.org");
477
 
        QString subject("Message from TeXworks user");
478
 
        QString body("\n\n----- configuration info -----\n");
 
475
        QString body("Instructions:\n-) Please write your message in English (it's in your own best interest; otherwise, many people will not be able to understand it and therefore will not answer).\n\n-) Please type something meaningful in the subject line.\n\n-) If you are having a problem, please describe it step-by-step in detail.\n\n-) After reading, please delete these instructions (up to the \"configuration info\" below which we may need to find the source of problems).\n\n\n\n----- configuration info -----\n");
479
476
 
480
477
        body += "TeXworks version : " TEXWORKS_VERSION "r" SVN_REVISION_STR " (" TW_BUILD_ID_STR ")\n";
481
478
#ifdef Q_WS_MAC
529
526
        body += " (runtime)\n";
530
527
        body += "------------------------------\n";
531
528
 
532
 
        openUrl(QUrl(QString("mailto:%1?subject=%2&body=%3").arg(address).arg(subject).arg(body)));
 
529
        openUrl(QUrl(QString("mailto:%1?&body=%3").arg(address).arg(body)));
533
530
}
534
531
 
535
532
void TWApp::launchAction()
568
565
#endif
569
566
}
570
567
 
571
 
void TWApp::newFile()
 
568
QObject * TWApp::newFile() const
572
569
{
573
570
        TeXDocument *doc = new TeXDocument;
574
571
        doc->show();
575
572
        doc->editor()->updateLineNumberAreaWidth(0);
576
573
        doc->runHooks("NewFile");
 
574
        return doc;
577
575
}
578
576
 
579
 
void TWApp::newFromTemplate()
 
577
QObject * TWApp::newFromTemplate() const
580
578
{
581
579
        QString templateName = TemplateDialog::doTemplateDialog();
582
580
        if (!templateName.isEmpty()) {
586
584
                        doc->selectWindow();
587
585
                        doc->editor()->updateLineNumberAreaWidth(0);
588
586
                        doc->runHooks("NewFromTemplate");
 
587
                        return doc;
589
588
                }
590
589
        }
 
590
        return NULL;
591
591
}
592
592
 
593
593
void TWApp::openRecentFile()
833
833
        else
834
834
                engineList->clear();
835
835
        *engineList
836
 
                << Engine("LaTeXmk", "latexmk" EXE, QStringList("-e") << 
837
 
                                  "$pdflatex=q/pdflatex -synctex=1 %O %S/" << "-pdf" << "$fullname", true)
 
836
//              << Engine("LaTeXmk", "latexmk" EXE, QStringList("-e") << 
 
837
//                                "$pdflatex=q/pdflatex -synctex=1 %O %S/" << "-pdf" << "$fullname", true)
838
838
                << Engine("pdfTeX", "pdftex" EXE, QStringList("$synctexoption") << "$fullname", true)
839
839
                << Engine("pdfLaTeX", "pdflatex" EXE, QStringList("$synctexoption") << "$fullname", true)
 
840
                << Engine("LuaTeX", "luatex" EXE, QStringList("$synctexoption") << "$fullname", true)
 
841
                << Engine("LuaLaTeX", "lualatex" EXE, QStringList("$synctexoption") << "$fullname", true)
840
842
                << Engine("XeTeX", "xetex" EXE, QStringList("$synctexoption") << "$fullname", true)
841
843
                << Engine("XeLaTeX", "xelatex" EXE, QStringList("$synctexoption") << "$fullname", true)
842
844
                << Engine("ConTeXt (LuaTeX)", "context" EXE, QStringList("--synctex") << "$fullname", true)
943
945
{
944
946
        const QList<Engine> engines = getEngineList();
945
947
        int i;
946
 
        for (i = 0; i < engines.count(); ++i)
 
948
        for (i = 0; i < engines.count(); ++i) {
947
949
                if (engines[i].name() == name) {
948
950
                        QSETTINGS_OBJECT(settings);
949
951
                        settings.setValue("defaultEngine", name);
950
952
                        break;
951
953
                }
 
954
        }
 
955
        // If the engine was not found (e.g., if it has been deleted)
 
956
        // try the DEFAULT_ENGINE_NAME instead (should not happen, unless the config
 
957
        // was edited manually (or by an updater, copy/paste'ing, etc.)
 
958
        if (i == engines.count() && name != DEFAULT_ENGINE_NAME) {
 
959
                for (i = 0; i < engines.count(); ++i) {
 
960
                        if (engines[i].name() == DEFAULT_ENGINE_NAME) 
 
961
                                break;
 
962
                }
 
963
        }
 
964
        // if neither the passed engine name nor DEFAULT_ENGINE_NAME was found,
 
965
        // fall back to selecting the first engine
952
966
        if (i == engines.count())
953
967
                i = 0;
 
968
 
954
969
        defaultEngineIndex = i;
955
970
}
956
971