#include <QAction>
+#include <QApplication>
#include <QAssistantClient>
#include <QDir>
#include <QFileDialog>
mussaViewTB("Path Views"),
zoom(),
threshold(),
+ progress_dialog(0),
aboutAction(0),
closeAction(0),
createNewAnalysisAction(0),
addToolBar(&mussaViewTB);
statusBar()->showMessage("Welcome to mussa", 2000);
+ connect(analysis, SIGNAL(progress(const std::string&, int, int)),
+ this, SLOT(updateProgress(const std::string&, int, int)));
updateAnalysis();
}
if (analysis != 0) delete analysis;
aligned_windows.clear();
if (motif_editor != 0) delete motif_editor;
+ if (progress_dialog != 0) delete progress_dialog;
if (aboutAction != 0) delete aboutAction;
if (closeAction != 0) delete closeAction;
try {
Mussa *m = new Mussa;
fs::path converted_path(mupa_path.toStdString(), fs::native);
+ connect(m, SIGNAL(progress(const std::string&, int, int)),
+ this, SLOT(updateProgress(const std::string&, int, int)));
m->load_mupa_file(converted_path);
m->analyze();
setAnalysis(m);
try {
Mussa *m = new Mussa;
fs::path converted_path(muway_dir.toStdString(), fs::native);
+ connect(m, SIGNAL(progress(const std::string&, int, int)),
+ this, SLOT(updateProgress(const std::string&, int, int)));
m->load(converted_path);
// only switch mussas if we loaded without error
setAnalysis(m);
browser.update();
}
+void
+MussaWindow::updateProgress(const string& description, int current, int max)
+{
+ // if we're done
+ if (current == max) {
+ cout << "done with dialog" << endl;
+ if (progress_dialog != 0) {
+ progress_dialog->hide();
+ delete progress_dialog;
+ progress_dialog = 0;
+ }
+ } else {
+ // if we're starting, create the dialog
+ if (progress_dialog == 0) {
+ cout << "creating dialog" << endl;
+ QString desc(description.c_str());
+ QString cancel("Cancel");
+ progress_dialog = new QProgressDialog(desc, cancel, current, max, this);
+ progress_dialog->show();
+ } else {
+ // just update the dialog
+ progress_dialog->setValue(current);
+ }
+ }
+ qApp->processEvents();
+}