summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog9
-rw-r--r--muse2/muse/app.cpp131
-rw-r--r--muse2/muse/app.h6
-rw-r--r--muse2/muse/cliplist/cliplist.cpp1
-rw-r--r--muse2/muse/conf.cpp3
-rw-r--r--muse2/muse/dialogs.cpp28
-rw-r--r--muse2/muse/liste/listedit.cpp4
-rw-r--r--muse2/muse/liste/listedit.h2
-rw-r--r--muse2/muse/main.cpp4
-rw-r--r--muse2/muse/master/lmaster.cpp4
-rw-r--r--muse2/muse/master/lmaster.h2
-rw-r--r--muse2/muse/master/masteredit.cpp4
-rw-r--r--muse2/muse/master/masteredit.h2
-rw-r--r--muse2/muse/mplugins/mitplugin.cpp6
-rw-r--r--muse2/muse/mplugins/mittranspose.cpp2
-rw-r--r--muse2/muse/shortcuts.cpp6
-rw-r--r--muse2/muse/shortcuts.h3
-rw-r--r--muse2/muse/trackdrummapupdater.cpp2
-rw-r--r--muse2/muse/trackdrummapupdater.h2
-rw-r--r--muse2/muse/waveedit/waveedit.cpp4
-rw-r--r--muse2/muse/waveedit/waveedit.h2
-rw-r--r--muse2/muse/widgets/shortcutconfig.cpp134
-rw-r--r--muse2/muse/widgets/shortcutconfig.h15
-rw-r--r--muse2/muse/widgets/shortcutconfigbase.ui38
-rw-r--r--muse2/share/templates/MusE.cfg2
25 files changed, 353 insertions, 63 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 411536b0..18261e01 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,12 @@
+27.01.2013:
+ * Feature: Shortcuts dialog modeless + has default global shortcut Ctl+Shift+F1 + "Printable file" button. (Tim)
+ - Memory leaks! Many widgets and dialogs had no parent and were not deleted! (Tim)
+ Including several top-level editors such as LMaster, MasterEdit, ListEdit, and WaveEditor!
+ Created MusE::deleteParentlessDialogs(), call it from MusE::closeEvent() to delete all parentless dialogs:
+ appearance, metronomeConfig, shortcutConfig, midiSyncConfig, midiFileConfig, globalSettingsConfig,
+ mitPluginTranspose, midiInputTransform, midiFilterConfig, midiRemoteConfig, midiRhythmGenerator, midiTransformerDialog.
+ Also moved call of destroy_function_dialogs() into it instead of at end of main. (Consolidation.)
+ Verified that all destructors were being called.
25.01.2013:
* Feature/fix: Zoom at cursor! Zoom Ctl+PgUp/PgDown (defaults) and Ctl+MouseWheel now zoom about cursor. (Tim)
Eliminated redundant call in ScrollScale::setMag(), by blocking signals.
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
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index bdeaadf4..5cd15792 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -65,7 +65,6 @@ namespace MusEGui {
class Appearance;
class Arranger;
class ArrangerView;
-class AudioConf;
class AudioMixerApp;
class AudioRecord;
class BigTime;
@@ -193,7 +192,6 @@ class MusE : public QMainWindow
MRConfig* midiRemoteConfig;
RhythmGen* midiRhythmGenerator;
MetronomeConfig* metronomeConfig;
- AudioConf* audioConfig;
MidiFileConfig* midiFileConfig;
GlobalSettingsConfig* globalSettingsConfig;
MidiFilterConfig* midiFilterConfig;
@@ -202,7 +200,8 @@ class MusE : public QMainWindow
Appearance* appearance;
AudioMixerApp* mixer1;
AudioMixerApp* mixer2;
-
+ void deleteParentlessDialogs();
+
Arranger* _arranger;
ToplevelList toplevels;
ClipListEdit* clipListEdit;
@@ -273,6 +272,7 @@ class MusE : public QMainWindow
void configMidiSync();
void configMidiFile();
void configShortCuts();
+ void configShortCutsSaveConfig();
void configMetronome();
void configAppearance();
diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp
index 8a711b61..b9653f36 100644
--- a/muse2/muse/cliplist/cliplist.cpp
+++ b/muse2/muse/cliplist/cliplist.cpp
@@ -156,7 +156,6 @@ ClipListEdit::ClipListEdit(QWidget* parent)
ClipListEdit::~ClipListEdit()
{
-
}
//---------------------------------------------------------
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
index ea2390c3..aa096bc6 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -1470,6 +1470,7 @@ void MusE::writeConfiguration(int level, MusECore::Xml& xml) const
void MusE::configMidiSync()
{
if (!midiSyncConfig)
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiSyncConfig = new MusEGui::MidiSyncConfig;
if (midiSyncConfig->isVisible()) {
@@ -1487,6 +1488,7 @@ void MusE::configMidiSync()
void MusE::configMidiFile()
{
if (!midiFileConfig)
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiFileConfig = new MusEGui::MidiFileConfig();
midiFileConfig->updateValues();
@@ -1505,6 +1507,7 @@ void MusE::configMidiFile()
void MusE::configGlobalSettings()
{
if (!globalSettingsConfig)
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
globalSettingsConfig = new MusEGui::GlobalSettingsConfig();
if (globalSettingsConfig->isVisible()) {
diff --git a/muse2/muse/dialogs.cpp b/muse2/muse/dialogs.cpp
index a39f7c10..6bdddcdd 100644
--- a/muse2/muse/dialogs.cpp
+++ b/muse2/muse/dialogs.cpp
@@ -57,6 +57,7 @@ PasteEventsDialog* paste_events_dialog=NULL;
void init_function_dialogs()
{
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
gatetime_dialog = new GateTime();
velocity_dialog = new Velocity();
quantize_dialog = new Quantize();
@@ -71,20 +72,23 @@ void init_function_dialogs()
paste_events_dialog = new PasteEventsDialog();
}
+//
+// NOTE: This is called by MusE::deleteParentlessDialogs()
+//
void destroy_function_dialogs()
{
- delete gatetime_dialog;
- delete velocity_dialog;
- delete quantize_dialog;
- delete erase_dialog;
- delete del_overlaps_dialog;
- delete set_notelen_dialog;
- delete move_notes_dialog;
- delete transpose_dialog;
- delete crescendo_dialog;
- delete legato_dialog;
- delete paste_dialog;
- delete paste_events_dialog;
+ if(gatetime_dialog) delete gatetime_dialog;
+ if(velocity_dialog) delete velocity_dialog;
+ if(quantize_dialog) delete quantize_dialog;
+ if(erase_dialog) delete erase_dialog;
+ if(del_overlaps_dialog) delete del_overlaps_dialog;
+ if(set_notelen_dialog) delete set_notelen_dialog;
+ if(move_notes_dialog) delete move_notes_dialog;
+ if(transpose_dialog) delete transpose_dialog;
+ if(crescendo_dialog) delete crescendo_dialog;
+ if(legato_dialog) delete legato_dialog;
+ if(paste_dialog) delete paste_dialog;
+ if(paste_events_dialog) delete paste_events_dialog;
}
void retranslate_function_dialogs()
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index 52958e3c..e1a49842 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -439,8 +439,8 @@ QString EventListItem::text(int col) const
// ListEdit
//---------------------------------------------------------
-ListEdit::ListEdit(MusECore::PartList* pl)
- : MidiEditor(TopWin::LISTE, 0, pl)
+ListEdit::ListEdit(MusECore::PartList* pl, QWidget* parent, const char* name)
+ : MidiEditor(TopWin::LISTE, 0, pl, parent, name)
{
selectedTick=0;
diff --git a/muse2/muse/liste/listedit.h b/muse2/muse/liste/listedit.h
index 5ab4faf7..3c81a72b 100644
--- a/muse2/muse/liste/listedit.h
+++ b/muse2/muse/liste/listedit.h
@@ -89,7 +89,7 @@ class ListEdit : public MidiEditor {
void isDeleting(MusEGui::TopWin*);
public:
- ListEdit(MusECore::PartList*);
+ ListEdit(MusECore::PartList*, QWidget* parent = 0, const char* name = 0);
~ListEdit();
virtual void readStatus(MusECore::Xml&);
virtual void writeStatus(int, MusECore::Xml&) const;
diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp
index f1bf4f57..af3e2f0f 100644
--- a/muse2/muse/main.cpp
+++ b/muse2/muse/main.cpp
@@ -732,8 +732,8 @@ int main(int argc, char* argv[])
int rv = app.exec();
if(MusEGlobal::debugMsg)
printf("app.exec() returned:%d\nDeleting main MusE object\n", rv);
- delete MusEGlobal::muse;
- MusEGui::destroy_function_dialogs();
+ delete MusEGlobal::muse;
+
if(MusEGlobal::debugMsg)
printf("Finished! Exiting main, return value:%d\n", rv);
return rv;
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 44dbf1e1..e0731a13 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -145,8 +145,8 @@ void LMaster::songChanged(MusECore::SongChangedFlags_t type)
// LMaster
//---------------------------------------------------------
-LMaster::LMaster()
- : MidiEditor(TopWin::LMASTER, 0, 0, 0)
+LMaster::LMaster(QWidget* parent, const char* name)
+ : MidiEditor(TopWin::LMASTER, 0, 0, parent, name)
{
pos_editor = 0;
tempo_editor = 0;
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index 52c75c49..9ed15914 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -175,7 +175,7 @@ class LMaster : public MidiEditor {
void seekTo(int tick);
public:
- LMaster();
+ LMaster(QWidget* parent = 0, const char* name = 0);
~LMaster();
virtual void readStatus(MusECore::Xml&);
virtual void writeStatus(int, MusECore::Xml&) const;
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index 14a6a35d..90675d25 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -102,8 +102,8 @@ void MasterEdit::songChanged(MusECore::SongChangedFlags_t type)
// MasterEdit
//---------------------------------------------------------
-MasterEdit::MasterEdit()
- : MidiEditor(TopWin::MASTER, _rasterInit, 0)
+MasterEdit::MasterEdit(QWidget* parent, const char* name)
+ : MidiEditor(TopWin::MASTER, _rasterInit, 0, parent, name)
{
setWindowTitle(tr("MusE: Mastertrack"));
setFocusPolicy(Qt::NoFocus);
diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h
index 5d98cabe..c084e9cf 100644
--- a/muse2/muse/master/masteredit.h
+++ b/muse2/muse/master/masteredit.h
@@ -97,7 +97,7 @@ class MasterEdit : public MidiEditor {
void isDeleting(MusEGui::TopWin*);
public:
- MasterEdit();
+ MasterEdit(QWidget* parent = 0, const char* name = 0);
~MasterEdit();
virtual void readStatus(MusECore::Xml&);
virtual void writeStatus(int, MusECore::Xml&) const;
diff --git a/muse2/muse/mplugins/mitplugin.cpp b/muse2/muse/mplugins/mitplugin.cpp
index be833fa3..2cc2f209 100644
--- a/muse2/muse/mplugins/mitplugin.cpp
+++ b/muse2/muse/mplugins/mitplugin.cpp
@@ -48,6 +48,7 @@ void MusE::startMidiInputPlugin(int id)
QAction* act = 0;
if (id == 0) {
if (!MusEGlobal::mitPluginTranspose) {
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
MusEGlobal::mitPluginTranspose = new MITPluginTranspose();
MusECore::mitPlugins.push_back(MusEGlobal::mitPluginTranspose);
connect(MusEGlobal::mitPluginTranspose, SIGNAL(hideWindow()),
@@ -58,6 +59,7 @@ void MusE::startMidiInputPlugin(int id)
}
else if (id == 1) {
if (!midiInputTransform) {
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiInputTransform = new MidiInputTransformDialog();
connect(midiInputTransform, SIGNAL(hideWindow()),
SLOT(hideMidiInputTransform()));
@@ -67,6 +69,7 @@ void MusE::startMidiInputPlugin(int id)
}
else if (id == 2) {
if (!midiFilterConfig) {
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiFilterConfig = new MidiFilterConfig();
connect(midiFilterConfig, SIGNAL(hideWindow()),
SLOT(hideMidiFilterConfig()));
@@ -76,6 +79,7 @@ void MusE::startMidiInputPlugin(int id)
}
else if (id == 3) {
if (!midiRemoteConfig) {
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiRemoteConfig = new MRConfig();
connect(midiRemoteConfig, SIGNAL(hideWindow()),
SLOT(hideMidiRemoteConfig()));
@@ -86,6 +90,7 @@ void MusE::startMidiInputPlugin(int id)
#ifdef BUILD_EXPERIMENTAL
else if (id == 4) {
if (!midiRhythmGenerator) {
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiRhythmGenerator = new RhythmGen();
connect(midiRhythmGenerator, SIGNAL(hideWindow()),
SLOT(hideMidiRhythmGenerator()));
@@ -134,6 +139,7 @@ void MusE::hideMidiRhythmGenerator()
void MusE::startMidiTransformer()
{
if (midiTransformerDialog == 0)
+ // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs().
midiTransformerDialog = new MidiTransformerDialog;
midiTransformerDialog->show();
}
diff --git a/muse2/muse/mplugins/mittranspose.cpp b/muse2/muse/mplugins/mittranspose.cpp
index ae71c725..19f0c608 100644
--- a/muse2/muse/mplugins/mittranspose.cpp
+++ b/muse2/muse/mplugins/mittranspose.cpp
@@ -32,7 +32,7 @@
#include "globals.h"
namespace MusEGlobal {
-MusEGui::MITPluginTranspose* mitPluginTranspose;
+MusEGui::MITPluginTranspose* mitPluginTranspose = 0;
}
namespace MusEGui {
diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp
index 60a264f5..2be06e9b 100644
--- a/muse2/muse/shortcuts.cpp
+++ b/muse2/muse/shortcuts.cpp
@@ -47,7 +47,6 @@ void defShrt(int shrt, int key, const char* descr, int type, const char* xml)
shortcuts[shrt].xml = xml;
}
-
void initShortCuts()
{
//Global:
@@ -62,6 +61,7 @@ void initShortCuts()
defShrt(SHRT_START_REC, Qt::Key_Asterisk, QT_TRANSLATE_NOOP("shortcuts", "Transport: Toggle Record"), GLOBAL_SHRT, "toggle_rec");
defShrt(SHRT_REC_CLEAR, Qt::Key_Backspace, QT_TRANSLATE_NOOP("shortcuts", "Transport: Clear all rec enabled tracks"), GLOBAL_SHRT, "rec_clear");
defShrt(SHRT_FULLSCREEN, Qt::CTRL + Qt::Key_F, QT_TRANSLATE_NOOP("shortcuts", "Toggle fullscreen"), GLOBAL_SHRT, "fullscreen");
+ defShrt(SHRT_CONFIG_SHORTCUTS, Qt::CTRL + Qt::SHIFT + Qt::Key_F1, QT_TRANSLATE_NOOP("shortcuts", "Settings: Configure shortcuts"), GLOBAL_SHRT, "configure_key_shortcuts");
defShrt(SHRT_COPY, Qt::CTRL + Qt::Key_C, QT_TRANSLATE_NOOP("shortcuts", "Edit: Copy"), INVIS_SHRT, "copy");
defShrt(SHRT_COPY_RANGE, Qt::CTRL + Qt::SHIFT + Qt::Key_C, QT_TRANSLATE_NOOP("shortcuts", "Edit: Copy in range"), GLOBAL_SHRT, "copy_range");
@@ -103,7 +103,7 @@ void initShortCuts()
defShrt(SHRT_ADD_MIDI_TRACK, Qt::CTRL + Qt::Key_J, QT_TRANSLATE_NOOP("shortcuts", "Add midi track"), ARRANG_SHRT, "add_midi_track");
defShrt(SHRT_ADD_DRUM_TRACK, 0, QT_TRANSLATE_NOOP("shortcuts", "Add drum track"), ARRANG_SHRT, "add_drum_track");
defShrt(SHRT_ADD_NEW_STYLE_DRUM_TRACK, 0, QT_TRANSLATE_NOOP("shortcuts", "Add new style drum track"), ARRANG_SHRT, "add_new_style_drum_track");
- defShrt(SHRT_ADD_WAVE_TRACK, Qt::CTRL + Qt::Key_K, QT_TRANSLATE_NOOP("shortcuts", "Add wave track"), ARRANG_SHRT, "add_wave_track");
+ defShrt(SHRT_ADD_WAVE_TRACK, 0, QT_TRANSLATE_NOOP("shortcuts", "Add wave track"), ARRANG_SHRT, "add_wave_track");
defShrt(SHRT_ADD_AUDIO_OUTPUT, 0, QT_TRANSLATE_NOOP("shortcuts", "Add audio output"), ARRANG_SHRT, "add_audio_output");
defShrt(SHRT_ADD_AUDIO_GROUP, 0, QT_TRANSLATE_NOOP("shortcuts", "Add audio group"), ARRANG_SHRT, "add_audio_group");
defShrt(SHRT_ADD_AUDIO_INPUT, 0, QT_TRANSLATE_NOOP("shortcuts", "Add audio input"), ARRANG_SHRT, "add_audio_input");
@@ -124,7 +124,7 @@ void initShortCuts()
defShrt(SHRT_FOLLOW_CONTINUOUS, 0, QT_TRANSLATE_NOOP("shortcuts", "Settings: Follow song continuous"), ARRANG_SHRT, "follow_continuous");
defShrt(SHRT_GLOBAL_CONFIG, 0, QT_TRANSLATE_NOOP("shortcuts", "Settings: Global configuration"), ARRANG_SHRT, "configure_global");
- defShrt(SHRT_CONFIG_SHORTCUTS, 0, QT_TRANSLATE_NOOP("shortcuts", "Settings: Configure shortcuts"), ARRANG_SHRT, "configure_shortcuts");
+ //defShrt(SHRT_CONFIG_SHORTCUTS, Qt::CTRL + Qt::SHIFT + Qt::Key_F1, QT_TRANSLATE_NOOP("shortcuts", "Settings: Configure shortcuts"), ARRANG_SHRT, "configure_key_shortcuts");
defShrt(SHRT_CONFIG_METRONOME, 0, QT_TRANSLATE_NOOP("shortcuts", "Settings: Configure metronome"), ARRANG_SHRT, "configure_metronome");
defShrt(SHRT_CONFIG_MIDISYNC, 0, QT_TRANSLATE_NOOP("shortcuts", "Settings: Midi sync configuration"), ARRANG_SHRT, "configure_midi_sync");
defShrt(SHRT_MIDI_FILE_CONFIG, 0, QT_TRANSLATE_NOOP("shortcuts", "Settings: Midi file import/export configuration"), ARRANG_SHRT, "configure_midi_file");
diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h
index 2b84093d..8b7cdbef 100644
--- a/muse2/muse/shortcuts.h
+++ b/muse2/muse/shortcuts.h
@@ -64,6 +64,7 @@ struct shortcut
const char* descr;
const char* xml; //xml-tag for config-file
int type;
+ shortcut() : key(0), descr(NULL), xml(NULL), type(0) { }
};
struct shortcut_cg
@@ -148,7 +149,7 @@ enum {
SHRT_FOLLOW_CONTINUOUS, //Default: undefined
SHRT_GLOBAL_CONFIG, //Default: undefined
- SHRT_CONFIG_SHORTCUTS, //Default: undefined
+ SHRT_CONFIG_SHORTCUTS, //Default: Ctrl+K
SHRT_CONFIG_METRONOME, //Default: undefined
SHRT_CONFIG_MIDISYNC, //Default: undefined
SHRT_MIDI_FILE_CONFIG, //Default: undefined
diff --git a/muse2/muse/trackdrummapupdater.cpp b/muse2/muse/trackdrummapupdater.cpp
index 2ad6a90d..581d0f30 100644
--- a/muse2/muse/trackdrummapupdater.cpp
+++ b/muse2/muse/trackdrummapupdater.cpp
@@ -29,7 +29,7 @@ namespace MusECore {
using MusEGlobal::song;
-TrackDrummapUpdater::TrackDrummapUpdater()
+TrackDrummapUpdater::TrackDrummapUpdater(QObject* parent) : QObject(parent)
{
connect(song,SIGNAL(songChanged(MusECore::SongChangedFlags_t)), this, SLOT(songChanged(MusECore::SongChangedFlags_t)));
}
diff --git a/muse2/muse/trackdrummapupdater.h b/muse2/muse/trackdrummapupdater.h
index 1070d780..95b34d2f 100644
--- a/muse2/muse/trackdrummapupdater.h
+++ b/muse2/muse/trackdrummapupdater.h
@@ -34,7 +34,7 @@ class TrackDrummapUpdater : public QObject
Q_OBJECT
public:
- TrackDrummapUpdater();
+ TrackDrummapUpdater(QObject* parent = 0);
private slots:
void songChanged(MusECore::SongChangedFlags_t flags);
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index 17f3de00..95443757 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -91,8 +91,8 @@ void WaveEdit::closeEvent(QCloseEvent* e)
// WaveEdit
//---------------------------------------------------------
-WaveEdit::WaveEdit(MusECore::PartList* pl)
- : MidiEditor(TopWin::WAVE, 1, pl)
+WaveEdit::WaveEdit(MusECore::PartList* pl, QWidget* parent, const char* name)
+ : MidiEditor(TopWin::WAVE, 1, pl, parent, name)
{
setFocusPolicy(Qt::NoFocus);
colorMode = colorModeInit;
diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h
index 756b4085..54fc769a 100644
--- a/muse2/muse/waveedit/waveedit.h
+++ b/muse2/muse/waveedit/waveedit.h
@@ -108,7 +108,7 @@ class WaveEdit : public MidiEditor {
void isDeleting(MusEGui::TopWin*);
public:
- WaveEdit(MusECore::PartList*);
+ WaveEdit(MusECore::PartList*, QWidget* parent = 0, const char* name = 0);
~WaveEdit();
virtual void readStatus(MusECore::Xml&);
virtual void writeStatus(int, MusECore::Xml&) const;
diff --git a/muse2/muse/widgets/shortcutconfig.cpp b/muse2/muse/widgets/shortcutconfig.cpp
index 609564cc..a2e16d17 100644
--- a/muse2/muse/widgets/shortcutconfig.cpp
+++ b/muse2/muse/widgets/shortcutconfig.cpp
@@ -31,11 +31,18 @@
// Description:
// Dialog for configuring keyboard shortcuts
+#include "config.h"
+
#include <QCloseEvent>
#include <QKeySequence>
#include <QString>
#include <QSettings>
#include <QApplication>
+#include <QFileDialog>
+#include <QDir>
+#include <QFile>
+#include <QMessageBox>
+#include <QString>
#include "shortcutconfig.h"
#include "shortcutcapturedialog.h"
@@ -54,10 +61,13 @@ ShortcutConfig::ShortcutConfig(QWidget* parent)
this, SLOT(categorySelChanged(QTreeWidgetItem*, int)));
connect(scListView, SIGNAL(itemActivated(QTreeWidgetItem*, int )),
this, SLOT(shortcutSelChanged(QTreeWidgetItem*, int)));
-
+
+ okButton->setDefault(true);
connect(defineButton, SIGNAL(pressed()), this, SLOT(assignShortcut()));
connect(clearButton, SIGNAL(pressed()), this, SLOT(clearShortcut()));
- connect(applyButton, SIGNAL(pressed()), this, SLOT(assignAll()));
+ connect(textFileButton, SIGNAL(pressed()), this, SLOT(textFileClicked()));
+ connect(applyButton, SIGNAL(pressed()), this, SLOT(applyAll()));
+ connect(okButton, SIGNAL(pressed()), this, SLOT(okClicked()));
current_category = ALL_SHRT;
cgListView->sortItems(SHRT_CATEGORY_COL, Qt::AscendingOrder);
@@ -110,8 +120,8 @@ void ShortcutConfig::assignShortcut()
QKeySequence keySequence = QKeySequence(key);
active->setText(SHRT_SHRTCUT_COL, keySequence);
_config_changed = true;
+ clearButton->setEnabled(true);
}
- clearButton->setEnabled(true);
defineButton->setDown(false);
}
@@ -146,16 +156,124 @@ void ShortcutConfig::shortcutSelChanged(QTreeWidgetItem* in_item, int /*column*/
void ShortcutConfig::closeEvent(QCloseEvent* /*e*/) // prevent compiler warning : unused variable
{
- QSettings settings("MusE", "MusE-qt");
- settings.setValue("ShortcutConfig/geometry", saveGeometry());
- done(_config_changed);
+ closing();
}
+// NOTE: closeEvent was not being called when Esc was pressed, despite the implication that
+// it should in the Qt help ("close event can't be ignored"). So this is a workaround,
+// and the 'recommended' way according to forums.
+void ShortcutConfig::reject()
+ {
+ closing();
+ QDialog::reject();
+ }
-void ShortcutConfig::assignAll()
+void ShortcutConfig::closing()
+{
+ QSettings settings("MusE", "MusE-qt");
+ settings.setValue("ShortcutConfig/geometry", saveGeometry());
+ if(_config_changed)
+ {
+ emit saveConfig();
+ _config_changed = false;
+ }
+}
+
+void ShortcutConfig::applyAll()
{
applyButton->setDown(false);
- done(_config_changed);
+ closing(); // Just call closing to store everything, and don't close.
}
+void ShortcutConfig::okClicked()
+ {
+ okButton->setDown(false);
+ close();
+ }
+
+void ShortcutConfig::textFileClicked()
+{
+ textFileButton->setDown(false);
+
+ QString fname = QFileDialog::getSaveFileName(this,
+ tr("Save printable text file"),
+ QDir::homePath() + "/shortcuts.txt",
+ tr("Text files (*.txt);;All files (*)"));
+ if(fname.isEmpty())
+ {
+ //QMessageBox::critical(this, tr("Error"), tr("Selected file name is empty"));
+ return;
+ }
+
+ QFile qf(fname);
+ if(!qf.open(QIODevice::WriteOnly | QIODevice::Text))
+ {
+ QMessageBox::critical(this, tr("Error"), tr("Error opening file for saving"));
+ return;
+ }
+
+ bool error = false;
+
+ QString header;
+ for (int i=0; i < SHRT_NUM_OF_CATEGORIES; i++)
+ {
+ if(shortcut_category[i].id_flag == current_category)
+ {
+ header = QString(PACKAGE_NAME) + " " + tr("Shortcuts for selected category: ") + QString(shortcut_category[i].name) + "\n\n";
+ break;
+ }
+ }
+ if(!header.isEmpty() && qf.write(header.toLatin1().constData()) == -1)
+ error = true;
+
+ QString info;
+ if(current_category == ALL_SHRT)
+ {
+ info = tr("Legend:\n");
+ for (int i=0; i < SHRT_NUM_OF_CATEGORIES; i++)
+ {
+ if(shortcut_category[i].id_flag == ALL_SHRT)
+ continue;
+ info += (QString::number(i) + " : " + QString(shortcut_category[i].name) + "\n");
+ }
+ info += "\n";
+ }
+ if(!info.isEmpty() && qf.write(info.toLatin1().constData()) == -1)
+ error = true;
+
+ for(int i=0; i < SHRT_NUM_OF_ELEMENTS; i++)
+ {
+ if(shortcuts[i].type & current_category)
+ {
+ QString s;
+ int pos = 0;
+ if(current_category == ALL_SHRT)
+ {
+ for(int j=0; j < SHRT_NUM_OF_CATEGORIES; j++)
+ {
+ if(shortcut_category[j].id_flag == ALL_SHRT)
+ continue;
+ if(shortcuts[i].type & shortcut_category[j].id_flag)
+ s.insert(pos, QString::number(j));
+ pos += 3;
+ }
+ s.insert(pos, " : ");
+ pos += 3;
+ }
+
+ s.insert(pos, QKeySequence(shortcuts[i].key).toString());
+ pos += 25;
+ s.insert(pos, qApp->translate("shortcuts", shortcuts[i].descr) + "\n");
+ if(qf.write(s.toLatin1().constData()) == -1)
+ error = true;
+ }
+ }
+
+ qf.close();
+
+ if(error)
+ QMessageBox::critical(this, tr("Error"), tr("An error occurred while saving"));
+}
+
+
} // namespace MusEGui
diff --git a/muse2/muse/widgets/shortcutconfig.h b/muse2/muse/widgets/shortcutconfig.h
index 3faf2b5e..d3f189e4 100644
--- a/muse2/muse/widgets/shortcutconfig.h
+++ b/muse2/muse/widgets/shortcutconfig.h
@@ -68,17 +68,24 @@ class ShortcutConfig : public QDialog, public Ui::ShortcutConfigBase {
void updateSCListView(int category);
void updateSCListView() { updateSCListView(current_category); }
void closeEvent(QCloseEvent *e);
+ void closing();
private slots:
void categorySelChanged(QTreeWidgetItem*, int);
void shortcutSelChanged(QTreeWidgetItem*, int);
void assignShortcut();
void clearShortcut();
- void assignAll();
-
-
+ void applyAll();
+ void okClicked();
+ void textFileClicked();
+
+ protected:
+ void reject();
+ signals:
+ void saveConfig();
+
public:
- ShortcutConfig(QWidget* parent);
+ ShortcutConfig(QWidget* parent = 0);
bool _config_changed;
};
diff --git a/muse2/muse/widgets/shortcutconfigbase.ui b/muse2/muse/widgets/shortcutconfigbase.ui
index 6dd5d5b7..da62ed19 100644
--- a/muse2/muse/widgets/shortcutconfigbase.ui
+++ b/muse2/muse/widgets/shortcutconfigbase.ui
@@ -29,7 +29,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="childrenCollapsible">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<widget class="QTreeWidget" name="cgListView">
<property name="sizePolicy">
@@ -146,6 +146,42 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QPushButton" name="textFileButton">
+ <property name="text">
+ <string>&amp;Printable file...</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+P</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>30</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton">
+ <property name="text">
+ <string>&amp;Ok</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+O</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
diff --git a/muse2/share/templates/MusE.cfg b/muse2/share/templates/MusE.cfg
index daf6da4a..b8be1eff 100644
--- a/muse2/share/templates/MusE.cfg
+++ b/muse2/share/templates/MusE.cfg
@@ -601,7 +601,7 @@ fff000000000000000000000002000000030000000a00540065006d0070006f0100000000fffffff
<follow_no>0</follow_no>
<follow_continuous>0</follow_continuous>
<configure_global>0</configure_global>
- <configure_shortcuts>0</configure_shortcuts>
+ <configure_key_shortcuts>117440560</configure_key_shortcuts>
<configure_metronome>0</configure_metronome>
<configure_midi_sync>0</configure_midi_sync>
<configure_midi_file>0</configure_midi_file>