diff --git a/mscore/help.cpp b/mscore/help.cpp index 54797d64c4..7f3c1e89a4 100644 --- a/mscore/help.cpp +++ b/mscore/help.cpp @@ -15,8 +15,6 @@ namespace Ms { -QHelpEngine* helpEngine; - //--------------------------------------------------------- // HelpQuery //--------------------------------------------------------- @@ -24,21 +22,6 @@ QHelpEngine* helpEngine; HelpQuery::HelpQuery(QWidget* parent) : QWidgetAction(parent) { - if (!helpEngine) { - QString lang = mscore->getLocaleISOCode(); - if (lang == "en_US") // HACK - lang = "en"; - - QString s = getSharePath() + "manual/doc_" + lang + ".qhc"; - qDebug("init Help from: <%s>", qPrintable(s)); - helpEngine = new QHelpEngine(s, this); - if (!helpEngine->setupData()) { - qDebug("cannot setup data for help engine: %s", qPrintable(helpEngine->error())); - delete helpEngine; - helpEngine = 0; - } - } - mapper = new QSignalMapper(this); w = new QWidget(parent); @@ -106,8 +89,10 @@ void HelpQuery::textChanged(const QString& ss) menu->removeAction(a); } emptyState = false; - QMaplist = helpEngine->linksForIdentifier(s); -// QMaplist = helpEngine->indexModel()->linksForKeyword(s); + if (!mscore->helpEngine()) + return; + QMaplist = mscore->helpEngine()->linksForIdentifier(s); +// QMaplist = mscore->helpEngine()->indexModel()->linksForKeyword(s); int k = 0; for (auto i = list.begin(); i != list.end(); ++i) { QAction* action = new QAction(i.key(), this); @@ -144,7 +129,7 @@ void HelpQuery::actionTriggered(QObject* obj) void HelpQuery::returnPressed() { - QMaplist = helpEngine->linksForIdentifier(entry->text().toLower()); + QMaplist = mscore->helpEngine()->linksForIdentifier(entry->text().toLower()); if (!list.isEmpty()) { mscore->showHelp(list.begin().value()); } diff --git a/mscore/help.h b/mscore/help.h index 1960e81117..ecce4e156d 100644 --- a/mscore/help.h +++ b/mscore/help.h @@ -43,7 +43,6 @@ class HelpQuery : public QWidgetAction { HelpQuery(QWidget* parent); }; -extern QHelpEngine* helpEngine; } // end namespace Ms diff --git a/mscore/helpBrowser.cpp b/mscore/helpBrowser.cpp index 025ebf23cd..543ffdd054 100644 --- a/mscore/helpBrowser.cpp +++ b/mscore/helpBrowser.cpp @@ -13,6 +13,7 @@ #include "helpBrowser.h" #include "icons.h" #include "help.h" +#include "musescore.h" namespace Ms { @@ -24,7 +25,7 @@ namespace Ms { HelpBrowser::HelpBrowser(QWidget* parent) : QWidget(parent) { - view = new HelpView(helpEngine); + view = new HelpView(mscore->helpEngine()); toolbar = new QWidget; toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp index 434d9ea022..ed877c7768 100644 --- a/mscore/musescore.cpp +++ b/mscore/musescore.cpp @@ -961,13 +961,30 @@ MuseScore::MuseScore() connect(autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSaveTimerTimeout())); initOsc(); startAutoSave(); + if (enableExperimental) { cornerLabel = new QLabel(this); cornerLabel->setScaledContents(true); cornerLabel->setPixmap(QPixmap(":/data/mscore.png")); cornerLabel->setGeometry(width() - 48, 0, 48, 48); } - _loginManager = new LoginManager(this); + if (!converterMode) { + _loginManager = new LoginManager(this); + + // initialize help engine + QString lang = mscore->getLocaleISOCode(); + if (lang == "en_US") // HACK + lang = "en"; + + QString s = getSharePath() + "manual/doc_" + lang + ".qhc"; + qDebug("init Help from: <%s>", qPrintable(s)); + _helpEngine = new QHelpEngine(s, this); + if (!_helpEngine->setupData()) { + qDebug("cannot setup data for help engine: %s", qPrintable(_helpEngine->error())); + delete _helpEngine; + _helpEngine = 0; + } + } } MuseScore::~MuseScore() @@ -1023,7 +1040,7 @@ void MuseScore::showHelp(const QUrl& url) { qDebug("showHelp <%s>", qPrintable(url.toString())); - if (!helpEngine) + if (!_helpEngine) return; QAction* a = getAction("local-help"); @@ -1048,12 +1065,12 @@ void MuseScore::showHelp(QString s) { s = s.toLower(); qDebug("showHelp <%s>", qPrintable(s)); - QMaplist = helpEngine->linksForIdentifier(s); + QMaplist = _helpEngine->linksForIdentifier(s); if (!list.isEmpty()) showHelp(*list.begin()); else { qDebug("help for <%s> not found", qPrintable(s)); - QMaplist = helpEngine->linksForIdentifier("manual"); + QMaplist = _helpEngine->linksForIdentifier("manual"); if (!list.isEmpty()) showHelp(*list.begin()); } diff --git a/mscore/musescore.h b/mscore/musescore.h index a3ab7135ca..932f539008 100644 --- a/mscore/musescore.h +++ b/mscore/musescore.h @@ -357,7 +357,8 @@ class MuseScore : public QMainWindow, public MuseScoreCore { QComboBox* playMode; QNetworkAccessManager* networkManager { 0 }; QAction* lastCmd { 0 }; - const Shortcut* lastShortcut { 0 }; + const Shortcut* lastShortcut { 0 }; + QHelpEngine* _helpEngine { 0 }; QAction* countInAction; QAction* metronomeAction; @@ -683,7 +684,8 @@ class MuseScore : public QMainWindow, public MuseScoreCore { void showLoginDialog(); void showUploadScoreDialog(); - LoginManager* loginManager() { return _loginManager; } + LoginManager* loginManager() { return _loginManager; } + QHelpEngine* helpEngine() const { return _helpEngine; } void updateInspector(); };