analysis(analysis_),
default_dir(QDir::home().absolutePath().toStdString(), fs::native),
motif_editor(0),
- setup_analysis_dialog(this),
- browser(this),
- mussaViewTB("Path Views"),
- zoom(),
- threshold(),
+ setup_analysis_dialog(new MussaSetupDialog(this)),
+ subanalysis_window(new SubanalysisWindow),
+ browser(new SequenceBrowserWidget(this)),
+ mussaViewTB(new QToolBar("Path Views")),
+ zoom(new ZoomWidget),
+ threshold(new ThresholdWidget),
progress_dialog(0),
aboutAction(0),
closeAction(0),
// a segfault when using WhatsThis feature with
// opengl widget.
//scene->setWhatsThis(tr("Mussa in OpenGL!"));
- setCentralWidget(&browser);
+ setCentralWidget(browser);
// well updatePosition isn't quite right as we really just need
// to call update()
- connect(this, SIGNAL(changedAnnotations()), &browser, SLOT(update()));
+ connect(this, SIGNAL(changedAnnotations()), browser, SLOT(update()));
- //mussaViewTB.addAction(toggleMotifsAction);
- mussaViewTB.addWidget(&zoom);
+ //mussaViewTB->addAction(toggleMotifsAction);
+ mussaViewTB->addWidget(zoom);
- connect(&zoom, SIGNAL(valueChanged(double)),
- &browser, SLOT(setZoom(double)));
+ connect(zoom, SIGNAL(valueChanged(double)),
+ browser, SLOT(setZoom(double)));
// threshold range is set in updateAnalysis
//scene->setClipPlane(20);
// FIXME: for when we get the paths drawn at the appropriate depth
- //connect(&threshold, SIGNAL(thresholdChanged(int)),
+ //connect(threshold, SIGNAL(thresholdChanged(int)),
// this, SLOT(setClipPlane(int)));
- connect(&threshold, SIGNAL(thresholdChanged(int)),
+ connect(threshold, SIGNAL(thresholdChanged(int)),
this, SLOT(setSoftThreshold(int)));
- mussaViewTB.addWidget(&threshold);
+ mussaViewTB->addWidget(threshold);
- addToolBar(&mussaViewTB);
+ addToolBar(mussaViewTB);
statusBar()->showMessage("Welcome to mussa", 2000);
connect(analysis, SIGNAL(progress(const std::string&, int, int)),
//Save pixel map action
saveBrowserPixmapAction = new QAction(tr("Save to image..."), this);
connect(saveBrowserPixmapAction, (SIGNAL(triggered())),
- &browser, SLOT(promptSaveBrowserPixmap()));
+ browser, SLOT(promptSaveBrowserPixmap()));
saveBrowserPixmapAction->setIcon(QIcon(":/icons/image2.png"));
viewMussaAlignmentAction = new QAction(tr("View sequence alignment"), this);
newMenu = menuBar()->addMenu(tr("&Edit"));
newMenu->addAction(editMotifsAction);
- newMenu->addAction(&browser.getCopySelectedSequenceAsFastaAction());
+ newMenu->addAction(browser->getCopySelectedSequenceAsFastaAction());
newMenu->addAction(createSubAnalysisAction);
newMenu = menuBar()->addMenu(tr("&View"));
newMenu->addAction(aboutAction);
// add some extra features to the context menu
- QMenu& popupMenu = browser.getPopupMenu();
- popupMenu.addAction(viewMussaAlignmentAction);
- popupMenu.addAction(createSubAnalysisAction);
+ QMenu *popupMenu = browser->getPopupMenu();
+ if (popupMenu) {
+ popupMenu->addAction(viewMussaAlignmentAction);
+ popupMenu->addAction(createSubAnalysisAction);
+ }
}
void MussaWindow::setupAssistant()
void MussaWindow::clear()
{
aligned_windows.clear();
- browser.clear();
+ browser->clear();
}
void MussaWindow::createNewAnalysis()
// but this should work for the moment.
if (not isClearingAnalysisSafe()) return;
- if (setup_analysis_dialog.exec()) {
+ if (setup_analysis_dialog->exec()) {
Mussa *m = 0;
- m = setup_analysis_dialog.getMussa();
+ m = setup_analysis_dialog->getMussa();
setAnalysis(m);
}
} catch(mussa_error e) {
void MussaWindow::createSubAnalysis()
{
list<SequenceLocation> result;
- SequenceLocationModel& model = subanalysis_window.getModel();
- browser.copySelectedTracksAsSeqLocation(result);
+ SequenceLocationModel& model = subanalysis_window->getModel();
+ browser->copySelectedTracksAsSeqLocation(result);
for(list<SequenceLocation>::iterator result_itor = result.begin();
result_itor != result.end();
++result_itor)
model.push_back(*result_itor);
}
- if (not subanalysis_window.isVisible()) {
- subanalysis_window.show();
+ if (not subanalysis_window->isVisible()) {
+ subanalysis_window->show();
}
}
void MussaWindow::showMussaToolbar()
{
- if (mussaViewTB.isVisible())
- mussaViewTB.hide();
+ if (mussaViewTB->isVisible())
+ mussaViewTB->hide();
else
- mussaViewTB.show();
+ mussaViewTB->show();
}
void MussaWindow::toggleMotifs()
void MussaWindow::viewMussaAlignment()
{
- const set<int>& selected_paths = browser.selectedPaths();
+ const set<int>& selected_paths = browser->selectedPaths();
if (selected_paths.size() == 0 ) {
QMessageBox::warning(this,
QObject::tr("mussa"),
void MussaWindow::updateAnalysis()
{
- threshold.setRange(analysis->get_threshold(),analysis->get_window());
-
const Mussa::vector_sequence_type& seqs = analysis->sequences();
- browser.setSequences(seqs, analysis->colorMapper());
+ browser->setSequences(seqs, analysis->colorMapper());
+ assert(browser->sequences().size() == analysis->size());
+
+ // setRange eventually emits something that causes updateLinks to be called
+ // 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());
updateLinks();
- browser.zoomOut();
- zoom.setValue(browser.zoom());
+ browser->zoomOut();
+ zoom->setValue(browser->zoom());
}
void MussaWindow::updateAnnotations()
// motifs were changed in the sequences by
// Mussa::update_sequences_motifs
emit changedAnnotations();
- browser.update();
+ browser->update();
}
void MussaWindow::updateLinks()
{
- browser.clear_links();
+ if(browser->sequences().size() == 0) {
+ // we don't have any sequences load so we have no business setting links
+ return;
+ }
+
+ browser->clear_links();
bool reversed = false;
const NwayPaths& nway = analysis->paths();
normalized_path.push_back(x);
rc_flags.push_back(reversed);
}
- browser.link(normalized_path, rc_flags, path_itor->window_size);
+ browser->link(normalized_path, rc_flags, path_itor->window_size);
}
- browser.update();
+ browser->update();
}
void