summaryrefslogtreecommitdiff
path: root/muse2/muse/app.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2013-01-27 11:51:23 +0000
committerTim E. Real <termtech@rogers.com>2013-01-27 11:51:23 +0000
commit3f99f3410d57b4377c38662b02e36186a019ad66 (patch)
tree06804038097eef0dbfe7a806c6f0473b61bd1bfb /muse2/muse/app.cpp
parent5fb1cdfe5bdd48406e58441b354fc87d3d3c582e (diff)
Feature: Shortcuts dialog modeless + has default global shortcut Ctl+Shift+F1 + "Printable file" button.
Memory leaks! Many widgets and dialogs had no parent and were not deleted! See ChangeLog.
Diffstat (limited to 'muse2/muse/app.cpp')
-rw-r--r--muse2/muse/app.cpp131
1 files changed, 119 insertions, 12 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 82bf56af..c0a56ac3 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -59,6 +59,7 @@
#include "drumedit.h"
#include "filedialog.h"
#include "gconfig.h"
+#include "genset.h"
#include "gui.h"
#include "helper.h"
#include "icons.h"
@@ -67,11 +68,21 @@
#include "marker/markerview.h"
#include "master/masteredit.h"
#include "metronome.h"
+#include "midifilterimpl.h"
+#include "midiitransform.h"
#include "midiseq.h"
+#include "midisyncimpl.h"
+#include "miditransform.h"
+#include "mitplugin.h"
+#include "mittranspose.h"
#include "mixdowndialog.h"
+#include "mrconfig.h"
#include "pianoroll.h"
#include "scoreedit.h"
#include "remote/pyapi.h"
+#ifdef BUILD_EXPERIMENTAL
+ #include "rhythm.h"
+#endif
#include "routepopup.h"
#include "shortcutconfig.h"
#include "songinfo.h"
@@ -97,7 +108,6 @@ extern void exitMidiAlsa();
namespace MusEGui {
extern void deleteIcons();
-
//extern void cacheJackRouteNames();
static pthread_t watchdogThread;
@@ -299,7 +309,6 @@ MusE::MusE() : QMainWindow()
midiRemoteConfig = 0;
midiPortConfig = 0;
metronomeConfig = 0;
- audioConfig = 0;
midiFileConfig = 0;
midiFilterConfig = 0;
midiInputTransform = 0;
@@ -336,7 +345,7 @@ MusE::MusE() : QMainWindow()
MusEGlobal::heartBeatTimer->setObjectName("timer");
connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), MusEGlobal::song, SLOT(beat()));
connect(this, SIGNAL(activeTopWinChanged(MusEGui::TopWin*)), SLOT(activeTopWinChangedSlot(MusEGui::TopWin*)));
- new MusECore::TrackDrummapUpdater(); // no need for keeping the reference, the thing autoconnects on its own.
+ new MusECore::TrackDrummapUpdater(this); // no need for keeping the reference, the thing autoconnects on its own.
#ifdef ENABLE_PYTHON
//---------------------------------------------------
@@ -1536,6 +1545,10 @@ void MusE::closeEvent(QCloseEvent* event)
if(MusEGlobal::debugMsg)
printf("MusE: Deleting icons\n");
deleteIcons();
+
+ if(MusEGlobal::debugMsg)
+ printf("MusE: Deleting all parentless dialogs and widgets\n");
+ deleteParentlessDialogs();
qApp->quit();
}
@@ -1853,7 +1866,7 @@ void MusE::startListEditor()
void MusE::startListEditor(MusECore::PartList* pl)
{
- MusEGui::ListEdit* listEditor = new MusEGui::ListEdit(pl);
+ MusEGui::ListEdit* listEditor = new MusEGui::ListEdit(pl, this);
toplevels.push_back(listEditor);
listEditor->show();
connect(listEditor, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
@@ -1867,7 +1880,7 @@ void MusE::startListEditor(MusECore::PartList* pl)
void MusE::startMasterEditor()
{
- MusEGui::MasterEdit* masterEditor = new MusEGui::MasterEdit();
+ MusEGui::MasterEdit* masterEditor = new MusEGui::MasterEdit(this);
toplevels.push_back(masterEditor);
masterEditor->show();
connect(masterEditor, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
@@ -1880,7 +1893,7 @@ void MusE::startMasterEditor()
void MusE::startLMasterEditor()
{
- MusEGui::LMaster* lmaster = new MusEGui::LMaster();
+ MusEGui::LMaster* lmaster = new MusEGui::LMaster(this);
toplevels.push_back(lmaster);
lmaster->show();
connect(lmaster, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
@@ -1928,7 +1941,7 @@ void MusE::startWaveEditor()
void MusE::startWaveEditor(MusECore::PartList* pl)
{
- MusEGui::WaveEdit* waveEditor = new MusEGui::WaveEdit(pl);
+ MusEGui::WaveEdit* waveEditor = new MusEGui::WaveEdit(pl, this);
waveEditor->show();
toplevels.push_back(waveEditor);
connect(MusEGlobal::muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged()));
@@ -2229,6 +2242,9 @@ void MusE::kbAccel(int key)
if (markerView)
markerView->prevMarker();
}
+ else if (key == MusEGui::shortcuts[MusEGui::SHRT_CONFIG_SHORTCUTS].key) {
+ configShortCuts();
+ }
else {
if (MusEGlobal::debugMsg)
printf("unknown kbAccel 0x%x\n", key);
@@ -2285,9 +2301,83 @@ void MusE::cmd(int cmd)
}
}
+//---------------------------------------------------------
+// deleteParentlessDialogs
+// All these dialogs and/or widgets have no parent,
+// but are not considered MusE 'top-level', so could not
+// be handled via the top-levels list...
+//---------------------------------------------------------
+
+void MusE::deleteParentlessDialogs()
+{
+ if(appearance)
+ {
+ delete appearance;
+ appearance = 0;
+ }
+ if(metronomeConfig)
+ {
+ delete metronomeConfig;
+ metronomeConfig = 0;
+ }
+ if(shortcutConfig)
+ {
+ delete shortcutConfig;
+ shortcutConfig = 0;
+ }
+ if(midiSyncConfig)
+ {
+ delete midiSyncConfig;
+ midiSyncConfig = 0;
+ }
+ if(midiFileConfig)
+ {
+ delete midiFileConfig;
+ midiFileConfig = 0;
+ }
+ if(globalSettingsConfig)
+ {
+ delete globalSettingsConfig;
+ globalSettingsConfig = 0;
+ }
+ destroy_function_dialogs();
+ if(MusEGlobal::mitPluginTranspose)
+ {
+ delete MusEGlobal::mitPluginTranspose;
+ MusEGlobal::mitPluginTranspose = 0;
+ }
+
+ if(midiInputTransform)
+ {
+ delete midiInputTransform;
+ midiInputTransform = 0;
+ }
+ if(midiFilterConfig)
+ {
+ delete midiFilterConfig;
+ midiFilterConfig = 0;
+ }
+ if(midiRemoteConfig)
+ {
+ delete midiRemoteConfig;
+ midiRemoteConfig = 0;
+ }
+#ifdef BUILD_EXPERIMENTAL
+ if(midiRhythmGenerator)
+ {
+ delete midiRhythmGenerator;
+ midiRhythmGenerator = 0;
+ }
+#endif
+ if(midiTransformerDialog)
+ {
+ delete midiTransformerDialog;
+ midiTransformerDialog = 0;
+ }
+}
//---------------------------------------------------------
// configAppearance
@@ -2296,6 +2386,7 @@ void MusE::cmd(int cmd)
void MusE::configAppearance()
{
if (!appearance)
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
appearance = new MusEGui::Appearance(_arranger);
appearance->resetValues();
if(appearance->isVisible()) {
@@ -2377,6 +2468,7 @@ void MusE::changeConfig(bool writeFlag)
void MusE::configMetronome()
{
if (!metronomeConfig)
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
metronomeConfig = new MusEGui::MetronomeConfig;
if(metronomeConfig->isVisible()) {
@@ -2395,12 +2487,27 @@ void MusE::configMetronome()
void MusE::configShortCuts()
{
if (!shortcutConfig)
- shortcutConfig = new MusEGui::ShortcutConfig(this);
- shortcutConfig->_config_changed = false;
- if (shortcutConfig->exec())
- changeConfig(true);
+ {
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
+ shortcutConfig = new MusEGui::ShortcutConfig();
+ connect(shortcutConfig, SIGNAL(saveConfig()), SLOT(configShortCutsSaveConfig()));
+ }
+ if(shortcutConfig->isVisible()) {
+ shortcutConfig->raise();
+ shortcutConfig->activateWindow();
+ }
+ else
+ shortcutConfig->show();
}
+//---------------------------------------------------------
+// configShortCutsSaveConfig
+//---------------------------------------------------------
+
+void MusE::configShortCutsSaveConfig()
+ {
+ changeConfig(true);
+ }
//---------------------------------------------------------
// bounceToTrack
@@ -2913,7 +3020,7 @@ void MusE::updateConfiguration()
autoClearAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIXER_AUTOMATION_CLEAR].key);
settingsGlobalAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_GLOBAL_CONFIG].key);
- settingsShortcutsAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_SHORTCUTS].key);
+ //settingsShortcutsAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_SHORTCUTS].key); // This is global now, handled in MusE::kbAccel
settingsMetronomeAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_METRONOME].key);
settingsMidiSyncAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_MIDISYNC].key);
// settingsMidiIOAction does not have acceleration