provide python interpreter for mussa qui via a seperate thread
[mussa.git] / qui / MussaWindow.cpp
index 9325a8201e5a069304eed8c3b2ed0cee7f831c19..11eb02f4ac21392e71466adec05ad26263902b05 100644 (file)
@@ -99,8 +99,8 @@ MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) :
   statusBar()->showMessage("Welcome to mussa", 2000);
   // FIXME: we should start refactoring the connect call to updateAnalysis or something
   if (analysis) {
-    connect(analysis.get(), SIGNAL(progress(const std::string&, int, int)),
-            this, SLOT(updateProgress(const std::string&, int, int)));
+    connect(analysis.get(), SIGNAL(progress(const QString&, int, int)),
+            this, SLOT(updateProgress(const QString&, int, int)));
     connect(analysis.get(), SIGNAL(isModified(bool)),
             this, SLOT(updateAnalysisModified(bool)));        
   }
@@ -530,10 +530,10 @@ void MussaWindow::loadMupa()
     // but this should work for the moment.
     if (not isClearingAnalysisSafe()) return;
 
-    MussaRef m(new Mussa);
+    MussaRef m = Mussa::init();
     fs::path converted_path(mupa_path.toStdString(), fs::native);
-    connect(m.get(), SIGNAL(progress(const std::string&, int, int)),
-            this, SLOT(updateProgress(const std::string&, int, int)));
+    connect(m.get(), SIGNAL(progress(const QString&, int, int)),
+            this, SLOT(updateProgress(const QString&, int, int)));
     m->load_mupa_file(converted_path);
     m->analyze();
     setAnalysis(m);
@@ -567,10 +567,10 @@ void MussaWindow::loadSavedAnalysis()
     // but this should work for the moment.
     if (not isClearingAnalysisSafe()) return;
 
-    MussaRef m(new Mussa);
+    MussaRef m = Mussa::init();
     fs::path converted_path(muway_dir.toStdString(), fs::native);
-    connect(m.get(), SIGNAL(progress(const std::string&, int, int)),
-            this, SLOT(updateProgress(const std::string&, int, int)));
+    connect(m.get(), SIGNAL(progress(const QString&, int, int)),
+            this, SLOT(updateProgress(const QString&, int, int)));
     m->load(converted_path);
     // only switch mussas if we loaded without error
     if (analysis->empty()) {
@@ -602,8 +602,7 @@ void MussaWindow::loadSavedAnalysis()
 
 void MussaWindow::newMussaWindow()
 {
-  MussaRef a(new Mussa);
-  MussaWindow *win = new MussaWindow(a);
+  MussaWindow *win = new MussaWindow(Mussa::init());
   win->default_dir = default_dir;
   win->show();
 }
@@ -776,7 +775,7 @@ void MussaWindow::updateLinks()
 }
 
 void 
-MussaWindow::updateProgress(const string& description, int current, int max)
+MussaWindow::updateProgress(const QString& description, int current, int max)
 {  
   // if we're done  
   if (current == max) {
@@ -788,9 +787,8 @@ MussaWindow::updateProgress(const string& description, int current, int max)
   } else {
     // if we're starting, create the dialog
     if (progress_dialog == 0) {
-      QString desc(description.c_str());
       QString cancel("Cancel");
-      progress_dialog = new QProgressDialog(desc, cancel, current, max, this);
+      progress_dialog = new QProgressDialog(description, cancel, current, max, this);
       progress_dialog->show();
     } else {
       // just update the dialog