Mercurial > hg > tony
diff src/MainWindow.cpp @ 164:62ceae757fe0
Re-analyse frames when selection changes (this only pulls up a set of new candidates for now, can't do anything with them and the old ones are never removed)
author | Chris Cannam |
---|---|
date | Thu, 30 Jan 2014 17:33:55 +0000 |
parents | 106fdf38c6c9 |
children | 6b6906017536 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Wed Jan 29 17:34:28 2014 +0000 +++ b/src/MainWindow.cpp Thu Jan 30 17:33:55 2014 +0000 @@ -147,6 +147,9 @@ m_viewManager->setShowCentreLine(false); m_viewManager->setOverlayMode(ViewManager::MinimalOverlays); + connect(m_viewManager, SIGNAL(selectionChanged()), + this, SLOT(selectionChanged())); + QFrame *frame = new QFrame; setCentralWidget(frame); @@ -1623,7 +1626,27 @@ cerr << "MainWindow::doubleClickSelectInvoked(" << frame << "): [" << f0 << "," << f1 << "]" << endl; - m_viewManager->setSelection(Selection(f0, f1)); + Selection sel(f0, f1); + m_viewManager->setSelection(sel); +} + +void +MainWindow::selectionChanged() +{ + MultiSelection::SelectionList selections = m_viewManager->getSelections(); + + cerr << "MainWindow::selectionChanged" << endl; + + if (!selections.empty()) { + Selection sel = *selections.begin(); + cerr << "MainWindow::selectionChanged: have selection" << endl; + QString error = m_analyser->reAnalyseSelection(sel); + if (error != "") { + QMessageBox::critical + (this, tr("Failed to analyse selection"), + tr("<b>Analysis failed</b><p>%2</p>").arg(error)); + } + } } void