diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-21 12:01:09 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-21 12:01:09 +0000 |
commit | ac2d334936e34beabf43282d8c96a71886a2c459 (patch) | |
tree | d3c981060f6e658988741765055177bfe882db80 | |
parent | 90cfa63b4fb1b52ed15027441c6a979a830d8ca3 (diff) |
Commit of the beast. User instruments path is made user configurable. Removed env. variables usage.
-rw-r--r-- | muse2/ChangeLog | 5 | ||||
-rw-r--r-- | muse2/muse/conf.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/gconfig.cpp | 1 | ||||
-rw-r--r-- | muse2/muse/gconfig.h | 1 | ||||
-rw-r--r-- | muse2/muse/instruments/editinstrument.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/main.cpp | 40 | ||||
-rw-r--r-- | muse2/muse/song.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/genset.cpp | 27 | ||||
-rw-r--r-- | muse2/muse/widgets/genset.h | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/gensetbase.ui | 32 | ||||
-rw-r--r-- | muse2/synti/deicsonze/deicsonze.cpp | 2 | ||||
-rw-r--r-- | muse2/synti/deicsonze/deicsonzegui.cpp | 2 |
12 files changed, 75 insertions, 50 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index a9f66242..03076767 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,10 +1,11 @@ 21.12.2010: - Moved all the config files "~/.musePrj, ~/.MusE, ~/.deicsonze.dco" into ~/.config/MusE/ and renamed them as "projects, MusE.cfg, deicsonze.dco", respectively. (Orcan) - TODO: user instruments path will be made user configurable with default location in - ~/.config/MusE/ + - User instruments path is made user configurable with default location in + ~/.config/MusE/instruments - In simpledrums2, set the 64bit ladpsa plugin paths. (Orcan) - Fix: gensetbase was opening in the last tab instead of the first. (Orcan) + - Eliminated environment variables usage (MUSE, MUSEHOME, MUSEINSTRUMENTS). (Orcan) 20.12.2010: - Fixed arranger grid h-line drawing, track, and part drawing alignment, border issues. (Tim) - To open help pages, use the default browser of the system via QDeskopServices. Removed diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 3ea829b0..44b9715c 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -836,6 +836,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) config.dummyAudioBufSize = xml.parseInt(); else if (tag == "guiRefresh") config.guiRefresh = xml.parseInt(); + else if (tag == "userInstrumentsDir") + config.userInstrumentsDir = xml.parse1(); else if (tag == "midiTransform") readMidiTransform(xml); else if (tag == "midiInputTransform") @@ -882,6 +884,8 @@ bool readConfiguration() if (debugMsg || debugMode) fprintf(stderr, "NO Config File <%s> found\n", configName.toLatin1().constData()); + if (config.userInstrumentsDir.isEmpty()) + config.userInstrumentsDir = configPath + "/instruments"; return true; } Xml xml(f); @@ -1077,6 +1081,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const xml.intTag(level, "dummyAudioSampleRate", config.dummyAudioSampleRate); xml.intTag(level, "guiRefresh", config.guiRefresh); + xml.strTag(level, "userInstrumentsDir", config.userInstrumentsDir); // Removed by Orcan. 20101220 //xml.strTag(level, "helpBrowser", config.helpBrowser); xml.intTag(level, "extendedMidi", config.extendedMidi); diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index f4db3604..46f74d5c 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -82,6 +82,7 @@ GlobalConfigValues config = { -60.0, // double minSlider; false, // use Jack freewheel 20, // int guiRefresh; + QString(""), // userInstrumentsDir //QString(""), // helpBrowser; // Obsolete true, // extendedMidi 384, // division for smf export diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index 50d13d21..f2287607 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -78,6 +78,7 @@ struct GlobalConfigValues { double minSlider; bool freewheelMode; int guiRefresh; + QString userInstrumentsDir; bool extendedMidi; // extended smf format int midiDivision; // division for smf export diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index 18a51eff..c45ac97a 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -394,7 +394,7 @@ void EditInstrument::saveAs() if(QMessageBox::question(this, tr("MusE:"), tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + - tr("(You can override with the environment variable MUSEINSTRUMENTS)"), + tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, Qt::NoButton) == QMessageBox::Ok) @@ -686,7 +686,7 @@ void EditInstrument::fileSaveAs() if(QMessageBox::question(this, tr("MusE:"), tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + - tr("(You can override with the environment variable MUSEINSTRUMENTS)"), + tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, Qt::NoButton) == QMessageBox::Ok) diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index 8a0b5cec..ff4931bd 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -159,7 +159,7 @@ static QString localeList() { // Find out what translations are available: QStringList deliveredLocaleListFiltered; - QString distLocale = QString(SHAREDIR) + "/locale"; + QString distLocale = museGlobalShare + "/locale"; QFileInfo distLocaleFi(distLocale); if (distLocaleFi.isDir()) { QDir dir = QDir(distLocale); @@ -230,45 +230,17 @@ int main(int argc, char* argv[]) getCapabilities(); int noAudio = false; - const char* mu = getenv("MUSEHOME"); - if(mu) - museUser = QString(mu); - if(museUser.isEmpty()) - museUser = QString(getenv("HOME")); - - QString museGlobal; - const char* p = getenv("MUSE"); - if (p) - museGlobal = p; - - if (museGlobal.isEmpty()) { - museGlobalLib = QString(LIBDIR); - museGlobalShare = QString(SHAREDIR); - } - else { - // Doesn't it make more sense to hardcode these dirs? - // Well... They will be set properly anyways... - // Need to discuss this with Tim. - Orcan - museGlobalLib = museGlobal + "/lib"; - museGlobalShare = museGlobal + "/share"; - //museGlobalLib = museGlobal + QString("/") + QString(LIBINSTPREFIX); // p4.0.7 - //museGlobalShare = museGlobal + QString("/") + QString(SHAREINSTPREFIX); - } + museUser = QString(getenv("HOME")); + museGlobalLib = QString(LIBDIR); + museGlobalShare = QString(SHAREDIR); museProject = museProjectInitPath; //getcwd(0, 0); + museInstruments = museGlobalShare + QString("/instruments"); // Create config dir if it doesn't exists QDir cPath = QDir(configPath); if (! cPath.exists()) cPath.mkpath("."); - museInstruments = museGlobalShare + QString("/instruments"); - - const char* ins = getenv("MUSEINSTRUMENTS"); - if(ins) - museUserInstruments = QString(ins); - if(museUserInstruments.isEmpty()) - museUserInstruments = museUser + QString("/muse_instruments"); - #ifdef HAVE_LASH lash_args_t * lash_args = 0; if(useLASH) @@ -284,6 +256,8 @@ int main(int argc, char* argv[]) initShortCuts(); readConfiguration(); + museUserInstruments = config.userInstrumentsDir; + if (config.useDenormalBias) printf("Denormal protection enabled.\n"); // SHOW MUSE SPLASH SCREEN diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index e0268577..2212228e 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -3724,7 +3724,7 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver) // // List scripts // - QString distScripts = QString(SHAREDIR) + "/scripts"; + QString distScripts = museGlobalShare + "/scripts"; QString userScripts = configPath + "/scripts"; @@ -3779,7 +3779,7 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver) QString Song::getScriptPath(int id, bool isdelivered) { if (isdelivered) { - QString path = QString(SHAREDIR) + "/scripts/" + deliveredScriptNames[id]; + QString path = museGlobalShare + "/scripts/" + deliveredScriptNames[id]; return path; } diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 24e58855..0d81d846 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -8,7 +8,7 @@ #include <stdio.h> -#include <QDialog> +#include <QFileDialog> #include <QRect> #include <QShowEvent> @@ -17,6 +17,7 @@ #include "gconfig.h" #include "midiseq.h" #include "globals.h" +#include "icons.h" static int rtcResolutions[] = { 1024, 2048, 4096, 8192, 16384, 32768 @@ -64,7 +65,13 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) break; } } - + + userInstrumentsPath->setText(config.userInstrumentsDir); + selectInstrumentsDirButton->setIcon(*openIcon); + defaultInstrumentsDirButton->setIcon(*undoIcon); + connect(selectInstrumentsDirButton, SIGNAL(clicked()), SLOT(selectInstrumentsPath())); + connect(defaultInstrumentsDirButton, SIGNAL(clicked()), SLOT(defaultInstrumentsPath())); + guiRefreshSelect->setValue(config.guiRefresh); minSliderSelect->setValue(int(config.minSlider)); minMeterSelect->setValue(config.minMeter); @@ -256,6 +263,7 @@ void GlobalSettingsConfig::apply() config.useOutputLimiter = outputLimiterCheckBox->isChecked(); config.vstInPlace = vstInPlaceCheckBox->isChecked(); config.rtcTicks = rtcResolutions[rtcticks]; + config.userInstrumentsDir = userInstrumentsPath->text(); config.startSong = startSongEntry->text(); config.startMode = startSongGroup->checkedId(); int das = dummyAudioSize->currentIndex(); @@ -340,6 +348,8 @@ void GlobalSettingsConfig::apply() muse->resize(config.geometryMain.size()); muse->move(config.geometryMain.topLeft()); + museUserInstruments = config.userInstrumentsDir; + muse->setHeartBeat(); // set guiRefresh midiSeq->msgSetRtc(); // set midi tick rate muse->changeConfig(true); // save settings @@ -439,3 +449,16 @@ void GlobalSettingsConfig::transportCurrent() transportY->setValue(r.y()); } +void GlobalSettingsConfig::selectInstrumentsPath() + { + QString dir = QFileDialog::getExistingDirectory(this, + tr("Selects instruments directory"), + config.userInstrumentsDir); + userInstrumentsPath->setText(dir); + } + +void GlobalSettingsConfig::defaultInstrumentsPath() + { + QString dir = configPath + "/instruments"; + userInstrumentsPath->setText(dir); + } diff --git a/muse2/muse/widgets/genset.h b/muse2/muse/widgets/genset.h index e0494b2f..ea094296 100644 --- a/muse2/muse/widgets/genset.h +++ b/muse2/muse/widgets/genset.h @@ -30,6 +30,8 @@ class GlobalSettingsConfig : public QDialog, public Ui::GlobalSettingsDialogBase void bigtimeCurrent(); void arrangerCurrent(); void transportCurrent(); + void selectInstrumentsPath(); + void defaultInstrumentsPath(); protected: void showEvent(QShowEvent*); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index 9885f97f..9fb4e6f2 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -907,13 +907,7 @@ Shorter periods are desirable.</string> <property name="title"> <string>Ticks</string> </property> - <layout class="QGridLayout"> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> + <layout class="QGridLayout" name="gridLayout9"> <item row="0" column="0"> <widget class="QLabel" name="TextLabel3"> <property name="text"> @@ -1085,6 +1079,30 @@ Shorter periods are desirable.</string> </item> </widget> </item> + <item row="3" column="0"> + <widget class="QLabel" name="TextLabel3_4"> + <property name="text"> + <string>Instruments Directory</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="userInstrumentsPath"/> + </item> + <item row="3" column="2"> + <widget class="QPushButton" name="selectInstrumentsDirButton"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QPushButton" name="defaultInstrumentsDirButton"> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp index 0168432a..0ee1368e 100644 --- a/muse2/synti/deicsonze/deicsonze.cpp +++ b/muse2/synti/deicsonze/deicsonze.cpp @@ -121,7 +121,7 @@ DeicsOnze::DeicsOnze() : Mess(2) { _saveConfig = true; _isInitSet = true; //false if an initial bank must be download - QString sharePath(SHAREDIR); + QString sharePath(museGlobalShare); _initSetPath = sharePath + QString("/presets/deicsonze/SutulaBank.dei"); diff --git a/muse2/synti/deicsonze/deicsonzegui.cpp b/muse2/synti/deicsonze/deicsonzegui.cpp index 58fbb903..61543d10 100644 --- a/muse2/synti/deicsonze/deicsonzegui.cpp +++ b/muse2/synti/deicsonze/deicsonzegui.cpp @@ -440,7 +440,7 @@ DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze) setEnabledPreset(false); // Tim. - QString sharePath(SHAREDIR); + QString sharePath(museGlobalShare); updateInitSetPath (sharePath + QString("/presets/deicsonze/SutulaBank.dei")); // Tim. |