diff main/main.cpp @ 54:ec77936c268e

* Add system-specific LADSPA and DSSI plugin paths (for OS/X and Windows) * Add ability to open more than one audio file at once from the command line * Add plugin input source selection (with some caveats) * Show name of file being decoded in Ogg/mp3 decode progress dialog
author Chris Cannam
date Thu, 12 Oct 2006 14:56:28 +0000
parents 47bff9f88882
children f7f676a533e5
line wrap: on
line diff
--- a/main/main.cpp	Wed Oct 11 16:18:51 2006 +0000
+++ b/main/main.cpp	Thu Oct 12 14:56:28 2006 +0000
@@ -138,17 +138,56 @@
     settings.endGroup();
     
     gui.show();
-
-    QString path;
+/*
+    QStringList pathList;
     for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {
         if (i == args.begin()) continue;
         if (!i->startsWith('-')) {
-            path = *i;
-            break;
+            pathList.push_back(*i);
         }
     }
+*/
+    bool haveSession = false;
+    bool haveMainModel = false;
 
-    if (!path.isEmpty()) {
+    for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {
+
+        bool success = false;
+
+        if (i == args.begin()) continue;
+        if (i->startsWith('-')) continue;
+
+        QString path = *i;
+
+        if (path.endsWith("sv")) {
+            if (!haveSession) {
+                success = gui.openSessionFile(path);
+                if (success) {
+                    haveSession = true;
+                    haveMainModel = true;
+                }
+            } else {
+                std::cerr << "WARNING: Ignoring additional session file argument \"" << path.toStdString() << "\"" << std::endl;
+                success = true;
+            }
+        }
+        if (!success) {
+            if (!haveMainModel) {
+                success = gui.openSomeFile(path, MainWindow::ReplaceMainModel);
+                if (success) haveMainModel = true;
+            } else {
+                success = gui.openSomeFile(path, MainWindow::CreateAdditionalModel);
+            }
+        }
+        if (!success) {
+	    QMessageBox::critical
+                (&gui, QMessageBox::tr("Failed to open file"),
+                 QMessageBox::tr("File \"%1\" could not be opened").arg(path));
+        }
+    }            
+    /*       
+
+    if (!pathList.isEmpty()) {
         bool success = false;
         if (path.endsWith(".sv")) {
             success = gui.openSessionFile(path);
@@ -161,6 +200,7 @@
 				  QMessageBox::tr("File \"%1\" could not be opened").arg(path));
 	}
     }
+    */
 
     int rv = application.exec();
     std::cerr << "application.exec() returned " << rv << std::endl;