summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-11-10 03:49:08 +0000
committerTim E. Real <termtech@rogers.com>2010-11-10 03:49:08 +0000
commit500e9f44bc9112af6a303679ed84df707abf0833 (patch)
treeaccaa299facc23dee1663f352d93426a6b9f2557 /muse2
parent590b675a80810870412620818d2f7d4067df5ede (diff)
Fixed audio and midi strips and converted to Qt4. Looks OK now, but will be better
once knob, slider, rack classes are fixed, converted.
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog3
-rw-r--r--muse2/muse/mixer/astrip.cpp246
-rw-r--r--muse2/muse/mixer/mstrip.cpp286
-rw-r--r--muse2/muse/mixer/mstrip.h4
-rw-r--r--muse2/muse/mixer/strip.cpp23
-rw-r--r--muse2/muse/mixer/strip.h10
6 files changed, 305 insertions, 267 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 0a3f0fd3..ba4f9c43 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+09.11.2010
+ - Fixed audio and midi strips and converted to Qt4. Looks OK now, but will be better... (Tim)
+ TODO: Convert Slider, Knob, EffectRack, ComboBox classes etc. (After that the strips will be perfect.)
08.11.2010
- Add missing link to libdl.so. Caused bulid failure on Fedora 14 (Orcan)
- Fixed strip name label colours, also name label auto-font-sizing. (Tim)
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
index a0d793ee..c98f72fa 100644
--- a/muse2/muse/mixer/astrip.cpp
+++ b/muse2/muse/mixer/astrip.cpp
@@ -8,29 +8,23 @@
#include <fastlog.h>
-#include <qlayout.h>
-#include <qapplication.h>
-#include <qdialog.h>
-#include <qtoolbutton.h>
+#include <QLayout>
+#include <QApplication>
+//#include <QDialog>
+#include <QToolButton>
#include <QLabel>
-#include <qdialog.h>
-#include <qcombobox.h>
-#include <qtooltip.h>
-#include <qtimer.h>
-//#include <qpopupmenu.h>
-#include <qcursor.h>
-#include <qpainter.h>
-#include <qstring.h>
-#include <qpoint.h>
-#include <qevent.h>
-#include <qwidget.h>
+#include <QComboBox>
+#include <QToolTip>
+#include <QTimer>
+//#include <QPopupMenu>
+#include <QCursor>
+#include <QPainter>
+#include <QString>
+#include <QPoint>
+#include <QEvent>
+#include <QWidget>
#include <QVariant>
#include <QAction>
-//Added by qt3to4:
-//#include <Q3HBoxLayout>
-//#include <Q3GridLayout>
-
-#include <QHBoxLayout>
#include <QGridLayout>
#include "app.h"
@@ -583,17 +577,17 @@ void AudioStrip::updateChannels()
Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
{
Knob* knob = new Knob(this);
- knob->setFixedWidth(STRIP_WIDTH/2);
+ knob->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
if (type == 0)
knob->setRange(-1.0, +1.0);
else
knob->setRange(config.minSlider-0.1, 10.0);
- knob->setBackgroundMode(Qt::PaletteMid);
+ knob->setBackgroundRole(QPalette::Mid);
if (type == 0)
- QToolTip::add(knob, tr("panorama"));
+ knob->setToolTip(tr("panorama"));
else
- QToolTip::add(knob, tr("aux send level"));
+ knob->setToolTip(tr("aux send level"));
DoubleLabel* pl;
@@ -606,7 +600,7 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
*dlabel = pl;
pl->setSlider(knob);
pl->setFont(config.fonts[1]);
- pl->setBackgroundMode(Qt::PaletteMid);
+ pl->setBackgroundRole(QPalette::Mid);
pl->setFrame(true);
if (type == 0)
pl->setPrecision(2);
@@ -614,7 +608,7 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
pl->setPrecision(0);
pl->setPrecision(0);
}
- pl->setFixedWidth(STRIP_WIDTH/2);
+ pl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
QString label;
if (type == 0)
@@ -624,14 +618,15 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
QLabel* plb = new QLabel(label, this);
plb->setFont(config.fonts[1]);
- plb->setFixedWidth(STRIP_WIDTH/2);
+ plb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
plb->setAlignment(Qt::AlignCenter);
- QGridLayout* pangrid = new QGridLayout(0, 2, 2, 0, 0, "pangrid");
+ QGridLayout* pangrid = new QGridLayout();
+ pangrid->setMargin(0);
pangrid->addWidget(plb, 0, 0);
pangrid->addWidget(pl, 1, 0);
- pangrid->addMultiCellWidget(knob, 0, 1, 1, 1);
- layout->addLayout(pangrid);
+ pangrid->addWidget(knob, 0, 1, 2, 1);
+ grid->addLayout(pangrid, _curGridRow++, 0, 1, 2);
connect(knob, SIGNAL(valueChanged(double,int)), pl, SLOT(setValue(double)));
//connect(pl, SIGNAL(valueChanged(double, int)), SLOT(panChanged(double)));
@@ -672,19 +667,14 @@ AudioStrip::~AudioStrip()
AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
: Strip(parent, at)
{
- //iR = 0;
- //oR = 0;
-
- off = 0;
-
volume = -1.0;
panVal = 0;
record = 0;
+ off = 0;
AudioTrack* t = (AudioTrack*)track;
channel = at->channels();
- setFixedWidth(STRIP_WIDTH);
setMinimumWidth(STRIP_WIDTH);
int ch = 0;
@@ -698,27 +688,25 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
//---------------------------------------------------
EffectRack* rack = new EffectRack(this, t);
- rack->setFixedWidth(STRIP_WIDTH);
- rack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
- layout->addWidget(rack);
+ rack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ grid->addWidget(rack, _curGridRow++, 0, 1, 2);
//---------------------------------------------------
// mono/stereo pre/post
//---------------------------------------------------
- QHBoxLayout* ppBox = new QHBoxLayout(0);
-
stereo = new QToolButton();
stereo->setFont(config.fonts[1]);
QIcon stereoSet;
stereoSet.addPixmap(*monoIcon, QIcon::Normal, QIcon::Off);
stereoSet.addPixmap(*stereoIcon, QIcon::Normal, QIcon::On);
stereo->setIcon(stereoSet);
+ stereo->setIconSize(monoIcon->size());
stereo->setCheckable(true);
stereo->setToolTip(tr("1/2 channel"));
stereo->setChecked(channel == 2);
- stereo->setFixedWidth(STRIP_WIDTH/2);
+ stereo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
connect(stereo, SIGNAL(clicked(bool)), SLOT(stereoToggled(bool)));
// disable mono/stereo for Synthesizer-Plugins
@@ -731,12 +719,11 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
pre->setText(tr("Pre"));
pre->setToolTip(tr("pre fader - post fader"));
pre->setChecked(t->prefader());
- pre->setFixedWidth(STRIP_WIDTH/2);
+ stereo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
connect(pre, SIGNAL(clicked(bool)), SLOT(preToggled(bool)));
- ppBox->addWidget(stereo);
- ppBox->addWidget(pre);
- layout->addLayout(ppBox);
+ grid->addWidget(stereo, _curGridRow, 0);
+ grid->addWidget(pre, _curGridRow++, 1);
//---------------------------------------------------
// aux send
@@ -755,19 +742,19 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
}
}
else {
- if (auxsSize)
- layout->addSpacing((STRIP_WIDTH/2 + 2) * auxsSize);
+ ///if (auxsSize)
+ //layout->addSpacing((STRIP_WIDTH/2 + 2) * auxsSize);
+ ///grid->addSpacing((STRIP_WIDTH/2 + 2) * auxsSize); // ???
}
//---------------------------------------------------
// slider, label, meter
//---------------------------------------------------
- //sliderGrid = new QGridLayout(this); // ddskrjo this
- sliderGrid = new QGridLayout(); // ddskrjo this
+ sliderGrid = new QGridLayout();
sliderGrid->setRowStretch(0, 100);
-
- //slider = new Slider(this);
+ sliderGrid->setMargin(0);
+
slider = new Slider(this, "vol", Qt::Vertical, Slider::None,
Slider::BgTrough | Slider::BgSlot);
slider->setCursorHoming(true);
@@ -786,16 +773,16 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
sliderGrid->addWidget(meter[i], 0, i+1, Qt::AlignHCenter);
sliderGrid->setColStretch(i, 50);
}
- layout->addLayout(sliderGrid);
+ grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2);
sl = new DoubleLabel(0.0, config.minSlider, 10.0, this);
sl->setSlider(slider);
sl->setFont(config.fonts[1]);
- sl->setBackgroundMode(Qt::PaletteMid);
+ sl->setBackgroundRole(QPalette::Mid);
sl->setSuffix(tr("dB"));
sl->setFrame(true);
sl->setPrecision(0);
- sl->setFixedWidth(STRIP_WIDTH);
+ sl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
sl->setValue(fast_log10(t->volume()) * 20.0);
connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volLabelChanged(double)));
@@ -805,7 +792,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
connect(slider, SIGNAL(sliderPressed(int)), SLOT(volumePressed()));
connect(slider, SIGNAL(sliderReleased(int)), SLOT(volumeReleased()));
connect(slider, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(volumeRightClicked(const QPoint &)));
- layout->addWidget(sl);
+ grid->addWidget(sl, _curGridRow++, 0, 1, 2);
//---------------------------------------------------
// pan, balance
@@ -820,135 +807,134 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
if (track->canRecord()) {
record = new TransparentToolButton(this);
- record->setToggleButton(true);
- record->setFixedWidth(STRIP_WIDTH/2);
- record->setBackgroundMode(Qt::PaletteMid);
+ record->setCheckable(true);
+ record->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ record->setBackgroundRole(QPalette::Mid);
QIcon iconSet;
- iconSet.setPixmap(*record_on_Icon, QIcon::Automatic, QIcon::Normal, QIcon::On);
- iconSet.setPixmap(*record_off_Icon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
- record->setIconSet(iconSet);
- QToolTip::add(record, tr("record"));
- record->setOn(t->recordFlag());
- connect(record, SIGNAL(toggled(bool)), SLOT(recordToggled(bool)));
+ iconSet.addPixmap(*record_on_Icon, QIcon::Normal, QIcon::On);
+ iconSet.addPixmap(*record_off_Icon, QIcon::Normal, QIcon::Off);
+ record->setIcon(iconSet);
+ record->setIconSize(record_on_Icon->size());
+ record->setToolTip(tr("record"));
+ record->setChecked(t->recordFlag());
+ connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
}
Track::TrackType type = t->type();
- QHBoxLayout* smBox1 = new QHBoxLayout(0);
- QHBoxLayout* smBox2 = new QHBoxLayout(0);
-
- mute = new QToolButton(this);
-
+ mute = new QToolButton();
QIcon muteSet;
- muteSet.setPixmap(*muteIconOn, QIcon::Automatic, QIcon::Normal, QIcon::Off);
- muteSet.setPixmap(*muteIconOff, QIcon::Automatic, QIcon::Normal, QIcon::On);
- mute->setIconSet(muteSet);
- mute->setToggleButton(true);
- QToolTip::add(mute, tr("mute"));
- mute->setOn(t->mute());
- mute->setFixedWidth(STRIP_WIDTH/2-2);
- connect(mute, SIGNAL(toggled(bool)), SLOT(muteToggled(bool)));
- smBox2->addWidget(mute);
-
- solo = new QToolButton(this);
+ muteSet.addPixmap(*muteIconOn, QIcon::Normal, QIcon::Off);
+ muteSet.addPixmap(*muteIconOff, QIcon::Normal, QIcon::On);
+ mute->setIcon(muteSet);
+ mute->setIconSize(muteIconOn->size());
+ mute->setCheckable(true);
+ mute->setToolTip(tr("mute"));
+ mute->setChecked(t->mute());
+ mute->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
+
+ solo = new QToolButton();
if((bool)t->internalSolo())
{
- solo->setIconSet(*soloIconSet2);
+ solo->setIcon(*soloIconSet2);
useSoloIconSet2 = true;
}
else
{
- solo->setIconSet(*soloIconSet1);
+ solo->setIcon(*soloIconSet1);
useSoloIconSet2 = false;
}
- solo->setToggleButton(true);
- solo->setOn(t->solo());
-
- solo->setFixedWidth(STRIP_WIDTH/2-2);
- smBox2->addWidget(solo);
- connect(solo, SIGNAL(toggled(bool)), SLOT(soloToggled(bool)));
+ solo->setCheckable(true);
+ solo->setChecked(t->solo());
+ solo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
if (type == Track::AUDIO_OUTPUT) {
- QToolTip::add(record, tr("record downmix"));
- //QToolTip::add(solo, tr("solo mode (monitor)"));
- QToolTip::add(solo, tr("solo mode"));
+ record->setToolTip(tr("record downmix"));
+ //solo->setToolTip(tr("solo mode (monitor)"));
+ solo->setToolTip(tr("solo mode"));
}
else {
- //QToolTip::add(solo, tr("pre fader listening"));
- QToolTip::add(solo, tr("solo mode"));
+ //solo->setToolTip(tr("pre fader listening"));
+ solo->setToolTip(tr("solo mode"));
}
off = new TransparentToolButton(this);
QIcon iconSet;
- iconSet.setPixmap(*exit1Icon, QIcon::Automatic, QIcon::Normal, QIcon::On);
- iconSet.setPixmap(*exitIcon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
- off->setIconSet(iconSet);
- off->setBackgroundMode(Qt::PaletteMid);
- off->setFixedWidth(STRIP_WIDTH/2);
- off->setToggleButton(true);
- QToolTip::add(off, tr("off"));
- off->setOn(t->off());
- connect(off, SIGNAL(toggled(bool)), SLOT(offToggled(bool)));
-
- smBox1->addWidget(off);
- if (track->canRecord())
- smBox1->addWidget(record);
- else
- smBox1->addStretch(100);
-
- layout->addLayout(smBox1);
- layout->addLayout(smBox2);
+ iconSet.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On);
+ iconSet.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off);
+ off->setIcon(iconSet);
+ off->setIconSize(exit1Icon->size());
+ off->setBackgroundRole(QPalette::Mid);
+ off->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ off->setCheckable(true);
+ off->setToolTip(tr("off"));
+ off->setChecked(t->off());
+ connect(off, SIGNAL(clicked(bool)), SLOT(offToggled(bool)));
+
+ grid->addWidget(off, _curGridRow, 0);
+ if (record)
+ grid->addWidget(record, _curGridRow, 1);
+ ++_curGridRow;
+ grid->addWidget(mute, _curGridRow, 0);
+ grid->addWidget(solo, _curGridRow++, 1);
//---------------------------------------------------
// routing
//---------------------------------------------------
- QHBoxLayout* rBox = new QHBoxLayout(0);
if (type != Track::AUDIO_AUX) {
- iR = new QToolButton(this);
+ iR = new QToolButton();
iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
+ iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
iR->setText(tr("iR"));
- iR->setToggleButton(false);
- QToolTip::add(iR, tr("input routing"));
- rBox->addWidget(iR);
+ iR->setCheckable(false);
+ iR->setToolTip(tr("input routing"));
+ grid->addWidget(iR, _curGridRow, 0);
connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
}
- else
- rBox->addSpacing((STRIP_WIDTH-4)/2);
- oR = new QToolButton(this);
+
+ oR = new QToolButton();
oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
+ oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
oR->setText(tr("oR"));
- oR->setToggleButton(false);
- QToolTip::add(oR, tr("output routing"));
- rBox->addWidget(oR);
+ oR->setCheckable(false);
+ oR->setToolTip(tr("output routing"));
+ grid->addWidget(oR, _curGridRow++, 1);
connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
- layout->addLayout(rBox);
-
//---------------------------------------------------
// automation type
//---------------------------------------------------
autoType = new ComboBox(this);
autoType->setFont(config.fonts[1]);
- autoType->setFixedWidth(STRIP_WIDTH-4);
+ autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+
autoType->insertItem(tr("Off"), AUTO_OFF);
autoType->insertItem(tr("Read"), AUTO_READ);
autoType->insertItem(tr("Touch"), AUTO_TOUCH);
autoType->insertItem(tr("Write"), AUTO_WRITE);
autoType->setCurrentItem(t->automationType());
+ // FIXME: TODO: Convert ComboBox to QT4
+ //autoType->insertItem(AUTO_OFF, tr("Off"));
+ //autoType->insertItem(AUTO_READ, tr("Read"));
+ //autoType->insertItem(AUTO_TOUCH, tr("Touch"));
+ //autoType->insertItem(AUTO_WRITE, tr("Write"));
+ //autoType->setCurrentIndex(t->automationType());
if(t->automationType() == AUTO_TOUCH || t->automationType() == AUTO_WRITE)
+ // FIXME:
autoType->setPaletteBackgroundColor(Qt::red);
else
+ // FIXME:
autoType->setPaletteBackgroundColor(qApp->palette().active().background());
- QToolTip::add(autoType, tr("automation type"));
+ autoType->setToolTip(tr("automation type"));
connect(autoType, SIGNAL(activated(int,int)), SLOT(setAutomationType(int,int)));
- layout->addWidget(autoType);
+ grid->addWidget(autoType, _curGridRow++, 0, 1, 2);
if (off) {
off->blockSignals(true);
diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp
index 6ec47f24..f6e3a26e 100644
--- a/muse2/muse/mixer/mstrip.cpp
+++ b/muse2/muse/mixer/mstrip.cpp
@@ -10,18 +10,15 @@
#include <QLayout>
#include <QAction>
-#include <qapplication.h>
-#include <qdialog.h>
-#include <qtoolbutton.h>
-#include <qlabel.h>
-#include <qdialog.h>
-#include <qcombobox.h>
-#include <qtooltip.h>
-#include <qtimer.h>
-//#include <qpopupmenu.h>
-#include <qcursor.h>
-//Added by qt3to4:
-#include <QHBoxLayout>
+#include <QApplication>
+//#include <QDialog>
+#include <QToolButton>
+#include <QLabel>
+#include <QComboBox>
+#include <QToolTip>
+#include <QTimer>
+//#include <QPopupMenu>
+#include <QCursor>
#include <QGridLayout>
#include <math.h>
@@ -84,23 +81,21 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label,
knob->setId(ctl);
controller[idx].knob = knob;
- knob->setFixedWidth(STRIP_WIDTH/2-3);
- knob->setFixedHeight(30);
- knob->setBackgroundMode(Qt::PaletteMid);
- QToolTip::add(knob, tt);
+ knob->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ knob->setBackgroundRole(QPalette::Mid);
+ knob->setToolTip(tt);
knob->setEnabled(enabled);
DoubleLabel* dl = new DoubleLabel(0.0, double(mn), double(mx), this);
dl->setId(idx);
dl->setSpecialText(tr("off"));
- QToolTip::add(dl, tr("double click on/off"));
+ dl->setToolTip(tr("double click on/off"));
controller[idx].dl = dl;
dl->setFont(config.fonts[1]);
- dl->setBackgroundMode(Qt::PaletteMid);
+ dl->setBackgroundRole(QPalette::Mid);
dl->setFrame(true);
dl->setPrecision(0);
- dl->setFixedWidth(STRIP_WIDTH/2);
- dl->setFixedHeight(15);
+ dl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
dl->setEnabled(enabled);
double dlv;
@@ -140,17 +135,16 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label,
QLabel* lb = new QLabel(label, this);
controller[idx].lb = lb;
lb->setFont(config.fonts[1]);
- lb->setFixedWidth(STRIP_WIDTH/2-3);
+ lb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
lb->setAlignment(Qt::AlignCenter);
- lb->setFixedHeight(15);
lb->setEnabled(enabled);
- QGridLayout* grid = new QGridLayout(0, 2, 2, 0, 0, "grid");
- grid->setMargin(2);
- grid->addWidget(lb, 0, 0);
- grid->addWidget(dl, 1, 0);
- grid->addMultiCellWidget(knob, 0, 1, 1, 1);
- layout->addLayout(grid);
+ QGridLayout* gr = new QGridLayout();
+ gr->setMargin(0);
+ gr->addWidget(lb, 0, 0);
+ gr->addWidget(dl, 1, 0);
+ gr->addWidget(knob, 0, 1, 2, 1);
+ grid->addLayout(gr, _curGridRow++, 0, 1, 2);
connect(knob, SIGNAL(sliderMoved(double,int)), slot);
connect(knob, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(controlRightClicked(const QPoint &, int)));
@@ -181,8 +175,9 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
addKnob(KNOB_REV_SEND, tr("ReverbSend"), tr("Rev"), SLOT(setReverbSend(double)), false);
addKnob(KNOB_CHO_SEND, tr("ChorusSend"), tr("Cho"), SLOT(setChorusSend(double)), false);
int auxsSize = song->auxs()->size();
- if (auxsSize)
- layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize);
+ ///if (auxsSize)
+ //layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize);
+ ///grid->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize); // ??
//---------------------------------------------------
// slider, label, meter
@@ -206,21 +201,22 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
meter[0]->setRange(0, 127.0);
meter[0]->setFixedWidth(15);
connect(meter[0], SIGNAL(mousePress()), this, SLOT(resetPeaks()));
- sliderGrid = new QGridLayout(this); // ddskrjo this
+
+ sliderGrid = new QGridLayout();
sliderGrid->setRowStretch(0, 100);
sliderGrid->addWidget(slider, 0, 0, Qt::AlignRight);
sliderGrid->addWidget(meter[0], 0, 1, Qt::AlignLeft);
- layout->addLayout(sliderGrid);
+ grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2);
sl = new DoubleLabel(0.0, -98.0, 0.0, this);
sl->setFont(config.fonts[1]);
- sl->setBackgroundMode(Qt::PaletteMid);
+ sl->setBackgroundRole(QPalette::Mid);
sl->setSpecialText(tr("off"));
sl->setSuffix(tr("dB"));
- QToolTip::add(sl, tr("double click on/off"));
+ sl->setToolTip(tr("double click on/off"));
sl->setFrame(true);
sl->setPrecision(0);
- sl->setFixedWidth(STRIP_WIDTH);
+ sl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
// Set the label's slider 'buddy'.
sl->setSlider(slider);
@@ -264,7 +260,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
connect(sl, SIGNAL(valueChanged(double, int)), SLOT(volLabelChanged(double)));
connect(sl, SIGNAL(doubleClicked(int)), SLOT(labelDoubleClicked(int)));
- layout->addWidget(sl);
+ grid->addWidget(sl, _curGridRow++, 0, 1, 2);
//---------------------------------------------------
// pan, balance
@@ -281,66 +277,73 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
//---------------------------------------------------
record = new TransparentToolButton(this);
- record->setBackgroundMode(Qt::PaletteMid);
- record->setToggleButton(true);
-
- //record->setFixedWidth(STRIP_WIDTH/2);
- //record->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
- record->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
+ record->setBackgroundRole(QPalette::Mid);
+ record->setCheckable(true);
+ record->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
QIcon iconSet;
- iconSet.setPixmap(*record_on_Icon, QIcon::Automatic, QIcon::Normal, QIcon::On);
- iconSet.setPixmap(*record_off_Icon, QIcon::Automatic, QIcon::Normal, QIcon::Off);
- record->setIconSet(iconSet);
- QToolTip::add(record, tr("record"));
- record->setOn(track->recordFlag());
- connect(record, SIGNAL(toggled(bool)), SLOT(recordToggled(bool)));
-
- mute = new QToolButton(this);
+ iconSet.addPixmap(*record_on_Icon, QIcon::Normal, QIcon::On);
+ iconSet.addPixmap(*record_off_Icon, QIcon::Normal, QIcon::Off);
+ record->setIcon(iconSet);
+ record->setIconSize(record_on_Icon->size());
+ record->setToolTip(tr("record"));
+ record->setChecked(track->recordFlag());
+ connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
+
+ mute = new QToolButton();
QIcon muteSet;
- muteSet.setPixmap(*muteIconOn, QIcon::Automatic, QIcon::Normal, QIcon::Off);
- muteSet.setPixmap(*muteIconOff, QIcon::Automatic, QIcon::Normal, QIcon::On);
- mute->setIconSet(muteSet);
- mute->setToggleButton(true);
- QToolTip::add(mute, tr("mute"));
- mute->setOn(track->mute());
- mute->setFixedWidth(STRIP_WIDTH/2);
- connect(mute, SIGNAL(toggled(bool)), SLOT(muteToggled(bool)));
+ muteSet.addPixmap(*muteIconOn, QIcon::Normal, QIcon::Off);
+ muteSet.addPixmap(*muteIconOff, QIcon::Normal, QIcon::On);
+ mute->setIcon(muteSet);
+ mute->setIconSize(muteIconOn->size());
+ mute->setCheckable(true);
+ mute->setToolTip(tr("mute"));
+ mute->setChecked(track->mute());
+ mute->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
- solo = new QToolButton(this);
+ solo = new QToolButton();
if((bool)t->internalSolo())
{
- solo->setIconSet(*soloIconSet2);
+ solo->setIcon(*soloIconSet2);
useSoloIconSet2 = true;
}
else
{
- solo->setIconSet(*soloIconSet1);
+ solo->setIcon(*soloIconSet1);
useSoloIconSet2 = false;
}
- //QToolTip::add(solo, tr("pre fader listening"));
- QToolTip::add(solo, tr("solo mode"));
- solo->setToggleButton(true);
- solo->setOn(t->solo());
- solo->setFixedWidth(STRIP_WIDTH/2);
- connect(solo, SIGNAL(toggled(bool)), SLOT(soloToggled(bool)));
-
- QHBoxLayout* smBox1 = new QHBoxLayout(0);
- QHBoxLayout* smBox2 = new QHBoxLayout(0);
-
- smBox2->addWidget(mute);
- smBox2->addWidget(solo);
-
+ //solo->setToolTip(tr("pre fader listening"));
+ solo->setToolTip(tr("solo mode"));
+ solo->setCheckable(true);
+ solo->setChecked(t->solo());
+ solo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
+
+ /*
// Changed by Tim. p3.3.21
//QToolTip::add(record, tr("record"));
//smBox1->addStretch(100);
//smBox1->addWidget(record);
- QLabel* dev_ch_label = new QLabel(this);
- dev_ch_label->setMinimumWidth(STRIP_WIDTH/2);
+ QLabel* dev_ch_label = new QLabel();
+ ///dev_ch_label->setMinimumWidth(STRIP_WIDTH/2);
+
+ // Special here: Must make label same size as the 'exit' button would be IF this were an audio strip...
+ // (The 'exit1' icon is BIGGER than the 'record on' icon.)
+ TransparentToolButton* off = new TransparentToolButton(this);
+ QIcon iconOff;
+ iconOff.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On);
+ iconOff.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off);
+ off->setIcon(iconOff);
+ off->setIconSize(exit1Icon->size());
+ dev_ch_label->setMinimumHeight(off->height());
+ delete off;
+
//dev_ch_label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
- dev_ch_label->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum));
+ ///dev_ch_label->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum));
+ dev_ch_label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
dev_ch_label->setAlignment(Qt::AlignCenter);
int port = t->outPort();
int channel = t->outChannel();
@@ -353,43 +356,48 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
// Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size.
//autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, config.fonts[6].pointSize(), 5);
QToolTip::add(dev_ch_label, tr("output port and channel"));
- smBox1->addWidget(dev_ch_label);
- smBox1->addWidget(record);
+ */
- layout->addLayout(smBox1);
- layout->addLayout(smBox2);
+ off = new TransparentToolButton(this);
+ QIcon iconOff;
+ iconOff.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On);
+ iconOff.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off);
+ off->setIcon(iconOff);
+ off->setIconSize(exit1Icon->size());
+ off->setBackgroundRole(QPalette::Mid);
+ off->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ off->setCheckable(true);
+ off->setToolTip(tr("off"));
+ off->setChecked(t->off());
+ connect(off, SIGNAL(toggled(bool)), SLOT(offToggled(bool)));
+
+ grid->addWidget(off, _curGridRow, 0);
+ grid->addWidget(record, _curGridRow++, 1);
+ grid->addWidget(mute, _curGridRow, 0);
+ grid->addWidget(solo, _curGridRow++, 1);
//---------------------------------------------------
// routing
//---------------------------------------------------
- // p3.3.38
- //route = new QToolButton(this);
- //route->setFont(config.fonts[1]);
- //route->setFixedWidth(STRIP_WIDTH);
- //route->setText(tr("Route"));
- //QToolTip::add(route, tr("set routing"));
- //layout->addWidget(route);
- QHBoxLayout* rBox = new QHBoxLayout(0);
- iR = new QToolButton(this);
+ iR = new QToolButton();
iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
+ iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
iR->setText(tr("iR"));
- iR->setToggleButton(false);
- QToolTip::add(iR, tr("input routing"));
- rBox->addWidget(iR);
+ iR->setCheckable(false);
+ iR->setToolTip(tr("input routing"));
+ grid->addWidget(iR, _curGridRow, 0);
connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
- oR = new QToolButton(this);
+ oR = new QToolButton();
oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
+ oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
oR->setText(tr("oR"));
- oR->setToggleButton(false);
+ oR->setCheckable(false);
// TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values...
oR->setEnabled(false);
- QToolTip::add(oR, tr("output routing"));
- rBox->addWidget(oR);
+ oR->setToolTip(tr("output routing"));
+ grid->addWidget(oR, _curGridRow++, 1);
connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
- layout->addLayout(rBox);
//---------------------------------------------------
// automation mode
@@ -397,8 +405,9 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
autoType = new ComboBox(this);
autoType->setFont(config.fonts[1]);
- autoType->setFixedWidth(STRIP_WIDTH-4);
+ autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
autoType->setEnabled(false);
+
// Removed by T356.
// Disabled for now. There is no midi automation mechanism yet...
//autoType->insertItem(tr("Off"), AUTO_OFF);
@@ -406,14 +415,52 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
//autoType->insertItem(tr("Touch"), AUTO_TOUCH);
//autoType->insertItem(tr("Write"), AUTO_WRITE);
//autoType->setCurrentItem(t->automationType());
- //QToolTip::add(autoType, tr("automation type"));
+ // TODO: Convert ComboBox to QT4
+ //autoType->insertItem(AUTO_OFF, tr("Off"));
+ //autoType->insertItem(AUTO_READ, tr("Read"));
+ //autoType->insertItem(AUTO_TOUCH, tr("Touch"));
+ //autoType->insertItem(AUTO_WRITE, tr("Write"));
+ //autoType->setCurrentIndex(t->automationType());
+ //autoType->setToolTip(tr("automation type"));
+
//connect(autoType, SIGNAL(activated(int,int)), SLOT(setAutomationType(int,int)));
- layout->addWidget(autoType);
+ grid->addWidget(autoType, _curGridRow++, 0, 1, 2);
connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
inHeartBeat = false;
}
//---------------------------------------------------------
+// updateOffState
+//---------------------------------------------------------
+
+void MidiStrip::updateOffState()
+ {
+ bool val = !track->off();
+ slider->setEnabled(val);
+ sl->setEnabled(val);
+ //pan->setEnabled(val);
+ label->setEnabled(val);
+
+ if (record)
+ record->setEnabled(val);
+ if (solo)
+ solo->setEnabled(val);
+ if (mute)
+ mute->setEnabled(val);
+ if (autoType)
+ autoType->setEnabled(val);
+ if (iR)
+ iR->setEnabled(val);
+ if (oR)
+ oR->setEnabled(val);
+ if (off) {
+ off->blockSignals(true);
+ off->setOn(track->off());
+ off->blockSignals(false);
+ }
+ }
+
+//---------------------------------------------------------
// songChanged
//---------------------------------------------------------
@@ -431,13 +478,13 @@ void MidiStrip::songChanged(int val)
{
if(!useSoloIconSet2)
{
- solo->setIconSet(*soloIconSet2);
+ solo->setIcon(*soloIconSet2);
useSoloIconSet2 = true;
}
}
else if(useSoloIconSet2)
{
- solo->setIconSet(*soloIconSet1);
+ solo->setIcon(*soloIconSet1);
useSoloIconSet2 = false;
}
solo->blockSignals(true);
@@ -555,6 +602,16 @@ void MidiStrip::labelDoubleClicked(int idx)
}
+//---------------------------------------------------------
+// offToggled
+//---------------------------------------------------------
+
+void MidiStrip::offToggled(bool val)
+ {
+ track->setOff(val);
+ song->update(SC_MUTE);
+ }
+
/*
//---------------------------------------------------------
// routeClicked
@@ -944,25 +1001,6 @@ void MidiStrip::setReverbSend(double val)
}
//---------------------------------------------------------
-// updateOffState
-//---------------------------------------------------------
-
-void MidiStrip::updateOffState() // Ripped from AudioStrip, hehh(mg)
- {
- bool val = !track->off();
- slider->setEnabled(val);
- //KNOB* gcon = &controller[KNOB_PAN]; // TODO: Pan ctrl
- //gcon->setOn(val);
- label->setEnabled(val);
- if (record)
- record->setEnabled(val);
- if (solo)
- solo->setEnabled(val);
- if (mute)
- mute->setEnabled(val);
- }
-
-//---------------------------------------------------------
// routingPopupMenuActivated
//---------------------------------------------------------
diff --git a/muse2/muse/mixer/mstrip.h b/muse2/muse/mixer/mstrip.h
index d5776d43..920cca99 100644
--- a/muse2/muse/mixer/mstrip.h
+++ b/muse2/muse/mixer/mstrip.h
@@ -10,7 +10,6 @@
#define __MSTRIP_H__
#include "strip.h"
-//Added by qt3to4:
#include <QLabel>
class Slider;
@@ -21,6 +20,7 @@ class QString;
class MidiTrack;
class QLabel;
class QAction;
+class TransparentToolButton;
//---------------------------------------------------------
// MidiStrip
@@ -31,6 +31,7 @@ class MidiStrip : public Strip {
Slider* slider;
DoubleLabel* sl;
+ TransparentToolButton* off;
//QToolButton* route;
//QToolButton* iR;
//QToolButton* oR;
@@ -55,6 +56,7 @@ class MidiStrip : public Strip {
private slots:
//void routeClicked();
+ void offToggled(bool);
void iRoutePressed();
void oRoutePressed();
void routingPopupMenuActivated(QAction*);
diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp
index 7bd564b7..394e6b73 100644
--- a/muse2/muse/mixer/strip.cpp
+++ b/muse2/muse/mixer/strip.cpp
@@ -126,7 +126,6 @@ void Strip::setLabelText()
label->setText(track->name());
QPalette palette;
palette.setColor(label->backgroundRole(), c);
- //palette.setColor(QPalette::Window, c);
label->setPalette(palette);
}
@@ -158,6 +157,7 @@ void Strip::soloToggled(bool val)
Strip::Strip(QWidget* parent, Track* t)
: QFrame(parent)
{
+ _curGridRow = 0;
setAttribute(Qt::WA_DeleteOnClose);
iR = 0;
oR = 0;
@@ -171,16 +171,22 @@ Strip::Strip(QWidget* parent, Track* t)
meter[0] = 0;
meter[1] = 0;
setFixedWidth(STRIP_WIDTH);
- //layout = new QVBoxLayout(this);
- layout = new QVBoxLayout();
- layout->setMargin(3);
- setLayout(layout);
+
+ grid = new QGridLayout();
+ grid->setMargin(0);
+ grid->setSpacing(0);
+ setLayout(grid);
//---------------------------------------------
// label
//---------------------------------------------
+ //label = new QLabel(this);
+ // NOTE: This was required, otherwise the strip labels have no colour in the mixer only - track info OK !
+ // Not sure why...
label = new QLabel(this);
+
+
// Moved by Tim. p3.3.9
//setLabelText();
//label->setFont(config.fonts[1]);
@@ -192,7 +198,9 @@ Strip::Strip(QWidget* parent, Track* t)
// Therefore 'fake' set the size of the label now.
// Added by Tim. p3.3.9
//label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*frameWidth() - 2*layout->margin(), label->height());
- label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*layout->margin(), label->height());
+ label->setGeometry(label->x(), label->y(), STRIP_WIDTH - 2*grid->margin(), label->height());
+
+ label->setTextFormat(Qt::PlainText);
// Unfortunately for the mixer labels, QLabel doesn't support the BreakAnywhere flag.
// Changed by Tim. p3.3.9
@@ -214,7 +222,8 @@ Strip::Strip(QWidget* parent, Track* t)
setLabelText();
setLabelFont();
- layout->addWidget(label);
+ //layout->addWidget(label);
+ grid->addWidget(label, _curGridRow++, 0, 1, 2);
}
//---------------------------------------------------------
diff --git a/muse2/muse/mixer/strip.h b/muse2/muse/mixer/strip.h
index 4b4bfab1..b138992e 100644
--- a/muse2/muse/mixer/strip.h
+++ b/muse2/muse/mixer/strip.h
@@ -9,10 +9,8 @@
#ifndef __STRIP_H__
#define __STRIP_H__
-//#include <q3frame.h>
#include <QFrame>
#include <QIcon>
-//Added by qt3to4:
#include <QVBoxLayout>
#include <QGridLayout>
#include <QLabel>
@@ -22,7 +20,7 @@
class Track;
class QLabel;
-class QVBoxLayout;
+//class QVBoxLayout;
class Meter;
class QToolButton;
class QGridLayout;
@@ -36,11 +34,13 @@ static const int STRIP_WIDTH = 65;
class Strip : public QFrame {
Q_OBJECT
-
+
protected:
Track* track;
QLabel* label;
- QVBoxLayout* layout;
+ //QVBoxLayout* layout;
+ QGridLayout* grid;
+ int _curGridRow;
Meter* meter[MAX_CHANNELS];
bool useSoloIconSet2;