Mercurial > hg > sonic-visualiser
comparison main/main.cpp @ 2375:59b7fa58c0af
Use updated MainWindowBase API with ability to open playback device before record - hoping to fix #1946 Should ask for microphone permission only when first recording, not when first opening a file
author | Chris Cannam |
---|---|
date | Wed, 16 Oct 2019 15:28:48 +0100 |
parents | 2cd56528616a |
children | 119588c42772 |
comparison
equal
deleted
inserted
replaced
2374:9ca6872a5d0f | 2375:59b7fa58c0af |
---|---|
242 exit(0); | 242 exit(0); |
243 } | 243 } |
244 | 244 |
245 svSystemSpecificInitialisation(); | 245 svSystemSpecificInitialisation(); |
246 | 246 |
247 #ifdef Q_OS_MAC | |
248 if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) { | |
249 // Fix for OS/X 10.9 font problem | |
250 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); | |
251 } | |
252 #endif | |
253 | |
254 SVApplication application(argc, argv); | 247 SVApplication application(argc, argv); |
255 | 248 |
256 QApplication::setOrganizationName("sonic-visualiser"); | 249 QApplication::setOrganizationName("sonic-visualiser"); |
257 QApplication::setOrganizationDomain("sonicvisualiser.org"); | 250 QApplication::setOrganizationDomain("sonicvisualiser.org"); |
258 QApplication::setApplicationName(QApplication::tr("Sonic Visualiser")); | 251 QApplication::setApplicationName(QApplication::tr("Sonic Visualiser")); |
275 ("Do not show a splash screen."))); | 268 ("Do not show a splash screen."))); |
276 parser.addOption(QCommandLineOption | 269 parser.addOption(QCommandLineOption |
277 ("osc-script", QApplication::tr | 270 ("osc-script", QApplication::tr |
278 ("Batch run the Open Sound Control script found in the given file. Supply \"-\" as file to read from stdin. Scripts consist of /command arg1 arg2 ... OSC control lines, optionally interleaved with numbers to specify pauses in seconds."), | 271 ("Batch run the Open Sound Control script found in the given file. Supply \"-\" as file to read from stdin. Scripts consist of /command arg1 arg2 ... OSC control lines, optionally interleaved with numbers to specify pauses in seconds."), |
279 "osc.txt")); | 272 "osc.txt")); |
273 parser.addOption(QCommandLineOption | |
274 ("first-run", QApplication::tr | |
275 ("Clear any saved settings and reset to first-run behaviour."))); | |
280 | 276 |
281 parser.addPositionalArgument | 277 parser.addPositionalArgument |
282 ("[<file> ...]", QApplication::tr("One or more Sonic Visualiser (.sv) and audio files may be provided.")); | 278 ("[<file> ...]", QApplication::tr("One or more Sonic Visualiser (.sv) and audio files may be provided.")); |
283 | 279 |
284 QStringList args = application.arguments(); | 280 QStringList args = application.arguments(); |
291 } | 287 } |
292 } | 288 } |
293 | 289 |
294 parser.process(args); | 290 parser.process(args); |
295 | 291 |
292 if (parser.isSet("first-run")) { | |
293 QSettings settings; | |
294 settings.clear(); | |
295 } | |
296 | |
296 bool audioOutput = !(parser.isSet("no-audio")); | 297 bool audioOutput = !(parser.isSet("no-audio")); |
297 bool oscSupport = !(parser.isSet("no-osc")); | 298 bool oscSupport = !(parser.isSet("no-osc")); |
298 bool showSplash = !(parser.isSet("no-splash")); | 299 bool showSplash = !(parser.isSet("no-splash")); |
299 | 300 |
300 if (!audioOutput) { | 301 if (!audioOutput) { |
394 | 395 |
395 // Permit these types to be used as args in queued signal calls | 396 // Permit these types to be used as args in queued signal calls |
396 qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName"); | 397 qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName"); |
397 qRegisterMetaType<ZoomLevel>("ZoomLevel"); | 398 qRegisterMetaType<ZoomLevel>("ZoomLevel"); |
398 | 399 |
399 MainWindow::SoundOptions options = MainWindow::WithEverything; | 400 MainWindow::AudioMode audioMode = |
400 if (!audioOutput) options = 0; | 401 MainWindow::AUDIO_PLAYBACK_NOW_RECORD_LATER; |
401 | 402 MainWindow::MIDIMode midiMode = |
402 MainWindow *gui = new MainWindow(options, oscSupport); | 403 MainWindow::MIDI_LISTEN; |
404 | |
405 if (!audioOutput) { | |
406 audioMode = MainWindow::AUDIO_NONE; | |
407 midiMode = MainWindow::MIDI_NONE; | |
408 } | |
409 | |
410 MainWindow *gui = new MainWindow(audioMode, midiMode, oscSupport); | |
403 application.setMainWindow(gui); | 411 application.setMainWindow(gui); |
412 | |
404 InteractiveFileFinder::setParentWidget(gui); | 413 InteractiveFileFinder::setParentWidget(gui); |
405 TransformUserConfigurator::setParentWidget(gui); | 414 TransformUserConfigurator::setParentWidget(gui); |
406 if (splash) { | 415 if (splash) { |
407 QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide())); | 416 QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide())); |
408 QObject::connect(gui, SIGNAL(hideSplash(QWidget *)), | 417 QObject::connect(gui, SIGNAL(hideSplash(QWidget *)), |