fix #47351 Crash when running in converter mode
This commit is contained in:
parent
8dacb7f27b
commit
4eda1f64e6
5 changed files with 32 additions and 28 deletions
|
@ -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;
|
||||
QMap<QString,QUrl>list = helpEngine->linksForIdentifier(s);
|
||||
// QMap<QString,QUrl>list = helpEngine->indexModel()->linksForKeyword(s);
|
||||
if (!mscore->helpEngine())
|
||||
return;
|
||||
QMap<QString,QUrl>list = mscore->helpEngine()->linksForIdentifier(s);
|
||||
// QMap<QString,QUrl>list = 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()
|
||||
{
|
||||
QMap<QString,QUrl>list = helpEngine->linksForIdentifier(entry->text().toLower());
|
||||
QMap<QString,QUrl>list = mscore->helpEngine()->linksForIdentifier(entry->text().toLower());
|
||||
if (!list.isEmpty()) {
|
||||
mscore->showHelp(list.begin().value());
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ class HelpQuery : public QWidgetAction {
|
|||
HelpQuery(QWidget* parent);
|
||||
};
|
||||
|
||||
extern QHelpEngine* helpEngine;
|
||||
|
||||
} // end namespace Ms
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
QMap<QString,QUrl>list = helpEngine->linksForIdentifier(s);
|
||||
QMap<QString,QUrl>list = _helpEngine->linksForIdentifier(s);
|
||||
if (!list.isEmpty())
|
||||
showHelp(*list.begin());
|
||||
else {
|
||||
qDebug("help for <%s> not found", qPrintable(s));
|
||||
QMap<QString,QUrl>list = helpEngine->linksForIdentifier("manual");
|
||||
QMap<QString,QUrl>list = _helpEngine->linksForIdentifier("manual");
|
||||
if (!list.isEmpty())
|
||||
showHelp(*list.begin());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue