diff options
author | Florian Jung <flo@windfisch.org> | 2011-12-25 19:13:12 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-12-25 19:13:12 +0000 |
commit | c836582af5661f1ca0e7d93c2674c947462faeb0 (patch) | |
tree | 62c2efc3499e886bc19504459cb985aa0f3c8141 | |
parent | f7bd12297b81b95371713af725c47f8c56a77550 (diff) |
added config option for switching between "prefer old/new drumtracks"
and "only show new/old drumtracks". defaults to "prefer new"
-rw-r--r-- | muse2/muse/arranger/arrangerview.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/conf.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/gconfig.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/gconfig.h | 8 | ||||
-rw-r--r-- | muse2/muse/helper.cpp | 46 | ||||
-rw-r--r-- | muse2/muse/helper.h | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/genset.cpp | 26 | ||||
-rw-r--r-- | muse2/muse/widgets/gensetbase.ui | 67 | ||||
-rw-r--r-- | muse2/muse/widgets/musewidgetsplug.cpp | 3 |
9 files changed, 128 insertions, 32 deletions
diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp index 1bb45863..7b8abb63 100644 --- a/muse2/muse/arranger/arrangerview.cpp +++ b/muse2/muse/arranger/arrangerview.cpp @@ -641,7 +641,7 @@ void ArrangerView::clearScoreMenuMappers() void ArrangerView::populateAddTrack() { - QActionGroup *grp = MusEGui::populateAddTrack(addTrack, true); + QActionGroup *grp = MusEGui::populateAddTrack(addTrack, true, true); connect(addTrack, SIGNAL(triggered(QAction *)), SLOT(addNewTrack(QAction *))); trackMidiAction = grp->actions()[0]; diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 5376734c..e9ec1396 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -969,6 +969,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer, bool doReadGlobalConfig MusEGlobal::config.rangeMarkerWithoutMMB = xml.parseInt(); else if (tag == "addHiddenTracks") MusEGlobal::config.addHiddenTracks = xml.parseInt(); + else if (tag == "drumTrackPreference") + MusEGlobal::config.drumTrackPreference = (MusEGlobal::drumTrackPreference_t) xml.parseInt(); else if (tag == "unhideTracks") MusEGlobal::config.unhideTracks = xml.parseInt(); @@ -1312,6 +1314,7 @@ void MusE::writeGlobalConfiguration(int level, MusECore::Xml& xml) const xml.intTag(level, "unhideTracks", MusEGlobal::config.unhideTracks); xml.intTag(level, "addHiddenTracks", MusEGlobal::config.addHiddenTracks); + xml.intTag(level, "drumTrackPreference", MusEGlobal::config.drumTrackPreference); xml.intTag(level, "waveTracksVisible", MusECore::WaveTrack::visible()); xml.intTag(level, "auxTracksVisible", MusECore::AudioAux::visible()); diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index 843c2278..68ac6315 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -192,7 +192,8 @@ GlobalConfigValues config = { false, // rangeMarkerWithoutMMB MusECore::DONT_REC_MUTED_OR_HIDDEN, true, // addHiddenTracks - true // unhideTracks + true, // unhideTracks + MusEGlobal::PREFER_NEW // drumTrackPreference }; //GlobalConfigValues globalConfig = config; diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index f611687f..4ba9efea 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -47,6 +47,13 @@ enum newDrumRecordCondition_t namespace MusEGlobal { +enum drumTrackPreference_t +{ + PREFER_OLD = 0, + PREFER_NEW = 1, + ONLY_OLD = 2, + ONLY_NEW = 3 +}; //--------------------------------------------------------- // MixerConfig //--------------------------------------------------------- @@ -180,6 +187,7 @@ struct GlobalConfigValues { MusECore::newDrumRecordCondition_t newDrumRecordCondition; bool addHiddenTracks; bool unhideTracks; + drumTrackPreference_t drumTrackPreference; }; diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index a0d85133..05cecc08 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -238,7 +238,7 @@ QMenu* populateAddSynth(QWidget* parent) // this is also used in "mixer" //--------------------------------------------------------- -QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll) +QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll, bool evenIgnoreDrumPreference) { QActionGroup* grp = new QActionGroup(addTrack); if (MusEGlobal::config.addHiddenTracks) @@ -249,18 +249,38 @@ QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll) qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add Midi Track"))); midi->setData(MusECore::Track::MIDI); grp->addAction(midi); - } - if (populateAll || MusECore::MidiTrack::visible()) { - QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), - qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add Drum Track"))); - drum->setData(MusECore::Track::DRUM); - grp->addAction(drum); - } - if (populateAll || MusECore::MidiTrack::visible()) { - QAction* newdrum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), - qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add New Style Drum Track"))); - newdrum->setData(MusECore::Track::NEW_DRUM); - grp->addAction(newdrum); + + + if (!evenIgnoreDrumPreference && (MusEGlobal::config.drumTrackPreference==MusEGlobal::PREFER_OLD || MusEGlobal::config.drumTrackPreference==MusEGlobal::ONLY_OLD)) + { + QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add Drum Track"))); + drum->setData(MusECore::Track::DRUM); + grp->addAction(drum); + } + + if (!evenIgnoreDrumPreference && (MusEGlobal::config.drumTrackPreference==MusEGlobal::PREFER_NEW || MusEGlobal::config.drumTrackPreference==MusEGlobal::ONLY_NEW)) + { + QAction* newdrum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add Drum Track"))); + newdrum->setData(MusECore::Track::NEW_DRUM); + grp->addAction(newdrum); + } + + if (evenIgnoreDrumPreference || MusEGlobal::config.drumTrackPreference==MusEGlobal::PREFER_NEW) + { + QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add Old Style Drum Track"))); + drum->setData(MusECore::Track::DRUM); + grp->addAction(drum); + } + if (evenIgnoreDrumPreference || MusEGlobal::config.drumTrackPreference==MusEGlobal::PREFER_OLD) + { + QAction* newdrum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + qApp->translate("@default", QT_TRANSLATE_NOOP("@default", "Add New Style Drum Track"))); + newdrum->setData(MusECore::Track::NEW_DRUM); + grp->addAction(newdrum); + } } if (populateAll || MusECore::WaveTrack::visible()) { QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon), diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h index ad531fae..8ef39346 100644 --- a/muse2/muse/helper.h +++ b/muse2/muse/helper.h @@ -53,7 +53,7 @@ QSet<Part*> parts_at_tick(unsigned tick, const QSet<Track*>& tracks); namespace MusEGui { QMenu* populateAddSynth(QWidget* parent); -QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll=false); +QActionGroup* populateAddTrack(QMenu* addTrack, bool populateAll=false, bool evenIgnoreDrumPreference=false); QStringList localizedStringListFromCharArray(const char** array, const char* context); QString getFilterExtension(const QString &filter); QString browseProjectFolder(QWidget* parent = 0); diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index df7dea78..422f5110 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -184,6 +184,14 @@ Shorter periods are desirable.</string> addHiddenCheckBox->setChecked(MusEGlobal::config.addHiddenTracks); unhideTracksCheckBox->setChecked(MusEGlobal::config.unhideTracks); + + switch (MusEGlobal::config.drumTrackPreference) + { + case MusEGlobal::ONLY_NEW: onlyNewDrumBtn->setChecked(true); break; + case MusEGlobal::ONLY_OLD: onlyOldDrumBtn->setChecked(true); break; + case MusEGlobal::PREFER_NEW: preferNewDrumBtn->setChecked(true); break; + case MusEGlobal::PREFER_OLD: preferOldDrumBtn->setChecked(true); break; + } //updateSettings(); // TESTING @@ -332,6 +340,14 @@ void GlobalSettingsConfig::updateSettings() addHiddenCheckBox->setChecked(MusEGlobal::config.addHiddenTracks); unhideTracksCheckBox->setChecked(MusEGlobal::config.unhideTracks); + switch (MusEGlobal::config.drumTrackPreference) + { + case MusEGlobal::ONLY_NEW: onlyNewDrumBtn->setChecked(true); break; + case MusEGlobal::ONLY_OLD: onlyOldDrumBtn->setChecked(true); break; + case MusEGlobal::PREFER_NEW: preferNewDrumBtn->setChecked(true); break; + case MusEGlobal::PREFER_OLD: preferOldDrumBtn->setChecked(true); break; + } + updateMdiSettings(); } @@ -474,6 +490,16 @@ void GlobalSettingsConfig::apply() MusEGlobal::muse->setHeartBeat(); // set guiRefresh MusEGlobal::midiSeq->msgSetRtc(); // set midi tick rate + if (onlyNewDrumBtn->isChecked()) + MusEGlobal::config.drumTrackPreference=MusEGlobal::ONLY_NEW; + else if (onlyOldDrumBtn->isChecked()) + MusEGlobal::config.drumTrackPreference=MusEGlobal::ONLY_OLD; + else if (preferOldDrumBtn->isChecked()) + MusEGlobal::config.drumTrackPreference=MusEGlobal::PREFER_OLD; + else if (preferNewDrumBtn->isChecked()) + MusEGlobal::config.drumTrackPreference=MusEGlobal::PREFER_NEW; + + applyMdiSettings(); MusEGlobal::muse->changeConfig(true); // save settings diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index 1abc3cd1..aec753f1 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -1442,19 +1442,6 @@ left button behave like the middle button in such areas.</string> </property> </widget> </item> - <item row="9" column="0"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> <item row="7" column="1"> <widget class="QCheckBox" name="addHiddenCheckBox"> <property name="text"> @@ -1486,6 +1473,56 @@ left button behave like the middle button in such areas.</string> </layout> </widget> </item> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Drum tracks</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QRadioButton" name="onlyOldDrumBtn"> + <property name="text"> + <string>Only offer old-style drumtracks</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QRadioButton" name="onlyNewDrumBtn"> + <property name="text"> + <string>Only offer new-style drumtracks</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="preferOldDrumBtn"> + <property name="text"> + <string>Prefer old-style drumtracks</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QRadioButton" name="preferNewDrumBtn"> + <property name="text"> + <string>Prefer new-style drumtracks</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> </layout> </widget> <widget class="QWidget" name="tab_2"> @@ -1544,8 +1581,8 @@ left button behave like the middle button in such areas.</string> <rect> <x>0</x> <y>0</y> - <width>96</width> - <height>26</height> + <width>486</width> + <height>375</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout_3"> diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index 5267436f..6cdc3812 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -220,7 +220,8 @@ MusEGlobal::GlobalConfigValues config = { false, // rangeMarkerWithoutMMB MusECore::DONT_REC_MUTED_OR_HIDDEN, true, // addHiddenTracks - true // unhideTracks + true, // unhideTracks + MusEGlobal::PREFER_NEW // drumTrackPreference }; //--------------------------------------------------------- |