summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-10-13 13:07:15 +0000
committerWerner Schweer <ws.seh.de>2006-10-13 13:07:15 +0000
commit3a3c7cc80ba01dc7d0c32935ccd23325139f1ecf (patch)
tree416773e9a33b6a997149c659ddcd98cafca28770
parent96c6663ceeb1cf134b2c365a5d21285297ca6001 (diff)
fix crash when clicking "bypass" in rack context menu
-rw-r--r--muse/muse/mixer/astrip.cpp6
-rw-r--r--muse/muse/mixer/midirack.cpp2
-rw-r--r--muse/muse/mixer/mstrip.cpp67
-rw-r--r--muse/muse/mixer/rack.cpp2
-rw-r--r--muse/muse/plugingui.cpp2
-rw-r--r--muse/muse/plugingui.h2
6 files changed, 38 insertions, 43 deletions
diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp
index 1f017e5b..8b4b0ed7 100644
--- a/muse/muse/mixer/astrip.cpp
+++ b/muse/muse/mixer/astrip.cpp
@@ -285,7 +285,7 @@ void AudioStrip::updateOffState()
if (track->type() != Track::AUDIO_SOFTSYNTH)
stereo->setEnabled(val);
-//TD label->setEnabled(val);
+ label->setEnabled(val);
if (solo)
solo->setEnabled(val);
if (mute)
@@ -670,6 +670,8 @@ static void addSyntiPorts(AudioTrack* t, QMenu* lb, RouteList* r)
void AudioStrip::iRoutePressed()
{
QMenu pup(iR);
+ pup.setSeparatorsCollapsible(false);
+
AudioTrack* t = (AudioTrack*)track;
RouteList* irl = t->inRoutes();
@@ -745,6 +747,8 @@ void AudioStrip::iRoutePressed()
void AudioStrip::oRoutePressed()
{
QMenu pup(oR);
+ pup.setSeparatorsCollapsible(false);
+
AudioTrack* t = (AudioTrack*)track;
RouteList* orl = t->outRoutes();
diff --git a/muse/muse/mixer/midirack.cpp b/muse/muse/mixer/midirack.cpp
index 561a3d11..29d2e748 100644
--- a/muse/muse/mixer/midirack.cpp
+++ b/muse/muse/mixer/midirack.cpp
@@ -22,6 +22,8 @@
MidiRack::MidiRack(QWidget* parent, MidiTrackBase* t)
: QListWidget(parent)
{
+ setUniformItemSizes(true);
+ setAlternatingRowColors(true);
setAttribute(Qt::WA_DeleteOnClose, true);
verticalScrollBar()->setStyle(smallStyle);
track = t;
diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp
index b93d747d..4195ec86 100644
--- a/muse/muse/mixer/mstrip.cpp
+++ b/muse/muse/mixer/mstrip.cpp
@@ -1536,33 +1536,34 @@ void MidiSyntiStrip::controllerChanged(int id)
void MidiSyntiStrip::oRoutePressed()
{
- QMenu* pup = new QMenu(oR);
- pup->addSeparator()->setText(tr("OutputPorts"));
+ QMenu pup(oR);
+ pup.setSeparatorsCollapsible(false);
+ pup.addSeparator()->setText(tr("OutputPorts"));
RouteList* orl = track->outRoutes();
MidiOutPortList* mpl = song->midiOutPorts();
int pn = 0;
for (iMidiOutPort i = mpl->begin(); i != mpl->end(); ++i, ++pn) {
MidiOutPort* op = *i;
- QMenu* m = pup->addMenu(op->name());
+ QMenu* m = pup.addMenu(op->name());
m->addSeparator()->setText(tr("Channel"));
for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
QString s;
s.setNum(channel+1);
- QAction* action = m->addAction(s);//int id = m->insertItem(s, pn * 16 + channel);
+ QAction* action = m->addAction(s);
action->setData(pn * 16 + channel);
MidiChannel* mc = op->channel(channel);
Route r(mc, -1, Route::TRACK);
for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
if (r == *ir) {
- action->setCheckable(true);//m->setItemChecked(id, true);
+ action->setCheckable(true);
action->setChecked(true);
break;
}
}
}
}
- QAction* action = pup->exec(QCursor::pos()); //int n = pup->exec(QCursor::pos());
+ QAction* action = pup.exec(QCursor::pos());
if (action) {
int n = action->data().toInt();
int portno = n >> 4;
@@ -1592,7 +1593,6 @@ void MidiSyntiStrip::oRoutePressed()
if (mixer)
mixer->setUpdateMixer();
}
- delete pup;
oR->setDown(false); // pup->exec() catches mouse release event
}
@@ -1602,72 +1602,59 @@ void MidiSyntiStrip::oRoutePressed()
void MidiSyntiStrip::iRoutePressed()
{
- QMenu* pup = new QMenu(oR);
- pup->addSeparator()->setText(tr("Input Ports"));
+ QMenu pup(oR);
+ pup.setSeparatorsCollapsible(false);
+
+ pup.addSeparator()->setText(tr("Input Ports"));
MidiOutPort* t = (MidiOutPort*)track;
RouteList* irl = t->inRoutes();
MidiInPortList* ipl = song->midiInPorts();
int tn = 0;
for (iMidiInPort i = ipl->begin(); i != ipl->end(); ++i, ++tn) {
- QMenu* m = pup->addMenu((*i)->name());
+ QMenu* m = pup.addMenu((*i)->name());
m->addSeparator()->setText(tr("Channel"));
QAction* action = m->addAction(tr("All"));
- QMap<QString, QVariant> data;
- data["id"] = tn * 32 + MIDI_CHANNELS;
- data["was_checked"] = false;
- action->setData(data);
+ Route src(*i, MIDI_CHANNELS, Route::TRACK);
+ action->setData(QVariant::fromValue(src));
for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
QString s;
s.setNum(channel+1);
- QMap<QString, QVariant> data;
- action = m->addAction(s); //int id = m->insertItem(s, tn * 32 + channel);
- data["id"] = tn * 32 + channel;
- data["was_checked"] = false;
- action->setData(data);
-
+ action = m->addAction(s);
+ action->setCheckable(true);
Route src(*i, channel, Route::TRACK);
+ action->setData(QVariant::fromValue(src));
+
for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
if (*ir == src) {
- //m->setItemChecked(id, true);
- action->setCheckable(true);
action->setChecked(true);
- data["was_checked"] = true;
- action->setData(data);
break;
}
}
}
}
- QAction* action = pup->exec(QCursor::pos());//int n = pup->exec(QCursor::pos());
+ QAction* action = pup.exec(QCursor::pos());
if (action) {
- int n = action->data().toMap()["id"].toInt();
- int was_checked = action->data().toMap()["was_checked"].toInt();
- int port = n >> 5;
- int channel = n & 0x1f;
- MidiInPort* mip = ipl->index(port);
- if (channel == MIDI_CHANNELS) {
- for (channel = 0; channel < MIDI_CHANNELS; ++channel) {
- Route srcRoute(mip, channel, Route::TRACK);
+ Route srcRoute = action->data().value<Route>();
+ if (srcRoute.channel == MIDI_CHANNELS) {
+ for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
+ srcRoute.channel = channel;
Route dstRoute(track, channel, Route::TRACK);
audio->msgAddRoute(srcRoute, dstRoute);
}
}
else {
- Route srcRoute(mip, channel, Route::TRACK);
- Route dstRoute(track, channel, Route::TRACK);
-
- if (was_checked)
- audio->msgRemoveRoute(srcRoute, dstRoute);
- else
+ Route dstRoute(track, srcRoute.channel, Route::TRACK);
+ if (action->isChecked())
audio->msgAddRoute(srcRoute, dstRoute);
+ else
+ audio->msgRemoveRoute(srcRoute, dstRoute);
}
song->update(SC_ROUTE);
}
- delete pup;
iR->setDown(false); // pup->exec() catches mouse release event
}
diff --git a/muse/muse/mixer/rack.cpp b/muse/muse/mixer/rack.cpp
index eb0822b2..646625fa 100644
--- a/muse/muse/mixer/rack.cpp
+++ b/muse/muse/mixer/rack.cpp
@@ -26,6 +26,8 @@ static const int PipelineDepth = 4;
EffectRack::EffectRack(QWidget* parent, AudioTrack* t, bool flag)
: QListWidget(parent)
{
+ setUniformItemSizes(true);
+ setAlternatingRowColors(true);
prefader = flag;
setAttribute(Qt::WA_DeleteOnClose, true);
verticalScrollBar()->setStyle(smallStyle);
diff --git a/muse/muse/plugingui.cpp b/muse/muse/plugingui.cpp
index e6988db3..c452eb80 100644
--- a/muse/muse/plugingui.cpp
+++ b/muse/muse/plugingui.cpp
@@ -355,7 +355,7 @@ PluginGui::PluginGui(PluginI* p)
tools->addAction(QWhatsThis::createAction(this));
- QAction* onOff = tools->addAction(*onOffIcon, tr("bypass plugin"));
+ onOff = tools->addAction(*onOffIcon, tr("bypass plugin"));
onOff->setCheckable(true);
onOff->setChecked(plugin->on());
onOff->setWhatsThis(tr(presetBypassText));
diff --git a/muse/muse/plugingui.h b/muse/muse/plugingui.h
index 3dac942c..e54e683a 100644
--- a/muse/muse/plugingui.h
+++ b/muse/muse/plugingui.h
@@ -64,7 +64,7 @@ class PluginGui : public QMainWindow {
PluginI* plugin; // plugin instance
std::vector<GuiWidget> gw;
- QToolButton* onOff;
+ QAction* onOff;
void connectPrebuiltGui(QWidget* wContainer);
private slots: