diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-09 00:03:41 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-09 00:03:41 +0000 |
commit | 45f00094ca990cacd3e3a6b5516259b280b4e182 (patch) | |
tree | bb0d1c25db9a3869836924f27307056bd911ee6b /muse2/muse | |
parent | 4a1be16bbfafb8455b54336c4465da8f8bfe3ab6 (diff) |
Converted Qt3 methods to Qt4. Ported song.cpp
Diffstat (limited to 'muse2/muse')
35 files changed, 489 insertions, 409 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 3c73efc1..81f313ea 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -322,8 +322,8 @@ bool MusE::seqStart() } if (!audio->start()) { - QMessageBox::critical( muse, tr(QString("Failed to start audio!")), - tr(QString("Was not able to start audio, check if jack is running.\n"))); + QMessageBox::critical( muse, tr("Failed to start audio!"), + tr("Was not able to start audio, check if jack is running.\n")); return false; } @@ -641,7 +641,7 @@ QMenu* populateAddSynth(QWidget* parent) synMESS = dynamic_cast<MessSynth*>(*i); if(synMESS) { - mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().lower().toLatin1().constData()), ii) ); + mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); } else { @@ -650,7 +650,7 @@ QMenu* populateAddSynth(QWidget* parent) synDSSI = dynamic_cast<DssiSynth*>(*i); if(synDSSI) { - mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().lower().toLatin1().constData()), ii) ); + mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); } else #endif @@ -660,13 +660,13 @@ QMenu* populateAddSynth(QWidget* parent) synVST = dynamic_cast<VstSynth*>(*i); if(synVST) { - mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().lower().toLatin1().constData()), ii) ); + mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); } else #endif { - mapOther.insert( std::pair<std::string, int> (std::string((*i)->description().lower().toLatin1().constData()), ii) ); + mapOther.insert( std::pair<std::string, int> (std::string((*i)->description().toLower().toLatin1().constData()), ii) ); } } } @@ -873,7 +873,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() song = new Song("song"); song->blockSignals(true); - heartBeatTimer = new QTimer(this, "timer"); + heartBeatTimer = new QTimer(this); + heartBeatTimer->setObjectName("timer"); connect(heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat())); #ifdef ENABLE_PYTHON @@ -936,7 +937,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() punchoutAction->setWhatsThis(tr(infoPunchoutButton)); connect(punchoutAction, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool))); - transportAction->addSeparator(); + QAction *tseparator = new QAction(this); + tseparator->setSeparator(true); + transportAction->addAction(tseparator); startAction = new QAction(QIcon(*startIcon), tr("Start"), transportAction); @@ -961,7 +964,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() stopAction->setCheckable(true); stopAction->setWhatsThis(tr(infoStopButton)); - stopAction->setOn(true); + stopAction->setChecked(true); connect(stopAction, SIGNAL(toggled(bool)), song, SLOT(setStop(bool))); playAction = new QAction(QIcon(*playIcon), @@ -969,7 +972,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() playAction->setCheckable(true); playAction->setWhatsThis(tr(infoPlayButton)); - playAction->setOn(false); + playAction->setChecked(false); connect(playAction, SIGNAL(toggled(bool)), song, SLOT(setPlay(bool))); recordAction = new QAction(QIcon(*recordIcon), @@ -1423,7 +1426,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //------------------------------------------------------------- menuView = menuBar()->addMenu(tr("View")); - menuView->setCheckable(true); + //menuView->setCheckable(true);// not necessary with Qt4 menuView->addAction(viewTransportAction); menuView->addAction(viewBigtimeAction); @@ -1738,16 +1741,16 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll project.setFile("untitled"); } else { - printf("Setting project path to %s\n", fi.dirPath(true).toLatin1().constData()); - museProject = fi.dirPath(true); + printf("Setting project path to %s\n", fi.absolutePath().toLatin1().constData()); + museProject = fi.absolutePath(); project.setFile(name); } // Changed by T356. 01/19/2010. We want the complete extension here. - //QString ex = fi.extension(false).lower(); + //QString ex = fi.extension(false).toLower(); //if (ex.length() == 3) // ex += "."; //ex = ex.left(4); - QString ex = fi.extension(true).lower(); + QString ex = fi.completeSuffix().toLower(); QString mex = ex.section('.', -1, -1); if((mex == "gz") || (mex == "bz2")) mex = ex.section('.', -2, -2); @@ -1792,8 +1795,8 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll setUntitledProject(); } if (!songTemplate) { - addProject(project.absFilePath()); - setCaption(QString("MusE: Song: ") + project.baseName(true)); + addProject(project.absoluteFilePath()); + setWindowTitle(QString("MusE: Song: ") + project.completeBaseName()); } song->dirty = false; @@ -1839,9 +1842,9 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll } transport->setMasterFlag(song->masterFlag()); - punchinAction->setOn(song->punchin()); - punchoutAction->setOn(song->punchout()); - loopAction->setOn(song->loop()); + punchinAction->setChecked(song->punchin()); + punchoutAction->setChecked(song->punchout()); + loopAction->setChecked(song->loop()); song->update(); song->updatePos(); clipboardChanged(); // enable/disable "Paste" @@ -1886,9 +1889,9 @@ void MusE::setUntitledProject() { setConfigDefaults(); QString name("untitled"); - museProject = QFileInfo(name).dirPath(true); + museProject = QFileInfo(name).absolutePath(); project.setFile(name); - setCaption(tr("MusE: Song: ") + project.baseName(true)); + setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); } //--------------------------------------------------------- @@ -1955,7 +1958,7 @@ void MusE::loadProject() QString fn = getOpenFileName(QString(""), med_file_pattern, this, tr("MusE: load project"), &loadAll); if (!fn.isEmpty()) { - museProject = QFileInfo(fn).dirPath(true); + museProject = QFileInfo(fn).absolutePath(); loadProjectFile(fn, false, loadAll); } } @@ -1969,7 +1972,7 @@ void MusE::loadTemplate() QString fn = getOpenFileName(QString("templates"), med_file_pattern, this, tr("MusE: load template"), 0); if (!fn.isEmpty()) { - // museProject = QFileInfo(fn).dirPath(true); + // museProject = QFileInfo(fn).absolutePath(); loadProjectFile(fn, true, true); setUntitledProject(); } @@ -1981,7 +1984,7 @@ void MusE::loadTemplate() bool MusE::save() { - if (project.baseName(true) == "untitled") + if (project.completeBaseName() == "untitled") return saveAs(); else return save(project.filePath(), false); @@ -2038,7 +2041,7 @@ bool MusE::save(const QString& name, bool overwriteWarn) void MusE::quitDoc() { - close(true); + close(); } //--------------------------------------------------------- @@ -2129,7 +2132,7 @@ void MusE::closeEvent(QCloseEvent* event) QFileInfo f(filename); QDir d = f.dir(); d.remove(filename); - d.remove(f.baseName(true) + ".wca"); + d.remove(f.completeBaseName() + ".wca"); } // Added by Tim. p3.3.14 @@ -3107,11 +3110,11 @@ bool MusE::saveAs() bool ok = false; if (!name.isEmpty()) { QString tempOldProj = museProject; - museProject = QFileInfo(name).dirPath(true); + museProject = QFileInfo(name).absolutePath(); ok = save(name, true); if (ok) { project.setFile(name); - setCaption(tr("MusE: Song: ") + project.baseName(true)); + setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); addProject(name); } else @@ -3727,7 +3730,8 @@ int main(int argc, char* argv[]) muse_splash->show(); QTimer* stimer = new QTimer(0); muse_splash->connect(stimer, SIGNAL(timeout()), muse_splash, SLOT(close())); - stimer->start(6000, true); + stimer->setSingleShot(true); + stimer->start(6000); } } @@ -3859,10 +3863,10 @@ int main(int argc, char* argv[]) } static QTranslator translator(0); - QString locale(QTextCodec::locale()); + QString locale(QApplication::keyboardInputLocale().name()); if (locale != "C") { QString loc("muse_"); - loc += QString(QTextCodec::locale()); + loc += QString(QApplication::keyboardInputLocale().name()); if (translator.load(loc, QString(".")) == false) { QString lp(museGlobalShare); lp += QString("/locale"); @@ -3909,7 +3913,7 @@ int main(int argc, char* argv[]) muse = new MusE(argc, &argv[optind]); app.setMuse(muse); - muse->setIcon(*museIcon); + muse->setWindowIcon(*museIcon); // Added by Tim. p3.3.22 if (!debugMode) { @@ -4282,7 +4286,7 @@ void MusE::configAppearance() appearance->resetValues(); if(appearance->isVisible()) { appearance->raise(); - appearance->setActiveWindow(); + appearance->activateWindow(); } else appearance->show(); @@ -4294,7 +4298,7 @@ void MusE::configAppearance() void MusE::loadTheme(const QString& s) { - if (style()->name() != s) + if (style()->objectName() != s) QApplication::setStyle(s); } @@ -4335,7 +4339,7 @@ void MusE::changeConfig(bool writeFlag) //loadStyleSheetFile(config.styleSheetFile); loadTheme(config.style); - QApplication::setFont(config.fonts[0], true); + QApplication::setFont(config.fonts[0]); loadStyleSheetFile(config.styleSheetFile); emit configChanged(); @@ -4353,7 +4357,7 @@ void MusE::configMetronome() if(metronomeConfig->isVisible()) { metronomeConfig->raise(); - metronomeConfig->setActiveWindow(); + metronomeConfig->activateWindow(); } else metronomeConfig->show(); @@ -4829,12 +4833,12 @@ MusE::lash_idle_cb () { /* save file */ QString ss = QString(lash_event_get_string(event)) + QString("/lash-project-muse.med"); - int ok = save (ss.ascii(), false); + int ok = save (ss.toAscii(), false); if (ok) { - project.setFile(ss.ascii()); - setCaption(tr("MusE: Song: ") + project.baseName(true)); - addProject(ss.ascii()); - museProject = QFileInfo(ss.ascii()).dirPath(true); + project.setFile(ss.toAscii()); + setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); + addProject(ss.toAscii()); + museProject = QFileInfo(ss.toAscii()).absolutePath(); } lash_send_event (lash_client, event); } @@ -4844,7 +4848,7 @@ MusE::lash_idle_cb () { /* load file */ QString sr = QString(lash_event_get_string(event)) + QString("/lash-project-muse.med"); - loadProjectFile(sr.ascii(), false, true); + loadProjectFile(sr.toAscii(), false, true); lash_send_event (lash_client, event); } break; @@ -4919,7 +4923,7 @@ again: case Toplevel::MASTER: case Toplevel::WAVE: case Toplevel::LMASTER: - ((QWidget*)(obj))->close(true); + ((QWidget*)(obj))->close(); goto again; } } @@ -4940,7 +4944,7 @@ void MusE::startEditInstrument() } else { - if(editInstrument->isShown()) + if(! editInstrument->isHidden()) editInstrument->hide(); else editInstrument->show(); @@ -5296,13 +5300,13 @@ void MusE::setUsedTool(int tool) void MusE::execDeliveredScript(int id) { //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id]; - song->executeScript(song->getScriptPath(id, true), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger + song->executeScript(song->getScriptPath(id, true).toLatin1().constData(), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger } //--------------------------------------------------------- // execUserScript //--------------------------------------------------------- void MusE::execUserScript(int id) { - song->executeScript(song->getScriptPath(id, false), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger + song->executeScript(song->getScriptPath(id, false).toLatin1().constData(), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger } diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index bd09147d..0d094a71 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -207,13 +207,13 @@ Appearance::Appearance(Arranger* a, QWidget* parent) // Fonts //--------------------------------------------------- - fontBrowse0->setPixmap(*openIcon); - fontBrowse1->setPixmap(*openIcon); - fontBrowse2->setPixmap(*openIcon); - fontBrowse3->setPixmap(*openIcon); - fontBrowse4->setPixmap(*openIcon); - fontBrowse5->setPixmap(*openIcon); - fontBrowse6->setPixmap(*openIcon); + fontBrowse0->setIcon(QIcon(*openIcon)); + fontBrowse1->setIcon(QIcon(*openIcon)); + fontBrowse2->setIcon(QIcon(*openIcon)); + fontBrowse3->setIcon(QIcon(*openIcon)); + fontBrowse4->setIcon(QIcon(*openIcon)); + fontBrowse5->setIcon(QIcon(*openIcon)); + fontBrowse6->setIcon(QIcon(*openIcon)); connect(fontBrowse0, SIGNAL(clicked()), SLOT(browseFont0())); connect(fontBrowse1, SIGNAL(clicked()), SLOT(browseFont1())); connect(fontBrowse2, SIGNAL(clicked()), SLOT(browseFont2())); @@ -240,22 +240,41 @@ void Appearance::resetValues() *config = ::config; // init with global config values styleSheetPath->setText(config->styleSheetFile); updateFonts(); - palette0->setPaletteBackgroundColor(config->palette[0]); - palette1->setPaletteBackgroundColor(config->palette[1]); - palette2->setPaletteBackgroundColor(config->palette[2]); - palette3->setPaletteBackgroundColor(config->palette[3]); - palette4->setPaletteBackgroundColor(config->palette[4]); - palette5->setPaletteBackgroundColor(config->palette[5]); - palette6->setPaletteBackgroundColor(config->palette[6]); - palette7->setPaletteBackgroundColor(config->palette[7]); - palette8->setPaletteBackgroundColor(config->palette[8]); - palette9->setPaletteBackgroundColor(config->palette[9]); - palette10->setPaletteBackgroundColor(config->palette[10]); - palette11->setPaletteBackgroundColor(config->palette[11]); - palette12->setPaletteBackgroundColor(config->palette[12]); - palette13->setPaletteBackgroundColor(config->palette[13]); - palette14->setPaletteBackgroundColor(config->palette[14]); - palette15->setPaletteBackgroundColor(config->palette[15]); + + QPalette pal; + + pal.setColor(palette0->backgroundRole(), config->palette[0]); + palette0->setPalette(pal); + pal.setColor(palette1->backgroundRole(), config->palette[1]); + palette1->setPalette(pal); + pal.setColor(palette2->backgroundRole(), config->palette[2]); + palette2->setPalette(pal); + pal.setColor(palette3->backgroundRole(), config->palette[3]); + palette3->setPalette(pal); + pal.setColor(palette4->backgroundRole(), config->palette[4]); + palette4->setPalette(pal); + pal.setColor(palette5->backgroundRole(), config->palette[5]); + palette5->setPalette(pal); + pal.setColor(palette6->backgroundRole(), config->palette[6]); + palette6->setPalette(pal); + pal.setColor(palette7->backgroundRole(), config->palette[7]); + palette7->setPalette(pal); + pal.setColor(palette8->backgroundRole(), config->palette[8]); + palette8->setPalette(pal); + pal.setColor(palette9->backgroundRole(), config->palette[9]); + palette9->setPalette(pal); + pal.setColor(palette10->backgroundRole(), config->palette[10]); + palette10->setPalette(pal); + pal.setColor(palette11->backgroundRole(), config->palette[11]); + palette11->setPalette(pal); + pal.setColor(palette12->backgroundRole(), config->palette[12]); + palette12->setPalette(pal); + pal.setColor(palette13->backgroundRole(), config->palette[13]); + palette13->setPalette(pal); + pal.setColor(palette14->backgroundRole(), config->palette[14]); + palette14->setPalette(pal); + pal.setColor(palette15->backgroundRole(), config->palette[15]); + palette15->setPalette(pal); currentBg = ::config.canvasBgPixmap; if (currentBg.isEmpty()) @@ -278,15 +297,15 @@ void Appearance::resetValues() arrGrid->setChecked(config->canvasShowGrid); themeComboBox->clear(); - QString cs = muse->style()->name(); + QString cs = muse->style()->objectName(); //printf("Appearance::resetValues style:%s\n", cs.toAscii().data()); // REMOVE Tim //printf("Appearance::resetValues App styleSheet:%s\n", qApp->styleSheet().toAscii().data()); // REMOVE Tim - cs = cs.lower(); + cs = cs.toLower(); - themeComboBox->insertStringList(QStyleFactory::keys()); + themeComboBox->insertItems(0, QStyleFactory::keys()); for (int i = 0; i < themeComboBox->count(); ++i) { - if (themeComboBox->text(i).lower() == cs) { - themeComboBox->setCurrentItem(i); + if (themeComboBox->itemText(i).toLower() == cs) { + themeComboBox->setCurrentIndex(i); } } @@ -392,7 +411,7 @@ void Appearance::apply() config->fonts[0].setPointSize(fontSize0->value()); config->fonts[0].setItalic(italic0->isChecked()); config->fonts[0].setBold(bold0->isChecked()); - QApplication::setFont(config->fonts[0], true); + QApplication::setFont(config->fonts[0]); config->fonts[1].setFamily(fontName1->text()); config->fonts[1].setPointSize(fontSize1->value()); @@ -442,7 +461,7 @@ void Appearance::apply() void Appearance::ok() { apply(); - close(false); + close(); } //--------------------------------------------------------- @@ -451,7 +470,7 @@ void Appearance::ok() void Appearance::cancel() { - close(false); + close(); } //--------------------------------------------------------- @@ -555,7 +574,9 @@ void Appearance::updateColor() vval->setEnabled(color); if (color == 0) return; - colorframe->setBackgroundColor(*color); + QPalette pal; + pal.setColor(colorframe->backgroundRole(), *color); + colorframe->setPalette(pal); color->getRgb(&r, &g, &b); color->getHsv(&h, &s, &v); @@ -692,7 +713,9 @@ void Appearance::addToPaletteClicked() if (button) { int id = aPalette->id(button); config->palette[id] = *color; - button->setPaletteBackgroundColor(*color); + QPalette pal; + pal.setColor(button->backgroundRole(), *color); + button->setPalette(pal); button->update(); //?? } } @@ -707,7 +730,7 @@ void Appearance::paletteClicked(int id) return; QAbstractButton* button = (QAbstractButton*)aPalette->button(id); // ddskrjo if (button) { - QColor c = button->paletteBackgroundColor(); + QColor c = button->palette().color(QPalette::Window); int r, g, b; c.getRgb(&r, &g, &b); if (r == 0xff && g == 0xff && b == 0xff) diff --git a/muse2/muse/arranger/alayout.cpp b/muse2/muse/arranger/alayout.cpp index b5374754..c59ba563 100644 --- a/muse2/muse/arranger/alayout.cpp +++ b/muse2/muse/arranger/alayout.cpp @@ -117,7 +117,7 @@ void TLLayout::setGeometry(const QRect &rect) range = 0; sb->setShown(range != 0); if (range) - sb->setMaxValue(range); + sb->setMaximum(range); if (widget) { QSize r(s0.width(), y2); diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index e54ffba4..c7689355 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -225,29 +225,39 @@ Arranger::Arranger(QMainWindow* parent, const char* name) //split->setHandleWidth(10); QWidget* tracklist = new QWidget(split); - split->setResizeMode(tracklist, QSplitter::KeepSize); - tracklist->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding, 0, 100)); + + split->setStretchFactor(split->indexOf(tracklist), 0); + //tracklist->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding, 0, 100)); + QSizePolicy tpolicy = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + tpolicy.setHorizontalStretch(0); + tpolicy.setVerticalStretch(100); + tracklist->setSizePolicy(tpolicy); QWidget* editor = new QWidget(split); - split->setResizeMode(editor, QSplitter::Stretch); - editor->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, + split->setStretchFactor(split->indexOf(editor), 1); + //editor->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, // Changed by T356. Was causing "large int implicitly truncated" warning. These are UCHAR values... //1000, 100)); //232, 100)); // 232 is what it was being truncated to, but what is the right value?... - 255, 100)); + //255, 100)); + QSizePolicy epolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + epolicy.setHorizontalStretch(255); + epolicy.setVerticalStretch(100); + editor->setSizePolicy(epolicy); //--------------------------------------------------- // Track Info //--------------------------------------------------- - infoScroll = new QScrollBar(Qt::Vertical, tracklist, "infoScrollBar"); + infoScroll = new QScrollBar(Qt::Vertical, tracklist); + infoScroll->setObjectName("infoScrollBar"); genTrackInfo(tracklist); // Track-Info Button ib = new QToolButton(tracklist); ib->setText(tr("TrackInfo")); ib->setCheckable(true); - ib->setOn(showTrackinfoFlag); + ib->setChecked(showTrackinfoFlag); connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool))); header = new Header(tracklist); @@ -318,8 +328,15 @@ Arranger::Arranger(QMainWindow* parent, const char* name) // Changed p3.3.43 Too small steps for me... //vscroll = new QScrollBar(1, 20*20, 1, 5, 0, Vertical, editor); - vscroll = new QScrollBar(1, 20*20, 5, 25, 0, Qt::Vertical, editor); - + //vscroll = new QScrollBar(1, 20*20, 5, 25, 0, Qt::Vertical, editor); + vscroll = new QScrollBar(editor); + vscroll->setMinimum(1); + vscroll->setMaximum(20*20); + vscroll->setSingleStep(5); + vscroll->setPageStep(25); + vscroll->setValue(0); + vscroll->setOrientation(Qt::Vertical); + list->setScroll(vscroll); QList<int> vallist; @@ -348,8 +365,11 @@ Arranger::Arranger(QMainWindow* parent, const char* name) connect(this, SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*))); connect(list, SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*))); - egrid->addMultiCellWidget(time, 0, 0, 0, 1); - egrid->addMultiCellWidget(hLine(editor), 1, 1, 0, 1); + //egrid->addMultiCellWidget(time, 0, 0, 0, 1); + //egrid->addMultiCellWidget(hLine(editor), 1, 1, 0, 1); + egrid->addWidget(time, 0, 0, 1, 2); + egrid->addWidget(hLine(editor), 1, 0, 1, 2); + egrid->addWidget(canvas, 2, 0); egrid->addWidget(vscroll, 2, 1); egrid->addWidget(hscroll, 3, 0, Qt::AlignBottom); @@ -583,7 +603,7 @@ void Arranger::setMode(int mode) void Arranger::writeStatus(int level, Xml& xml) { xml.tag(level++, "arranger"); - xml.intTag(level, "info", ib->isOn()); + xml.intTag(level, "info", ib->isChecked()); split->writeStatus(level, xml); list->writeStatus(level, xml, "list"); @@ -609,7 +629,7 @@ void Arranger::readStatus(Xml& xml) case Xml::TagStart: if (tag == "info") showTrackinfoFlag = xml.parseInt(); - else if (tag == split->name()) + else if (tag == split->objectName()) split->readStatus(xml); else if (tag == "list") list->readStatus(xml, "list"); @@ -626,7 +646,7 @@ void Arranger::readStatus(Xml& xml) break; case Xml::TagEnd: if (tag == "arranger") { - ib->setOn(showTrackinfoFlag); + ib->setChecked(showTrackinfoFlag); return; } default: @@ -891,8 +911,9 @@ void Arranger::trackInfoScroll(int y) //--------------------------------------------------------- WidgetStack::WidgetStack(QWidget* parent, const char* name) - : QWidget(parent, name) + : QWidget(parent) { + setObjectName(name); top = -1; } diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index c2ffe6ba..b1eb22ca 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -225,7 +225,7 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) } QPoint cpos = event->pos(); curItem = items.find(cpos); - bool shift = event->state() & Qt::ShiftButton; + bool shift = event->modifiers() & Qt::ShiftModifier; if (curItem) { if (event->button() == Qt::LeftButton && shift) { editPart = (NPart*)curItem; @@ -738,7 +738,7 @@ QMenu* PartCanvas::genItemPopup(CItem* item) act_copy->setData(5); act_copy->setShortcut(Qt::CTRL+Qt::Key_C); - partPopup->insertSeparator(); + partPopup->addSeparator(); int rc = npart->part()->events()->arefCount(); QString st = QString(tr("s&elect ")); if(rc > 1) @@ -747,7 +747,7 @@ QMenu* PartCanvas::genItemPopup(CItem* item) QAction *act_select = partPopup->addAction(st); act_select->setData(18); - partPopup->insertSeparator(); + partPopup->addSeparator(); QAction *act_rename = partPopup->addAction(tr("rename")); act_rename->setData(0); QMenu* colorPopup = new QMenu(tr("color")); @@ -772,7 +772,7 @@ QMenu* PartCanvas::genItemPopup(CItem* item) QAction *act_declone = partPopup->addAction(tr("de-clone")); act_declone->setData(15); - partPopup->insertSeparator(); + partPopup->addSeparator(); switch(trackType) { case Track::MIDI: { QAction *act_pianoroll = partPopup->addAction(QIcon(*pianoIconSet), tr("pianoroll")); @@ -809,10 +809,10 @@ QMenu* PartCanvas::genItemPopup(CItem* item) break; } - partPopup->setItemEnabled(18, rc > 1); - partPopup->setItemEnabled(1, true); - partPopup->setItemEnabled(4, true); - partPopup->setItemEnabled(15, rc > 1); + act_select->setEnabled( rc > 1); + act_delete->setEnabled( true); + act_cut->setEnabled( true); + act_declone->setEnabled( rc > 1); return partPopup; } @@ -1006,7 +1006,7 @@ void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt) void PartCanvas::mousePress(QMouseEvent* event) { - if (event->state() & Qt::ShiftButton) { + if (event->modifiers() & Qt::ShiftModifier) { return; } QPoint pt = event->pos(); @@ -1083,11 +1083,11 @@ void PartCanvas::keyPress(QKeyEvent* event) return; } - if (event->state() & Qt::ShiftButton) + if (event->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; - if (event->state() & Qt::AltButton) + if (event->modifiers() & Qt::AltModifier) key += Qt::ALT; - if (event->state() & Qt::ControlButton) + if (event->modifiers() & Qt::ControlModifier) key += Qt::CTRL; if (key == shortcuts[SHRT_DELETE].key) { @@ -1567,7 +1567,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) rr.setX(rr.x() + 3); p.save(); p.setFont(config.fonts[1]); - p.setWorldXForm(false); + p.setWorldMatrixEnabled(false); p.drawText(rr, Qt::AlignVCenter|Qt::AlignLeft, part->name()); p.restore(); } @@ -1596,11 +1596,11 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) void PartCanvas::drawWavePart(QPainter& p, const QRect& bb, WavePart* wp, const QRect& _pr) { - QRect rr = p.worldMatrix().map(bb); - QRect pr = p.worldMatrix().map(_pr); + QRect rr = p.worldMatrix().mapRect(bb); + QRect pr = p.worldMatrix().mapRect(_pr); p.save(); - p.resetXForm(); + p.resetTransform(); int x2 = 1; int x1 = rr.x() > pr.x() ? rr.x() : pr.x(); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index f1be95fa..729e318f 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -56,8 +56,9 @@ static const int WHEEL_DELTA = 120; //--------------------------------------------------------- TList::TList(Header* hdr, QWidget* parent, const char* name) - : QWidget(parent, name, Qt::WNoAutoErase | Qt::WResizeNoErase) + : QWidget(parent) // Qt::WNoAutoErase | Qt::WResizeNoErase are no longer needed according to Qt4 doc { + setObjectName(name); ypos = 0; editMode = false; setFocusPolicy(Qt::StrongFocus); @@ -69,7 +70,8 @@ TList::TList(Header* hdr, QWidget* parent, const char* name) editor = 0; mode = NORMAL; - setBackgroundMode(Qt::NoBackground); + //setBackgroundMode(Qt::NoBackground); // ORCAN - FIXME + //setAttribute(Qt::WA_OpaquePaintEvent); resizeFlag = false; connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); @@ -107,6 +109,7 @@ void TList::paintEvent(QPaintEvent* ev) { if (!pmValid) paint(ev->rect()); + /* Orcan - fixme */ bitBlt(this, ev->rect().topLeft(), &pm, ev->rect(), true); //CopyROP, true); ddskrjo } @@ -180,6 +183,7 @@ void TList::paint(const QRect& r) QColor bg; if (track->selected()) { bg = config.selectTrackBg; + //p.setPen(palette().active().text()); p.setPen(config.selectTrackFg); } else { @@ -209,7 +213,7 @@ void TList::paint(const QRect& r) bg = config.synthTrackBg; break; } - p.setPen(palette().active().text()); + p.setPen(palette().color(QPalette::Active, QPalette::Text)); } p.fillRect(x1, yy, w, trackHeight, bg); @@ -217,7 +221,8 @@ void TList::paint(const QRect& r) for (int index = 0; index < header->count(); ++index) { int section = header->visualIndex(index); int w = header->sectionSize(section); - QRect r = p.xForm(QRect(x+2, yy, w-4, trackHeight)); + //QRect r = p.xForm(QRect(x+2, yy, w-4, trackHeight)); + QRect r = p.combinedTransform().mapRect(QRect(x+2, yy, w-4, trackHeight)); switch (section) { case COL_RECORD: @@ -411,7 +416,7 @@ void TList::adjustScrollbar() TrackList* l = song->tracks(); for (iTrack it = l->begin(); it != l->end(); ++it) h += (*it)->height(); - scroll->setMaxValue(h +30); + scroll->setMaximum(h +30); redraw(); } @@ -767,7 +772,7 @@ void TList::mousePressEvent(QMouseEvent* ev) int x = ev->x(); int y = ev->y(); int button = ev->button(); - bool shift = ev->state() & Qt::ShiftModifier; + bool shift = ev->modifiers() & Qt::ShiftModifier; Track* t = y2Track(y + ypos); @@ -948,7 +953,7 @@ void TList::mousePressEvent(QMouseEvent* ev) break; case COL_MUTE: // p3.3.29 - if ((button == Qt::RightButton) || (ev->state() & Qt::ControlModifier)) + if ((button == Qt::RightButton) || (ev->modifiers() & Qt::ControlModifier)) t->setOff(!t->off()); else { @@ -1129,7 +1134,7 @@ void TList::selectTrackBelow() void TList::mouseMoveEvent(QMouseEvent* ev) { - if (ev->state() == 0) { + if (ev->modifiers() == 0) { int y = ev->y(); int ty = -ypos; TrackList* tracks = song->tracks(); @@ -1147,14 +1152,14 @@ void TList::mouseMoveEvent(QMouseEvent* ev) else { if (!resizeFlag) { resizeFlag = true; - setCursor(QCursor(Qt::splitVCursor)); + setCursor(QCursor(Qt::SplitVCursor)); } break; } } } if (it == tracks->end() && resizeFlag) { - setCursor(QCursor(Qt::arrowCursor)); + setCursor(QCursor(Qt::ArrowCursor)); resizeFlag = false; } return; @@ -1175,7 +1180,7 @@ void TList::mouseMoveEvent(QMouseEvent* ev) mode = DRAG; dragHeight = t->height(); sTrack = song->tracks()->index(t); - setCursor(QCursor(Qt::sizeVerCursor)); + setCursor(QCursor(Qt::SizeVerCursor)); redraw(); } } @@ -1220,7 +1225,7 @@ void TList::mouseReleaseEvent(QMouseEvent* ev) } if (mode != NORMAL) { mode = NORMAL; - setCursor(QCursor(Qt::arrowCursor)); + setCursor(QCursor(Qt::ArrowCursor)); redraw(); } if (editTrack) @@ -1254,7 +1259,7 @@ void TList::wheelEvent(QWheelEvent* ev) break; case COL_MUTE: // p3.3.29 - if (ev->state() & Qt::ControlModifier) + if (ev->modifiers() & Qt::ControlModifier) t->setOff(!t->off()); else { @@ -1361,7 +1366,7 @@ void TList::readStatus(Xml& xml, const char* name) case Xml::End: return; case Xml::TagStart: - if (tag == header->name()) + if (tag == header->objectName()) header->readStatus(xml); else xml.unknown("Tlist"); @@ -1402,13 +1407,14 @@ void TList::setYPos(int y) } else if (delta < 0) { // shift up //printf("TList::setYPos delta < 0 : shift up\n"); + /* Orcan - fixme */ bitBlt(&pm, 0, 0, &pm, 0, -delta, w, h + delta, true); //CopyROP, true); ddskrjo r = QRect(0, h + delta, w, -delta); } else { // shift down //printf("TList::setYPos delta !< 0 : shift down\n"); + /* Orcan - fixme */ bitBlt(&pm, 0, delta, &pm, 0, 0, w, h-delta, true); //CopyROP, true); ddskrjo - // NOTE: June 2 2010: On my machine with an old NV V8200 + prop drivers (curr 96.43.11), // this is a problem. There is severe graphical corruption. // Not just here but several other windows (ex. ladspa browser), @@ -1432,7 +1438,9 @@ void TList::setYPos(int y) void TList::resizeEvent(QResizeEvent* ev) { - pm.resize(ev->size()); + //pm.resize(ev->size()); // Qt3 way + //pm = pm.copy(QRect(QPoint(0, 0), ev->size())); // orcan - didn't work. Let's try: + pm = QPixmap(ev->size()); // Works, but is this efficient? pmValid = false; } diff --git a/muse2/muse/arranger/trackinfo.cpp b/muse2/muse/arranger/trackinfo.cpp index 2f205490..6ca32a40 100644 --- a/muse2/muse/arranger/trackinfo.cpp +++ b/muse2/muse/arranger/trackinfo.cpp @@ -58,10 +58,10 @@ void Arranger::midiTrackInfoHeartBeat() MidiPort* mp = &midiPorts[outPort]; // Set record echo. - if(midiTrackInfo->recEchoButton->isOn() != track->recEcho()) + if(midiTrackInfo->recEchoButton->isChecked() != track->recEcho()) { midiTrackInfo->recEchoButton->blockSignals(true); - midiTrackInfo->recEchoButton->setOn(track->recEcho()); + midiTrackInfo->recEchoButton->setChecked(track->recEcho()); midiTrackInfo->recEchoButton->blockSignals(false); } @@ -346,9 +346,13 @@ void Arranger::genTrackInfo(QWidget* parent) noTrackInfo = new QWidget(trackInfo); QPixmap *noInfoPix = new QPixmap(160, 1000); //muse_leftside_logo_xpm); const QPixmap *logo = new QPixmap(*museLeftSideLogo); - noInfoPix->fill(noTrackInfo->paletteBackgroundColor() ); + noInfoPix->fill(noTrackInfo->palette().color(QPalette::Window) ); + /* Orcan - fixme */ copyBlt(noInfoPix, 10, 0, logo, 0,0, logo->width(), logo->height()); - noTrackInfo->setPaletteBackgroundPixmap(*noInfoPix); + //noTrackInfo->setPaletteBackgroundPixmap(*noInfoPix); + QPalette palette; + palette.setBrush(noTrackInfo->backgroundRole(), QBrush(*noInfoPix)); + noTrackInfo->setPalette(palette); noTrackInfo->setGeometry(0, 0, 65, 200); noTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); @@ -984,7 +988,7 @@ void Arranger::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 *act = pop->exec(midiTrackInfo->iPatch->mapToGlobal(QPoint(10,5))); if (act) { @@ -1185,13 +1189,14 @@ void Arranger::genMidiTrackInfo() midiTrackInfo->iChanDetectLabel->setPixmap(*darkRedLedIcon); QIcon recEchoIconSet; - recEchoIconSet.setPixmap(*recEchoIconOn, QIcon::Automatic, QIcon::Normal, QIcon::On); - recEchoIconSet.setPixmap(*recEchoIconOff, QIcon::Automatic, QIcon::Normal, QIcon::Off); - midiTrackInfo->recEchoButton->setIconSet(recEchoIconSet); + recEchoIconSet.addPixmap(*recEchoIconOn, QIcon::Normal, QIcon::On); + recEchoIconSet.addPixmap(*recEchoIconOff, QIcon::Normal, QIcon::Off); + midiTrackInfo->recEchoButton->setIcon(recEchoIconSet); // MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here. - midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter | Qt::TextWordWrap); + midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter); + //Qt::TextWordWrap is not available for alignment in Qt4 - Orcan // 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... //midiTrackInfo->trackNameLabel->setAlignment(Qt::AlignCenter | Qt::TextWordWrap | Qt::TextWrapAnywhere); @@ -1216,7 +1221,7 @@ void Arranger::genMidiTrackInfo() connect(midiTrackInfo->iPatch, SIGNAL(released()), SLOT(instrPopup())); pop = new QMenu(midiTrackInfo->iPatch); - pop->setCheckable(false); + //pop->setCheckable(false); // not needed in Qt4 // Removed by Tim. p3.3.9 //connect(midiTrackInfo->iName, SIGNAL(returnPressed()), SLOT(iNameChanged())); @@ -1290,9 +1295,9 @@ void Arranger::updateMidiTrackInfo(int flags) for (int i = 0; i < MIDI_PORTS; ++i) { QString name; name.sprintf("%d:%s", i+1, midiPorts[i].portname().toLatin1().constData()); - midiTrackInfo->iOutput->insertItem(name, i); + midiTrackInfo->iOutput->insertItem(i, name); if (i == outPort) - midiTrackInfo->iOutput->setCurrentItem(i); + midiTrackInfo->iOutput->setCurrentIndex(i); } //midiTrackInfo->iInput->setText(bitmap2String(inPort)); ///midiTrackInfo->iInput->setText(u32bitmap2String(inPort)); @@ -1309,10 +1314,10 @@ void Arranger::updateMidiTrackInfo(int flags) ///midiTrackInfo->iInputChannel->setText(bitmap2String(inChannel)); // Set record echo. - if(midiTrackInfo->recEchoButton->isOn() != track->recEcho()) + if(midiTrackInfo->recEchoButton->isChecked() != track->recEcho()) { midiTrackInfo->recEchoButton->blockSignals(true); - midiTrackInfo->recEchoButton->setOn(track->recEcho()); + midiTrackInfo->recEchoButton->setChecked(track->recEcho()); midiTrackInfo->recEchoButton->blockSignals(false); } diff --git a/muse2/muse/audiotrack.cpp b/muse2/muse/audiotrack.cpp index f486fbae..6730ce7b 100644 --- a/muse2/muse/audiotrack.cpp +++ b/muse2/muse/audiotrack.cpp @@ -859,7 +859,7 @@ void AudioTrack::writeProperties(int level, Xml& xml) const int naux = song->auxs()->size(); for (int idx = 0; idx < naux; ++idx) { QString s("<auxSend idx=%1>%2</auxSend>\n"); - xml.nput(level, s.arg(idx).arg(_auxSend[idx])); + xml.nput(level, s.arg(idx).arg(_auxSend[idx]).toAscii().constData()); } } for (ciPluginI ip = _efxPipe->begin(); ip != _efxPipe->end(); ++ip) { @@ -869,11 +869,11 @@ void AudioTrack::writeProperties(int level, Xml& xml) const for (ciCtrlList icl = _controller.begin(); icl != _controller.end(); ++icl) { const CtrlList* cl = icl->second; QString s("controller id=\"%1\" cur=\"%2\""); - xml.tag(level++, s.arg(cl->id()).arg(cl->curVal())); + xml.tag(level++, s.arg(cl->id()).arg(cl->curVal()).toAscii().constData()); int i = 0; for (ciCtrl ic = cl->begin(); ic != cl->end(); ++ic) { QString s("%1 %2, "); - xml.nput(level, s.arg(ic->second.frame).arg(ic->second.val)); + xml.nput(level, s.arg(ic->second.frame).arg(ic->second.val).toAscii().constData()); ++i; if (i >= 4) { xml.put(level, ""); @@ -1576,7 +1576,7 @@ bool AudioTrack::setRecordFlag1(bool f) sprintf(buffer, "%s/rec%d.wav", museProject.toLatin1().constData(), recFileNumber); - fil.setName(QString(buffer)); + fil.setFileName(QString(buffer)); if (!fil.exists()) break; } diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 4f3dad63..9ab9e594 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -8,22 +8,8 @@ #include <sndfile.h> #include <errno.h> -#include <q3listview.h> #include <qlayout.h> -#include <qpushbutton.h> -#include <qlineedit.h> -#include <qcombobox.h> -#include <qlabel.h> -#include <QButtonGroup> #include <stdio.h> -#include <q3popupmenu.h> -#include <q3groupbox.h> -#include <qradiobutton.h> -#include <qspinbox.h> -#include <qcheckbox.h> -#include <qsignalmapper.h> -#include <qtooltip.h> -#include <qstyle.h> #include "app.h" #include "transport.h" @@ -1313,7 +1299,7 @@ void MusE::configMidiSync() if (midiSyncConfig->isVisible()) { midiSyncConfig->raise(); - midiSyncConfig->setActiveWindow(); + midiSyncConfig->activateWindow(); } else midiSyncConfig->show(); @@ -1331,7 +1317,7 @@ void MusE::configMidiFile() if (midiFileConfig->isVisible()) { midiFileConfig->raise(); - midiFileConfig->setActiveWindow(); + midiFileConfig->activateWindow(); } else midiFileConfig->show(); @@ -1362,8 +1348,8 @@ void MidiFileConfig::updateValues() case 192: divisionIdx = 1; break; case 384: divisionIdx = 2; break; } - divisionCombo->setCurrentItem(divisionIdx); - formatCombo->setCurrentItem(config.smfFormat); + divisionCombo->setCurrentIndex(divisionIdx); + formatCombo->setCurrentIndex(config.smfFormat); extendedFormat->setChecked(config.extendedMidi); copyrightEdit->setText(config.copyright); optNoteOffs->setChecked(config.expOptimNoteOffs); @@ -1377,13 +1363,13 @@ void MidiFileConfig::updateValues() void MidiFileConfig::okClicked() { - int divisionIdx = divisionCombo->currentItem(); + int divisionIdx = divisionCombo->currentIndex(); int divisions[3] = { 96, 192, 384 }; if (divisionIdx >= 0 && divisionIdx < 3) config.midiDivision = divisions[divisionIdx]; config.extendedMidi = extendedFormat->isChecked(); - config.smfFormat = formatCombo->currentItem(); + config.smfFormat = formatCombo->currentIndex(); config.copyright = copyrightEdit->text(); config.expOptimNoteOffs = optNoteOffs->isChecked(); config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked(); @@ -1413,7 +1399,7 @@ void MusE::configGlobalSettings() if (globalSettingsConfig->isVisible()) { globalSettingsConfig->raise(); - globalSettingsConfig->setActiveWindow(); + globalSettingsConfig->activateWindow(); } else globalSettingsConfig->show(); diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index 8e77c155..203e0a63 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -969,7 +969,7 @@ void MusE::configMidiPorts() midiPortConfig = new MPConfig(0); if (midiPortConfig->isVisible()) { midiPortConfig->raise(); - midiPortConfig->setActiveWindow(); + midiPortConfig->activateWindow(); } else midiPortConfig->show(); diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index d274cee7..dc7f0cf2 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -701,7 +701,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) //snprintf(oscUrl, 1024, "%s/%s", url, synti->name().toLatin1().constData()); // snprintf(oscUrl, 1024, "%s/%s/%s", url, info.baseName().toLatin1().constData(), synti->name().toLatin1().constData()); //QString guiPath(info.path() + "/" + info.baseName()); - QString guiPath(info.dirPath() + "/" + info.baseName()); + QString guiPath(info.path() + "/" + info.baseName()); QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files); _hasGui = guiDir.exists(); diff --git a/muse2/muse/globals.cpp b/muse2/muse/globals.cpp index 72dd00fb..d87020b6 100644 --- a/muse2/muse/globals.cpp +++ b/muse2/muse/globals.cpp @@ -106,11 +106,11 @@ const char* midi_file_pattern[] = { }; */ const QStringList midi_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Midi/Kar (*.mid *.MID *.kar *.KAR *.mid.gz *.mid.bz2);;") + QString("Midi (*.mid *.MID *.mid.gz *.mid.bz2);;") + QString("Karaoke (*.kar *.KAR *.kar.gz *.kar.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); //FIXME: By T356 01/19/2010 // If saving as a compressed file (gz or bz2), @@ -147,10 +147,10 @@ const char* midi_file_save_pattern[] = { }; */ const QStringList midi_file_save_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Midi (*.mid);;") + QString("Karaoke (*.kar);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); /* const char* med_file_pattern[] = { @@ -170,18 +170,18 @@ const char* med_file_save_pattern[] = { }; */ const QStringList med_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("med Files (*.med *.med.gz *.med.bz2);;") + QString("Uncompressed med Files (*.med);;") + QString("gzip compressed med Files (*.med.gz);;") + QString("bzip2 compressed med Files (*.med.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); const QStringList med_file_save_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Uncompressed med Files (*.med);;") + QString("gzip compressed med Files (*.med.gz);;") + QString("bzip2 compressed med Files (*.med.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); /* const char* image_file_pattern[] = { @@ -194,12 +194,12 @@ const char* image_file_pattern[] = { }; */ const QStringList image_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("(*.jpg *.gif *.png);;") + QString("(*.jpg);;") + QString("(*.gif);;") + QString("(*.png);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); // Not used. /* @@ -226,16 +226,16 @@ const char* part_file_save_pattern[] = { }; */ const QStringList part_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("part Files (*.mpt *.mpt.gz *.mpt.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); const QStringList part_file_save_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("part Files (*.mpt);;") + QString("gzip compressed part Files (*.mpt.gz);;") + QString("bzip2 compressed part Files (*.mpt.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); /* const char* plug_file_pattern[] = { @@ -260,34 +260,34 @@ const char* preset_file_save_pattern[] = { }; */ const QStringList preset_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Presets (*.pre *.pre.gz *.pre.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); const QStringList preset_file_save_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Presets (*.pre);;") + QString("gzip compressed presets (*.pre.gz);;") + QString("bzip2 compressed presets (*.pre.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); const QStringList drum_map_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Presets (*.map *.map.gz *.map.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); const QStringList drum_map_file_save_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Presets (*.map);;") + QString("gzip compressed presets (*.map.gz);;") + QString("bzip2 compressed presets (*.map.bz2);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); const QStringList audio_file_pattern = - QStringList::split(";;", QT_TR_NOOP( + QT_TR_NOOP( QString("Wave/Binary (*.wav *.ogg *.bin);;") + QString("Wave (*.wav *.ogg);;") + QString("Binary (*.bin);;") + - QString("All Files (*)")) ); + QString("All Files (*)")).split(";;"); ///Qt::ButtonState globalKeyState; Qt::KeyboardModifiers globalKeyState; diff --git a/muse2/muse/globals.h b/muse2/muse/globals.h index 648af514..9d45ee65 100644 --- a/muse2/muse/globals.h +++ b/muse2/muse/globals.h @@ -10,13 +10,9 @@ #define GLOBALS_H #include <sys/types.h> -//#include <qstring.h> -//#include <qfont.h> -//#include <qnamespace.h> -//Added by qt3to4: -#include <QActionGroup> + #include <Qt3Support> -//#include <qaction.h> + #include "value.h" #include "mtc.h" #include "route.h" diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 1b695459..ee8c8e50 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -326,7 +326,7 @@ void DList::viewMousePressEvent(QMouseEvent* ev) val = 127; ///if (ev->state() & Qt::ControlButton) { - if (ev->state() & Qt::ControlModifier) { + if (ev->modifiers() & Qt::ControlModifier) { audio->msgIdle(true); // Delete all port controller events. //audio->msgChangeAllPortDrumCtrlEvents(false); @@ -690,7 +690,7 @@ void DList::viewMouseMoveEvent(QMouseEvent* ev) if (delta <= 2) return; drag = DRAG; - setCursor(QCursor(Qt::sizeVerCursor)); + setCursor(QCursor(Qt::SizeVerCursor)); redraw(); break; case NORMAL: @@ -710,7 +710,7 @@ void DList::viewMouseReleaseEvent(QMouseEvent* ev) if (drag == DRAG) { int y = ev->y(); unsigned dPitch = y / TH; - setCursor(QCursor(Qt::arrowCursor)); + setCursor(QCursor(Qt::ArrowCursor)); currentlySelected = &drumMap[int(dPitch)]; emit curDrumInstrumentChanged(dPitch); emit mapChanged(sPitch, dPitch); //Track pitch change done in canvas diff --git a/muse2/muse/midiedit/piano.cpp b/muse2/muse/midiedit/piano.cpp index ed7ac9f5..625ad564 100644 --- a/muse2/muse/midiedit/piano.cpp +++ b/muse2/muse/midiedit/piano.cpp @@ -526,7 +526,7 @@ void Piano::viewMouseMoveEvent(QMouseEvent* event) void Piano::viewMousePressEvent(QMouseEvent* event) { button = event->button(); - shift = event->state() & Qt::ShiftButton; + shift = event->modifiers() & Qt::ShiftModifier; if (keyDown != -1) { emit keyReleased(keyDown, shift); keyDown = -1; @@ -548,7 +548,7 @@ void Piano::viewMousePressEvent(QMouseEvent* event) void Piano::viewMouseReleaseEvent(QMouseEvent* event) { button = Qt::NoButton; - shift = event->state() & Qt::ShiftButton; + shift = event->modifiers() & Qt::ShiftModifier; if (keyDown != -1) { emit keyReleased(keyDown, shift); keyDown = -1; diff --git a/muse2/muse/midiedit/quantconfig.cpp b/muse2/muse/midiedit/quantconfig.cpp index b82f66d6..59f2eaba 100644 --- a/muse2/muse/midiedit/quantconfig.cpp +++ b/muse2/muse/midiedit/quantconfig.cpp @@ -27,7 +27,7 @@ const char* wtQLenTxt = QT_TR_NOOP("quantize also note len as default"); QuantConfig::QuantConfig(int s, int l, bool lenFlag) : QDialog() { - setCaption(tr("MusE: Config Quantize")); + setWindowTitle(tr("MusE: Config Quantize")); QVBoxLayout *mainlayout = new QVBoxLayout; QGridLayout* layout = new QGridLayout; diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp index 58013986..9bda29d4 100644 --- a/muse2/muse/midieditor.cpp +++ b/muse2/muse/midieditor.cpp @@ -173,7 +173,7 @@ void MidiEditor::songChanged(int type) genPartlist(); // close window if editor has no parts anymore if (parts()->empty()) { - close(false); + close(); return; } } diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index ee09ba31..c6601591 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -1015,13 +1015,13 @@ void MidiPort::writeRouting(int level, Xml& xml) const s = QT_TR_NOOP("Route"); if(r->channel != -1 && r->channel != 0) s += QString(QT_TR_NOOP(" channelMask=\"%1\"")).arg(r->channel); // Use new channel mask. - xml.tag(level++, s); + xml.tag(level++, s.toLatin1().constData()); xml.tag(level, "source mport=\"%d\"/", portno()); s = QT_TR_NOOP("dest"); 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/miditransform.cpp b/muse2/muse/miditransform.cpp index 7a32282b..1c73b7c2 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -1383,49 +1383,49 @@ void MidiTransformerDialog::presetChanged(QListWidgetItem* item) nameEntry->setText(data->cmt->name); commentEntry->setText(data->cmt->comment); - selEventOp->setCurrentItem(data->cmt->selEventOp); + selEventOp->setCurrentIndex(data->cmt->selEventOp); selEventOpSel(data->cmt->selEventOp); for (unsigned i = 0; i < sizeof(eventTypeTable)/sizeof(*eventTypeTable); ++i) { if (eventTypeTable[i] == data->cmt->selType) { - selType->setCurrentItem(i); + selType->setCurrentIndex(i); break; } } - selVal1Op->setCurrentItem(data->cmt->selVal1); + selVal1Op->setCurrentIndex(data->cmt->selVal1); selVal1OpSel(data->cmt->selVal1); - selVal2Op->setCurrentItem(data->cmt->selVal2); + selVal2Op->setCurrentIndex(data->cmt->selVal2); selVal2OpSel(data->cmt->selVal2); - selLenOp->setCurrentItem(data->cmt->selLen); + selLenOp->setCurrentIndex(data->cmt->selLen); selLenOpSel(data->cmt->selLen); - selRangeOp->setCurrentItem(data->cmt->selRange); + selRangeOp->setCurrentIndex(data->cmt->selRange); selRangeOpSel(data->cmt->selRange); - funcOp->setCurrentItem(data->cmt->funcOp); + funcOp->setCurrentIndex(data->cmt->funcOp); funcOpSel(data->cmt->funcOp); // TransformOperator procEvent: Keep, Fix - procEventOp->setCurrentItem(data->cmt->procEvent == Fix); + procEventOp->setCurrentIndex(data->cmt->procEvent == Fix); procEventOpSel(data->cmt->procEvent); - procVal1Op->setCurrentItem(data->cmt->procVal1); + procVal1Op->setCurrentIndex(data->cmt->procVal1); procVal1OpSel(data->cmt->procVal1); for (unsigned i = 0; i < sizeof(procVal2Map)/sizeof(*procVal2Map); ++i) { if (procVal2Map[i] == data->cmt->procVal2) { - procVal2Op->setCurrentItem(i); + procVal2Op->setCurrentIndex(i); break; } } - procLenOp->setCurrentItem(data->cmt->procLen); + procLenOp->setCurrentIndex(data->cmt->procLen); procLenOpSel(data->cmt->procLen); - procPosOp->setCurrentItem(data->cmt->procPos); + procPosOp->setCurrentIndex(data->cmt->procPos); procPosOpSel(data->cmt->procPos); selVal1aChanged(data->cmt->selVal1a); @@ -1475,7 +1475,7 @@ void MidiTransformerDialog::nameChanged(const QString& s) void MidiTransformerDialog::commentChanged() { - data->cmt->comment = commentEntry->text(); + data->cmt->comment = commentEntry->toPlainText(); } //-----------------------------op---------------------------- diff --git a/muse2/muse/mixer/meter.cpp b/muse2/muse/mixer/meter.cpp index aae380f3..a25aef95 100644 --- a/muse2/muse/mixer/meter.cpp +++ b/muse2/muse/mixer/meter.cpp @@ -116,6 +116,7 @@ void Meter::paintEvent(QPaintEvent*) else yv = val == 0 ? h : int(((maxScale - val) * h)/range); + // ORCAN - FIXME */ bitBlt(this, fw, fw, &bgPm, 0, 0, -1, yv, true); // CopyROP, true); ddskrjo bitBlt(this, fw, fw+yv, &fgPm, 0, yv, -1, h-yv, true); //CopyROP, true); ddskrjo diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 507d32ae..7786424a 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -651,7 +651,7 @@ Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi) // EnsembleLite (EnsLite VST) has the flag set, but it is a vst synth and is not involved here! // Yet many (all?) ladspa vst effect plugins exhibit this problem. // Changed by Tim. p3.3.14 - if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace)) + if ((_inports != _outports) || (fi.completeBaseName() == QString("dssi-vst") && !config.vstInPlace)) _inPlaceCapable = false; } @@ -825,7 +825,7 @@ int Plugin::incReferences(int val) _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(plugin->Properties); // Blacklist vst plugins in-place configurable for now. - if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace)) + if ((_inports != _outports) || (fi.completeBaseName() == QString("dssi-vst") && !config.vstInPlace)) _inPlaceCapable = false; } } @@ -927,10 +927,10 @@ double Plugin::defaultValue(unsigned long port) const static void loadPluginLib(QFileInfo* fi) { - void* handle = dlopen(fi->filePath().ascii(), RTLD_NOW); + void* handle = dlopen(fi->filePath().toAscii().constData(), RTLD_NOW); if (handle == 0) { fprintf(stderr, "dlopen(%s) failed: %s\n", - fi->filePath().ascii(), dlerror()); + fi->filePath().toAscii().constData(), dlerror()); return; } @@ -953,7 +953,7 @@ static void loadPluginLib(QFileInfo* fi) !descr->run_multiple_synths_adding) { // Make sure it doesn't already exist. - if(plugins.find(fi->baseName(true), QString(descr->LADSPA_Plugin->Label)) != 0) + if(plugins.find(fi->completeBaseName(), QString(descr->LADSPA_Plugin->Label)) != 0) continue; #ifdef PLUGIN_DEBUGIN @@ -983,7 +983,7 @@ static void loadPluginLib(QFileInfo* fi) "Unable to find ladspa_descriptor() function in plugin " "library file \"%s\": %s.\n" "Are you sure this is a LADSPA plugin file?\n", - fi->filePath().ascii(), + fi->filePath().toAscii().constData(), txt); } dlclose(handle); @@ -998,7 +998,7 @@ static void loadPluginLib(QFileInfo* fi) break; // Make sure it doesn't already exist. - if(plugins.find(fi->baseName(true), QString(descr->Label)) != 0) + if(plugins.find(fi->completeBaseName(), QString(descr->Label)) != 0) continue; #ifdef PLUGIN_DEBUGIN @@ -1028,7 +1028,7 @@ static void loadPluginDir(const QString& s) QDir pluginDir(s, QString("*.so")); // ddskrjo if (pluginDir.exists()) { QFileInfoList list = pluginDir.entryInfoList(); - QFileInfoListIterator it=list.begin(); + QFileInfoList::iterator it=list.begin(); while(it != list.end()) { loadPluginLib(&*it); ++it; @@ -2527,7 +2527,7 @@ int PluginI::oscControl(unsigned long port, float value) PluginDialog::PluginDialog(QWidget* parent) : QDialog(parent) { - setCaption(tr("MusE: select plugin")); + setWindowTitle(tr("MusE: select plugin")); QVBoxLayout* layout = new QVBoxLayout(this); pList = new QTreeWidget(this); @@ -2813,7 +2813,7 @@ PluginGui::PluginGui(PluginIBase* p) gw = 0; params = 0; plugin = p; - setCaption(plugin->name()); + setWindowTitle(plugin->name()); QToolBar* tools = addToolBar(tr("File Buttons")); @@ -2851,7 +2851,7 @@ PluginGui::PluginGui(PluginIBase* p) // construct GUI from *.ui file // PluginLoader loader; - QFile file(uifile.name()); + QFile file(uifile.fileName()); file.open(QFile::ReadOnly); mw = loader.load(&file, this); file.close(); @@ -2864,7 +2864,8 @@ PluginGui::PluginGui(PluginIBase* p) QList<QObject*>::iterator it; for (it = l.begin(); it != l.end(); ++it) { obj = *it; - const char* name = obj->name(); + QByteArray ba = obj->objectName().toLatin1(); + const char* name = ba.constData(); if (*name !='P') continue; int parameter = -1; @@ -2876,17 +2877,18 @@ PluginGui::PluginGui(PluginIBase* p) it = l.begin(); gw = new GuiWidgets[nobj]; nobj = 0; - QSignalMapper* mapper = new QSignalMapper(this, "pluginGuiMapper"); + QSignalMapper* mapper = new QSignalMapper(this); connect(mapper, SIGNAL(mapped(int)), SLOT(guiParamChanged(int))); - QSignalMapper* mapperPressed = new QSignalMapper(this, "pluginGuiMapperPressed"); - QSignalMapper* mapperReleased = new QSignalMapper(this, "pluginGuiMapperReleased"); + QSignalMapper* mapperPressed = new QSignalMapper(this); + QSignalMapper* mapperReleased = new QSignalMapper(this); connect(mapperPressed, SIGNAL(mapped(int)), SLOT(guiParamPressed(int))); connect(mapperReleased, SIGNAL(mapped(int)), SLOT(guiParamReleased(int))); for (it = l.begin(); it != l.end(); ++it) { obj = *it; - const char* name = obj->name(); + QByteArray ba = obj->objectName().toLatin1(); + const char* name = ba.constData(); if (*name !='P') continue; int parameter = -1; @@ -2902,7 +2904,7 @@ PluginGui::PluginGui(PluginIBase* p) gw[nobj].param = parameter; gw[nobj].type = -1; - if (strcmp(obj->className(), "Slider") == 0) { + if (strcmp(obj->metaObject()->className(), "Slider") == 0) { gw[nobj].type = GuiWidgets::SLIDER; ((Slider*)obj)->setId(nobj); ((Slider*)obj)->setCursorHoming(true); @@ -2916,7 +2918,7 @@ PluginGui::PluginGui(PluginIBase* p) connect(obj, SIGNAL(sliderReleased(int)), SLOT(guiSliderReleased(int))); connect(obj, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(guiSliderRightClicked(const QPoint &, int))); } - else if (strcmp(obj->className(), "DoubleLabel") == 0) { + else if (strcmp(obj->metaObject()->className(), "DoubleLabel") == 0) { gw[nobj].type = GuiWidgets::DOUBLE_LABEL; ((DoubleLabel*)obj)->setId(nobj); for(int i = 0; i < nobj; i++) @@ -2929,18 +2931,18 @@ PluginGui::PluginGui(PluginIBase* p) } connect(obj, SIGNAL(valueChanged(double,int)), mapper, SLOT(map())); } - else if (strcmp(obj->className(), "QCheckBox") == 0) { + else if (strcmp(obj->metaObject()->className(), "QCheckBox") == 0) { gw[nobj].type = GuiWidgets::QCHECKBOX; connect(obj, SIGNAL(toggled(bool)), mapper, SLOT(map())); connect(obj, SIGNAL(pressed()), mapperPressed, SLOT(map())); connect(obj, SIGNAL(released()), mapperReleased, SLOT(map())); } - else if (strcmp(obj->className(), "QComboBox") == 0) { + else if (strcmp(obj->metaObject()->className(), "QComboBox") == 0) { gw[nobj].type = GuiWidgets::QCOMBOBOX; connect(obj, SIGNAL(activated(int)), mapper, SLOT(map())); } else { - printf("unknown widget class %s\n", obj->className()); + printf("unknown widget class %s\n", obj->metaObject()->className()); continue; } ++nobj; @@ -3052,7 +3054,8 @@ PluginGui::PluginGui(PluginIBase* p) grid->addWidget(params[i].actuator, i, 2); } else if (params[i].type == GuiParam::GUI_SWITCH) { - grid->addMultiCellWidget(params[i].actuator, i, i, 0, 2); + //grid->addMultiCellWidget(params[i].actuator, i, i, 0, 2); + grid->addWidget(params[i].actuator, i, 0, 1, 3); } if (params[i].type == GuiParam::GUI_SLIDER) { connect(params[i].actuator, SIGNAL(sliderMoved(double,int)), SLOT(sliderChanged(double,int))); @@ -3405,7 +3408,7 @@ void PluginGui::bypassToggled(bool val) void PluginGui::setOn(bool val) { onOff->blockSignals(true); - onOff->setOn(val); + onOff->setChecked(val); onOff->blockSignals(false); } @@ -3453,7 +3456,7 @@ void PluginGui::updateValues() ((QCheckBox*)widget)->setChecked(int(val)); break; case GuiWidgets::QCOMBOBOX: - ((QComboBox*)widget)->setCurrentItem(int(val)); + ((QComboBox*)widget)->setCurrentIndex(int(val)); break; } } @@ -3569,12 +3572,12 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { int n = (int) plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param)); - if(((QComboBox*)widget)->currentItem() != n) + if(((QComboBox*)widget)->currentIndex() != n) { //printf("PluginGui::updateControls combobox\n"); ((QComboBox*)widget)->blockSignals(true); - ((QComboBox*)widget)->setCurrentItem(n); + ((QComboBox*)widget)->setCurrentIndex(n); ((QComboBox*)widget)->blockSignals(false); } } @@ -3614,7 +3617,7 @@ void PluginGui::guiParamChanged(int idx) val = double(((QCheckBox*)w)->isChecked()); break; case GuiWidgets::QCOMBOBOX: - val = double(((QComboBox*)w)->currentItem()); + val = double(((QComboBox*)w)->currentIndex()); break; } @@ -3634,7 +3637,7 @@ void PluginGui::guiParamChanged(int idx) ((QCheckBox*)widget)->setChecked(int(val)); break; case GuiWidgets::QCOMBOBOX: - ((QComboBox*)widget)->setCurrentItem(int(val)); + ((QComboBox*)widget)->setCurrentIndex(int(val)); break; } } @@ -3700,7 +3703,7 @@ void PluginGui::guiParamPressed(int idx) track->startAutoRecord(id, val); break; case GuiWidgets::QCOMBOBOX: - double val = (double)((ComboBox*)w)->currentItem(); + double val = (double)((ComboBox*)w)->currentIndex(); track->startAutoRecord(id, val); break; } @@ -3745,7 +3748,7 @@ void PluginGui::guiParamReleased(int idx) track->stopAutoRecord(id, param); break; case GuiWidgets::QCOMBOBOX: - double val = (double)((ComboBox*)w)->currentItem(); + double val = (double)((ComboBox*)w)->currentIndex(); track->stopAutoRecord(id, param); break; } @@ -3802,7 +3805,7 @@ void PluginGui::guiSliderPressed(int idx) ((QCheckBox*)widget)->setChecked(int(val)); break; case GuiWidgets::QCOMBOBOX: - ((QComboBox*)widget)->setCurrentItem(int(val)); + ((QComboBox*)widget)->setCurrentIndex(int(val)); break; } } @@ -3855,9 +3858,9 @@ void PluginGui::guiSliderRightClicked(const QPoint &p, int idx) QWidget* PluginLoader::createWidget(const QString & className, QWidget * parent, const QString & name) { if(className == QString("DoubleLabel")) - return new DoubleLabel(parent, name); + return new DoubleLabel(parent, name.toLatin1().constData()); if(className == QString("Slider")) - return new Slider(parent, name, Qt::Horizontal); + return new Slider(parent, name.toLatin1().constData(), Qt::Horizontal); return QUiLoader::createWidget(className, parent, name); }; diff --git a/muse2/muse/route.cpp b/muse2/muse/route.cpp index c40b4397..2b0fb4cf 100644 --- a/muse2/muse/route.cpp +++ b/muse2/muse/route.cpp @@ -1360,7 +1360,7 @@ void Route::read(Xml& xml) else if(rtype == JACK_ROUTE) { - void* jport = audioDevice->findPort(s); + void* jport = audioDevice->findPort(s.toLatin1().constData()); if(jport == 0) printf("Route::read(): jack port <%s> not found\n", s.toLatin1().constData()); else diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp index b81ed0c9..05a7a94b 100644 --- a/muse2/muse/shortcuts.cpp +++ b/muse2/muse/shortcuts.cpp @@ -300,7 +300,7 @@ void readShortCuts(Xml& xml) switch (token) { case Xml::TagStart: { if (tag.length()) { - int index = getShrtByTag(tag); + int index = getShrtByTag(tag.toAscii().constData()); if (index == -1) //No such tag found printf("Config file might be corrupted. Unknown shortcut: %s\n",tag.toLatin1().constData()); else { diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 465bc257..dded4c10 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -72,8 +72,9 @@ class RoutingMenuItem : public QCustomMenuItem //--------------------------------------------------------- Song::Song(const char* name) - :QObject(0, name) + :QObject(0) { + setObjectName(name); _recRaster = 0; // Set to measure, the same as Arranger intial value. Arranger snap combo will set this. noteFifoSize = 0; noteFifoWindex = 0; @@ -1003,7 +1004,7 @@ void Song::setLoop(bool f) { if (loopFlag != f) { loopFlag = f; - loopAction->setOn(loopFlag); + loopAction->setChecked(loopFlag); emit loopChanged(loopFlag); } } @@ -1084,7 +1085,7 @@ void Song::setRecord(bool f, bool autoRecEnable) if (audio->isPlaying() && f) f = false; recordFlag = f; - recordAction->setOn(recordFlag); + recordAction->setChecked(recordFlag); emit recordChanged(recordFlag); } } @@ -1098,7 +1099,7 @@ void Song::setPunchin(bool f) { if (punchinFlag != f) { punchinFlag = f; - punchinAction->setOn(punchinFlag); + punchinAction->setChecked(punchinFlag); emit punchinChanged(punchinFlag); } } @@ -1112,7 +1113,7 @@ void Song::setPunchout(bool f) { if (punchoutFlag != f) { punchoutFlag = f; - punchoutAction->setOn(punchoutFlag); + punchoutAction->setChecked(punchoutFlag); emit punchoutChanged(punchoutFlag); } } @@ -1171,7 +1172,7 @@ void Song::setPlay(bool f) } // only allow the user to set the button "on" if (!f) - playAction->setOn(true); + playAction->setChecked(true); else audio->msgPlay(true); } @@ -1185,7 +1186,7 @@ void Song::setStop(bool f) } // only allow the user to set the button "on" if (!f) - stopAction->setOn(true); + stopAction->setChecked(true); else audio->msgPlay(false); } @@ -1197,8 +1198,8 @@ void Song::setStopPlay(bool f) emit playChanged(f); // signal transport window - playAction->setOn(f); - stopAction->setOn(!f); + playAction->setChecked(f); + stopAction->setChecked(!f); stopAction->blockSignals(false); playAction->blockSignals(false); @@ -2201,8 +2202,8 @@ void Song::seqSignal(int fd) { // give the user a sensible explanation - int btn = QMessageBox::critical( muse, tr(QString("Jack shutdown!")), - tr(QString("Jack has detected a performance problem which has lead to\n" + int btn = QMessageBox::critical( muse, tr("Jack shutdown!"), + tr("Jack has detected a performance problem which has lead to\n" "MusE being disconnected.\n" "This could happen due to a number of reasons:\n" "- a performance issue with your particular setup.\n" @@ -2216,7 +2217,7 @@ void Song::seqSignal(int fd) " homepage which is available through the help menu)\n" "\n" "To proceed check the status of Jack and try to restart it and then .\n" - "click on the Restart button.")), "restart", "cancel"); + "click on the Restart button."), "restart", "cancel"); if (btn == 0) { printf("restarting!\n"); muse->seqRestart(); @@ -2344,7 +2345,7 @@ void Song::recordEvent(MidiTrack* mt, Event& event) // execAutomationCtlPopup //--------------------------------------------------------- -int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& /*menupos*/, int acid) +int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int acid) { //enum { HEADER, SEP1, PREV_EVENT, NEXT_EVENT, SEP2, ADD_EVENT, CLEAR_EVENT, CLEAR_RANGE, CLEAR_ALL_EVENTS }; enum { HEADER, PREV_EVENT, NEXT_EVENT, SEP2, ADD_EVENT, CLEAR_EVENT, CLEAR_RANGE, CLEAR_ALL_EVENTS }; @@ -2390,37 +2391,47 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& /*menupos*/, i //menu->insertSeparator(SEP1); - menu->insertItem(tr("previous event"), PREV_EVENT, PREV_EVENT); - menu->setItemEnabled(PREV_EVENT, canSeekPrev); + QAction* prevEvent = menu->addAction(tr("previous event")); + prevEvent->setData(PREV_EVENT); + prevEvent->setEnabled(canSeekPrev); - menu->insertItem(tr("next event"), NEXT_EVENT, NEXT_EVENT); - menu->setItemEnabled(NEXT_EVENT, canSeekNext); + QAction* nextEvent = menu->addAction(tr("next event")); + nextEvent->setData(NEXT_EVENT); + nextEvent->setEnabled(canSeekNext); - menu->insertSeparator(SEP2); + //menu->insertSeparator(SEP2); + menu->addSeparator(); + QAction* addEvent = new QAction(this); + menu->addAction(addEvent); if(isEvent) - menu->insertItem(tr("set event"), ADD_EVENT, ADD_EVENT); + addEvent->setText(tr("set event")); else - menu->insertItem(tr("add event"), ADD_EVENT, ADD_EVENT); - menu->setItemEnabled(ADD_EVENT, canAdd); - menu->insertItem(tr("erase event"), CLEAR_EVENT, CLEAR_EVENT); - menu->setItemEnabled(CLEAR_EVENT, isEvent); - - menu->insertItem(tr("erase range"), CLEAR_RANGE, CLEAR_RANGE); - menu->setItemEnabled(CLEAR_RANGE, canEraseRange); - - menu->insertItem(tr("clear automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS); - menu->setItemEnabled(CLEAR_ALL_EVENTS, (bool)count); - - // ORCAN - FIXME - /* - int sel = menu->exec(menupos, 1); - delete menu; - if (sel == -1) + addEvent->setText(tr("add event")); + addEvent->setData(ADD_EVENT); + addEvent->setEnabled(canAdd); + + QAction* eraseEventAction = menu->addAction(tr("erase event")); + eraseEventAction->setData(CLEAR_EVENT); + menu->setEnabled(isEvent); + + QAction* eraseRangeAction = menu->addAction(tr("erase range")); + eraseRangeAction->setData(CLEAR_RANGE); + eraseRangeAction->setEnabled(canEraseRange); + + QAction* clearAction = menu->addAction(tr("clear automation")); + clearAction->setData(CLEAR_ALL_EVENTS); + clearAction->setEnabled((bool)count); + + QAction* act = menu->exec(menupos); + //delete menu; + if (!act) return -1; if(!track) return -1; + + int sel = act->data().toInt(); switch(sel) { case ADD_EVENT: @@ -2454,7 +2465,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& /*menupos*/, i break; } return sel; - */ + return 0; } @@ -2462,7 +2473,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& /*menupos*/, i // execMidiAutomationCtlPopup //--------------------------------------------------------- -int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPoint& /*menupos*/, int ctlnum) +int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPoint& menupos, int ctlnum) { if(!track && !part) return -1; @@ -2570,15 +2581,19 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo // menu->insertSeparator(SEP2); + QAction* addEvent = new QAction(this); + menu->addAction(addEvent); if(isEvent) - menu->insertItem(tr("set event"), ADD_EVENT, ADD_EVENT); - else - menu->insertItem(tr("add event"), ADD_EVENT, ADD_EVENT); - //menu->setItemEnabled(ADD_EVENT, canAdd); - menu->setItemEnabled(ADD_EVENT, true); - - menu->insertItem(tr("erase event"), CLEAR_EVENT, CLEAR_EVENT); - menu->setItemEnabled(CLEAR_EVENT, isEvent); + addEvent->setText(tr("set event")); + else + addEvent->setText(tr("add event")); + addEvent->setData(ADD_EVENT); + //addEvent->setEnabled(canAdd); + addEvent->setEnabled(true); + + QAction* eraseEventAction = menu->addAction(tr("erase event")); + eraseEventAction->setData(CLEAR_EVENT); + menu->setEnabled(isEvent); // menu->insertItem(tr("erase range"), CLEAR_RANGE, CLEAR_RANGE); // menu->setItemEnabled(CLEAR_RANGE, canEraseRange); @@ -2587,16 +2602,15 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo // menu->setItemEnabled(CLEAR_ALL_EVENTS, (bool)count); -// ORCAN - FIXME -/* - int sel = menu->exec(menupos, 1); - delete menu; - if (sel == -1) + QAction* act = menu->exec(menupos); + //delete menu; + if (!act) return -1; - + //if(!part) // return -1; + int sel = act->data().toInt(); switch(sel) { case ADD_EVENT: @@ -2676,7 +2690,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo } return sel; -*/ + return 0; } @@ -3589,7 +3603,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo line = stream.readLine(); // line of text excluding '\n' if (line.startsWith("NOTE")) { - QStringList sl = QStringList::split(" ",line); + QStringList sl = line.split(" "); Event e(Note); int tick = sl[1].toInt(); @@ -3606,7 +3620,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo } if (line.startsWith("CONTROLLER")) { - QStringList sl = QStringList::split(" ",line); + QStringList sl = line.split(" "); Event e(Controller); int tick = sl[1].toInt(); @@ -3665,16 +3679,16 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver) for (QStringList::Iterator it = deliveredScriptNames.begin(); it != deliveredScriptNames.end(); it++, id++) { //menuPlugins->insertItem(*it, this, SLOT(execDeliveredScript(int)), 0, id); //menuPlugins->insertItem(*it, this, slot_deliveredscripts, 0, id); - menuPlugins->insertItem(*it, receiver, SLOT(execDeliveredScript(int)), 0, id); + menuPlugins->addAction(*it, receiver, SLOT(execDeliveredScript(int))); //id } - menuPlugins->insertSeparator(); + menuPlugins->addSeparator(); } if (userScriptNames.size() > 0) { for (QStringList::Iterator it = userScriptNames.begin(); it != userScriptNames.end(); it++, id++) { //menuPlugins->insertItem(*it, this, slot_userscripts, 0, id); - menuPlugins->insertItem(*it, receiver, SLOT(execUserScript(int)), 0, id); + menuPlugins->addAction(*it, receiver, SLOT(execUserScript(int))); //id } - menuPlugins->insertSeparator(); + menuPlugins->addSeparator(); } } return; diff --git a/muse2/muse/song.h b/muse2/muse/song.h index e5f854b0..5661fee3 100644 --- a/muse2/muse/song.h +++ b/muse2/muse/song.h @@ -9,14 +9,6 @@ #ifndef __SONG_H__ #define __SONG_H__ -#include <qstring.h> -#include <qobject.h> -#include <qfont.h> -//Added by qt3to4: -//#include <Q3PopupMenu> -#include <QMenu> -#include <QEvent> - #include "pos.h" #include "globaldefs.h" #include "tempo.h" @@ -25,6 +17,12 @@ #include "undo.h" #include "track.h" +class QFont; +class QMenu; +class QButton; +class QString; +class QStringList; + class SynthI; struct MidiMsg; struct AudioMsg; @@ -40,8 +38,6 @@ class EventList; class MarkerList; class Marker; class SNode; -class QMenu; -class QButton; class MidiPort; class MidiDevice; diff --git a/muse2/muse/stringparam.cpp b/muse2/muse/stringparam.cpp index 3444dc8b..cc2f76e6 100644 --- a/muse2/muse/stringparam.cpp +++ b/muse2/muse/stringparam.cpp @@ -74,7 +74,7 @@ void StringParamMap::read(Xml& xml, const QString& name) case Xml::End: return; case Xml::TagStart: - xml.unknown(name); + xml.unknown(name.toAscii().constData()); break; case Xml::Attribut: if(tag == "name") @@ -83,7 +83,7 @@ void StringParamMap::read(Xml& xml, const QString& name) if(tag == "val") value = xml.s2(); else - xml.unknown(name); + xml.unknown(name.toAscii().constData()); break; case Xml::TagEnd: if(tag == name) diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp index 93aa0763..defcd02e 100644 --- a/muse2/muse/synth.cpp +++ b/muse2/muse/synth.cpp @@ -204,7 +204,7 @@ void* MessSynth::instantiate(const QString& instanceName) "Unable to find msynth_descriptor() function in plugin " "library file \"%s\": %s.\n" "Are you sure this is a MESS plugin file?\n", - info.filePath().ascii(), txt); + info.filePath().toAscii().constData(), txt); undoSetuid(); return 0; } @@ -501,7 +501,7 @@ void initMidiSynth() printf("searching for software synthesizer in <%s>\n", s.toLatin1().constData()); if (pluginDir.exists()) { QFileInfoList list = pluginDir.entryInfoList(); - QFileInfoListIterator it=list.begin(); + QFileInfoList::iterator it=list.begin(); QFileInfo* fi; while(it!=list.end()) { fi = &*it; @@ -698,7 +698,7 @@ void SynthI::readProgram(Xml& xml, const QString& name) case Xml::End: return; case Xml::TagStart: - xml.unknown(name); + xml.unknown(name.toAscii().constData()); break; case Xml::Attribut: if(tag == "bankH") @@ -710,7 +710,7 @@ void SynthI::readProgram(Xml& xml, const QString& name) if(tag == "prog") _curProgram = xml.s2().toUInt(); else - xml.unknown(name); + xml.unknown(name.toAscii().constData()); break; case Xml::TagEnd: if(tag == name) diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index a90aa3c1..4cae5324 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -753,7 +753,7 @@ void Track::writeRouting(int level, Xml& xml) const ///Route dst(name(), true, r->channel); //xml.tag(level++, "Route"); - xml.tag(level++, s); + xml.tag(level++, s.toAscii().constData()); // p3.3.38 New routing scheme. ///xml.strTag(level, "srcNode", r->name()); @@ -763,7 +763,7 @@ void Track::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.toAscii().constData()); ///xml.strTag(level, "dstNode", dst.name()); @@ -810,7 +810,7 @@ void Track::writeRouting(int level, Xml& xml) const s += QString(QT_TR_NOOP(" remch=\"%1\"")).arg(r->remoteChannel); //xml.tag(level++, "Route"); - xml.tag(level++, s); + xml.tag(level++, s.toAscii().constData()); ///xml.strTag(level, "srcNode", src); //if(r->channel != -1) @@ -862,7 +862,7 @@ void Track::writeRouting(int level, Xml& xml) const else s += QString(QT_TR_NOOP(" name=\"%1\"/")).arg(Xml::xmlString(r->name())); - xml.tag(level, s); + xml.tag(level, s.toAscii().constData()); xml.etag(level--, "Route"); } diff --git a/muse2/muse/transport.cpp b/muse2/muse/transport.cpp index 0bcf1962..36b0486d 100644 --- a/muse2/muse/transport.cpp +++ b/muse2/muse/transport.cpp @@ -52,9 +52,9 @@ static QToolButton* newButton(const QString& s, const QString& tt, QToolButton* button = new QToolButton(parent); button->setFixedHeight(height); button->setText(s); - button->setToggleButton(toggle); + button->setCheckable(toggle); button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); - QToolTip::add(button, tt); + button->setToolTip(tt); return button; } @@ -63,9 +63,9 @@ static QToolButton* newButton(const QPixmap* pm, const QString& tt, { QToolButton* button = new QToolButton(parent); button->setFixedHeight(25); - button->setPixmap(*pm); - button->setToggleButton(toggle); - QToolTip::add(button, tt); + button->setIcon(QIcon(*pm)); + button->setCheckable(toggle); + button->setToolTip(tt); return button; } @@ -80,7 +80,7 @@ Handle::Handle(QWidget* r, QWidget* parent) { rootWin = r; setFixedWidth(20); - setCursor(Qt::pointingHandCursor); + setCursor(Qt::PointingHandCursor); QPalette palette; palette.setColor(this->backgroundRole(), config.transportHandleColor); this->setPalette(palette); @@ -143,10 +143,10 @@ TempoSig::TempoSig(QWidget* parent) l3->setFont(config.fonts[2]); vb1->addWidget(l3); - l1->setBackgroundMode(Qt::PaletteLight); + l1->setBackgroundRole(QPalette::Light); l1->setAlignment(Qt::AlignCenter); l1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); - l2->setBackgroundMode(Qt::PaletteLight); + l2->setBackgroundRole(QPalette::Light); l2->setAlignment(Qt::AlignCenter); l2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); l3->setAlignment(Qt::AlignCenter); @@ -212,7 +212,7 @@ void TempoSig::setTimesig(int a, int b) void Transport::setRecord(bool flag) { buttons[5]->blockSignals(true); - buttons[5]->setOn(flag); + buttons[5]->setChecked(flag); buttons[5]->blockSignals(false); } @@ -224,9 +224,10 @@ Transport::Transport(QWidget*, const char* name) // : QWidget(0, name, WStyle_Customize | WType_TopLevel | WStyle_Tool //| WStyle_NoBorder | WStyle_StaysOnTop) //: QWidget(0, name, Qt::WStyle_Customize | Qt::Window | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop) - : QWidget(0, name, Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ) // Possibly also Qt::X11BypassWindowManagerHint + : QWidget(0, Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ) // Possibly also Qt::X11BypassWindowManagerHint { - setCaption(QString("Muse: Transport")); + setObjectName(name); + setWindowTitle(QString("Muse: Transport")); setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); QHBoxLayout* hbox = new QHBoxLayout; @@ -242,9 +243,9 @@ Transport::Transport(QWidget*, const char* name) QVBoxLayout *box1 = new QVBoxLayout; recMode = new QComboBox; recMode->setFocusPolicy(Qt::NoFocus); - recMode->insertItem(tr("Overdub"), Song::REC_OVERDUP); - recMode->insertItem(tr("Replace"), Song::REC_REPLACE); - recMode->setCurrentItem(song->recMode()); + recMode->insertItem(Song::REC_OVERDUP, tr("Overdub")); + recMode->insertItem(Song::REC_REPLACE, tr("Replace")); + recMode->setCurrentIndex(song->recMode()); box1->addWidget(recMode); @@ -256,10 +257,10 @@ Transport::Transport(QWidget*, const char* name) cycleMode = new QComboBox; cycleMode->setFocusPolicy(Qt::NoFocus); - cycleMode->insertItem(tr("Normal"), Song::CYCLE_NORMAL); - cycleMode->insertItem(tr("Mix"), Song::CYCLE_MIX); - cycleMode->insertItem(tr("Replace"), Song::CYCLE_REPLACE); - cycleMode->setCurrentItem(song->cycleMode()); + cycleMode->insertItem(Song::CYCLE_NORMAL, tr("Normal")); + cycleMode->insertItem(Song::CYCLE_MIX, tr("Mix")); + cycleMode->insertItem(Song::CYCLE_REPLACE, tr("Replace")); + cycleMode->setCurrentIndex(song->cycleMode()); box1->addWidget(cycleMode); @@ -281,15 +282,15 @@ Transport::Transport(QWidget*, const char* name) QToolButton* b1 = newButton(punchinIcon, tr("punchin"), true); QToolButton* b2 = newButton(loopIcon, tr("loop"), true); - b2->setAccel(shortcuts[SHRT_TOGGLE_LOOP].key); + b2->setShortcut(shortcuts[SHRT_TOGGLE_LOOP].key); QToolButton* b3 = newButton(punchoutIcon, tr("punchout"), true); button2->addWidget(b1); button2->addWidget(b2); button2->addWidget(b3); - QToolTip::add(b1, tr("Punch In")); - QToolTip::add(b2, tr("Loop")); - QToolTip::add(b3, tr("Punch Out")); + b1->setToolTip(tr("Punch In")); + b2->setToolTip(tr("Loop")); + b3->setToolTip(tr("Punch Out")); b1->setWhatsThis(tr("Punch In")); b2->setWhatsThis(tr("Loop")); b3->setWhatsThis(tr("Punch Out")); @@ -298,13 +299,13 @@ Transport::Transport(QWidget*, const char* name) connect(b2, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool))); connect(b3, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool))); - b1->setOn(song->punchin()); - b2->setOn(song->loop()); - b3->setOn(song->punchout()); + b1->setChecked(song->punchin()); + b2->setChecked(song->loop()); + b3->setChecked(song->punchout()); - connect(song, SIGNAL(punchinChanged(bool)), b1, SLOT(setOn(bool))); - connect(song, SIGNAL(punchoutChanged(bool)), b3, SLOT(setOn(bool))); - connect(song, SIGNAL(loopChanged(bool)), b2, SLOT(setOn(bool))); + connect(song, SIGNAL(punchinChanged(bool)), b1, SLOT(setChecked(bool))); + connect(song, SIGNAL(punchoutChanged(bool)), b3, SLOT(setChecked(bool))); + connect(song, SIGNAL(loopChanged(bool)), b2, SLOT(setChecked(bool))); hbox->addLayout(button2); @@ -366,7 +367,13 @@ Transport::Transport(QWidget*, const char* name) hbox1->addWidget(time2); box4->addLayout(hbox1); - slider = new QSlider(0, 200000, 1000, 0, Qt::Horizontal); + slider = new QSlider; + slider->setMinimum(0); + slider->setMaximum(0); + slider->setPageStep(1000); + slider->setValue(0); + slider->setOrientation(Qt::Horizontal); + box4->addWidget(slider); tb = new QHBoxLayout; @@ -384,7 +391,7 @@ Transport::Transport(QWidget*, const char* name) buttons[2]->setWhatsThis(tr(fforwardTransportText)); buttons[3] = newButton(stopIcon, tr("stop"), true); - buttons[3]->setOn(true); // set STOP + buttons[3]->setChecked(true); // set STOP buttons[3]->setWhatsThis(tr(stopTransportText)); buttons[4] = newButton(playIcon, tr("play"), true); @@ -421,16 +428,16 @@ Transport::Transport(QWidget*, const char* name) quantizeButton = newButton(tr("AC"), tr("quantize during record"), true,19); clickButton = newButton(tr("Click"), tr("metronom click on/off"), true,19); - clickButton->setAccel(shortcuts[SHRT_TOGGLE_METRO].key); + clickButton->setShortcut(shortcuts[SHRT_TOGGLE_METRO].key); syncButton = newButton(tr("Sync"), tr("external sync on/off"), true,19); jackTransportButton = newButton(tr("Jack"), tr("Jack transport sync on/off"), true,19); - quantizeButton->setOn(song->quantize()); - clickButton->setOn(song->click()); - syncButton->setOn(extSyncFlag.value()); - jackTransportButton->setOn(useJackTransport.value()); + quantizeButton->setChecked(song->quantize()); + clickButton->setChecked(song->click()); + syncButton->setChecked(extSyncFlag.value()); + jackTransportButton->setChecked(useJackTransport.value()); button1->addWidget(quantizeButton); button1->addWidget(clickButton); @@ -503,8 +510,11 @@ void Transport::configChanged() l3->setFont(config.fonts[2]); l5->setFont(config.fonts[2]); l6->setFont(config.fonts[2]); - lefthandle->setBackgroundColor(config.transportHandleColor); - righthandle->setBackgroundColor(config.transportHandleColor); + + QPalette pal; + pal.setColor(lefthandle->backgroundRole(), config.transportHandleColor); + lefthandle->setPalette(pal); + righthandle->setPalette(pal); } //--------------------------------------------------------- @@ -526,8 +536,10 @@ void Transport::setTempo(int t) void Transport::setHandleColor(QColor c) { - lefthandle->setBackgroundColor(c); - righthandle->setBackgroundColor(c); + QPalette pal; + pal.setColor(lefthandle->backgroundRole(), c); + lefthandle->setPalette(pal); + righthandle->setPalette(pal); } //--------------------------------------------------------- @@ -614,8 +626,8 @@ void Transport::setPlay(bool f) { buttons[3]->blockSignals(true); buttons[4]->blockSignals(true); - buttons[3]->setOn(!f); - buttons[4]->setOn(f); + buttons[3]->setChecked(!f); + buttons[4]->setChecked(f); buttons[3]->blockSignals(false); buttons[4]->blockSignals(false); } @@ -626,7 +638,7 @@ void Transport::setPlay(bool f) void Transport::setMasterFlag(bool f) { - masterButton->setOn(f); + masterButton->setChecked(f); } //--------------------------------------------------------- @@ -636,7 +648,7 @@ void Transport::setMasterFlag(bool f) void Transport::setClickFlag(bool f) { clickButton->blockSignals(true); - clickButton->setOn(f); + clickButton->setChecked(f); clickButton->blockSignals(false); } @@ -646,7 +658,7 @@ void Transport::setClickFlag(bool f) void Transport::setQuantizeFlag(bool f) { - quantizeButton->setOn(f); + quantizeButton->setChecked(f); } //--------------------------------------------------------- @@ -655,7 +667,7 @@ void Transport::setQuantizeFlag(bool f) void Transport::setSyncFlag(bool f) { - syncButton->setOn(f); + syncButton->setChecked(f); } //--------------------------------------------------------- @@ -702,7 +714,7 @@ void Transport::songChanged(int flags) setTimesig(z, n); } if (flags & SC_MASTER) - masterButton->setOn(song->masterFlag()); + masterButton->setChecked(song->masterFlag()); } //--------------------------------------------------------- @@ -711,7 +723,7 @@ void Transport::songChanged(int flags) void Transport::syncChanged(bool flag) { - syncButton->setOn(flag); + syncButton->setChecked(flag); buttons[0]->setEnabled(!flag); // goto start buttons[1]->setEnabled(!flag); // rewind buttons[2]->setEnabled(!flag); // forward @@ -720,7 +732,7 @@ void Transport::syncChanged(bool flag) slider->setEnabled(!flag); masterButton->setEnabled(!flag); if (flag) { - masterButton->setOn(false); + masterButton->setChecked(false); song->setMasterFlag(false); tempo->setTempo(0); // slave mode: show "extern" } @@ -735,7 +747,7 @@ void Transport::syncChanged(bool flag) void Transport::jackSyncChanged(bool flag) { - jackTransportButton->setOn(flag); + jackTransportButton->setChecked(flag); } //--------------------------------------------------------- // stopToggled @@ -747,7 +759,7 @@ void Transport::stopToggled(bool val) song->setStop(true); else { buttons[3]->blockSignals(true); - buttons[3]->setOn(true); + buttons[3]->setChecked(true); buttons[3]->blockSignals(false); } } @@ -762,7 +774,7 @@ void Transport::playToggled(bool val) song->setPlay(true); else { buttons[4]->blockSignals(true); - buttons[4]->setOn(true); + buttons[4]->setChecked(true); buttons[4]->blockSignals(false); } } diff --git a/muse2/muse/transport.h b/muse2/muse/transport.h index 2c2f980e..d9932bac 100644 --- a/muse2/muse/transport.h +++ b/muse2/muse/transport.h @@ -129,7 +129,7 @@ class Transport : public QWidget public: Transport(QWidget* parent, const char* name = 0); - QColor getHandleColor() const { return lefthandle->backgroundColor(); } + QColor getHandleColor() const { return lefthandle->palette().color(QPalette::Window); } }; #endif diff --git a/muse2/muse/transpose.cpp b/muse2/muse/transpose.cpp index c7ab912d..9e99c471 100644 --- a/muse2/muse/transpose.cpp +++ b/muse2/muse/transpose.cpp @@ -17,6 +17,7 @@ Transpose::Transpose(QWidget* parent) : QDialog(parent) { setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); buttonGroup1 = new QButtonGroup(this); buttonGroup1->addButton(time_all); buttonGroup1->addButton(time_selected); @@ -94,6 +95,6 @@ void Transpose::accept() } } song->endUndo(SC_EVENT_MODIFIED); - close(true); + close(); } diff --git a/muse2/muse/value.cpp b/muse2/muse/value.cpp index 0acfc6e0..dfdbe1ad 100644 --- a/muse2/muse/value.cpp +++ b/muse2/muse/value.cpp @@ -11,12 +11,14 @@ IValue::IValue(QObject* parent, const char* name) - : QObject(parent, name) + : QObject(parent) { + setObjectName(name); } BValue::BValue(QObject* parent, const char* name) - : QObject(parent, name) + : QObject(parent) { + setObjectName(name); } //--------------------------------------------------------- @@ -25,7 +27,7 @@ BValue::BValue(QObject* parent, const char* name) void BValue::save(int level, Xml& xml) { - xml.intTag(level, name(), val); + xml.intTag(level, objectName().toLatin1().constData(), val); } //--------------------------------------------------------- @@ -34,7 +36,7 @@ void BValue::save(int level, Xml& xml) void IValue::save(int level, Xml& xml) { - xml.intTag(level, name(), val); + xml.intTag(level, objectName().toLatin1().constData(), val); } //--------------------------------------------------------- diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index 347bd972..20a0e13d 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -100,7 +100,7 @@ bool SndFile::openRead() writeFlag = false; openFlag = true; - QString cacheName = finfo->dirPath(true) + QString("/") + finfo->baseName(true) + QString(".wca"); + QString cacheName = finfo->absolutePath() + QString("/") + finfo->completeBaseName() + QString(".wca"); readCache(cacheName, true); return false; } @@ -115,8 +115,8 @@ void SndFile::update() close(); // force recreation of wca data - QString cacheName = finfo->dirPath(true) + - QString("/") + finfo->baseName(true) + QString(".wca"); + QString cacheName = finfo->absolutePath() + + QString("/") + finfo->completeBaseName() + QString(".wca"); ::remove(cacheName.toLatin1().constData()); if (openRead()) { printf("SndFile::update openRead(%s) failed: %s\n", path().toLatin1().constData(), strerror().toLatin1().constData()); @@ -346,8 +346,8 @@ bool SndFile::openWrite() if (sf) { openFlag = true; writeFlag = true; - QString cacheName = finfo->dirPath(true) + - QString("/") + finfo->baseName(true) + QString(".wca"); + QString cacheName = finfo->absolutePath() + + QString("/") + finfo->completeBaseName() + QString(".wca"); readCache(cacheName, true); } return sf == 0; @@ -382,7 +382,7 @@ void SndFile::remove() QString SndFile::basename() const { - return finfo->baseName(true); + return finfo->completeBaseName(); } QString SndFile::path() const @@ -392,7 +392,7 @@ QString SndFile::path() const QString SndFile::dirPath() const { - return finfo->dirPath(true); + return finfo->absolutePath(); } QString SndFile::name() const @@ -648,7 +648,7 @@ SndFile* getWave(const QString& inName, bool readOnlyFlag) error = f->openWrite(); // if peak cache is older than wave file we reaquire the cache QFileInfo wavinfo(name); - QString cacheName = wavinfo.dirPath(true) + QString("/") + wavinfo.baseName(true) + QString(".wca"); + QString cacheName = wavinfo.absolutePath() + QString("/") + wavinfo.completeBaseName() + QString(".wca"); QFileInfo wcainfo(cacheName); if (!wcainfo.exists() || wcainfo.lastModified() < wavinfo.lastModified()) { //printf("wcafile is older or does not exist!\n"); @@ -681,7 +681,7 @@ SndFile* getWave(const QString& inName, bool readOnlyFlag) else { // if peak cache is older than wave file we reaquire the cache QFileInfo wavinfo(name); - QString cacheName = wavinfo.dirPath(true) + QString("/") + wavinfo.baseName(true) + QString(".wca"); + QString cacheName = wavinfo.absolutePath() + QString("/") + wavinfo.completeBaseName() + QString(".wca"); QFileInfo wcainfo(cacheName); if (!wcainfo.exists() || wcainfo.lastModified() < wavinfo.lastModified()) { //printf("wcafile is older or does not exist!\n"); @@ -859,7 +859,7 @@ bool MusE::importWaveToTrack(QString& name, unsigned tick, Track* track) event.setLenFrame(samples); part->addEvent(event); - part->setName(QFileInfo(name).baseName(true)); + part->setName(QFileInfo(name).completeBaseName()); audio->msgAddPart(part); unsigned endTick = part->tick() + part->lenTick(); if (song->len() < endTick) diff --git a/muse2/muse/widgets/combobox.cpp b/muse2/muse/widgets/combobox.cpp index 4d8ba519..cf7442ec 100644 --- a/muse2/muse/widgets/combobox.cpp +++ b/muse2/muse/widgets/combobox.cpp @@ -24,7 +24,7 @@ ComboBox::ComboBox(QWidget* parent, const char* name) _currentItem = 0; _id = -1; list = new QMenu(0); - connect(list, SIGNAL(activated(int)), SLOT(activatedIntern(int))); + connect(list, SIGNAL(triggered(QAction*)), SLOT(activatedIntern(QAction*))); setFrameStyle(QFrame::Panel | QFrame::Raised); setLineWidth(2); } @@ -47,11 +47,11 @@ void ComboBox::mousePressEvent(QMouseEvent*) // activated //--------------------------------------------------------- -void ComboBox::activatedIntern(int n) +void ComboBox::activatedIntern(QAction* act) { - _currentItem = n; - emit activated(n, _id); - setText(list->text(_currentItem)); + _currentItem = act->data().toInt(); + emit activated(_currentItem, _id); + setText(act->text()); } //--------------------------------------------------------- @@ -61,7 +61,15 @@ void ComboBox::activatedIntern(int n) void ComboBox::setCurrentItem(int i) { _currentItem = i; - setText(list->text(list->idAt(_currentItem))); + // ORCAN - CHECK + QList<QAction *> actions = list->actions(); + for (QList<QAction *>::iterator it = actions.begin(); it != actions.end(); ++it) { + QAction* act = *it; + if (act->data().toInt() == i) { + setText(act->text()); + break; + } + } } //--------------------------------------------------------- diff --git a/muse2/muse/widgets/combobox.h b/muse2/muse/widgets/combobox.h index 54ed597d..eea9bb94 100644 --- a/muse2/muse/widgets/combobox.h +++ b/muse2/muse/widgets/combobox.h @@ -28,7 +28,7 @@ class ComboBox : public QLabel { virtual void mousePressEvent(QMouseEvent*); private slots: - void activatedIntern(int); + void activatedIntern(QAction*); signals: void activated(int val, int id); |