diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-01 08:59:04 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2010-12-01 08:59:04 +0000 |
commit | ffe6b074794c48f8f5e9428911bbad72a257f15a (patch) | |
tree | 70084b6b495e0d9963329c0f568470ddf9a9209f /muse2/muse | |
parent | 220cd2ee02444791e089a9ee0c772844bf9c3d3c (diff) |
Ported midiport to Qt4.
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 9 | ||||
-rw-r--r-- | muse2/muse/midiedit/dlist.cpp | 9 | ||||
-rw-r--r-- | muse2/muse/midiport.cpp | 12 | ||||
-rw-r--r-- | muse2/muse/midiport.h | 6 |
4 files changed, 19 insertions, 17 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 28e50750..15a1cdf9 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -11,7 +11,7 @@ #include <qpainter.h> #include <qlineedit.h> -#include <q3popupmenu.h> +#include <QMenu> #include <qmessagebox.h> #include <qscrollbar.h> #include <qtimer.h> @@ -531,9 +531,10 @@ void TList::portsPopupMenu(Track* t, int x, int y) else port = track->outPort(); - Q3PopupMenu* p = midiPortsPopup(0, port); - int n = p->exec(mapToGlobal(QPoint(x, y)), 0); - if (n != -1) { + QMenu* p = midiPortsPopup(0, port); + QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0); + if (act) { + int n = act->data().toInt(); // Changed by T356. //track->setOutPort(n); //audio->msgSetTrackOutPort(track, n); diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 06c9ffbf..9f1c5db0 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -7,7 +7,7 @@ #include <QCursor> #include <QHeaderView> -#include <Q3PopupMenu> +#include <QMenu> #include <QMouseEvent> #include <QPainter> #include <QPixmap> @@ -164,10 +164,11 @@ void DList::draw(QPainter& p, const QRect& rect) void DList::devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll) { - Q3PopupMenu* p = midiPortsPopup(this); - int n = p->exec(mapToGlobal(QPoint(x, y)), 0); + QMenu* p = midiPortsPopup(); + QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0); bool doemit = false; - if (n != -1) { + if (act) { + int n = act->data().toInt(); if (!changeAll) { if(n != t->port) diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index fcaa8f36..0f593fd4 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -8,7 +8,8 @@ //#include "config.h" -#include <q3popupmenu.h> +#include <QMenu> + #include "mididev.h" #include "midiport.h" #include "midictrl.h" @@ -258,17 +259,18 @@ int MidiPort::portno() const //--------------------------------------------------------- //QPopupMenu* midiPortsPopup(QWidget* parent) -Q3PopupMenu* midiPortsPopup(QWidget* parent, int checkPort) +QMenu* midiPortsPopup(QWidget* parent, int checkPort) { - Q3PopupMenu* p = new Q3PopupMenu(parent); + QMenu* p = new QMenu(parent); for (int i = 0; i < MIDI_PORTS; ++i) { MidiPort* port = &midiPorts[i]; QString name; name.sprintf("%d:%s", port->portno()+1, port->portname().latin1()); - p->insertItem(name, i); + QAction *act = p->addAction(name); + act->setData(i); if(i == checkPort) - p->setItemChecked(i, true); + act->setChecked(true); } return p; } diff --git a/muse2/muse/midiport.h b/muse2/muse/midiport.h index 7c8a408c..5ba08d67 100644 --- a/muse2/muse/midiport.h +++ b/muse2/muse/midiport.h @@ -12,8 +12,6 @@ #include "globaldefs.h" #include "sync.h" #include "route.h" -//Added by qt3to4: -#include <Q3PopupMenu> class MidiDevice; class MidiInstrument; @@ -122,9 +120,9 @@ class MidiPort { extern MidiPort midiPorts[MIDI_PORTS]; extern void initMidiPorts(); -class Q3PopupMenu; +class QMenu; class QWidget; //extern QPopupMenu* midiPortsPopup(QWidget*); -extern Q3PopupMenu* midiPortsPopup(QWidget*, int checkPort = -1); +extern QMenu* midiPortsPopup(QWidget* parent = 0, int checkPort = -1); #endif |