From 4a1be16bbfafb8455b54336c4465da8f8bfe3ab6 Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Wed, 8 Dec 2010 08:22:29 +0000 Subject: ported many Qt3 methods to Qt4 --- muse2/ChangeLog | 2 ++ muse2/awl/sigedit.cpp | 2 +- muse2/muse/app.h | 2 ++ muse2/muse/arranger/arranger.cpp | 3 +- muse2/muse/driver/alsamidi.cpp | 4 +-- muse2/muse/driver/jackmidi.cpp | 6 ++-- muse2/muse/instruments/editinstrument.cpp | 52 +++++++++++++++--------------- muse2/muse/instruments/minstrument.cpp | 4 +-- muse2/muse/liste/editevent.cpp | 44 ++++++++++++++++--------- muse2/muse/liste/listedit.cpp | 18 +++++------ muse2/muse/marker/markerview.cpp | 6 ++-- muse2/muse/midiedit/drumedit.cpp | 2 +- muse2/muse/midiedit/pianoroll.cpp | 3 +- muse2/muse/mixer/astrip.cpp | 33 +++++++++++++++---- muse2/muse/mixer/strip.cpp | 3 +- muse2/muse/mplugins/midifilterimpl.cpp | 40 +++++++++++------------ muse2/muse/mplugins/midiitransform.cpp | 34 ++++++++++---------- muse2/muse/mplugins/mitplugin.cpp | 20 ++++++++---- muse2/muse/widgets/checkbox.cpp | 3 +- muse2/muse/widgets/comboQuant.cpp | 4 +-- muse2/muse/widgets/combobox.cpp | 3 +- muse2/muse/widgets/comment.cpp | 9 +++--- muse2/muse/widgets/ctrlcombo.cpp | 2 +- muse2/muse/widgets/header.cpp | 9 +++--- muse2/muse/widgets/knob.cpp | 20 ++++++------ muse2/muse/widgets/metronome.cpp | 4 +-- muse2/muse/widgets/pitchedit.cpp | 5 ++- muse2/muse/widgets/pitchlabel.cpp | 3 +- muse2/muse/widgets/slider.cpp | 32 +++++++++---------- muse2/muse/widgets/sliderbase.cpp | 7 ++-- muse2/muse/widgets/splitter.cpp | 9 +++--- muse2/muse/widgets/tempolabel.cpp | 3 +- muse2/muse/widgets/tools.cpp | 2 +- muse2/muse/widgets/ttoolbutton.cpp | 8 ++--- muse2/muse/widgets/view.cpp | 10 +++--- muse2/muse/xml.cpp | 10 +++--- muse2/synti/fluid/fluid.cpp | 2 +- muse2/synti/fluid/fluidgui.cpp | 2 +- muse2/synti/fluidsynth/fluidsynthgui.cpp | 19 +++++------ muse2/synti/fluidsynth/fluidsynti.cpp | 7 ++-- muse2/synti/organ/organ.cpp | 4 +-- muse2/synti/organ/organgui.cpp | 10 +++--- muse2/synti/vam/vam.cpp | 2 +- muse2/synti/vam/vamgui.cpp | 53 +++++++++++++++---------------- 44 files changed, 290 insertions(+), 230 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index d041ec5a..fbe2488a 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,5 @@ +08.12.2010: + - Ported many more Qt3 methods to Qt4. (Orcan) 07.12.2010: - Ported rack. TODO: Drag and drop needs a hand. It's not working. (Orcan) - Converted various Qt3 support methods to Qt4 in many files. (Orcan) diff --git a/muse2/awl/sigedit.cpp b/muse2/awl/sigedit.cpp index 9ddf15c0..3e995a93 100644 --- a/muse2/awl/sigedit.cpp +++ b/muse2/awl/sigedit.cpp @@ -103,7 +103,7 @@ void SigEdit::setValue(const AL::TimeSignature& s) void SigEdit::setValue(const QString& s) { int z = 4, n = 4; - sscanf(s.latin1(), "%d/%d", &z, &n); + sscanf(s.toLatin1().constData(), "%d/%d", &z, &n); AL::TimeSignature sig(z, n); setValue(sig); } diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 3a6189c5..c8348af3 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -286,7 +286,9 @@ class MusE : public QMainWindow void hideMidiInputTransform(); void hideMidiFilterConfig(); void hideMidiRemoteConfig(); +#ifdef BUILD_EXPERIMENTAL void hideMidiRhythmGenerator(); +#endif void globalCut(); void globalInsert(); void globalSplit(); diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index d03eaf92..e54ffba4 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -90,8 +90,9 @@ void Arranger::setHeaderWhatsThis() //--------------------------------------------------------- Arranger::Arranger(QMainWindow* parent, const char* name) - : QWidget(parent, name) + : QWidget(parent) { + setObjectName(name); _raster = 0; // measure selected = 0; // Since program covers 3 controls at once, it is in 'midi controller' units rather than 'gui control' units. diff --git a/muse2/muse/driver/alsamidi.cpp b/muse2/muse/driver/alsamidi.cpp index 4426279b..dd72ac4a 100644 --- a/muse2/muse/driver/alsamidi.cpp +++ b/muse2/muse/driver/alsamidi.cpp @@ -225,7 +225,7 @@ void MidiAlsaDevice::writeRouting(int level, Xml& xml) const s = QT_TR_NOOP("Route"); if(r->channel != -1) s += QString(QT_TR_NOOP(" channel=\"%1\"")).arg(r->channel); - xml.tag(level++, s); + xml.tag(level++, s.toLatin1().constData()); /* //xml.strTag(level, "srcNode", name()); @@ -266,7 +266,7 @@ void MidiAlsaDevice::writeRouting(int level, Xml& xml) const s += QString(QT_TR_NOOP(" type=\"%1\"")).arg(r->type); //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name()); s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name())); - xml.tag(level, s); + xml.tag(level, s.toLatin1().constData()); xml.etag(level--, "Route"); } diff --git a/muse2/muse/driver/jackmidi.cpp b/muse2/muse/driver/jackmidi.cpp index da0f6235..c310462d 100644 --- a/muse2/muse/driver/jackmidi.cpp +++ b/muse2/muse/driver/jackmidi.cpp @@ -713,7 +713,7 @@ void MidiJackDevice::writeRouting(int level, Xml& xml) const //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name()); s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name())); - xml.tag(level, s); + xml.tag(level, s.toLatin1().constData()); //xml.strTag(level, "dstNode", name()); //xml.tag(level, "dest type=\"%d\" name=\"%s\"/", Route::JACK_MIDI_ROUTE, name().toLatin1().constData()); @@ -735,7 +735,7 @@ void MidiJackDevice::writeRouting(int level, Xml& xml) const s += QString(QT_TR_NOOP(" channel=\"%1\"")).arg(r->channel); //xml.tag(level++, "Route"); - xml.tag(level++, s); + xml.tag(level++, s.toLatin1().constData()); /* //xml.strTag(level, "srcNode", name()); @@ -777,7 +777,7 @@ void MidiJackDevice::writeRouting(int level, Xml& xml) const //s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(r->name()); s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name())); - xml.tag(level, s); + xml.tag(level, s.toLatin1().constData()); xml.etag(level--, "Route"); diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index 486acbcc..2fa1f0c9 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -49,7 +49,7 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) Help->addAction(QWhatsThis::createAction(this)); patchpopup = new QMenu(patchButton); - patchpopup->setCheckable(false); + //patchpopup->setCheckable(false);// Qt4 doc says this is unnecessary. // populate instrument list // Populate common controller list. @@ -260,7 +260,7 @@ void EditInstrument::fileSave() // Do not allow a direct overwrite of a 'built-in' muse instrument. QFileInfo qfi(workingInstrument.filePath()); - if(qfi.dirPath(true) == museInstruments) + if(qfi.absolutePath() == museInstruments) { //fileSaveAs(); saveAs(); @@ -317,7 +317,7 @@ bool EditInstrument::fileSave(MidiInstrument* instrument, const QString& name) // } //Xml xml(&f); - FILE* f = fopen(name.ascii(), "w"); + FILE* f = fopen(name.toAscii().constData(), "w"); if(f == 0) { //if(debugMsg) @@ -429,7 +429,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.dirPath(true) != museInstruments) + if(fi.absolutePath() != museInstruments) { //QMessageBox::critical(this, // tr("MusE: Bad instrument name"), @@ -450,8 +450,8 @@ void EditInstrument::saveAs() // path, // tr("Instrument Definition (*.idf)")); - QString s = QFileDialog::getSaveFileName(path, tr("Instrument Definition (*.idf)"), this, - tr("MusE: Save Instrument Definition").toLatin1().constData()); + QString s = QFileDialog::getSaveFileName(this, tr("MusE: Save Instrument Definition").toLatin1().constData(), + path, tr("Instrument Definition (*.idf)")); if (s.isEmpty()) return; //instrument->setFilePath(s); @@ -553,7 +553,7 @@ void EditInstrument::fileSaveAs() { // Allow override of built-in instrument names. QFileInfo fi((*imi)->filePath()); - if(fi.dirPath(true) == museInstruments) + if(fi.absolutePath() == museInstruments) break; found = true; break; @@ -563,8 +563,8 @@ void EditInstrument::fileSaveAs() continue; bool ok; - s = QInputDialog::getText(tr("MusE: Save instrument as"), tr("Enter a new unique instrument name:"), - QLineEdit::Normal, s, &ok, this); + s = QInputDialog::getText(this, tr("MusE: Save instrument as"), tr("Enter a new unique instrument name:"), + QLineEdit::Normal, s, &ok); if(!ok) return; if(s.isEmpty()) @@ -587,7 +587,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.dirPath(true) == museUserInstruments) + if(fi.absolutePath() == museUserInstruments) { // No choice really but to overwrite the destination instrument file! // Can not have two user files containing the same instrument name. @@ -716,8 +716,8 @@ void EditInstrument::fileSaveAs() sfn = path; else { - sfn = QFileDialog::getSaveFileName(path, tr("Instrument Definition (*.idf)"), this, - tr("MusE: Save Instrument Definition").toLatin1().constData()); + sfn = QFileDialog::getSaveFileName(this, tr("MusE: Save Instrument Definition").toLatin1().constData(), + path, tr("Instrument Definition (*.idf)")); if (sfn.isEmpty()) return; //instrument->setFilePath(s); @@ -1188,7 +1188,7 @@ void EditInstrument::tabChanged(QWidget* w) return; // If we're switching to the Patches tab, just ignore. - if(QString(w->name()) == QString("patchesTab")) + if(QString(w->objectName()) == QString("patchesTab")) return; if(oldPatchItem) @@ -1203,7 +1203,7 @@ void EditInstrument::tabChanged(QWidget* w) // We're still on the same item. No need to set oldPatchItem as in patchChanged... // If we're switching to the Controller tab, update the default patch button text in case a patch changed... - if(QString(w->name()) == QString("controllerTab")) + if(QString(w->objectName()) == QString("controllerTab")) { QTreeWidgetItem* sel = viewController->currentItem(); @@ -1443,7 +1443,7 @@ void EditInstrument::patchButtonClicked() for (ciPatchGroup i = pg->begin(); i != pg->end(); ++i) { PatchGroup* pgp = *i; QMenu* pm = new QMenu(pgp->name); - pm->setCheckable(false); + //pm->setCheckable(false);//Qt4 doc says this is unnecessary pm->setFont(config.fonts[0]); const PatchList& pl = pgp->patches; for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { @@ -1477,7 +1477,7 @@ void EditInstrument::patchButtonClicked() } } - if(patchpopup->count() == 0) + if(patchpopup->actions().count() == 0) return; QAction* act = patchpopup->exec(patchButton->mapToGlobal(QPoint(10,5))); @@ -1646,7 +1646,7 @@ void EditInstrument::controllerChanged() //ctrlType->setCurrentIndex(type); ctrlType->blockSignals(true); - ctrlType->setCurrentItem(type); + ctrlType->setCurrentIndex(type); ctrlType->blockSignals(false); //ctrlTypeChanged(type); @@ -1750,7 +1750,7 @@ void EditInstrument::controllerChanged() spinBoxDefault->setRange(c->minVal() - 1, c->maxVal()); if(c->initVal() == CTRL_VAL_UNKNOWN) //spinBoxDefault->setValue(c->minVal() - 1); - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); else spinBoxDefault->setValue(c->initVal()); } @@ -1854,7 +1854,7 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxMax->setValue(127); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); lnum = spinBoxLCtrlNo->value(); //rng = 127; //min = -128; @@ -1885,7 +1885,7 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxMin->setValue(0); spinBoxMax->setValue(127); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); hnum = spinBoxHCtrlNo->value(); lnum = spinBoxLCtrlNo->value(); @@ -1920,7 +1920,7 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxMin->setValue(0); spinBoxMax->setValue(16383); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); hnum = spinBoxHCtrlNo->value(); lnum = spinBoxLCtrlNo->value(); @@ -1953,7 +1953,7 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxMin->setValue(-8192); spinBoxMax->setValue(8191); spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); //rng = 8191; //min = -8192; @@ -2024,7 +2024,7 @@ void EditInstrument::ctrlTypeChanged(int idx) { c->setMinVal(spinBoxMin->value()); c->setMaxVal(spinBoxMax->value()); - if(spinBoxDefault->value() == spinBoxDefault->minValue()) + if(spinBoxDefault->value() == spinBoxDefault->minimum()) c->setInitVal(CTRL_VAL_UNKNOWN); else c->setInitVal(spinBoxDefault->value()); @@ -2081,7 +2081,7 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); int inval = c->initVal(); if(inval == CTRL_VAL_UNKNOWN) - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); else { if(inval < c->minVal()) @@ -2217,7 +2217,7 @@ void EditInstrument::ctrlMinChanged(int val) int inval = c->initVal(); if(inval == CTRL_VAL_UNKNOWN) - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); else { if(inval < c->minVal()) @@ -2303,7 +2303,7 @@ void EditInstrument::ctrlMaxChanged(int val) int inval = c->initVal(); if(inval == CTRL_VAL_UNKNOWN) - spinBoxDefault->setValue(spinBoxDefault->minValue()); + spinBoxDefault->setValue(spinBoxDefault->minimum()); else { if(inval < c->minVal()) diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index b784f2be..a1544d64 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -184,7 +184,7 @@ static void loadIDF(QFileInfo* fi) qf.close(); */ - FILE* f = fopen(fi->filePath().ascii(), "r"); + FILE* f = fopen(fi->filePath().toAscii().constData(), "r"); if (f == 0) return; if (debugMsg) @@ -270,7 +270,7 @@ void initMidiInstruments() QDir instrumentsDir(museInstruments, QString("*.idf")); if (instrumentsDir.exists()) { QFileInfoList list = instrumentsDir.entryInfoList(); - QFileInfoListIterator it=list.begin(); // ddskrjo + QFileInfoList::iterator it=list.begin(); // ddskrjo while(it!=list.end()) { loadIDF(&*it); ++it; diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp index 9eff979b..9921c2cd 100644 --- a/muse2/muse/liste/editevent.cpp +++ b/muse2/muse/liste/editevent.cpp @@ -269,7 +269,7 @@ Event EditSysexDialog::event() void EditSysexDialog::accept() { - QString qsrc = edit->text(); + QString qsrc = edit->toPlainText(); QByteArray ba = qsrc.toLatin1(); const char* src = ba.constData(); @@ -332,9 +332,11 @@ EditMetaDialog::EditMetaDialog(int tick, const Event& ev, //layout1->addWidget(il2, 1, 1, AlignLeft); layout1->addLayout(typeLayout, 1, 1); - - layout1->addMultiCellWidget(hexButton, 2, 2, 0, 1); - layout1->addMultiCellWidget(edit, 3, 3, 0, 1); + + //layout1->addMultiCellWidget(hexButton, 2, 2, 0, 1); + //layout1->addMultiCellWidget(edit, 3, 3, 0, 1); + layout1->addWidget(hexButton, 2, 0, 1, 2); + layout1->addWidget(edit, 3, 0, 1, 2); } //--------------------------------------------------------- @@ -352,7 +354,7 @@ void EditMetaDialog::typeChanged(int val) void EditMetaDialog::toggled(bool flag) { - QString qsrc = edit->text(); + QString qsrc = edit->toPlainText(); QByteArray ba = qsrc.toLatin1(); const char* src = ba.constData(); edit->clear(); @@ -397,7 +399,7 @@ Event EditMetaDialog::event() void EditMetaDialog::accept() { - QString qsrc = edit->text(); + QString qsrc = edit->toPlainText(); QByteArray ba = qsrc.toLatin1(); const char* src = ba.constData(); if (!hexButton->isChecked()) { @@ -420,7 +422,7 @@ EditCAfterDialog::EditCAfterDialog(int tick, const Event& event, QWidget* parent) : EditEventDialog(parent) { - setCaption(tr("MusE: Enter Channel Aftertouch")); + setWindowTitle(tr("MusE: Enter Channel Aftertouch")); QLabel* l1 = new QLabel(tr("Time Position")); ///epos = new PosEdit; @@ -431,7 +433,12 @@ EditCAfterDialog::EditCAfterDialog(int tick, const Event& event, il2->setFrame(true); il2->setDark(); - QSlider* slider = new QSlider(0, 127, 1, 0, Qt::Horizontal); + QSlider* slider = new QSlider(Qt::Horizontal); + slider->setMinimum(0); + slider->setMaximum(127); + slider->setPageStep(1); + slider->setValue(0); + connect(slider, SIGNAL(valueChanged(int)), il2, SLOT(setValue(int))); connect(il2, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))); @@ -450,7 +457,8 @@ EditCAfterDialog::EditCAfterDialog(int tick, const Event& event, layout1->addWidget(epos, 0, 1, Qt::AlignLeft); layout1->addWidget(l2, 1, 0); layout1->addWidget(il2, 1, 1, Qt::AlignLeft); - layout1->addMultiCellWidget(slider, 2, 2, 0, 1); + //layout1->addMultiCellWidget(slider, 2, 2, 0, 1); + layout1->addWidget(slider, 2, 0, 1, 2); } //--------------------------------------------------------- @@ -473,7 +481,7 @@ EditPAfterDialog::EditPAfterDialog(int tick, const Event& event, QWidget* parent) : EditEventDialog(parent) { - setCaption(tr("MusE: Enter Poly Aftertouch")); + setWindowTitle(tr("MusE: Enter Poly Aftertouch")); QLabel* l1 = new QLabel(tr("Time Position")); ///epos = new PosEdit; @@ -486,7 +494,12 @@ EditPAfterDialog::EditPAfterDialog(int tick, const Event& event, il2->setFrame(true); il2->setDark(); - QSlider* slider = new QSlider(0, 127, 1, 0, Qt::Horizontal); + QSlider* slider = new QSlider(Qt::Horizontal); + slider->setMinimum(0); + slider->setMaximum(127); + slider->setPageStep(1); + slider->setValue(0); + connect(slider, SIGNAL(valueChanged(int)), il2, SLOT(setValue(int))); connect(il2, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int))); @@ -509,7 +522,8 @@ EditPAfterDialog::EditPAfterDialog(int tick, const Event& event, layout1->addWidget(pl, 1, 1, Qt::AlignLeft); layout1->addWidget(l3, 2, 0); layout1->addWidget(il2, 2, 1, Qt::AlignLeft); - layout1->addMultiCellWidget(slider, 3, 3, 0, 1); + //layout1->addMultiCellWidget(slider, 3, 3, 0, 1); + layout1->addWidget(slider, 3, 0, 1, 2); } //--------------------------------------------------------- @@ -580,7 +594,7 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, } pop = new QMenu(this); - pop->setCheckable(false); + //pop->setCheckable(false);//not necessary in Qt4 MidiTrack* track = part->track(); int portn = track->outPort(); @@ -664,7 +678,7 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, void EditCtrlDialog::newController() { QMenu* pop = new QMenu(this); - pop->setCheckable(this); + //pop->setCheckable(this);//not necessary in Qt4 // // populate popup with all controllers available for // current instrument @@ -829,7 +843,7 @@ void EditCtrlDialog::instrPopup() MidiInstrument* instr = midiPorts[port].instrument(); instr->populatePatchPopup(pop, channel, song->mtype(), track->type() == Track::DRUM); - if(pop->count() == 0) + if(pop->actions().count() == 0) return; QAction* rv = new QAction(pop->exec(patchName->mapToGlobal(QPoint(10,5)))); if (rv) { diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index 90169fbf..7df2c8bf 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -180,7 +180,7 @@ void ListEdit::songChanged(int type) genPartlist(); // close window if editor has no parts anymore if (parts()->empty()) { - close(false); + close(); return; } liste->setSortingEnabled(false); @@ -440,7 +440,7 @@ ListEdit::ListEdit(PartList* pl) ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo())); ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo())); - menuEdit->insertSeparator(); + menuEdit->addSeparator(); #if 0 QAction *cutAction = menuEdit->addAction(QIcon(*editcutIconSet), tr("Cut")); connect(cutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); @@ -460,7 +460,7 @@ ListEdit::ListEdit(PartList* pl) connect(deleteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(deleteAction, CMD_DELETE); deleteAction->setShortcut(Qt::Key_Delete); - menuEdit->insertSeparator(); + menuEdit->addSeparator(); menuEdit->addActions(insertItems->actions()); @@ -906,12 +906,12 @@ void ListEdit::configChanged() void ListEdit::initShortcuts() { - insertNote->setAccel(shortcuts[SHRT_LE_INS_NOTES].key); - insertSysEx->setAccel(shortcuts[SHRT_LE_INS_SYSEX].key); - insertCtrl->setAccel(shortcuts[SHRT_LE_INS_CTRL].key); - insertMeta->setAccel(shortcuts[SHRT_LE_INS_META].key); - insertCAfter->setAccel(shortcuts[SHRT_LE_INS_CHAN_AFTERTOUCH].key); - insertPAfter->setAccel(shortcuts[SHRT_LE_INS_POLY_AFTERTOUCH].key); + insertNote->setShortcut(shortcuts[SHRT_LE_INS_NOTES].key); + insertSysEx->setShortcut(shortcuts[SHRT_LE_INS_SYSEX].key); + insertCtrl->setShortcut(shortcuts[SHRT_LE_INS_CTRL].key); + insertMeta->setShortcut(shortcuts[SHRT_LE_INS_META].key); + insertCAfter->setShortcut(shortcuts[SHRT_LE_INS_CHAN_AFTERTOUCH].key); + insertPAfter->setShortcut(shortcuts[SHRT_LE_INS_POLY_AFTERTOUCH].key); } //--------------------------------------------------------- diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp index 873a22d1..ab976911 100644 --- a/muse2/muse/marker/markerview.cpp +++ b/muse2/muse/marker/markerview.cpp @@ -151,7 +151,7 @@ MarkerView::MarkerView(QWidget* parent) { //setAttribute(Qt::WA_DeleteOnClose); - setCaption(tr("MusE: Marker")); + setWindowTitle(tr("MusE: Marker")); QAction* markerAdd = new QAction(QIcon(*flagIcon), tr("add marker"), this); connect(markerAdd, SIGNAL(activated()), SLOT(addMarker())); @@ -460,7 +460,7 @@ void MarkerView::markerSelectionChanged() editTick->setValue(0); editSMPTE->setValue(0); editName->setText(QString("")); - lock->setOn(false); + lock->setChecked(false); editSMPTE->setEnabled(false); editTick->setEnabled(false); lock->setEnabled(false); @@ -471,7 +471,7 @@ void MarkerView::markerSelectionChanged() editSMPTE->setValue(item->tick()); editName->setText(item->name()); editName->setEnabled(true); - lock->setOn(item->lock()); + lock->setChecked(item->lock()); lock->setEnabled(true); //printf("MarkerView::markerSelectionChanged item->lock:%d\n", item->lock()); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 3c9e4ecd..b2a2702c 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -415,7 +415,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(canvas, SIGNAL(followEvent(int)), SLOT(follow(int))); connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); - setCaption(canvas->getCaption()); + setWindowTitle(canvas->getCaption()); updateHScrollRange(); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 3d387b95..cd1628ac 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -342,7 +342,8 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i //mainGrid->addRowSpacing(1, hscroll->sizeHint().height()); mainGrid->addItem(new QSpacerItem(0, hscroll->sizeHint().height()), 1, 0); - QWidget* split1 = new QWidget(splitter, "split1"); + QWidget* split1 = new QWidget(splitter); + split1->setObjectName("split1"); QGridLayout* gridS1 = new QGridLayout(split1); gridS1->setContentsMargins(0, 0, 0, 0); gridS1->setSpacing(0); diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index 1c206712..1317f63d 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -239,9 +239,19 @@ void AudioStrip::songChanged(int val) autoType->blockSignals(true); autoType->setCurrentItem(track->automationType()); if(track->automationType() == AUTO_TOUCH || track->automationType() == AUTO_WRITE) - autoType->setPaletteBackgroundColor(Qt::red); + { + //autoType->setPaletteBackgroundColor(Qt::red); + QPalette palette; + palette.setColor(autoType->backgroundRole(), QColor(Qt::red)); + autoType->setPalette(palette); + } else - autoType->setPaletteBackgroundColor(qApp->palette().active().background()); + { + //autoType->setPaletteBackgroundColor(qApp->palette().active().background()); + QPalette palette; + palette.setColor(autoType->backgroundRole(), qApp->palette().color(QPalette::Active, QPalette::Background)); + autoType->setPalette(palette); + } autoType->blockSignals(false); } @@ -945,12 +955,21 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //autoType->setCurrentIndex(t->automationType()); if(t->automationType() == AUTO_TOUCH || t->automationType() == AUTO_WRITE) - // FIXME: - autoType->setPaletteBackgroundColor(Qt::red); + { + // FIXME: + //autoType->setPaletteBackgroundColor(Qt::red); + QPalette palette; + palette.setColor(autoType->backgroundRole(), QColor(Qt::red)); + autoType->setPalette(palette); + } else - // FIXME: - autoType->setPaletteBackgroundColor(qApp->palette().active().background()); - + { + // FIXME: + //autoType->setPaletteBackgroundColor(qApp->palette().active().background()); + QPalette palette; + palette.setColor(autoType->backgroundRole(), qApp->palette().color(QPalette::Active, QPalette::Background)); + autoType->setPalette(palette); + } autoType->setToolTip(tr("automation type")); connect(autoType, SIGNAL(activated(int,int)), SLOT(setAutomationType(int,int))); grid->addWidget(autoType, _curGridRow++, 0, 1, 2); diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp index ec092482..30515129 100644 --- a/muse2/muse/mixer/strip.cpp +++ b/muse2/muse/mixer/strip.cpp @@ -218,7 +218,8 @@ Strip::Strip(QWidget* parent, Track* t) // MusE-2 Tested: TextWrapAnywhere actually works, but in fact it takes precedence // over word wrap, so I found it is not really desirable. Maybe with a user setting... //label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere); - label->setAlignment(Qt::AlignCenter | Qt::TextWordWrap); + // changed by Orcan: We can't use Qt::TextWordWrap in alignment in Qt4. + label->setAlignment(Qt::AlignCenter); label->setWordWrap(true); label->setAutoFillBackground(true); label->setLineWidth(2); diff --git a/muse2/muse/mplugins/midifilterimpl.cpp b/muse2/muse/mplugins/midifilterimpl.cpp index 2c678968..196ce97c 100644 --- a/muse2/muse/mplugins/midifilterimpl.cpp +++ b/muse2/muse/mplugins/midifilterimpl.cpp @@ -42,10 +42,10 @@ MidiFilterConfig::MidiFilterConfig(QDialog* parent) : QDialog(parent) { setupUi(this); - cb1->setCurrentItem(midiFilterCtrl1); - cb2->setCurrentItem(midiFilterCtrl2); - cb3->setCurrentItem(midiFilterCtrl3); - cb4->setCurrentItem(midiFilterCtrl4); + cb1->setCurrentIndex(midiFilterCtrl1); + cb2->setCurrentIndex(midiFilterCtrl2); + cb3->setCurrentIndex(midiFilterCtrl3); + cb4->setCurrentIndex(midiFilterCtrl4); rf1->setChecked(midiRecordType & 1); rf2->setChecked(midiRecordType & 2); @@ -77,22 +77,22 @@ MidiFilterConfig::MidiFilterConfig(QDialog* parent) connect(tf6, SIGNAL(toggled(bool)), SLOT(thruChanged6(bool))); connect(tf7, SIGNAL(toggled(bool)), SLOT(thruChanged7(bool))); - cf1->setOn(midiInputChannel & 1); - cf2->setOn(midiInputChannel & 2); - cf3->setOn(midiInputChannel & 4); - cf4->setOn(midiInputChannel & 8); - cf5->setOn(midiInputChannel & 0x10); - cf6->setOn(midiInputChannel & 0x20); - cf7->setOn(midiInputChannel & 0x40); - cf8->setOn(midiInputChannel & 0x80); - cf9->setOn(midiInputChannel & 0x100); - cf10->setOn(midiInputChannel & 0x200); - cf11->setOn(midiInputChannel & 0x400); - cf12->setOn(midiInputChannel & 0x800); - cf13->setOn(midiInputChannel & 0x1000); - cf14->setOn(midiInputChannel & 0x2000); - cf15->setOn(midiInputChannel & 0x4000); - cf16->setOn(midiInputChannel & 0x8000); + cf1->setChecked(midiInputChannel & 1); + cf2->setChecked(midiInputChannel & 2); + cf3->setChecked(midiInputChannel & 4); + cf4->setChecked(midiInputChannel & 8); + cf5->setChecked(midiInputChannel & 0x10); + cf6->setChecked(midiInputChannel & 0x20); + cf7->setChecked(midiInputChannel & 0x40); + cf8->setChecked(midiInputChannel & 0x80); + cf9->setChecked(midiInputChannel & 0x100); + cf10->setChecked(midiInputChannel & 0x200); + cf11->setChecked(midiInputChannel & 0x400); + cf12->setChecked(midiInputChannel & 0x800); + cf13->setChecked(midiInputChannel & 0x1000); + cf14->setChecked(midiInputChannel & 0x2000); + cf15->setChecked(midiInputChannel & 0x4000); + cf16->setChecked(midiInputChannel & 0x8000); connect(cb1, SIGNAL(activated(int)), SLOT(setCtrl1(int))); connect(cb2, SIGNAL(activated(int)), SLOT(setCtrl2(int))); diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index 386620b1..6ab584d3 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -611,7 +611,7 @@ MidiInputTransformDialog::MidiInputTransformDialog(QDialog* parent, Qt::WFlags f modulGroup->addButton(modul4select,3); for (unsigned i = 0; i < sizeof(oplist)/sizeof(*oplist); ++i) - funcOp->insertItem(oplist[i].text, i); + funcOp->insertItem(i, oplist[i].text); connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew())); connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete())); @@ -692,7 +692,7 @@ void MidiInputTransformDialog::updatePresetList() cmt = 0; presetList->clear(); - modul1select->setOn(true); + modul1select->setChecked(true); for (iMidiInputTransformation i = mtlist.begin(); i != mtlist.end(); ++i) { presetList->addItem((*i)->name); if (cmt == 0) @@ -967,7 +967,7 @@ void MidiInputTransformDialog::accept() void MidiInputTransformDialog::reject() { - close(false); + close(); } //--------------------------------------------------------- @@ -1246,7 +1246,7 @@ void MidiInputTransformDialog::nameChanged(const QString& s) void MidiInputTransformDialog::commentChanged() { - cmt->comment = commentEntry->text(); + cmt->comment = commentEntry->toPlainText(); } //--------------------------------------------------------- @@ -1631,33 +1631,33 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) nameEntry->setText(cmt->name); commentEntry->setText(cmt->comment); - selEventOp->setCurrentItem(cmt->selEventOp); + selEventOp->setCurrentIndex(cmt->selEventOp); selEventOpSel(cmt->selEventOp); for (unsigned i = 0; i < sizeof(selTypeTable)/sizeof(*selTypeTable); ++i) { if (selTypeTable[i] == cmt->selType) { - selType->setCurrentItem(i); + selType->setCurrentIndex(i); break; } } - selVal1Op->setCurrentItem(cmt->selVal1); + selVal1Op->setCurrentIndex(cmt->selVal1); selVal1OpSel(cmt->selVal1); - selVal2Op->setCurrentItem(cmt->selVal2); + selVal2Op->setCurrentIndex(cmt->selVal2); selVal2OpSel(cmt->selVal2); - selPortOp->setCurrentItem(cmt->selPort); + selPortOp->setCurrentIndex(cmt->selPort); selPortOpSel(cmt->selPort); - selChannelOp->setCurrentItem(cmt->selChannel); + selChannelOp->setCurrentIndex(cmt->selChannel); selChannelOpSel(cmt->selChannel); { unsigned i; for (i = 0; i < sizeof(oplist)/sizeof(*oplist); ++i) { if (oplist[i].id == cmt->funcOp) { - funcOp->setCurrentItem(i); + funcOp->setCurrentIndex(i); break; } } @@ -1668,20 +1668,20 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) for (unsigned i = 0; i < sizeof(procTypeTable)/sizeof(*procTypeTable); ++i) { if (procTypeTable[i] == cmt->eventType) { - procType->setCurrentItem(i); + procType->setCurrentIndex(i); break; } } - procEventOp->setCurrentItem(cmt->procEvent); + procEventOp->setCurrentIndex(cmt->procEvent); procEventOpSel(cmt->procEvent); - procVal1Op->setCurrentItem(cmt->procVal1); + procVal1Op->setCurrentIndex(cmt->procVal1); procVal1OpSel(cmt->procVal1); for (unsigned i = 0; i < sizeof(procVal2Map)/sizeof(*procVal2Map); ++i) { if (procVal2Map[i] == cmt->procVal2) { - procVal2Op->setCurrentItem(i); + procVal2Op->setCurrentIndex(i); break; } } @@ -1712,10 +1712,10 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) procChannelVala->setValue(cmt->procChannela); procChannelValb->setValue(cmt->procChannelb); - procPortOp->setCurrentItem(cmt->procPort); + procPortOp->setCurrentIndex(cmt->procPort); procPortOpSel(cmt->procPort); - procChannelOp->setCurrentItem(cmt->procChannel); + procChannelOp->setCurrentIndex(cmt->procChannel); procChannelOpSel(cmt->procChannel); } diff --git a/muse2/muse/mplugins/mitplugin.cpp b/muse2/muse/mplugins/mitplugin.cpp index d5ea7c7f..e1a4e656 100644 --- a/muse2/muse/mplugins/mitplugin.cpp +++ b/muse2/muse/mplugins/mitplugin.cpp @@ -30,6 +30,7 @@ void MusE::startMidiInputPlugin(int id) { bool flag = false; QWidget* w = 0; + QAction* act; if (id == 0) { if (!mitPluginTranspose) { mitPluginTranspose = new MITPluginTranspose(); @@ -38,6 +39,7 @@ void MusE::startMidiInputPlugin(int id) SLOT(hideMitPluginTranspose())); } w = mitPluginTranspose; + act = midiTrpAction; } else if (id == 1) { if (!midiInputTransform) { @@ -46,6 +48,7 @@ void MusE::startMidiInputPlugin(int id) SLOT(hideMidiInputTransform())); } w = midiInputTransform; + act = midiInputTrfAction; } else if (id == 2) { if (!midiFilterConfig) { @@ -54,6 +57,7 @@ void MusE::startMidiInputPlugin(int id) SLOT(hideMidiFilterConfig())); } w = midiFilterConfig; + act = midiInputFilterAction; } else if (id == 3) { if (!midiRemoteConfig) { @@ -62,6 +66,7 @@ void MusE::startMidiInputPlugin(int id) SLOT(hideMidiRemoteConfig())); } w = midiRemoteConfig; + act = midiRemoteAction; } #ifdef BUILD_EXPERIMENTAL else if (id == 4) { @@ -71,6 +76,7 @@ void MusE::startMidiInputPlugin(int id) SLOT(hideMidiRhythmGenerator())); } w = midiRhythmGenerator; + act = midiRhythmAction; } #endif if (w) { @@ -80,29 +86,31 @@ void MusE::startMidiInputPlugin(int id) else w->hide(); } - midiInputPlugins->setItemChecked(id, flag); + act->setChecked(flag); } void MusE::hideMitPluginTranspose() { - midiInputPlugins->setItemChecked(0, false); + midiTrpAction->setChecked(false); } void MusE::hideMidiInputTransform() { - midiInputPlugins->setItemChecked(1, false); + midiInputTrfAction->setChecked(false); } void MusE::hideMidiFilterConfig() { - midiInputPlugins->setItemChecked(2, false); + midiInputFilterAction->setChecked(false); } void MusE::hideMidiRemoteConfig() { - midiInputPlugins->setItemChecked(3, false); + midiRemoteAction->setChecked(false); } +#ifdef BUILD_EXPERIMENTAL void MusE::hideMidiRhythmGenerator() { - midiInputPlugins->setItemChecked(4, false); + midiRhythmAction->setChecked(false); } +#endif //--------------------------------------------------------- // processMidiInputTransformPlugins diff --git a/muse2/muse/widgets/checkbox.cpp b/muse2/muse/widgets/checkbox.cpp index 3cded268..c680314e 100644 --- a/muse2/muse/widgets/checkbox.cpp +++ b/muse2/muse/widgets/checkbox.cpp @@ -14,8 +14,9 @@ //--------------------------------------------------------- CheckBox::CheckBox(QWidget* parent, int i, const char* name) - : QCheckBox(parent, name) + : QCheckBox(parent) { + setObjectName(name); _id = i; connect(this, SIGNAL(toggled(bool)), SLOT(hasToggled(bool))); } diff --git a/muse2/muse/widgets/comboQuant.cpp b/muse2/muse/widgets/comboQuant.cpp index 3eb4e9e0..96ef51ff 100644 --- a/muse2/muse/widgets/comboQuant.cpp +++ b/muse2/muse/widgets/comboQuant.cpp @@ -63,7 +63,7 @@ ComboQuant::ComboQuant(QWidget* parent) // activated //--------------------------------------------------------- -void ComboQuant::activated(int index) +void ComboQuant::activated(int /*index*/) { ///emit valueChanged(quantTable[index]); emit valueChanged(quantTable[qlist->currentRow() + qlist->currentColumn() * 8]); @@ -77,7 +77,7 @@ void ComboQuant::setValue(int val) { for (int i = 0; i < 24; i++) { if (val == quantTable[i]) { - setCurrentItem(i); + setCurrentIndex(i); return; } } diff --git a/muse2/muse/widgets/combobox.cpp b/muse2/muse/widgets/combobox.cpp index 3104181a..4d8ba519 100644 --- a/muse2/muse/widgets/combobox.cpp +++ b/muse2/muse/widgets/combobox.cpp @@ -18,8 +18,9 @@ //--------------------------------------------------------- ComboBox::ComboBox(QWidget* parent, const char* name) - : QLabel(parent, name) + : QLabel(parent) { + setObjectName(name); _currentItem = 0; _id = -1; list = new QMenu(0); diff --git a/muse2/muse/widgets/comment.cpp b/muse2/muse/widgets/comment.cpp index 46747d0e..36298330 100644 --- a/muse2/muse/widgets/comment.cpp +++ b/muse2/muse/widgets/comment.cpp @@ -27,7 +27,7 @@ Comment::Comment(QWidget* parent) void Comment::textChanged() { - setText(textentry->text()); + setText(textentry->toPlainText()); } //--------------------------------------------------------- @@ -37,7 +37,8 @@ void Comment::textChanged() TrackComment::TrackComment(Track* t, QWidget* parent) : Comment(parent) { - setCaption(tr("MusE: Track Comment")); + setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("MusE: Track Comment")); track = t; connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); textentry->setText(track->comment()); @@ -64,11 +65,11 @@ void TrackComment::songChanged(int flags) break; } if (it == tl->end()) { - close(true); + close(); return; } label2->setText(track->name()); - if (track->comment() != textentry->text()) { + if (track->comment() != textentry->toPlainText()) { disconnect(textentry, SIGNAL(textChanged()), this, SLOT(textChanged())); textentry->setText(track->comment()); textentry->moveCursor(QTextCursor::End); diff --git a/muse2/muse/widgets/ctrlcombo.cpp b/muse2/muse/widgets/ctrlcombo.cpp index 93fdf3a9..911357ee 100644 --- a/muse2/muse/widgets/ctrlcombo.cpp +++ b/muse2/muse/widgets/ctrlcombo.cpp @@ -51,6 +51,6 @@ CtrlComboBox::CtrlComboBox(QWidget* parent) "PolyModeOn" }; for (unsigned int i = 0; i < sizeof(ctxt)/sizeof(*ctxt); ++i) - insertItem(QString(ctxt[i])); + insertItem(i, QString(ctxt[i])); } diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 9b209517..75bd2933 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -26,7 +26,8 @@ void Header::readStatus(Xml& xml) return; case Xml::Text: { - QStringList l = QStringList::split(QString(" "), tag); + //QStringList l = QStringList::split(QString(" "), tag); + QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); int index = count(); for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { int section = (*it).toInt(); @@ -39,7 +40,7 @@ void Header::readStatus(Xml& xml) xml.unknown("Header"); break; case Xml::TagEnd: - if (tag == name()) + if (tag ==objectName()) return; default: break; @@ -54,12 +55,12 @@ void Header::readStatus(Xml& xml) void Header::writeStatus(int level, Xml& xml) const { //xml.nput(level, "<%s> ", name()); - xml.nput(level, "<%s> ", Xml::xmlString(name()).toLatin1().constData()); + xml.nput(level, "<%s> ", Xml::xmlString(objectName()).toLatin1().constData()); int n = count() - 1; for (int i = n; i >= 0; --i) xml.nput("%d ", visualIndex(i)); //xml.put("", name()); - xml.put("", Xml::xmlString(name()).toLatin1().constData()); + xml.put("", Xml::xmlString(objectName()).toLatin1().constData()); } //--------------------------------------------------------- diff --git a/muse2/muse/widgets/knob.cpp b/muse2/muse/widgets/knob.cpp index 2f462835..8257ff88 100644 --- a/muse2/muse/widgets/knob.cpp +++ b/muse2/muse/widgets/knob.cpp @@ -122,11 +122,11 @@ void Knob::drawKnob(QPainter* p, const QRect& r) pn.setWidth(d_borderWidth); - pn.setColor(pal.light()); + pn.setColor(pal.color(QPalette::Light)); p->setPen(pn); p->drawArc(aRect, 45*16,180*16); - pn.setColor(pal.dark()); + pn.setColor(pal.color(QPalette::Dark)); p->setPen(pn); p->drawArc(aRect, 225*16,180*16); @@ -154,7 +154,7 @@ void Knob::valueChange() { recalcAngle(); d_newVal++; - repaint(kRect, FALSE); + repaint(kRect); SliderBase::valueChange(); } @@ -265,7 +265,7 @@ void Knob::rangeChange() } recalcAngle(); resize(size()); - repaint(FALSE); + repaint(); } //--------------------------------------------------------- @@ -415,7 +415,7 @@ void Knob::setKnobWidth(int w) { d_knobWidth = qwtMax(w,5); resize(size()); - repaint(FALSE); + repaint(); } //------------------------------------------------------------ @@ -434,7 +434,7 @@ void Knob::setBorderWidth(int bw) { d_borderWidth = qwtMax(bw, 0); resize(size()); - repaint(FALSE); + repaint(); } //------------------------------------------------------------ @@ -478,7 +478,7 @@ void Knob::setFaceColor(const QColor c) d_faceColor = c; if(!_faceColSel) //update(FALSE); - repaint(FALSE); + repaint(); } //------------------------------------------------------------ @@ -489,7 +489,7 @@ void Knob::setAltFaceColor(const QColor c) d_altFaceColor = c; if(_faceColSel) //update(FALSE); - repaint(FALSE); + repaint(); } //------------------------------------------------------------ @@ -503,7 +503,7 @@ void Knob::selectFaceColor(bool alt) else d_curFaceColor = d_faceColor; //update(FALSE); - repaint(FALSE); + repaint(); } //------------------------------------------------------------ @@ -513,6 +513,6 @@ void Knob::setMarkerColor(const QColor c) { d_markerColor = c; //update(FALSE); - repaint(FALSE); + repaint(); } diff --git a/muse2/muse/widgets/metronome.cpp b/muse2/muse/widgets/metronome.cpp index 0a333b59..9f56f45e 100644 --- a/muse2/muse/widgets/metronome.cpp +++ b/muse2/muse/widgets/metronome.cpp @@ -158,7 +158,7 @@ void MetronomeConfig::midiClickChanged(bool flag) midiPort->setEnabled(flag); } -void MetronomeConfig::precountEnableChanged(bool flag) +void MetronomeConfig::precountEnableChanged(bool /*flag*/) { /* precountBars->setEnabled(flag); @@ -168,7 +168,7 @@ void MetronomeConfig::precountEnableChanged(bool flag) */ } -void MetronomeConfig::precountFromMastertrackChanged(bool flag) +void MetronomeConfig::precountFromMastertrackChanged(bool /*flag*/) { /* precountSigZ->setEnabled(!flag); diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp index 510c993c..563cd6a8 100644 --- a/muse2/muse/widgets/pitchedit.cpp +++ b/muse2/muse/widgets/pitchedit.cpp @@ -14,8 +14,11 @@ //--------------------------------------------------------- PitchEdit::PitchEdit(QWidget* parent) - : QSpinBox(0, 127, 1, parent) + : QSpinBox(parent) { + setMinimum(0); + setMaximum(127); + setSingleStep(1); deltaMode = false; } diff --git a/muse2/muse/widgets/pitchlabel.cpp b/muse2/muse/widgets/pitchlabel.cpp index 50b63410..dc5c35ee 100644 --- a/muse2/muse/widgets/pitchlabel.cpp +++ b/muse2/muse/widgets/pitchlabel.cpp @@ -18,8 +18,9 @@ //--------------------------------------------------------- PitchLabel::PitchLabel(QWidget* parent, const char* name) - : QLabel(parent, name) + : QLabel(parent) { + setObjectName(name); _pitchMode = true; _value = -1; setFrameStyle(WinPanel | Sunken); diff --git a/muse2/muse/widgets/slider.cpp b/muse2/muse/widgets/slider.cpp index ca42741c..f422c275 100644 --- a/muse2/muse/widgets/slider.cpp +++ b/muse2/muse/widgets/slider.cpp @@ -175,7 +175,7 @@ void Slider::scaleChange() //------------------------------------------------------------ void Slider::fontChange(const QFont & /*oldFont*/) { - repaint(FALSE); + repaint(); } //------------------------------------------------------------ @@ -249,10 +249,10 @@ void Slider::drawSlider(QPainter *p, const QRect &r) pal, TRUE, 1); else { - p->setPen(pal.dark()); + p->setPen(pal.dark().color()); p->drawLine(markerPos -1 , cr.y() + lineDist, markerPos -1, cr.y() + cr.height() - lineDist - 1); - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(markerPos, cr.y() + lineDist, markerPos, cr.y() + cr.height() - lineDist - 1); } @@ -285,10 +285,10 @@ void Slider::drawSlider(QPainter *p, const QRect &r) pal, TRUE, 1); else { - p->setPen(pal.dark()); + p->setPen(pal.dark().color()); p->drawLine(cr.x() + lineDist, markerPos - 1 , cr.x() + cr.width() - lineDist - 1, markerPos - 1); - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(cr.x() + lineDist, markerPos, cr.x() + cr.width() - lineDist - 1 , markerPos); } @@ -338,13 +338,13 @@ void Slider::drawHsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, p->fillRect(rBound.x(),rSlot.y(), rPos - rBound.left(),ws,brBack); - p->setPen(pal.dark()); + p->setPen(pal.dark().color()); if (rSlot.x() < rThumb.left()) p->drawLine(rSlot.x(), rSlot.bottom(), rSlot.x(), rSlot.top()); if (rSlot.x() < rThumb.left() - 1) { p->drawLine(rSlot.x(), rSlot.top(), rThumb.left() - 1, rSlot.top()); - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(rSlot.x() + 1, rSlot.bottom(), rThumb.left() - 1, rSlot.bottom()); @@ -365,17 +365,17 @@ void Slider::drawHsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, if (lPos <= rBound.right()) p->fillRect(lPos, rSlot.y() , rBound.right() - lPos + 1, ws ,brBack); - p->setPen(pal.dark()); + p->setPen(pal.dark().color()); if (rSlot.right() > rThumb.right()) { p->drawLine(rThumb.right() + 1, rSlot.top(), rSlot.right(), rSlot.top()); - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(rSlot.right(), rSlot.bottom(), rSlot.right(), rSlot.top() + 1); } if (rSlot.right() > rThumb.right() + 1) { - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(rThumb.right() + 1, rSlot.bottom(), rSlot.right() -1, rSlot.bottom()); p->fillRect(rThumb.right() + 1, rSlot.y() + 1, @@ -434,7 +434,7 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, p->fillRect(rSlot.x(),rBound.y(), ws, hPos - rBound.top(),brBack); - p->setPen(pal.dark()); + p->setPen(pal.dark().color()); if (rSlot.top() < rThumb.top()) p->drawLine(rSlot.left(), rSlot.top(), rSlot.right(), rSlot.top()); @@ -442,7 +442,7 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, if (rSlot.top() < rThumb.top() - 1) { p->drawLine(rSlot.left(), rThumb.top() - 1, rSlot.left(), rSlot.top()); - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(rSlot.right(), rSlot.top() + 1, rSlot.right(), rThumb.top() - 1); @@ -465,17 +465,17 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb, if (lPos <= rBound.bottom()) p->fillRect(rSlot.left(), lPos, ws, rBound.bottom() - lPos + 1, brBack); - p->setPen(pal.dark()); + p->setPen(pal.dark().color()); if (rSlot.bottom() > rThumb.bottom()) { p->drawLine(rSlot.left(), rThumb.bottom() + 1, rSlot.left(), rSlot.bottom()); - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(rSlot.left() * 1, rSlot.bottom(), rSlot.right(), rSlot.bottom()); } if (rSlot.bottom() > rThumb.bottom() + 1) { - p->setPen(pal.light()); + p->setPen(pal.light().color()); p->drawLine(rSlot.right(), rThumb.bottom() + 1, rSlot.right(), rSlot.bottom()); p->fillRect(rSlot.left() + 1, rThumb.bottom() + 1, @@ -797,7 +797,7 @@ void Slider::rangeChange() if (!hasUserScale()) d_scale.setScale(minValue(), maxValue(), d_maxMajor, d_maxMinor); SliderBase::rangeChange(); - repaint(FALSE); + repaint(); } //------------------------------------------------------------ diff --git a/muse2/muse/widgets/sliderbase.cpp b/muse2/muse/widgets/sliderbase.cpp index eeed13c5..320e1bc3 100644 --- a/muse2/muse/widgets/sliderbase.cpp +++ b/muse2/muse/widgets/sliderbase.cpp @@ -39,8 +39,9 @@ //------------------------------------------------------------ SliderBase::SliderBase(QWidget *parent, const char *name) -: QWidget(parent, name) +: QWidget(parent) { + setObjectName(name); _id = -1; _cursorHoming = false; _ignoreMouseMove = false; @@ -92,7 +93,7 @@ void SliderBase::wheelEvent(QWheelEvent *e) e->accept(); float inc = (maxValue() - minValue()) / 40; - if (e->state() == Qt::ShiftModifier) + if (e->modifiers() == Qt::ShiftModifier) inc = inc / 10; if(inc < step()) @@ -233,7 +234,7 @@ void SliderBase::mouseReleaseEvent(QMouseEvent *e) int ms = 0; /*double inc = step(); */ // prevent compiler warning: unused variable _ignoreMouseMove = false; - const Qt::ButtonState button = e->button(); + const Qt::MouseButton button = e->button(); switch(d_scrollMode) { diff --git a/muse2/muse/widgets/splitter.cpp b/muse2/muse/widgets/splitter.cpp index 142d5307..96fe2378 100644 --- a/muse2/muse/widgets/splitter.cpp +++ b/muse2/muse/widgets/splitter.cpp @@ -30,13 +30,13 @@ void Splitter::writeStatus(int level, Xml& xml) { QList vl = sizes(); //xml.nput(level++, "<%s>", name()); - xml.nput(level++, "<%s>", Xml::xmlString(name()).toLatin1().constData()); + xml.nput(level++, "<%s>", Xml::xmlString(objectName()).toLatin1().constData()); QList::iterator ivl = vl.begin(); for (; ivl != vl.end(); ++ivl) { xml.nput("%d ", *ivl); } //xml.nput("\n", name()); - xml.nput("\n", Xml::xmlString(name()).toLatin1().constData()); + xml.nput("\n", Xml::xmlString(objectName()).toLatin1().constData()); } //--------------------------------------------------------- @@ -59,7 +59,8 @@ void Splitter::readStatus(Xml& xml) break; case Xml::Text: { - QStringList sl = QStringList::split(' ', tag); + //QStringList sl = QStringList::split(' ', tag); + QStringList sl = tag.split(QString(" "), QString::SkipEmptyParts); for (QStringList::Iterator it = sl.begin(); it != sl.end(); ++it) { int val = (*it).toInt(); vl.append(val); @@ -67,7 +68,7 @@ void Splitter::readStatus(Xml& xml) } break; case Xml::TagEnd: - if (tag == name()) { + if (tag == objectName()) { setSizes(vl); return; } diff --git a/muse2/muse/widgets/tempolabel.cpp b/muse2/muse/widgets/tempolabel.cpp index 25a3176a..df6e83c3 100644 --- a/muse2/muse/widgets/tempolabel.cpp +++ b/muse2/muse/widgets/tempolabel.cpp @@ -16,8 +16,9 @@ //--------------------------------------------------------- TempoLabel::TempoLabel(QWidget* parent, const char* name) - : QLabel(parent, name) + : QLabel(parent) { + setObjectName(name); setFrameStyle(WinPanel | Sunken); setLineWidth(2); setMidLineWidth(3); diff --git a/muse2/muse/widgets/tools.cpp b/muse2/muse/widgets/tools.cpp index 74c3eea7..87403abc 100644 --- a/muse2/muse/widgets/tools.cpp +++ b/muse2/muse/widgets/tools.cpp @@ -89,7 +89,7 @@ EditToolBar::EditToolBar(QWidget* parent, int tools, const char*) a->setToolTip(tr(t->tip)); a->setWhatsThis(tr(t->ltip)); if (first) { - a->setOn(true); + a->setChecked(true); first = false; } ++n; diff --git a/muse2/muse/widgets/ttoolbutton.cpp b/muse2/muse/widgets/ttoolbutton.cpp index bf9234c6..907dfe75 100644 --- a/muse2/muse/widgets/ttoolbutton.cpp +++ b/muse2/muse/widgets/ttoolbutton.cpp @@ -5,9 +5,9 @@ // (C) Copyright 2004 Werner Schweer (ws@seh.de) //========================================================= -#include -//Added by qt3to4: +#include #include +#include #include "ttoolbutton.h" #include "gconfig.h" @@ -22,8 +22,8 @@ void TransparentToolButton::drawButton(QPainter* p) int w = width(); int h = height(); QIcon::Mode mode = isEnabled() ? QIcon::Normal : QIcon::Disabled; - QIcon::State state = isOn() ? QIcon::On : QIcon::Off; - const QPixmap pm(iconSet().pixmap(QIcon::Automatic, mode, state)); + QIcon::State state = isChecked() ? QIcon::On : QIcon::Off; + const QPixmap pm(icon().pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize), mode, state)); p->drawPixmap(QPoint((w - pm.width())/2, (h - pm.height())/2), pm); } diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp index ffa1edca..be2fb592 100644 --- a/muse2/muse/widgets/view.cpp +++ b/muse2/muse/widgets/view.cpp @@ -78,8 +78,8 @@ void View::setXPos(int x) int delta = xpos - x; // - -> shift left xpos = x; - int w = width(); - int h = height(); + //int w = width(); + //int h = height(); scroll(delta, 0); @@ -95,8 +95,8 @@ void View::setYPos(int y) int delta = ypos - y; // - -> shift up ypos = y; - int w = width(); - int h = height(); + //int w = width(); + //int h = height(); scroll(0, delta); @@ -107,7 +107,7 @@ void View::setYPos(int y) // resizeEvent //--------------------------------------------------------- -void View::resizeEvent(QResizeEvent* ev) +void View::resizeEvent(QResizeEvent* /*ev*/) { } diff --git a/muse2/muse/xml.cpp b/muse2/muse/xml.cpp index 30cd17f1..99967c01 100644 --- a/muse2/muse/xml.cpp +++ b/muse2/muse/xml.cpp @@ -420,7 +420,7 @@ QString Xml::parse(const QString& tag) QString Xml::parse1() { - return parse(_s1.simplifyWhiteSpace()); + return parse(_s1.simplified()); } //--------------------------------------------------------- @@ -429,7 +429,7 @@ QString Xml::parse1() int Xml::parseInt() { - QString s(parse1().simplifyWhiteSpace()); + QString s(parse1().simplified()); bool ok; int base = 10; if (s.startsWith("0x") || s.startsWith("0X")) { @@ -447,7 +447,7 @@ int Xml::parseInt() unsigned int Xml::parseUInt() { - QString s(parse1().simplifyWhiteSpace()); + QString s(parse1().simplified()); bool ok; int base = 10; if (s.startsWith("0x") || s.startsWith("0X")) { @@ -464,7 +464,7 @@ unsigned int Xml::parseUInt() float Xml::parseFloat() { - QString s(parse1().simplifyWhiteSpace()); + QString s(parse1().simplified()); return s.toFloat(); } @@ -474,7 +474,7 @@ float Xml::parseFloat() double Xml::parseDouble() { - QString s(parse1().simplifyWhiteSpace()); + QString s(parse1().simplified()); return s.toDouble(); } 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; itoAscii(); 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("")) -- cgit v1.2.3