X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=qui%2FMussaWindow.cpp;h=75da849d591416a25371c980e9454b8c46e737af;hb=15e1618344491d9860923656fc16be15532223a6;hp=39d25f9db598bf69223ac14f05eb3d15cd37d411;hpb=8cae0e15c7c0961809dc72c768c20d04c067d9c5;p=mussa.git diff --git a/qui/MussaWindow.cpp b/qui/MussaWindow.cpp index 39d25f9..75da849 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,16 +69,18 @@ MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) : saveBrowserPixmapAction(0), whatsThisAction(0), viewMussaAlignmentAction(0), - manualAssistant(0) + assistantProcess(0) { init_resources(); + + default_dir.reset(new QDir(QDir::home().absolutePath())); + setupWidgets(); setupActions(); setupAssistant(); setupMainMenu(); setWindowIcon(QIcon(":/icons/mussa.png")); - default_dir.reset(new QDir(QDir::home().absolutePath())); setCentralWidget(browser); // well updatePosition isn't quite right as we really just need @@ -87,6 +92,10 @@ MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) : connect(zoom, SIGNAL(valueChanged(double)), browser, SLOT(setZoom(double))); mussaViewTB->addWidget(zoom); + + // Mouse Wheel triggered zooming + connect(browser, SIGNAL(mouseWheelZoom(double)), + zoom, SLOT(setValue(double))); // threshold range is set in updateAnalysis connect(threshold, SIGNAL(thresholdChanged(int)), @@ -113,7 +122,18 @@ void MussaWindow::setAnalysis(MussaRef new_analysis) if (new_analysis != 0) { // only switch mussas if we loaded without error clear(); + //std::cout << "analysis soft: " << analysis->get_soft_threshold() + // << " new analysis soft: " << new_analysis->get_soft_threshold() + // << "\n"; analysis.swap(new_analysis); + //std::cout << "after swap soft thres: " << analysis->get_soft_threshold() + // << "\n"; + threshold->disconnect(this); + threshold->reset(analysis->get_threshold(), + analysis->get_window(), + analysis->get_soft_threshold()); + connect(threshold, SIGNAL(thresholdChanged(int)), + this, SLOT(setSoftThreshold(int))); updateTitle(); updateAnalysis(); } @@ -297,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"; @@ -304,6 +325,7 @@ void MussaWindow::setupAssistant() manualAssistant->setArguments(manualAssistantArgs); connect(manualAssistant, SIGNAL(error(QString)), this, SLOT(assistantError(QString))); + */ #endif } @@ -629,14 +651,21 @@ void MussaWindow::newMussaWindow() void MussaWindow::setSoftThreshold(int value) { + //std::cout << "Soft: " << analysis->get_soft_threshold() + // << " Value: " << value << "\n"; if (analysis->get_soft_threshold() != value) { threshold->setEnabled( false ); + //std::cout << "Updating!!!!\n"; analysis->set_soft_threshold(value); analysis->nway(); updateLinks(); update(); threshold->setEnabled( true ); } + //else + //{ + // std::cout << "NOT Updating!!!!\n"; + //} } void MussaWindow::showMussaToolbar() @@ -665,16 +694,32 @@ 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;") + << QLatin1String("expandToc 0") + << QLatin1Char('\0') << endl; + #else QUrl manual_url("http://woldlab.caltech.edu/~king/mussagl_manual/"); if (not QDesktopServices::openUrl(manual_url)) { @@ -731,6 +776,7 @@ void MussaWindow::updateAnalysis() // but it's possible for us to not have had a chance to set out sequences // yet. threshold->setRange(analysis->get_threshold(),analysis->get_window()); + threshold->setBasepairThreshold(analysis->get_soft_threshold()); updateLinks(); browser->zoomOut(); zoom->setValue(browser->zoom());