updates for local help and build system

This commit is contained in:
ws 2015-02-06 20:38:10 +01:00
parent 30aaa5c5f4
commit 1f6e959af2
11 changed files with 28 additions and 54 deletions

View file

@ -39,6 +39,8 @@ HelpQuery::HelpQuery(QWidget* parent)
}
}
mapper = new QSignalMapper(this);
w = new QWidget(parent);
QHBoxLayout* layout = new QHBoxLayout;
@ -60,8 +62,7 @@ HelpQuery::HelpQuery(QWidget* parent)
connect(button, SIGNAL(clicked()), entry, SLOT(clear()));
connect(entry, SIGNAL(textChanged(const QString&)), SLOT(textChanged(const QString&)));
QMenu* menu = static_cast<QMenu*>(parent);
connect(menu, SIGNAL(triggered(QAction*)), SLOT(actionTriggered(QAction*)));
connect(mapper, SIGNAL(mapped(QObject*)), SLOT(actionTriggered(QObject*)));
}
//---------------------------------------------------------
@ -93,12 +94,14 @@ void HelpQuery::textChanged(const QString& s)
menu->removeAction(a);
}
emptyState = false;
QMap<QString,QUrl>list = helpEngine->linksForIdentifier(s);
for (const QUrl& s : list) {
QAction* action = new QAction(s.toString(), this);
action->setData(s);
for (auto i = list.begin(); i != list.end(); ++i) {
QAction* action = new QAction(i.key(), this);
action->setData(i.value());
printf("add action <%s> <%s>\n", qPrintable(i.key()), qPrintable(i.value().toString()));
menu->addAction(action);
connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
mapper->setMapping(action, action);
}
}
@ -106,15 +109,17 @@ void HelpQuery::textChanged(const QString& s)
// actionTriggered
//---------------------------------------------------------
void HelpQuery::actionTriggered(QAction* action)
void HelpQuery::actionTriggered(QObject* obj)
{
QAction* action = static_cast<QAction*>(obj);
if (action->data().isNull())
return;
QUrl url = action->data().toUrl();
if (url.isValid()) {
printf("actionTriggered <%s>\n", qPrintable(url.toString()));
if (url.isValid())
mscore->showHelp(url);
}
else
qDebug("actionTriggered: bad url");
entry->clear();
}

View file

@ -27,11 +27,16 @@ class HelpQuery : public QWidgetAction {
QWidget* w;
QLineEdit* entry;
QList<QAction*> actions;
QSignalMapper* mapper;
bool emptyState;
private slots:
void textChanged(const QString&);
void actionTriggered(QAction*);
void actionTriggered(QObject*);
public slots:
void setFocus() { entry->setFocus(); }
public:
HelpQuery(QWidget* parent);
@ -43,6 +48,3 @@ extern QHelpEngine* helpEngine;
#endif

View file

@ -177,11 +177,10 @@ QValidator::State MagValidator::validate(QString& input, int& /*pos*/) const
void MagBox::setMag(double val)
{
blockSignals(true);
const QSignalBlocker blocker(this);
setCurrentIndex(int(MagIdx::MAG_FREE));
freeMag = val;
setItemText(int(MagIdx::MAG_FREE), QString("%1%").arg(freeMag * 100));
blockSignals(false);
}
//---------------------------------------------------------
@ -190,9 +189,8 @@ void MagBox::setMag(double val)
void MagBox::setMagIdx(MagIdx idx)
{
blockSignals(true);
const QSignalBlocker blocker(this);
setCurrentIndex(int(idx));
blockSignals(false);
}
}

View file

@ -892,6 +892,7 @@ MuseScore::MuseScore()
HelpQuery* hw = new HelpQuery(menuHelp);
menuHelp->addAction(hw);
connect(menuHelp, SIGNAL(aboutToShow()), hw, SLOT(setFocus()));
menuHelp->addAction(getAction("local-help"));
menuHelp->addAction(tr("&Online Handbook"), this, SLOT(helpBrowser1()));

View file

@ -17,10 +17,11 @@ add_custom_target(referenceDocumentation
add_custom_command(TARGET referenceDocumentation
POST_BUILD
COMMAND qcollectiongenerator ${PROJECT_SOURCE_DIR}/rdoc/en/doc.qhcp -o doc_en.qhc
COMMAND qcollectiongenerator ${PROJECT_SOURCE_DIR}/rdoc/de/doc.qhcp -o doc_de.qhc
COMMAND Qt5::qcollectiongenerator ${PROJECT_SOURCE_DIR}/rdoc/en/doc.qhcp -o doc_en.qhc
COMMAND Qt5::qcollectiongenerator ${PROJECT_SOURCE_DIR}/rdoc/de/doc.qhcp -o doc_de.qhc
)
install(FILES
${PROJECT_BINARY_DIR}/rdoc/doc_en.qhc
${PROJECT_BINARY_DIR}/rdoc/doc_de.qhc

View file

Binary file not shown.

View file

@ -23,7 +23,6 @@
<keyword id="klops" ref="doc.html#foobar"/>
</keywords>
<files>
<file>../classic.css</file>
<file>doc.html</file>
</files>
</filterSection>

View file

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<QtHelpProject version="1.0">
<namespace>musescore.com.musescore.2.0</namespace>
<virtualFolder>doc</virtualFolder>
<customFilter name="MuseScore 2.0">
<filterAttribute>MuseScore</filterAttribute>
<filterAttribute>2.0</filterAttribute>
</customFilter>
<filterSection>
<filterAttribute>MuseScore</filterAttribute>
<filterAttribute>2.0</filterAttribute>
<toc>
<section title="My Application Manual" ref="index.html">
<section title="Chapter 1" ref="doc.html#chapter1"/>
<section title="Chapter 2" ref="doc.html#chapter2"/>
<section title="Chapter 3" ref="doc.html#chapter3"/>
</section>
</toc>
<keywords>
<keyword name="foo" id="MuseScore::foo" ref="doc.html#foo"/>
<keyword name="bar" ref="doc.html#bar"/>
<keyword id="MuseScore::foobar" ref="doc.html#foobar"/>
<keyword id="mops" ref="doc.html#foobar"/>
<keyword id="klops" ref="doc.html#foobar"/>
</keywords>
<files>
<file>classic.css</file>
<file>*.html</file>
</files>
</filterSection>
</QtHelpProject>

Binary file not shown.

View file

@ -16,14 +16,13 @@
</section>
</toc>
<keywords>
<keyword id="manual" ref="doc.html"/>
<keyword name="Manual" id="manual" ref="doc.html"/>
<keyword name="bar" ref="doc.html#bar"/>
<keyword id="MuseScore::foobar" ref="doc.html#foobar"/>
<keyword id="mops" ref="doc.html#foobar"/>
<keyword id="klops" ref="doc.html#foobar"/>
</keywords>
<files>
<file>../classic.css</file>
<file>doc.html</file>
</files>
</filterSection>