X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=qui%2FMussaWindow.cpp;h=f302f8e184d7b88a81d93f9e6908951db830c6dd;hp=b0342e40c0e186ba7731a28367735985f424d12d;hb=e216a2853d55398c68294f889615d125920676cf;hpb=0ce031d4b5b8dfa50dbd6b13702c8d3c384110e2 diff --git a/qui/MussaWindow.cpp b/qui/MussaWindow.cpp index b0342e4..f302f8e 100644 --- a/qui/MussaWindow.cpp +++ b/qui/MussaWindow.cpp @@ -11,12 +11,15 @@ #include #include #include +#include #include #include +#include #include #include #include #include +#include #include #include @@ -66,7 +69,7 @@ MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) : saveBrowserPixmapAction(0), whatsThisAction(0), viewMussaAlignmentAction(0), - manualAssistant(0) + assistantProcess(0) { init_resources(); @@ -314,6 +317,7 @@ void MussaWindow::setupWidgets() void MussaWindow::setupAssistant() { #if defined(QT_QTASSISTANT_FOUND) + /* QStringList manualAssistantArgs; manualAssistantArgs = QStringList(); manualAssistantArgs << "-profile" << "./doc/manual/mussagl_manual.adp"; @@ -321,6 +325,7 @@ void MussaWindow::setupAssistant() manualAssistant->setArguments(manualAssistantArgs); connect(manualAssistant, SIGNAL(error(QString)), this, SLOT(assistantError(QString))); + */ #endif } @@ -689,16 +694,31 @@ void MussaWindow::toggleMotifs() void MussaWindow::showManual() { #if defined(QT_QTASSISTANT_FOUND) - if (manualAssistant) { - manualAssistant->openAssistant(); - } else { - QMessageBox::warning(this, - tr("Mussa Help Error"), - tr("QtAssistant not setup correctly"), - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton); + + // Only define the process once. + if (!assistantProcess) + assistantProcess = new QProcess(this); + + // No need to fire up the process again if it is already running. + if (assistantProcess->state() == QProcess::Running) + return; + + QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + + QLatin1String("/assistant"); + + assistantProcess->start(app, QStringList() << QLatin1String("-enableRemoteControl") + << QLatin1String("-collectionFile") << QLatin1String("mussagl_manual.qhc")); + if (!assistantProcess->waitForStarted()) { + QMessageBox::critical(this, tr("Remote Control"), + tr("Could not start Qt Assistant from %1.").arg(app)); + return; } + + // show index page + QTextStream str(assistantProcess); + str << QLatin1String("SetSource qthelp://edu.caltech.woldlab.mussagl.1_0_0/doc/mussagl_manual.html") + << QLatin1Char('\0') << endl; + #else QUrl manual_url("http://woldlab.caltech.edu/~king/mussagl_manual/"); if (not QDesktopServices::openUrl(manual_url)) { @@ -708,7 +728,6 @@ void MussaWindow::showManual() QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); - } #endif //QT_QTASSISTANT_FOUND }