diff main/main.cpp @ 46:47bff9f88882

* Add --no-audio option to avoid opening any audio output device
author Chris Cannam
date Thu, 05 Oct 2006 11:01:36 +0000
parents 0dbd08e365ce
children ec77936c268e
line wrap: on
line diff
--- a/main/main.cpp	Thu Oct 05 11:00:59 2006 +0000
+++ b/main/main.cpp	Thu Oct 05 11:01:36 2006 +0000
@@ -78,6 +78,8 @@
 {
     SVApplication application(argc, argv);
 
+    QStringList args = application.arguments();
+
     signal(SIGINT,  signalHandler);
     signal(SIGTERM, signalHandler);
 
@@ -88,6 +90,9 @@
 
     svSystemSpecificInitialisation();
 
+    bool audioOutput = true;
+    if (args.contains("--no-audio")) audioOutput = false;
+
     QApplication::setOrganizationName("sonic-visualiser");
     QApplication::setOrganizationDomain("sonicvisualiser.org");
     QApplication::setApplicationName("sonic-visualiser");
@@ -112,7 +117,7 @@
     qRegisterMetaType<size_t>("size_t");
     qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");
 
-    MainWindow gui;
+    MainWindow gui(audioOutput);
     application.setMainWindow(&gui);
 
     QDesktopWidget *desktop = QApplication::desktop();
@@ -134,8 +139,16 @@
     
     gui.show();
 
-    if (argc > 1) {
-	QString path = argv[1];
+    QString path;
+    for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {
+        if (i == args.begin()) continue;
+        if (!i->startsWith('-')) {
+            path = *i;
+            break;
+        }
+    }
+
+    if (!path.isEmpty()) {
         bool success = false;
         if (path.endsWith(".sv")) {
             success = gui.openSessionFile(path);