summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrcan Ogetbil <oget.fedora@gmail.com>2010-12-01 08:59:04 +0000
committerOrcan Ogetbil <oget.fedora@gmail.com>2010-12-01 08:59:04 +0000
commitffe6b074794c48f8f5e9428911bbad72a257f15a (patch)
tree70084b6b495e0d9963329c0f568470ddf9a9209f
parent220cd2ee02444791e089a9ee0c772844bf9c3d3c (diff)
Ported midiport to Qt4.
-rw-r--r--muse2/ChangeLog1
-rw-r--r--muse2/muse/arranger/tlist.cpp9
-rw-r--r--muse2/muse/midiedit/dlist.cpp9
-rw-r--r--muse2/muse/midiport.cpp12
-rw-r--r--muse2/muse/midiport.h6
5 files changed, 20 insertions, 17 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index adc9c0dd..b223783f 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,6 +1,7 @@
01.12.2010
- Ported listedit. (Orcan)
- I missed to port one action call in drumedit. Now it's (hopefully) done. (Orcan)
+ - Ported midiport. This also finishes the port of dlist. (Orcan)
30.11.2010
- Ported vscale and ctrledit. (Orcan)
29.11.2010
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