From 9ad9a5c46c41d66100c7291173a269b5e744b361 Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Sat, 4 Dec 2010 04:46:04 +0000 Subject: Bunch of minor ports and cleanups. See ChangeLog. --- muse2/ChangeLog | 2 ++ muse2/muse/arranger/arranger.cpp | 2 +- muse2/muse/arranger/arranger.h | 4 +-- muse2/muse/arranger/tlist.cpp | 2 +- muse2/muse/arranger/tlist.h | 6 ++-- muse2/muse/midiedit/dcanvas.cpp | 8 ++--- muse2/muse/midiedit/dcanvas.h | 12 ++++--- muse2/muse/midiedit/drumedit.cpp | 2 +- muse2/muse/midiedit/drumedit.h | 2 +- muse2/muse/osc.cpp | 44 ++++++++++++++++---------- muse2/muse/osc.h | 5 +-- muse2/muse/song.cpp | 22 ++++++------- muse2/muse/wave.cpp | 19 ++++++----- muse2/muse/wave.h | 4 +-- muse2/muse/widgets/header.cpp | 68 +++++----------------------------------- muse2/muse/widgets/header.h | 28 ++--------------- 16 files changed, 81 insertions(+), 149 deletions(-) (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 37977eb4..153e7ee6 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -4,6 +4,8 @@ - Fixed arranger menu cut/copy enabling. Was never right before. Test OK cut and copy. (Tim) - Completed port of MidiInstrument. Fixed its populatePatchPopup(), which fixes midi trackinfo instrument selection not updating h-bank, l-bank, and prog spinboxes. (Tim) + - Some cleanups: Remove the old Header class. Rename HeaderNew to Header. (Orcan) + - Ported: osc, wave, dcanvas. (Orcan) 02.12.2010 - Ported alayout, tlist, arranger (Orcan) - Minor tweak in the HeaderNew API to set column widths easier. Also commented out the diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index c15492ae..4a79b1c2 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -249,7 +249,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) ib->setOn(showTrackinfoFlag); connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool))); - header = new HeaderNew(tracklist); + header = new Header(tracklist); header->setFixedHeight(30); diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index 439f55fc..a642c7a8 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -23,7 +23,7 @@ class QScrollBar; class QToolButton; class QWheelEvent; -class HeaderNew; +class Header; class TList; class ScrollScale; class MTScale; @@ -80,7 +80,7 @@ class Arranger : public QWidget { ScrollScale* hscroll; QScrollBar* vscroll; TList* list; - HeaderNew* header; + Header* header; MTScale* time; SpinBox* lenEntry; bool showTrackinfoFlag; diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index f2a3677e..e9ed1a88 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -55,7 +55,7 @@ static const int WHEEL_DELTA = 120; // TList //--------------------------------------------------------- -TList::TList(HeaderNew* hdr, QWidget* parent, const char* name) +TList::TList(Header* hdr, QWidget* parent, const char* name) : QWidget(parent, name, Qt::WNoAutoErase | Qt::WResizeNoErase) { ypos = 0; diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 4e911711..de631e47 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -21,7 +21,7 @@ class QWheelEvent; class ScrollScale; class Track; class Xml; -class HeaderNew; +class Header; enum TrackColumn { COL_RECORD = 0, @@ -52,7 +52,7 @@ class TList : public QWidget { bool resizeFlag; // true if resize cursor is shown - HeaderNew* header; + Header* header; QScrollBar* scroll; QLineEdit* editor; Track* editTrack; @@ -103,7 +103,7 @@ class TList : public QWidget { void selectTrackBelow(); public: - TList(HeaderNew*, QWidget* parent, const char* name); + TList(Header*, QWidget* parent, const char* name); void setScroll(QScrollBar* s) { scroll = s; } Track* track() const { return editTrack; } void writeStatus(int level, Xml&, const char* name) const; diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 17a4ac88..3c2895d6 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -9,10 +9,8 @@ #include #include #include - -//Added by qt3to4: #include -#include +#include #include #include #include @@ -484,7 +482,7 @@ void DrumCanvas::drawItem(QPainter&p, const CItem*item, const QRect& rect) int x = 0, y = 0; x = mapx(item->pos().x()); y = mapy(item->pos().y()); - Q3PointArray pa(4); + QPolygon pa(4); pa.setPoint(0, x - CARET2, y); pa.setPoint(1, x, y - CARET2); pa.setPoint(2, x + CARET2, y); @@ -542,7 +540,7 @@ void DrumCanvas::drawMoving(QPainter& p, const CItem* item, const QRect& rect) // return; //if(!item->isMoving()) // return; - Q3PointArray pa(4); + QPolygon pa(4); QPoint pt = map(item->mp()); int x = pt.x(); int y = pt.y(); diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 2b93ddae..996608bd 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -10,14 +10,16 @@ #include "ecanvas.h" #include "song.h" -#include -#include -#include -#include -#include #define TH 18 + +class QResizeEvent; +class QDragEnterEvent; +class QDropEvent; +class QDragMoveEvent; +class QDragLeaveEvent; + class MidiEditor; //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 44a6682e..62241b10 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -357,7 +357,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini // // Reihenfolge in dlist.c festgeschrieben ("Dcols") // - header = new HeaderNew(split1w1, "header"); + header = new Header(split1w1, "header"); header->setFixedHeight(31); header->setColumnLabel(tr("M"), COL_MUTE, 20); header->setColumnLabel(tr("Sound"), COL_NAME, 120); diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index 39f68deb..37473aaf 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -60,7 +60,7 @@ class DrumEdit : public MidiEditor { Splitter* split2; QWidget* split1w1; DList* dlist; - HeaderNew* header; + Header* header; QToolBar* tools; static int _quantInit, _rasterInit; diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp index 74b703c3..bb65f695 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -34,14 +34,14 @@ #include //#include //#include -//#include -#include -#include -#include -#include -//#include -#include -#include + +#include +#include +#include +#include +#include +#include + #include #ifdef DSSI_SUPPORT @@ -482,7 +482,7 @@ OscIF::~OscIF() // kill(guiPid, SIGHUP); if(_oscGuiQProc) { - if(_oscGuiQProc->isRunning()) + if(_oscGuiQProc->state()) { #ifdef OSC_DEBUG printf("OscIF::~OscIF terminating _oscGuiQProc\n"); @@ -493,7 +493,7 @@ OscIF::~OscIF() // it terminates the process the hard way. The timeout should be chosen depending on the time the // process needs to do all its cleanup: use a higher value if the process is likely to do a lot of // computation or I/O on cleanup." - _oscGuiQProc->tryTerminate(); + _oscGuiQProc->terminate(); QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) ); } //delete _oscGuiQProc; @@ -688,7 +688,7 @@ int OscIF::oscExiting(lo_arg**) if(_oscGuiQProc) { - if(_oscGuiQProc->isRunning()) + if(_oscGuiQProc->state()) { #ifdef OSC_DEBUG printf("OscIF::oscExiting terminating _oscGuiQProc\n"); @@ -699,7 +699,7 @@ int OscIF::oscExiting(lo_arg**) // it terminates the process the hard way. The timeout should be chosen depending on the time the // process needs to do all its cleanup: use a higher value if the process is likely to do a lot of // computation or I/O on cleanup." - _oscGuiQProc->tryTerminate(); + _oscGuiQProc->terminate(); QTimer::singleShot( 5000, _oscGuiQProc, SLOT( kill() ) ); } //delete _oscGuiQProc; @@ -827,7 +827,7 @@ bool OscIF::oscInitGui(const QString& typ, const QString& baseName, const QStrin const QString& label, const QString& filePath, const QString& dirPath) { // Are we already running? We don't want to allow another process do we... - if((_oscGuiQProc != 0) && (_oscGuiQProc->isRunning())) + if((_oscGuiQProc != 0) && (_oscGuiQProc->state())) return true; if(!url) @@ -949,8 +949,16 @@ bool OscIF::oscInitGui(const QString& typ, const QString& baseName, const QStrin { // No QProcess created yet? Do it now. Only once per SynthIF instance. Exists until parent destroyed. if(_oscGuiQProc == 0) - _oscGuiQProc = new Q3Process(muse); + _oscGuiQProc = new QProcess(muse); + QString program(fi.filePath()); + QStringList arguments; + arguments << oscUrl + << filePath + << name + << QString("channel-1"); + + /* Leave out Qt3 stuff for reference - Orcan: // Don't forget this, he he... _oscGuiQProc->clearArguments(); @@ -963,12 +971,14 @@ bool OscIF::oscInitGui(const QString& typ, const QString& baseName, const QStrin //_oscGuiQProc->addArgument(synth->name()); _oscGuiQProc->addArgument(name); _oscGuiQProc->addArgument(QString("channel-1")); - + */ #ifdef OSC_DEBUG fprintf(stderr, "OscIF::oscInitGui starting QProcess\n"); #endif + _oscGuiQProc->start(program, arguments); + - if(_oscGuiQProc->start() == TRUE) + if(_oscGuiQProc->state()) { #ifdef OSC_DEBUG fprintf(stderr, "OscIF::oscInitGui started QProcess\n"); @@ -1051,7 +1061,7 @@ void OscIF::oscShowGui(bool v) return; //if(guiPid == -1) - if((_oscGuiQProc == 0) || (!_oscGuiQProc->isRunning())) + if((_oscGuiQProc == 0) || (!_oscGuiQProc->state())) { // We need an indicator that update was called - update must have been called to get new path etc... // If the process is not running this path is invalid, right? diff --git a/muse2/muse/osc.h b/muse2/muse/osc.h index dbd8294a..8e093e2c 100644 --- a/muse2/muse/osc.h +++ b/muse2/muse/osc.h @@ -29,7 +29,8 @@ class DssiSynthIF; #endif -class Q3Process; +class QProcess; +class QString; class PluginI; class OscIF; @@ -126,7 +127,7 @@ class OscIF class OscIF { protected: - Q3Process* _oscGuiQProc; + QProcess* _oscGuiQProc; void* _uiOscTarget; char* _uiOscPath; char* _uiOscSampleRatePath; diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 98d9875c..a4c638a1 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -9,17 +9,13 @@ #include #include #include -#include -#include -//#include + +#include +#include #include -#include -#include -#include -#include -//#include -//Added by qt3to4: -#include +#include +#include +#include #include "app.h" #include "driver/jackmidi.h" @@ -2340,7 +2336,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 }; @@ -2458,7 +2454,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a // 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; @@ -3579,7 +3575,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo QFile file(tmp); if ( file.open( QIODevice::ReadOnly ) ) { - Q3TextStream stream( &file ); + QTextStream stream( &file ); QString line; while ( !stream.atEnd() ) { line = stream.readLine(); // line of text excluding '\n' diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index 761df539..b74858dd 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -9,11 +9,11 @@ #include #include #include -#include #include -#include -#include -#include + +#include +#include +#include #include "xml.h" #include "song.h" @@ -156,13 +156,12 @@ void SndFile::readCache(const QString& path, bool showProgress) //--------------------------------------------------- // create cache //--------------------------------------------------- - - Q3ProgressDialog* progress = 0; + QProgressDialog* progress = 0; if (showProgress) { QString label(QWidget::tr("create peakfile for ")); label += basename(); - progress = new Q3ProgressDialog(label, - QString::null, csize, 0, 0, true); + progress = new QProgressDialog(label, + QString::null, 0, csize, 0); progress->setMinimumDuration(0); progress->show(); } @@ -176,7 +175,7 @@ void SndFile::readCache(const QString& path, bool showProgress) interval = 1; for (int i = 0; i < csize; i++) { if (showProgress && ((i % interval) == 0)) - progress->setProgress(i); + progress->setValue(i); seek(i * cacheMag, 0); read(channels(), fp, cacheMag); for (unsigned ch = 0; ch < channels(); ++ch) { @@ -199,7 +198,7 @@ void SndFile::readCache(const QString& path, bool showProgress) } } if (showProgress) - progress->setProgress(csize); + progress->setValue(csize); writeCache(path); if (showProgress) delete progress; diff --git a/muse2/muse/wave.h b/muse2/muse/wave.h index f83e5bdb..4ef0a86a 100644 --- a/muse2/muse/wave.h +++ b/muse2/muse/wave.h @@ -9,11 +9,11 @@ #ifndef __WAVE_H__ #define __WAVE_H__ -#include #include -#include #include +class QFileInfo; +class QString; class Xml; //--------------------------------------------------------- diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index f82c7c22..548ee94c 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -7,11 +7,10 @@ #include "header.h" #include "xml.h" -#include - +#include #include -/* + //--------------------------------------------------------- // readStatus //--------------------------------------------------------- @@ -53,59 +52,6 @@ void Header::readStatus(Xml& xml) //--------------------------------------------------------- void Header::writeStatus(int level, Xml& xml) const - { - //xml.nput(level, "<%s> ", name()); - xml.nput(level, "<%s> ", Xml::xmlString(name()).latin1()); - int n = count() - 1; - for (int i = n; i >= 0; --i) - xml.nput("%d ", mapToSection(i)); - //xml.put("", name()); - xml.put("", Xml::xmlString(name()).latin1()); - } -*/ - - -//--------------------------------------------------------- -// readStatus -//--------------------------------------------------------- - -void HeaderNew::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::Text: - { - QStringList l = QStringList::split(QString(" "), tag); - int index = count(); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - int section = (*it).toInt(); - moveSection(section, index); - --index; - } - } - break; - case Xml::TagStart: - xml.unknown("Header"); - break; - case Xml::TagEnd: - if (tag == name()) - return; - default: - break; - } - } - } - -//--------------------------------------------------------- -// writeStatus -//--------------------------------------------------------- - -void HeaderNew::writeStatus(int level, Xml& xml) const { //xml.nput(level, "<%s> ", name()); xml.nput(level, "<%s> ", Xml::xmlString(name()).latin1()); @@ -117,10 +63,10 @@ void HeaderNew::writeStatus(int level, Xml& xml) const } //--------------------------------------------------------- -// HeaderNew +// Header //--------------------------------------------------------- -HeaderNew::HeaderNew(QWidget* parent, const char* name) +Header::Header(QWidget* parent, const char* name) : QHeaderView(Qt::Horizontal, parent) { setObjectName(name); @@ -134,7 +80,7 @@ HeaderNew::HeaderNew(QWidget* parent, const char* name) // setColumnLabel //--------------------------------------------------------- -void HeaderNew::setColumnLabel(const QString & text, int col, int width ) +void Header::setColumnLabel(const QString & text, int col, int width ) { QStandardItem *sitem = new QStandardItem(text ); itemModel->setHorizontalHeaderItem(col, sitem); @@ -146,7 +92,7 @@ void HeaderNew::setColumnLabel(const QString & text, int col, int width ) // setToolTip //--------------------------------------------------------- -void HeaderNew::setToolTip(int col, const QString &text) +void Header::setToolTip(int col, const QString &text) { QStandardItem *item = itemModel->horizontalHeaderItem(col); item->setToolTip(text); @@ -156,7 +102,7 @@ void HeaderNew::setToolTip(int col, const QString &text) // setWhatsThis //--------------------------------------------------------- -void HeaderNew::setWhatsThis(int col, const QString &text) +void Header::setWhatsThis(int col, const QString &text) { QStandardItem *item = itemModel->horizontalHeaderItem(col); item->setWhatsThis(text); diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h index 2c2c00f5..83680f8a 100644 --- a/muse2/muse/widgets/header.h +++ b/muse2/muse/widgets/header.h @@ -8,41 +8,19 @@ #ifndef __HEADER_H__ #define __HEADER_H__ -#include +#include -class QHeaderView; class QStandardItemModel; class Xml; -/* -//--------------------------------------------------------- -// Header -//--------------------------------------------------------- - -class Header : public Q3Header { - Q_OBJECT - - public: - Header(QWidget* parent=0, const char* name=0) - : Q3Header(parent, name) {} - Header(int sections, QWidget* parent=0, const char* name=0) - : Q3Header(sections, parent, name) {} - void writeStatus(int level, Xml&) const; - void readStatus(Xml&); - }; -*/ - -// ORCAN - TODO: Once everything is ported to use the new class below, we -// can remove the above Qt3 based class. - -class HeaderNew : public QHeaderView { +class Header : public QHeaderView { Q_OBJECT QStandardItemModel *itemModel; public: - HeaderNew(QWidget* parent=0, const char* name=0); + Header(QWidget* parent=0, const char* name=0); void writeStatus(int level, Xml&) const; void readStatus(Xml&); void setColumnLabel( const QString & s, int col, int width = -1 ); -- cgit v1.2.3