summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-10-09 23:49:15 +0000
committerTim E. Real <termtech@rogers.com>2011-10-09 23:49:15 +0000
commite160c228beaee36519fb210891006f7b40a46b4a (patch)
tree2d56abcbeddd7775cc6511d7ebc9f4921cc6c9f7
parent80d1f99cbad08ee6b0d7076f8df80ae71857c9f3 (diff)
Fixed track list midi port popup menu - too many ports listed.
Seperated empty ports into submenu.
-rw-r--r--muse2/ChangeLog10
-rw-r--r--muse2/muse/arranger/tlist.cpp2
-rw-r--r--muse2/muse/midiport.cpp36
3 files changed, 36 insertions, 12 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 11ee89bc..d0aabb95 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,4 +1,6 @@
-06.09.2011:
+09.10.2011:
+ - Fixed track list midi port popup menu - too many ports listed. Seperated empty ports into submenu. (Tim)
+06.10.2011:
- SigEdit, up/down arrow in denominator only moves between powers of two (decreased thick headedness),
numerator is no longer validated (rj)
- Hopefully last big namespace update. The only namespaces in use are
@@ -7,11 +9,11 @@
o MusEGui: For gui classes
One or two more namespaces will be added for the stuff outside the main tree (synti, al, etc) (Orcan)
- Fixed python control add-on building. Left it off by default. (Orcan)
-05.09.2011:
+05.10.2011:
- SigEdit, up/down arrow in denominator only moves between powers of two, 2,4,8...128 (rj)
-04.09.2011:
+04.10.2011:
- More fixes to SigEdit, close on enter, navigate with arrows and / between values, fixed background color, focus (rj)
-02.09.2011:
+02.10.2011:
- SigEdit reworked to use two spinboxes, plan on adding Enter/Return detection so the widget will close when
Enter/Return is pressed (rj)
- Fixed HUGE massive memory leaks in all things using CItemList, and SndFile, dssi, fluidsynth and other huge leaks. (Tim)
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index 98c4a595..87179575 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -602,7 +602,7 @@ void TList::portsPopupMenu(MusECore::Track* t, int x, int y)
else
port = track->outPort();
- QMenu* p = MusECore::midiPortsPopup(0, port);
+ QMenu* p = MusECore::midiPortsPopup(this, port); // 0, port);
QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0);
if (act) {
int n = act->data().toInt();
diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp
index a8a248cb..49934d7b 100644
--- a/muse2/muse/midiport.cpp
+++ b/muse2/muse/midiport.cpp
@@ -37,6 +37,7 @@
#include "synth.h"
#include "app.h"
#include "song.h"
+#include "menutitleitem.h"
//#ifdef DSSI_SUPPORT
//#include "dssihost.h"
@@ -316,20 +317,41 @@ int MidiPort::portno() const
// midiPortsPopup
//---------------------------------------------------------
-//QPopupMenu* midiPortsPopup(QWidget* parent)
QMenu* midiPortsPopup(QWidget* parent, int checkPort)
{
QMenu* p = new QMenu(parent);
+ p->addAction(new MusEGui::MenuTitleItem("Port / Device", p));
+ QMenu* subp = 0;
+ QAction *act = 0;
+ QString name;
for (int i = 0; i < MIDI_PORTS; ++i) {
MidiPort* port = &MusEGlobal::midiPorts[i];
- QString name;
name.sprintf("%d:%s", port->portno()+1, port->portname().toLatin1().constData());
- QAction *act = p->addAction(name);
- act->setData(i);
-
- if(i == checkPort)
- act->setChecked(true);
+ if(port->device() || (i == checkPort))
+ {
+ act = p->addAction(name);
+ act->setData(i);
+ act->setCheckable(true);
+ act->setChecked(i == checkPort);
+ }
+
+ if(!port->device())
+ {
+ if(!subp) // No submenu yet? Create it now.
+ {
+ subp = new QMenu(p);
+ subp->setTitle(subp->tr("Empty"));
+ subp->addAction(new MusEGui::MenuTitleItem("Empty Ports", subp));
+ }
+ //act = subp->addAction(name); // No need for all those "<None>" names.
+ act = subp->addAction(QString().setNum(i+1));
+ act->setData(i);
+ act->setCheckable(true);
+ act->setChecked(i == checkPort);
+ }
}
+ if(subp)
+ p->addMenu(subp);
return p;
}