diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2011-09-08 02:05:32 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2011-09-08 02:05:32 +0000 |
commit | d3e8a1b4c98cb3ba8b73f367ea88ad23f8dbca66 (patch) | |
tree | 921e5193e46287f0c34f4eff1590efb1df18d20f /muse2/muse/instruments | |
parent | ff0c5e9154e7a3d71d2465639b5e0da1ea2c7242 (diff) |
introducing namespaces
Diffstat (limited to 'muse2/muse/instruments')
-rw-r--r-- | muse2/muse/instruments/editinstrument.cpp | 58 | ||||
-rw-r--r-- | muse2/muse/instruments/minstrument.cpp | 29 |
2 files changed, 44 insertions, 43 deletions
diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index f2f0331d..49bdd6c2 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -277,7 +277,7 @@ void EditInstrument::fileSave() // Do not allow a direct overwrite of a 'built-in' muse instrument. QFileInfo qfi(workingInstrument.filePath()); - if(qfi.absolutePath() == museInstruments) + if(qfi.absolutePath() == MusEGlobal::museInstruments) { //fileSaveAs(); saveAs(); @@ -399,34 +399,34 @@ void EditInstrument::saveAs() //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); // MidiInstrument* instrument = (MidiInstrument*)item->data(); - //QString path = QDir::homePath() + "/" + config.instrumentPath; - //QString path = QDir::homeDirPath() + "/" + museGlobalShare; - //QString path = museInstruments; - QString path = museUserInstruments; + //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath; + //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare; + //QString path = MusEGlobal::museInstruments; + QString path = MusEGlobal::museUserInstruments; - if(!QDir(museUserInstruments).exists()) + if(!QDir(MusEGlobal::museUserInstruments).exists()) { if(QMessageBox::question(this, tr("MusE:"), - tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + + tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + 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) { - if(QDir().mkdir(museUserInstruments)) - printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); + if(QDir().mkdir(MusEGlobal::museUserInstruments)) + printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); else { - printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); - QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments); + printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); + QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); //return; - path = museUser; + path = MusEGlobal::museUser; } } else // return; - path = museUser; + path = MusEGlobal::museUser; } //if (instrument->filePath().isEmpty()) @@ -446,7 +446,7 @@ void EditInstrument::saveAs() { // Prompt only if it's a user instrument, to avoid duplicates in the user instrument dir. // This will still allow a user instrument to override a built-in instrument with the same name. - if(fi.absolutePath() != museInstruments) + if(fi.absolutePath() != MusEGlobal::museInstruments) { //QMessageBox::critical(this, // tr("MusE: Bad instrument name"), @@ -570,7 +570,7 @@ void EditInstrument::fileSaveAs() { // Allow override of built-in instrument names. QFileInfo fi((*imi)->filePath()); - if(fi.absolutePath() == museInstruments) + if(fi.absolutePath() == MusEGlobal::museInstruments) break; found = true; break; @@ -604,7 +604,7 @@ void EditInstrument::fileSaveAs() QFileInfo fi((*imi)->filePath()); // Allow override of built-in and user instruments: // If it's a user instrument, not a built-in instrument... - if(fi.absolutePath() == museUserInstruments) + if(fi.absolutePath() == MusEGlobal::museUserInstruments) { // No choice really but to overwrite the destination instrument file! // Can not have two user files containing the same instrument name. @@ -691,34 +691,34 @@ void EditInstrument::fileSaveAs() break; } - //QString path = QDir::homePath() + "/" + config.instrumentPath; - //QString path = QDir::homeDirPath() + "/" + museGlobalShare; - //QString path = museInstruments; - QString path = museUserInstruments; + //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath; + //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare; + //QString path = MusEGlobal::museInstruments; + QString path = MusEGlobal::museUserInstruments; - if(!QDir(museUserInstruments).exists()) + if(!QDir(MusEGlobal::museUserInstruments).exists()) { if(QMessageBox::question(this, tr("MusE:"), - tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + + tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + 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) { - if(QDir().mkdir(museUserInstruments)) - printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); + if(QDir().mkdir(MusEGlobal::museUserInstruments)) + printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); else { - printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); - QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments); + printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); + QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); //return; - path = museUser; + path = MusEGlobal::museUser; } } else // return; - path = museUser; + path = MusEGlobal::museUser; } path += QString("/%1.idf").arg(so); @@ -1463,7 +1463,7 @@ void EditInstrument::patchButtonClicked() PatchGroup* pgp = *i; QMenu* pm = patchpopup->addMenu(pgp->name); //pm->setCheckable(false);//Qt4 doc says this is unnecessary - pm->setFont(config.fonts[0]); + pm->setFont(MusEConfig::config.fonts[0]); const PatchList& pl = pgp->patches; for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { const Patch* mp = *ipl; diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index 7841a2e1..299f76bb 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -42,6 +42,7 @@ #include "gconfig.h" #include "popupmenu.h" + MidiInstrumentList midiInstruments; MidiInstrument* genericMidiInstrument; @@ -155,7 +156,7 @@ static void loadIDF(QFileInfo* fi) printf("cannot open file %s\n", fi->fileName().toLatin1()); return; } - if (debugMsg) + if (MusEGlobal::debugMsg) printf(" load instrument definition <%s>\n", fi->filePath().local8Bit().data()); QDomDocument doc; int line, column; @@ -187,7 +188,7 @@ static void loadIDF(QFileInfo* fi) if (midiInstruments[idx]->iname() == i->iname()) { midiInstruments.replace(idx, i); replaced = true; - if (debugMsg) + if (MusEGlobal::debugMsg) printf("Midi Instrument Definition <%s> overwritten\n", i->iname().toLocal8Bit().data()); break; @@ -208,7 +209,7 @@ static void loadIDF(QFileInfo* fi) FILE* f = fopen(fi->filePath().toAscii().constData(), "r"); if (f == 0) return; - if (debugMsg) + if (MusEGlobal::debugMsg) printf("READ IDF %s\n", fi->filePath().toLatin1().constData()); Xml xml(f); @@ -267,9 +268,9 @@ void initMidiInstruments() { genericMidiInstrument = new MidiInstrument(QWidget::tr("generic midi")); midiInstruments.push_back(genericMidiInstrument); - if (debugMsg) - printf("load user instrument definitions from <%s>\n", museUserInstruments.toLatin1().constData()); - QDir usrInstrumentsDir(museUserInstruments, QString("*.idf")); + if (MusEGlobal::debugMsg) + printf("load user instrument definitions from <%s>\n", MusEGlobal::museUserInstruments.toLatin1().constData()); + QDir usrInstrumentsDir(MusEGlobal::museUserInstruments, QString("*.idf")); if (usrInstrumentsDir.exists()) { QFileInfoList list = usrInstrumentsDir.entryInfoList(); QFileInfoList::iterator it=list.begin(); // ddskrjo @@ -280,15 +281,15 @@ void initMidiInstruments() } //else //{ - // if(usrInstrumentsDir.mkdir(museUserInstruments)) - // printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1()); + // if(usrInstrumentsDir.mkdir(MusEGlobal::museUserInstruments)) + // printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1()); // else - // printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1()); + // printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1()); //} - if (debugMsg) - printf("load instrument definitions from <%s>\n", museInstruments.toLatin1().constData()); - QDir instrumentsDir(museInstruments, QString("*.idf")); + if (MusEGlobal::debugMsg) + printf("load instrument definitions from <%s>\n", MusEGlobal::museInstruments.toLatin1().constData()); + QDir instrumentsDir(MusEGlobal::museInstruments, QString("*.idf")); if (instrumentsDir.exists()) { QFileInfoList list = instrumentsDir.entryInfoList(); QFileInfoList::iterator it=list.begin(); // ddskrjo @@ -298,7 +299,7 @@ void initMidiInstruments() } } else - printf("Instrument directory not found: %s\n", museInstruments.toLatin1().constData()); + printf("Instrument directory not found: %s\n", MusEGlobal::museInstruments.toLatin1().constData()); } @@ -960,7 +961,7 @@ void MidiInstrument::populatePatchPopup(PopupMenu* menu, int chan, MType songTyp //QMenu* pm = menu->addMenu(pgp->name); PopupMenu* pm = new PopupMenu(pgp->name, menu, menu->stayOpen()); // Use the parent stayOpen here. menu->addMenu(pm); - pm->setFont(config.fonts[0]); + pm->setFont(MusEConfig::config.fonts[0]); const PatchList& pl = pgp->patches; for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { const Patch* mp = *ipl; |