changeset 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 9ca6872a5d0f
children 06246370f210
files main/MainWindow.cpp main/MainWindow.h main/main.cpp
diffstat 3 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Oct 16 13:50:06 2019 +0100
+++ b/main/MainWindow.cpp	Wed Oct 16 15:28:48 2019 +0100
@@ -135,8 +135,8 @@
 using std::set;
 
 
-MainWindow::MainWindow(SoundOptions options, bool withOSCSupport) :
-    MainWindowBase(options),
+MainWindow::MainWindow(AudioMode audioMode, MIDIMode midiMode, bool withOSCSupport) :
+    MainWindowBase(audioMode, midiMode, int(PaneStack::Option::Default)),
     m_overview(nullptr),
     m_mainMenusCreated(false),
     m_paneMenu(nullptr),
--- a/main/MainWindow.h	Wed Oct 16 13:50:06 2019 +0100
+++ b/main/MainWindow.h	Wed Oct 16 15:28:48 2019 +0100
@@ -32,7 +32,7 @@
     Q_OBJECT
 
 public:
-    MainWindow(SoundOptions options, bool withOSCSupport = true);
+    MainWindow(AudioMode audioMode, MIDIMode midiMode, bool withOSCSupport);
     virtual ~MainWindow();
 
 signals:
--- a/main/main.cpp	Wed Oct 16 13:50:06 2019 +0100
+++ b/main/main.cpp	Wed Oct 16 15:28:48 2019 +0100
@@ -244,13 +244,6 @@
     
     svSystemSpecificInitialisation();
 
-#ifdef Q_OS_MAC
-    if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
-        // Fix for OS/X 10.9 font problem
-        QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
-    }
-#endif
-
     SVApplication application(argc, argv);
 
     QApplication::setOrganizationName("sonic-visualiser");
@@ -277,6 +270,9 @@
                      ("osc-script", QApplication::tr
                       ("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."),
                       "osc.txt"));
+    parser.addOption(QCommandLineOption
+                     ("first-run", QApplication::tr
+                      ("Clear any saved settings and reset to first-run behaviour.")));
 
     parser.addPositionalArgument
         ("[<file> ...]", QApplication::tr("One or more Sonic Visualiser (.sv) and audio files may be provided."));
@@ -293,6 +289,11 @@
         
     parser.process(args);
 
+    if (parser.isSet("first-run")) {
+        QSettings settings;
+        settings.clear();
+    }
+
     bool audioOutput = !(parser.isSet("no-audio"));
     bool oscSupport = !(parser.isSet("no-osc"));
     bool showSplash = !(parser.isSet("no-splash"));
@@ -396,11 +397,19 @@
     qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");
     qRegisterMetaType<ZoomLevel>("ZoomLevel");
 
-    MainWindow::SoundOptions options = MainWindow::WithEverything;
-    if (!audioOutput) options = 0;
+    MainWindow::AudioMode audioMode = 
+        MainWindow::AUDIO_PLAYBACK_NOW_RECORD_LATER;
+    MainWindow::MIDIMode midiMode =
+        MainWindow::MIDI_LISTEN;
+
+    if (!audioOutput) {
+        audioMode = MainWindow::AUDIO_NONE;
+        midiMode = MainWindow::MIDI_NONE;
+    } 
     
-    MainWindow *gui = new MainWindow(options, oscSupport);
+    MainWindow *gui = new MainWindow(audioMode, midiMode, oscSupport);
     application.setMainWindow(gui);
+
     InteractiveFileFinder::setParentWidget(gui);
     TransformUserConfigurator::setParentWidget(gui);
     if (splash) {