summaryrefslogtreecommitdiff
path: root/muse2/muse/widgets/mtrackinfo.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-12-21 17:39:57 +0000
committerFlorian Jung <flo@windfisch.org>2011-12-21 17:39:57 +0000
commit1057d7190242cdf9248671b316a398db805f5f56 (patch)
treeab50268a7db2f80cfb45a7ad6578fe735ab84ce5 /muse2/muse/widgets/mtrackinfo.cpp
parent9977c7114089b8708d310268833b83343caa0fd1 (diff)
parentc36a5508aa42e596b005425208054af9a60734b4 (diff)
merged with trunk (that is, pulled the fixes from release_2_0)
only quickly tested, seems okay on the first glance
Diffstat (limited to 'muse2/muse/widgets/mtrackinfo.cpp')
-rw-r--r--muse2/muse/widgets/mtrackinfo.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp
index d0c0e070..7952308e 100644
--- a/muse2/muse/widgets/mtrackinfo.cpp
+++ b/muse2/muse/widgets/mtrackinfo.cpp
@@ -579,7 +579,8 @@ void MidiTrackInfo::setLabelText()
//gradient.setColorAt(0, c.darker());
//gradient.setColorAt(0, c);
//gradient.setColorAt(1, c.darker());
- gradient.setColorAt(0, c.lighter());
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(0.5, c.lighter());
gradient.setColorAt(1, c);
//palette.setBrush(QPalette::Button, gradient);
//palette.setBrush(QPalette::Window, gradient);
@@ -640,14 +641,17 @@ void MidiTrackInfo::iOutputPortChanged(int index)
{
if(!selected)
return;
+ int port_num = iOutput->itemData(index).toInt();
+ if(port_num < 0 || port_num >= MIDI_PORTS)
+ return;
MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected;
- if (index == track->outPort())
+ if (port_num == track->outPort())
return;
// Changed by T356.
- //track->setOutPort(index);
+ //track->setOutPort(port_num);
MusEGlobal::audio->msgIdle(true);
- //audio->msgSetTrackOutPort(track, index);
- track->setOutPortAndUpdate(index);
+ //audio->msgSetTrackOutPort(track, port_num);
+ track->setOutPortAndUpdate(port_num);
MusEGlobal::audio->msgIdle(false);
//MusEGlobal::song->update(SC_MIDI_TRACK_PROP);
@@ -1086,11 +1090,9 @@ void MidiTrackInfo::instrPopup()
//QMenu* pup = new QMenu;
PopupMenu* pup = new PopupMenu(true);
- //instr->populatePatchPopup(pop, channel, MusEGlobal::song->mtype(), track->isDrumTrack());
- populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->isDrumTrack());
+ instr->populatePatchPopup(pup, channel, MusEGlobal::song->mtype(), track->isDrumTrack());
+ //populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->isDrumTrack());
- //if(pop->actions().count() == 0)
- // return;
if(pup->actions().count() == 0)
{
delete pup;
@@ -1100,7 +1102,6 @@ void MidiTrackInfo::instrPopup()
connect(pup, SIGNAL(triggered(QAction*)), SLOT(instrPopupActivated(QAction*)));
//connect(pup, SIGNAL(hovered(QAction*)), SLOT(instrPopupActivated(QAction*)));
- //QAction *act = pop->exec(iPatch->mapToGlobal(QPoint(10,5)));
QAction *act = pup->exec(iPatch->mapToGlobal(QPoint(10,5)));
if(act)
{
@@ -1351,12 +1352,20 @@ void MidiTrackInfo::updateTrackInfo(int flags)
//iInput->clear();
iOutput->clear();
+ int item_idx = 0;
for (int i = 0; i < MIDI_PORTS; ++i) {
+ MusECore::MidiDevice* md = MusEGlobal::midiPorts[i].device();
+ if(!md) // In the case of this combo box, don't bother listing empty ports. p4.0.41
+ continue;
+ //if(!(md->rwFlags() & 1 || md->isSynti()) && (i != outPort))
+ if(!(md->rwFlags() & 1) && (i != outPort)) // Only writeable ports, or current one. p4.0.41
+ continue;
QString name;
name.sprintf("%d:%s", i+1, MusEGlobal::midiPorts[i].portname().toLatin1().constData());
- iOutput->insertItem(i, name);
+ iOutput->insertItem(item_idx, name, i);
if (i == outPort)
- iOutput->setCurrentIndex(i);
+ iOutput->setCurrentIndex(item_idx);
+ item_idx++;
}
iOutput->blockSignals(false);