diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-08 08:22:29 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-08 08:22:29 +0000 |
commit | 4a1be16bbfafb8455b54336c4465da8f8bfe3ab6 (patch) | |
tree | 01cbdba041d5e864294909d834c1a189f0edb98b /muse2/synti | |
parent | f681783c513b54002aa4dfec2566f26bfc38689b (diff) |
ported many Qt3 methods to Qt4
Diffstat (limited to 'muse2/synti')
-rw-r--r-- | muse2/synti/fluid/fluid.cpp | 2 | ||||
-rw-r--r-- | muse2/synti/fluid/fluidgui.cpp | 2 | ||||
-rw-r--r-- | muse2/synti/fluidsynth/fluidsynthgui.cpp | 19 | ||||
-rw-r--r-- | muse2/synti/fluidsynth/fluidsynti.cpp | 7 | ||||
-rw-r--r-- | muse2/synti/organ/organ.cpp | 4 | ||||
-rw-r--r-- | muse2/synti/organ/organgui.cpp | 10 | ||||
-rw-r--r-- | muse2/synti/vam/vam.cpp | 2 | ||||
-rw-r--r-- | muse2/synti/vam/vamgui.cpp | 53 |
8 files changed, 50 insertions, 49 deletions
diff --git a/muse2/synti/fluid/fluid.cpp b/muse2/synti/fluid/fluid.cpp index 17a5119e..8bac3ca2 100644 --- a/muse2/synti/fluid/fluid.cpp +++ b/muse2/synti/fluid/fluid.cpp @@ -587,7 +587,7 @@ bool ISynth::init(const char* name) } gui = new FLUIDGui; - gui->setCaption(QString(name)); + gui->setWindowTitle(QString(name)); gui->show(); return false; } diff --git a/muse2/synti/fluid/fluidgui.cpp b/muse2/synti/fluid/fluidgui.cpp index 10625999..3ba70aff 100644 --- a/muse2/synti/fluid/fluidgui.cpp +++ b/muse2/synti/fluid/fluidgui.cpp @@ -73,7 +73,7 @@ void FLUIDGui::loadFont() void FLUIDGui::soundFontFileDialog() { - QString s = QFileDialog::getOpenFileName(QString::null, QString("*.[Ss][Ff]2"), this); + QString s = QFileDialog::getOpenFileName(this, QString(), QString(), QString("*.[Ss][Ff]2")); if (!s.isEmpty()) { pathEntry->setText(s); } diff --git a/muse2/synti/fluidsynth/fluidsynthgui.cpp b/muse2/synti/fluidsynth/fluidsynthgui.cpp index 39344c02..18d5df59 100644 --- a/muse2/synti/fluidsynth/fluidsynthgui.cpp +++ b/muse2/synti/fluidsynth/fluidsynthgui.cpp @@ -160,12 +160,13 @@ void FluidSynthGui::pushClicked() void FluidSynthGui::loadClicked() { - QString filename = QFileDialog::getOpenFileName(lastdir, QString("*.[Ss][Ff]2"), - this, - "Load Soundfont dialog", - "Choose soundfont"); + QString filename = QFileDialog::getOpenFileName(this, + tr("Choose soundfont"), + lastdir, + QString("*.[Ss][Ff]2")); + if (filename != QString::null) { - int lastslash = filename.findRev('/'); + int lastslash = filename.lastIndexOf('/'); lastdir = filename.left(lastslash); sendLastdir(lastdir); @@ -180,10 +181,10 @@ void FluidSynthGui::loadClicked() void FluidSynthGui::sendLastdir(QString dir) { - int l = strlen(dir)+2; + int l = dir.length()+2; byte data[l]; data[0] = FS_LASTDIR_CHANGE; - memcpy(data+1, dir.toLatin1(), strlen(dir)+1); + memcpy(data+1, dir.toLatin1(), dir.length()+1); sendSysex(data,l); } @@ -341,7 +342,7 @@ void FluidSynthGui::processEvent(const MidiPlayEvent& ev) } case FS_CHORUS_TYPE: { ChorusType->blockSignals(true); - ChorusType->setCurrentItem(val); + ChorusType->setCurrentIndex(val); ChorusType->blockSignals(false); break; } @@ -610,7 +611,7 @@ void FluidSynthGui::popClicked() void FluidSynthGui::sfItemClicked(QTreeWidgetItem* item, int /*col*/) { if (item != 0) { - currentlySelectedFont = atoi(item->text(FS_ID_COL)); + currentlySelectedFont = atoi(item->text(FS_ID_COL).toLatin1().constData()); Pop->setEnabled(true); } else { diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp index c9d5ef4d..0802614b 100644 --- a/muse2/synti/fluidsynth/fluidsynti.cpp +++ b/muse2/synti/fluidsynth/fluidsynti.cpp @@ -112,7 +112,7 @@ bool FluidSynth::init(const char* name) gui = new FluidSynthGui(); gui->show(); - gui->setCaption(name); + gui->setWindowTitle(name); lastdir= ""; currentlyLoadedFonts = 0; @@ -363,10 +363,11 @@ void FluidSynth::parseInitData(int n, const byte* d) for (int i=0; i<nr_of_fonts; i++) { fonts[i].filename = (char*)(chptr); chptr+=(strlen(fonts[i].filename.c_str())+1); + QByteArray ba = projPathPtr->toAscii(); if (QFileInfo(fonts[i].filename.c_str()).isRelative()) { printf("path is relative, we append full path!\n"); - fonts[i].filename = projPathPtr->ascii() + std::string("/")+ fonts[i].filename; + fonts[i].filename = ba.constData() + std::string("/")+ fonts[i].filename; } std::cout << "SOUNDFONT FILENAME + PATH " << fonts[i].filename << std::endl; } @@ -589,7 +590,7 @@ static void* fontLoadThread(void* t) //Strip off the filename QString temp = QString(filename); - QString name = temp.right(temp.length() - temp.findRev('/',-1) - 1); + QString name = temp.right(temp.length() - temp.lastIndexOf('/',-1) - 1); name = name.left(name.length()-4); //Strip off ".sf2" font.name = name.toLatin1().constData(); fptr->stack.push_front(font); diff --git a/muse2/synti/organ/organ.cpp b/muse2/synti/organ/organ.cpp index 0ab7880d..ebbdde95 100644 --- a/muse2/synti/organ/organ.cpp +++ b/muse2/synti/organ/organ.cpp @@ -159,7 +159,7 @@ static inline float table_pos (float* table, unsigned long freq_256, unsigned *a bool Organ::init(const char* name) { gui = new OrganGui; - gui->setCaption(QString(name)); + gui->setWindowTitle(QString(name)); gui->show(); for (int i = 0; i < NUM_CONTROLLER; ++i) @@ -682,7 +682,7 @@ void Organ::setGeometry(int x, int y, int w, int h) // construct a new synthesizer instance //--------------------------------------------------------- -static Mess* instantiate(int sr, QWidget*, QString* projectPathPtr, const char* name) +static Mess* instantiate(int sr, QWidget*, QString* /*projectPathPtr*/, const char* name) { Organ* synth = new Organ(sr); if (synth->init(name)) { diff --git a/muse2/synti/organ/organgui.cpp b/muse2/synti/organ/organgui.cpp index 340c67f6..9b763fd6 100644 --- a/muse2/synti/organ/organgui.cpp +++ b/muse2/synti/organ/organgui.cpp @@ -84,7 +84,7 @@ void OrganGui::ctrlChanged(int idx) QSlider* slider = (QSlider*)(ctrl->editor); val = slider->value(); // By T356. Apply auto-bias center value. - if(slider->minValue() < 0) + if(slider->minimum() < 0) val += 8192; } else if (ctrl->type == SynthGuiCtrl::SWITCH) { @@ -106,8 +106,8 @@ int OrganGui::getControllerMinMax(int id, int* min, int* max) const //int val = 0; if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); - *max = slider->maxValue(); - *min = slider->minValue(); + *max = slider->maximum(); + *min = slider->minimum(); //val = (slider->value() * 16383 + max/2) / max; //val = 16383 + 1/2 @@ -140,12 +140,12 @@ void OrganGui::setParam(int param, int val) ctrl->editor->blockSignals(true); if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); -// int max = slider->maxValue(); +// int max = slider->maximum(); // if(val < 0) val = (val * max + 8191) / 16383 - 1; // else val = (val * max + 8191) / 16383; // By T356. Apply auto-bias center value. - if(slider->minValue() < 0) + if(slider->minimum() < 0) val -= 8192; #ifdef ORGANGUI_DEBUG diff --git a/muse2/synti/vam/vam.cpp b/muse2/synti/vam/vam.cpp index 9d0d6e30..62125789 100644 --- a/muse2/synti/vam/vam.cpp +++ b/muse2/synti/vam/vam.cpp @@ -306,7 +306,7 @@ float *VAM::wave_tbl(int wave) bool VAM::init(const char* name) { gui = new VAMGui; - gui->setCaption(QString(name)); + gui->setWindowTitle(QString(name)); gui->show(); if (useCount == 0) { diff --git a/muse2/synti/vam/vamgui.cpp b/muse2/synti/vam/vamgui.cpp index 10378229..ab7c3ddb 100644 --- a/muse2/synti/vam/vamgui.cpp +++ b/muse2/synti/vam/vamgui.cpp @@ -162,7 +162,7 @@ void Preset::readConfiguration(Xml& xml) void Preset::writeConfiguration(Xml& xml, int level) { //xml.tag(level++, "preset name=\"%s\"", name.ascii()); - xml.tag(level++, "preset name=\"%s\"", Xml::xmlString(name).ascii()); + xml.tag(level++, "preset name=\"%s\"", Xml::xmlString(name).toAscii().constData()); for (int i = 0; i < NUM_CONTROLLER; ++i) { xml.tag(level, "control idx=\"%d\" val=\"%d\" /", i, ctrl[i]); } @@ -265,14 +265,14 @@ void VAMGui::ctrlChanged(int idx) int val = 0; if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); - int max = slider->maxValue(); + int max = slider->maximum(); val = (slider->value() * 16383 + max/2) / max; } else if (ctrl->type == SynthGuiCtrl::COMBOBOX) { - val = ((QComboBox*)(ctrl->editor))->currentItem(); + val = ((QComboBox*)(ctrl->editor))->currentIndex(); } else if (ctrl->type == SynthGuiCtrl::SWITCH) { - val = ((QCheckBox*)(ctrl->editor))->isOn(); + val = ((QCheckBox*)(ctrl->editor))->isChecked(); } sendController(0, idx + CTRL_RPN14_OFFSET, val); } @@ -283,14 +283,14 @@ int VAMGui::getController(int idx) int val = 0; if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); - int max = slider->maxValue(); + int max = slider->maximum(); val = (slider->value() * 16383 + max/2) / max; } else if (ctrl->type == SynthGuiCtrl::COMBOBOX) { - val = ((QComboBox*)(ctrl->editor))->currentItem(); + val = ((QComboBox*)(ctrl->editor))->currentIndex(); } else if (ctrl->type == SynthGuiCtrl::SWITCH) { - val = ((QCheckBox*)(ctrl->editor))->isOn(); + val = ((QCheckBox*)(ctrl->editor))->isChecked(); } return val; } @@ -308,19 +308,19 @@ int VAMGui::getControllerInfo(int id, const char** name, int* controller, //int val = 0; if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); - *max = 16383; //slider->maxValue(); - *min = slider->minValue(); + *max = 16383; //slider->maximum(); + *min = slider->minimum(); //val = (slider->value() * 16383 + max/2) / max; //val = 16383 + 1/2 } else if (ctrl->type == SynthGuiCtrl::COMBOBOX) { - //val = ((QComboBox*)(ctrl->editor))->currentItem(); + //val = ((QComboBox*)(ctrl->editor))->currentIndex(); *min = 0; *max = ((QComboBox*)(ctrl->editor))->count(); } else if (ctrl->type == SynthGuiCtrl::SWITCH) { - //val = ((QCheckBox*)(ctrl->editor))->isOn(); + //val = ((QCheckBox*)(ctrl->editor))->isChecked(); *min=0; *max=1; } @@ -425,14 +425,14 @@ void VAMGui::setPreset(Preset* preset) SynthGuiCtrl* ctrl = &dctrl[i]; if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); - int max = slider->maxValue(); + int max = slider->maximum(); val = (slider->value() * 16383 + max/2) / max; } else if (ctrl->type == SynthGuiCtrl::COMBOBOX) { - val = ((QComboBox*)(ctrl->editor))->currentItem(); + val = ((QComboBox*)(ctrl->editor))->currentIndex(); } else if (ctrl->type == SynthGuiCtrl::SWITCH) { - val = ((QCheckBox*)(ctrl->editor))->isOn(); + val = ((QCheckBox*)(ctrl->editor))->isChecked(); } preset->ctrl[i] = val; @@ -474,7 +474,7 @@ void VAMGui::setParam(int param, int val) ctrl->editor->blockSignals(true); if (ctrl->type == SynthGuiCtrl::SLIDER) { QSlider* slider = (QSlider*)(ctrl->editor); - int max = slider->maxValue(); + int max = slider->maximum(); if(val < 0) val = (val * max + 8191) / 16383 - 1; else val = (val * max + 8191) / 16383; @@ -483,7 +483,7 @@ void VAMGui::setParam(int param, int val) ((QLCDNumber*)(ctrl->label))->display(val); } else if (ctrl->type == SynthGuiCtrl::COMBOBOX) { - ((QComboBox*)(ctrl->editor))->setCurrentItem(val); + ((QComboBox*)(ctrl->editor))->setCurrentIndex(val); } else if (ctrl->type == SynthGuiCtrl::SWITCH) { ((QCheckBox*)(ctrl->editor))->setChecked(val); @@ -565,14 +565,13 @@ void VAMGui::loadPresetsPressed() this, "Load Soundfont dialog", "Choose soundfont");*/ - QString fn = QFileDialog::getOpenFileName(s, "Presets (*.vam)", - this, - "MusE: Load VAM Presets", - "Select a preset"); + QString fn = QFileDialog::getOpenFileName(this, tr("MusE: Load VAM Presets"), + s, "Presets (*.vam)"); + if (fn.isEmpty()) return; bool popenFlag=false; - FILE* f = fopen(fn.ascii(),"r");//fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); + FILE* f = fopen(fn.toAscii().constData(),"r");//fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); if (f == 0) return; presets.clear(); @@ -647,8 +646,8 @@ void VAMGui::doSavePresets(const QString& fn, bool showWarning) printf("empty name\n"); return; } - printf("fn=%s\n",fn.ascii()); - FILE* f = fopen(fn.ascii(),"w");//fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, showWarning); + printf("fn=%s\n",fn.toAscii().constData()); + FILE* f = fopen(fn.toAscii().constData(),"w");//fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, showWarning); if (f == 0) return; Xml xml(f); @@ -676,8 +675,8 @@ void VAMGui::savePresetsPressed() { #if 1 // TODO QString s(getenv("MUSE")); - QString fn = QFileDialog::getSaveFileName(s, "Presets (*.vam)", this, - tr("MusE: Save VAM Presets")); + QString fn = QFileDialog::getSaveFileName(this, tr("MusE: Save VAM Presets"), + s, "Presets (*.vam)"); if (fn.isEmpty()) return; doSavePresets (fn, true); @@ -694,8 +693,8 @@ void VAMGui::savePresetsToFilePressed() if (!presetFileName ) { QString s(getenv("MUSE")); - QString fn = QFileDialog::getSaveFileName(s, "Presets (*.vam)", this, - tr("MusE: Save VAM Presets")); + QString fn = QFileDialog::getSaveFileName(this, tr("MusE: Save VAM Presets"), + s, "Presets (*.vam)"); presetFileName = new QString(fn); } if (*presetFileName == QString("")) |