comparison 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
comparison
equal deleted inserted replaced
45:6b6bca31ad53 46:47bff9f88882
76 int 76 int
77 main(int argc, char **argv) 77 main(int argc, char **argv)
78 { 78 {
79 SVApplication application(argc, argv); 79 SVApplication application(argc, argv);
80 80
81 QStringList args = application.arguments();
82
81 signal(SIGINT, signalHandler); 83 signal(SIGINT, signalHandler);
82 signal(SIGTERM, signalHandler); 84 signal(SIGTERM, signalHandler);
83 85
84 #ifndef Q_WS_WIN32 86 #ifndef Q_WS_WIN32
85 signal(SIGHUP, signalHandler); 87 signal(SIGHUP, signalHandler);
86 signal(SIGQUIT, signalHandler); 88 signal(SIGQUIT, signalHandler);
87 #endif 89 #endif
88 90
89 svSystemSpecificInitialisation(); 91 svSystemSpecificInitialisation();
92
93 bool audioOutput = true;
94 if (args.contains("--no-audio")) audioOutput = false;
90 95
91 QApplication::setOrganizationName("sonic-visualiser"); 96 QApplication::setOrganizationName("sonic-visualiser");
92 QApplication::setOrganizationDomain("sonicvisualiser.org"); 97 QApplication::setOrganizationDomain("sonicvisualiser.org");
93 QApplication::setApplicationName("sonic-visualiser"); 98 QApplication::setApplicationName("sonic-visualiser");
94 99
110 115
111 // Permit size_t and PropertyName to be used as args in queued signal calls 116 // Permit size_t and PropertyName to be used as args in queued signal calls
112 qRegisterMetaType<size_t>("size_t"); 117 qRegisterMetaType<size_t>("size_t");
113 qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName"); 118 qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");
114 119
115 MainWindow gui; 120 MainWindow gui(audioOutput);
116 application.setMainWindow(&gui); 121 application.setMainWindow(&gui);
117 122
118 QDesktopWidget *desktop = QApplication::desktop(); 123 QDesktopWidget *desktop = QApplication::desktop();
119 QRect available = desktop->availableGeometry(); 124 QRect available = desktop->availableGeometry();
120 125
132 } 137 }
133 settings.endGroup(); 138 settings.endGroup();
134 139
135 gui.show(); 140 gui.show();
136 141
137 if (argc > 1) { 142 QString path;
138 QString path = argv[1]; 143 for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {
144 if (i == args.begin()) continue;
145 if (!i->startsWith('-')) {
146 path = *i;
147 break;
148 }
149 }
150
151 if (!path.isEmpty()) {
139 bool success = false; 152 bool success = false;
140 if (path.endsWith(".sv")) { 153 if (path.endsWith(".sv")) {
141 success = gui.openSessionFile(path); 154 success = gui.openSessionFile(path);
142 } 155 }
143 if (!success) { 156 if (!success) {