summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-11-12 01:32:41 +0000
committerTim E. Real <termtech@rogers.com>2010-11-12 01:32:41 +0000
commite15cfce0e93c4e9aab7dd7a99d02a0b69f7bca6a (patch)
tree258ef029526a8a13c0588566a75ad608955ee659 /muse2
parentf3cb950ad0c043f33a378d19b19e9dc7bb9c88e7 (diff)
WIP: Mixer and strips re-designed to be theme/font friendly - no more fixed STRIP_WIDTH.
Fixed Slider, Knob, Rack and DoubleEntry classes.
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog3
-rw-r--r--muse2/muse/mixer/amixer.cpp19
-rw-r--r--muse2/muse/mixer/astrip.cpp41
-rw-r--r--muse2/muse/mixer/astrip.h2
-rw-r--r--muse2/muse/mixer/mstrip.cpp33
-rw-r--r--muse2/muse/mixer/rack.cpp9
-rw-r--r--muse2/muse/mixer/rack.h1
-rw-r--r--muse2/muse/mixer/strip.cpp13
-rw-r--r--muse2/muse/widgets/doublelabel.cpp19
-rw-r--r--muse2/muse/widgets/doublelabel.h1
-rw-r--r--muse2/muse/widgets/knob.cpp34
-rw-r--r--muse2/muse/widgets/knob.h9
-rw-r--r--muse2/muse/widgets/slider.cpp70
-rw-r--r--muse2/muse/widgets/slider.h1
-rw-r--r--muse2/muse/widgets/sliderbase.cpp1
-rw-r--r--muse2/muse/widgets/sliderbase.h5
16 files changed, 155 insertions, 106 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 7e9ab1f4..ce8b11e6 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+11.11.2010
+ - WIP: Mixer and strips re-designed to be theme/font friendly - no more fixed STRIP_WIDTH. (Tim)
+ - Fixed Slider, Knob and DoubleEntry classes. Knob anti-aliasing applied (where allowed).
10.11.2010
- Ported transport window to Qt4. The handle color needs a fix (Orcan)
09.11.2010
diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp
index 2f5363ac..140dca3b 100644
--- a/muse2/muse/mixer/amixer.cpp
+++ b/muse2/muse/mixer/amixer.cpp
@@ -48,6 +48,7 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c)
cfg = c;
oldAuxsSize = 0;
routingDialog = 0;
+ setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding)); // TESTING Tim
setWindowTitle(cfg->name);
setWindowIcon(*museIcon);
@@ -209,10 +210,10 @@ void AudioMixerApp::updateMixer(UpdateAction action)
delete *ssi;
stripList.erase(ssi);
}
- setMaximumWidth(STRIP_WIDTH * stripList.size() + __WIDTH_COMPENSATION);
+ ///setMaximumWidth((STRIP_WIDTH + 10) * stripList.size() + __WIDTH_COMPENSATION); // 10 REMOVE Tim
// Added by Tim. p3.3.7
- if (stripList.size() < 8)
- view->setMinimumWidth(stripList.size() * STRIP_WIDTH + __WIDTH_COMPENSATION);
+ ///if (stripList.size() < 8)
+ /// view->setMinimumWidth(stripList.size() * (STRIP_WIDTH + 10) + __WIDTH_COMPENSATION); // 10 REMOVE Tim
return;
}
@@ -256,9 +257,9 @@ void AudioMixerApp::updateMixer(UpdateAction action)
addStrip(*i, idx++);
}
- setMaximumWidth(STRIP_WIDTH * stripList.size() + __WIDTH_COMPENSATION);
- if (stripList.size() < 8)
- view->setMinimumWidth(stripList.size() * STRIP_WIDTH + __WIDTH_COMPENSATION);
+ ///setMaximumWidth((STRIP_WIDTH + 10) * stripList.size() + __WIDTH_COMPENSATION); // 10 REMOVE Tim
+ ///if (stripList.size() < 8)
+ /// view->setMinimumWidth(stripList.size() * (STRIP_WIDTH + 10) + __WIDTH_COMPENSATION); // 10 REMOVE Tim
return;
}
@@ -341,9 +342,9 @@ void AudioMixerApp::updateMixer(UpdateAction action)
addStrip(*i, idx++);
}
- setMaximumWidth(STRIP_WIDTH * idx + __WIDTH_COMPENSATION);
- if (idx < 8)
- view->setMinimumWidth(idx * STRIP_WIDTH + __WIDTH_COMPENSATION);
+ ///setMaximumWidth((STRIP_WIDTH + 10) * idx + __WIDTH_COMPENSATION); // 10 REMOVE Tim
+ ///if (idx < 8)
+ /// view->setMinimumWidth(idx * (STRIP_WIDTH + 10) + __WIDTH_COMPENSATION); // 10 REMOVE Tim
}
//---------------------------------------------------------
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
index 7ede1a2e..2b1b53cf 100644
--- a/muse2/muse/mixer/astrip.cpp
+++ b/muse2/muse/mixer/astrip.cpp
@@ -71,7 +71,7 @@ QWidget* MenuTitleItem::createWidget(QWidget *parent)
return l;
}
-//---------------------------------------------------------
+/*//---------------------------------------------------------
// minimumSizeHint
//---------------------------------------------------------
@@ -81,6 +81,7 @@ QSize AudioStrip::minimumSizeHint () const
//return QWidget::minimumSizeHint();
return QSize(66,QWidget::minimumSizeHint().height());
}
+*/
//---------------------------------------------------------
// heartBeat
@@ -166,7 +167,7 @@ void AudioStrip::songChanged(int val)
if (mute && (val & SC_MUTE)) { // mute && off
mute->blockSignals(true);
- mute->setOn(src->mute());
+ mute->setChecked(src->mute());
mute->blockSignals(false);
updateOffState();
}
@@ -188,7 +189,7 @@ void AudioStrip::songChanged(int val)
}
solo->blockSignals(true);
- solo->setOn(track->solo());
+ solo->setChecked(track->solo());
solo->blockSignals(false);
}
if (val & SC_RECFLAG)
@@ -205,7 +206,7 @@ void AudioStrip::songChanged(int val)
if (val & SC_ROUTE) {
if (pre) {
pre->blockSignals(true);
- pre->setOn(src->prefader());
+ pre->setChecked(src->prefader());
pre->blockSignals(false);
}
}
@@ -324,7 +325,7 @@ void AudioStrip::updateOffState()
oR->setEnabled(val);
if (off) {
off->blockSignals(true);
- off->setOn(track->off());
+ off->setChecked(track->off());
off->blockSignals(false);
}
}
@@ -566,7 +567,7 @@ void AudioStrip::updateChannels()
}
channel = c;
stereo->blockSignals(true);
- stereo->setOn(channel == 2);
+ stereo->setChecked(channel == 2);
stereo->blockSignals(false);
}
@@ -591,7 +592,6 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
else
knob->setToolTip(tr("aux send level"));
-
DoubleLabel* pl;
if (type == 0)
pl = new DoubleLabel(0, -1.0, +1.0, this);
@@ -608,10 +608,9 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
pl->setPrecision(2);
else {
pl->setPrecision(0);
- pl->setPrecision(0);
}
pl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
-
+
QString label;
if (type == 0)
label = tr("Pan");
@@ -623,12 +622,13 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel)
plb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
plb->setAlignment(Qt::AlignCenter);
- QGridLayout* pangrid = new QGridLayout();
- pangrid->setMargin(0);
- pangrid->addWidget(plb, 0, 0);
- pangrid->addWidget(pl, 1, 0);
- pangrid->addWidget(knob, 0, 1, 2, 1);
- grid->addLayout(pangrid, _curGridRow++, 0, 1, 2);
+ grid->addWidget(plb, _curGridRow, 0);
+ grid->addWidget(pl, _curGridRow+1, 0);
+ grid->addWidget(knob, _curGridRow, 1, 2, 1);
+ //grid->addWidget(plb, _curGridRow, 0, Qt::AlignCenter);
+ //grid->addWidget(pl, _curGridRow+1, 0, Qt::AlignCenter);
+ //grid->addWidget(knob, _curGridRow, 1, 2, 1, Qt::AlignCenter);
+ _curGridRow += 2;
connect(knob, SIGNAL(valueChanged(double,int)), pl, SLOT(setValue(double)));
//connect(pl, SIGNAL(valueChanged(double, int)), SLOT(panChanged(double)));
@@ -677,8 +677,8 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
AudioTrack* t = (AudioTrack*)track;
channel = at->channels();
- setMinimumWidth(STRIP_WIDTH);
-
+ ///setMinimumWidth(STRIP_WIDTH);
+
int ch = 0;
for (; ch < channel; ++ch)
meter[ch] = new Meter(this);
@@ -721,7 +721,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
pre->setText(tr("Pre"));
pre->setToolTip(tr("pre fader - post fader"));
pre->setChecked(t->prefader());
- stereo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ pre->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
connect(pre, SIGNAL(clicked(bool)), SLOT(preToggled(bool)));
grid->addWidget(stereo, _curGridRow, 0);
@@ -784,7 +784,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
sl->setSuffix(tr("dB"));
sl->setFrame(true);
sl->setPrecision(0);
- sl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ sl->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum));
sl->setValue(fast_log10(t->volume()) * 20.0);
connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volLabelChanged(double)));
@@ -794,7 +794,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 &)));
- grid->addWidget(sl, _curGridRow++, 0, 1, 2);
+ grid->addWidget(sl, _curGridRow++, 0, 1, 2, Qt::AlignCenter);
//---------------------------------------------------
// pan, balance
@@ -916,6 +916,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
autoType = new ComboBox(this);
autoType->setFont(config.fonts[1]);
autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ autoType->setAlignment(Qt::AlignCenter);
autoType->insertItem(tr("Off"), AUTO_OFF);
autoType->insertItem(tr("Read"), AUTO_READ);
diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h
index b5a8612f..a60b4dd8 100644
--- a/muse2/muse/mixer/astrip.h
+++ b/muse2/muse/mixer/astrip.h
@@ -91,7 +91,7 @@ class AudioStrip : public Strip {
public:
AudioStrip(QWidget* parent, AudioTrack*);
~AudioStrip();
- virtual QSize minimumSizeHint () const;
+ ///virtual QSize minimumSizeHint () const;
};
#endif
diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp
index de3e6d7f..abf37a28 100644
--- a/muse2/muse/mixer/mstrip.cpp
+++ b/muse2/muse/mixer/mstrip.cpp
@@ -139,13 +139,11 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label,
lb->setAlignment(Qt::AlignCenter);
lb->setEnabled(enabled);
- 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);
-
+ grid->addWidget(lb, _curGridRow, 0);
+ grid->addWidget(dl, _curGridRow+1, 0);
+ grid->addWidget(knob, _curGridRow, 1, 2, 1);
+ _curGridRow += 2;
+
connect(knob, SIGNAL(sliderMoved(double,int)), slot);
connect(knob, SIGNAL(sliderRightClicked(const QPoint &, int)), SLOT(controlRightClicked(const QPoint &, int)));
connect(dl, SIGNAL(valueChanged(double, int)), slot);
@@ -174,7 +172,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
addKnob(KNOB_VAR_SEND, tr("VariationSend"), tr("Var"), SLOT(setVariSend(double)), false);
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();
+ ///int auxsSize = song->auxs()->size();
///if (auxsSize)
//layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize);
///grid->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize); // ??
@@ -216,7 +214,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
sl->setToolTip(tr("double click on/off"));
sl->setFrame(true);
sl->setPrecision(0);
- sl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ sl->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum));
// Set the label's slider 'buddy'.
sl->setSlider(slider);
@@ -260,7 +258,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
connect(sl, SIGNAL(valueChanged(double, int)), SLOT(volLabelChanged(double)));
connect(sl, SIGNAL(doubleClicked(int)), SLOT(labelDoubleClicked(int)));
- grid->addWidget(sl, _curGridRow++, 0, 1, 2);
+ grid->addWidget(sl, _curGridRow++, 0, 1, 2, Qt::AlignCenter);
//---------------------------------------------------
// pan, balance
@@ -408,6 +406,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t)
autoType = new ComboBox(this);
autoType->setFont(config.fonts[1]);
autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
+ autoType->setAlignment(Qt::AlignCenter);
autoType->setEnabled(false);
// Removed by T356.
@@ -440,7 +439,8 @@ void MidiStrip::updateOffState()
bool val = !track->off();
slider->setEnabled(val);
sl->setEnabled(val);
- //pan->setEnabled(val);
+ controller[KNOB_PAN].knob->setEnabled(val);
+ controller[KNOB_PAN].dl->setEnabled(val);
label->setEnabled(val);
if (record)
@@ -453,11 +453,12 @@ void MidiStrip::updateOffState()
autoType->setEnabled(val);
if (iR)
iR->setEnabled(val);
- if (oR)
- oR->setEnabled(val);
+ // TODO: Disabled for now.
+ //if (oR)
+ // oR->setEnabled(val);
if (off) {
off->blockSignals(true);
- off->setOn(track->off());
+ off->setChecked(track->off());
off->blockSignals(false);
}
}
@@ -470,7 +471,7 @@ void MidiStrip::songChanged(int val)
{
if (mute && (val & SC_MUTE)) { // mute && off
mute->blockSignals(true);
- mute->setOn(track->isMute());
+ mute->setChecked(track->isMute());
updateOffState();
mute->blockSignals(false);
}
@@ -492,7 +493,7 @@ void MidiStrip::songChanged(int val)
useSoloIconSet2 = false;
}
solo->blockSignals(true);
- solo->setOn(track->solo());
+ solo->setChecked(track->solo());
solo->blockSignals(false);
}
diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp
index 1fbef665..b59b9439 100644
--- a/muse2/muse/mixer/rack.cpp
+++ b/muse2/muse/mixer/rack.cpp
@@ -138,6 +138,15 @@ QSize EffectRack::minimumSizeHint() const
}
//---------------------------------------------------------
+// SizeHint
+//---------------------------------------------------------
+
+QSize EffectRack::sizeHint() const
+ {
+ return minimumSizeHint();
+ }
+
+//---------------------------------------------------------
// menuRequested
//---------------------------------------------------------
diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h
index edacfa29..438bbdb6 100644
--- a/muse2/muse/mixer/rack.h
+++ b/muse2/muse/mixer/rack.h
@@ -27,6 +27,7 @@ class EffectRack : public Q3ListBox {
Q_OBJECT
virtual QSize minimumSizeHint() const;
+ virtual QSize sizeHint() const;
void startDrag(int idx);
void initPlugin(Xml xml, int idx);
diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp
index 394e6b73..cef793d0 100644
--- a/muse2/muse/mixer/strip.cpp
+++ b/muse2/muse/mixer/strip.cpp
@@ -165,12 +165,23 @@ Strip::Strip(QWidget* parent, Track* t)
setBackgroundRole(QPalette::Mid);
setFrameStyle(Panel | Raised);
setLineWidth(2);
+
+ // NOTE: Workaround for freakin' improper disabled button text colour (at least with Oxygen colours).
+ // Just set the parent palette.
+ QPalette pal(palette());
+ pal.setColor(QPalette::Disabled, QPalette::ButtonText,
+ pal.color(QPalette::Disabled, QPalette::WindowText));
+ setPalette(pal);
+
useSoloIconSet2 = false;
track = t;
meter[0] = 0;
meter[1] = 0;
- setFixedWidth(STRIP_WIDTH);
+ //setFixedWidth(STRIP_WIDTH);
+ //setMinimumWidth(STRIP_WIDTH); // TESTING Tim.
+ //setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding)); // TESTING Tim.
+ setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding)); // TESTING Tim.
grid = new QGridLayout();
grid->setMargin(0);
diff --git a/muse2/muse/widgets/doublelabel.cpp b/muse2/muse/widgets/doublelabel.cpp
index c20de1e2..af492738 100644
--- a/muse2/muse/widgets/doublelabel.cpp
+++ b/muse2/muse/widgets/doublelabel.cpp
@@ -12,6 +12,7 @@
#include <qpalette.h>
#include <stdio.h>
#include <values.h>
+#include <math.h>
#include "utils.h"
@@ -170,9 +171,10 @@ QSize DoubleLabel::sizeHint() const
{
QFontMetrics fm = fontMetrics();
int h = fm.height() + 4;
- int n = _precision + 6;
-#if 0
- double aval = fabs(val);
+ int n = _precision;
+
+ ++n; // For some reason I have to add one digit. Shouldn't have to.
+ double aval = fmax(fabs(max), fabs(min));
if (aval >= 10.0)
++n;
if (aval >= 100.0)
@@ -183,7 +185,16 @@ QSize DoubleLabel::sizeHint() const
++n;
if (aval >= 100000.0)
++n;
-#endif
+
int w = fm.width(QString("-0.")) + fm.width('0') * n + 6;
+ if(!_suffix.isEmpty())
+ {
+ w += fm.width(QString(" ")) + fm.width(_suffix);
+ }
return QSize(w, h);
}
+
+QSize DoubleLabel::minimumSizeHint() const
+{
+ return sizeHint();
+}
diff --git a/muse2/muse/widgets/doublelabel.h b/muse2/muse/widgets/doublelabel.h
index 6698ec57..0887368e 100644
--- a/muse2/muse/widgets/doublelabel.h
+++ b/muse2/muse/widgets/doublelabel.h
@@ -39,6 +39,7 @@ class DoubleLabel : public Dentry {
DoubleLabel(QWidget*, const char* name = 0);
DoubleLabel(double val, double min, double max, QWidget*);
virtual QSize sizeHint() const;
+ virtual QSize minimumSizeHint () const;
double minValue() const { return min; }
double maxValue() const { return max; }
double off() const { return _off; }
diff --git a/muse2/muse/widgets/knob.cpp b/muse2/muse/widgets/knob.cpp
index bfc46e77..9d94e54c 100644
--- a/muse2/muse/widgets/knob.cpp
+++ b/muse2/muse/widgets/knob.cpp
@@ -23,9 +23,8 @@
#include <cmath>
#include "mmath.h"
-#include <qpainter.h>
-#include <qpalette.h>
-//Added by qt3to4:
+#include <QPainter>
+#include <QPalette>
#include <QPaintEvent>
#include <QResizeEvent>
@@ -57,10 +56,10 @@ Knob::Knob(QWidget* parent, const char* name)
d_maxScaleTicks = 11;
d_knobWidth = 30;
_faceColSel = FALSE;
- d_faceColor = backgroundColor();
+ d_faceColor = palette().color(QPalette::Window);
d_curFaceColor = d_faceColor;
d_altFaceColor = d_faceColor;
- d_markerColor = foregroundColor();
+ d_markerColor = palette().color(QPalette::WindowText);
d_dotWidth = 8;
setMinimumSize(30,30);
@@ -101,7 +100,7 @@ void Knob::drawKnob(QPainter* p, const QRect& r)
{
QRect aRect;
- QColorGroup g = colorGroup();
+ const QPalette& pal = palette();
QPen pn;
int bw2 = d_borderWidth / 2;
@@ -123,18 +122,20 @@ void Knob::drawKnob(QPainter* p, const QRect& r)
pn.setWidth(d_borderWidth);
- pn.setColor(g.light());
+ pn.setColor(pal.light());
p->setPen(pn);
p->drawArc(aRect, 45*16,180*16);
- pn.setColor(g.dark());
+ pn.setColor(pal.dark());
p->setPen(pn);
p->drawArc(aRect, 225*16,180*16);
//
// draw marker
//
- drawMarker(p, d_angle, d_markerColor);
+ //drawMarker(p, d_angle, isEnabled() ? d_markerColor : Qt::gray);
+ drawMarker(p, d_angle, pal.currentColorGroup() == QPalette::Disabled ?
+ pal.color(QPalette::Disabled, QPalette::WindowText) : d_markerColor);
}
//------------------------------------------------------------
@@ -299,9 +300,9 @@ void Knob::resizeEvent(QResizeEvent *)
// paintEvent
//------------------------------------------------------------
-void Knob::paintEvent(QPaintEvent* e)
+void Knob::paintEvent(QPaintEvent*)
{
- QPainter p(this);
+/* QPainter p(this);
const QRect &r = e->rect();
if ((r == kRect) && d_newVal ) { // event from valueChange()
@@ -319,6 +320,17 @@ void Knob::paintEvent(QPaintEvent* e)
drawKnob(&p, kRect);
}
d_newVal = 0;
+*/
+
+ QPainter p(this);
+ p.setRenderHint(QPainter::Antialiasing, true);
+ if(hasScale)
+ d_scale.draw(&p);
+ drawKnob(&p, kRect);
+ //drawMarker(&p, d_oldAngle, d_curFaceColor);
+ //drawMarker(&p, d_angle, d_markerColor);
+
+ d_newVal = 0;
}
//------------------------------------------------------------
diff --git a/muse2/muse/widgets/knob.h b/muse2/muse/widgets/knob.h
index baaf9a50..0e412d1e 100644
--- a/muse2/muse/widgets/knob.h
+++ b/muse2/muse/widgets/knob.h
@@ -1,10 +1,9 @@
#ifndef QWT_KNOB_H
#define QWT_KNOB_H
-#include <sliderbase.h>
-#include <sclif.h>
-#include <qcolor.h>
-//Added by qt3to4:
+#include "sliderbase.h"
+#include "sclif.h"
+#include <QColor>
#include <QResizeEvent>
#include <QPaintEvent>
@@ -50,7 +49,7 @@ class Knob : public SliderBase, public ScaleIf
void drawKnob(QPainter *p, const QRect &r);
void drawMarker(QPainter *p, double arc, const QColor &c);
- void paintEvent(QPaintEvent *e);
+ void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *e);
double getValue(const QPoint &p);
void getScrollMode( QPoint &p, const Qt::ButtonState &button, int &scrollMode, int &direction );
diff --git a/muse2/muse/widgets/slider.cpp b/muse2/muse/widgets/slider.cpp
index 64b57f16..a1a9890a 100644
--- a/muse2/muse/widgets/slider.cpp
+++ b/muse2/muse/widgets/slider.cpp
@@ -1,9 +1,8 @@
#include <cmath>
#include "mmath.h"
#include <qdrawutil.h>
-#include <qpainter.h>
-#include <qcursor.h>
-//Added by qt3to4:
+#include <QPainter>
+#include <QCursor>
#include <QPaintEvent>
#include <QResizeEvent>
@@ -186,10 +185,10 @@ void Slider::fontChange(const QFont & /*oldFont*/)
void Slider::drawSlider(QPainter *p, const QRect &r)
{
- QColorGroup g = colorGroup();
- QBrush brBack(g.background());
+ const QPalette& pal = palette();
+ QBrush brBack(pal.window());
QBrush brMid;
- QBrush brDark(g.dark());
+ QBrush brDark(pal.dark());
QRect cr;
@@ -200,12 +199,12 @@ void Slider::drawSlider(QPainter *p, const QRect &r)
if (d_bwTrough > 0) {
qDrawShadePanel(p, r.x(), r.y(),
r.width(), r.height(),
- g, TRUE, d_bwTrough,0);
+ pal, TRUE, d_bwTrough,0);
cr.setRect(r.x() + d_bwTrough,
r.y() + d_bwTrough,
r.width() - 2*d_bwTrough,
r.height() - 2*d_bwTrough);
- brMid = QBrush(g.mid());
+ brMid = pal.mid();
}
else {
cr = r;
@@ -242,18 +241,18 @@ void Slider::drawSlider(QPainter *p, const QRect &r)
// Draw thumb
//
qDrawShadePanel(p,ipos, cr.y(), d_thumbLength, cr.height(),
- colorGroup(), FALSE, d_borderWidth, &brBack);
+ pal, FALSE, d_borderWidth, &brBack);
if (lineDist > 1)
qDrawShadeLine(p,markerPos, cr.y() + lineDist , markerPos,
cr.y() + cr.height() - lineDist,
- colorGroup(), TRUE, 1);
+ pal, TRUE, 1);
else
{
- p->setPen(g.dark());
+ p->setPen(pal.dark());
p->drawLine(markerPos -1 , cr.y() + lineDist, markerPos -1,
cr.y() + cr.height() - lineDist - 1);
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(markerPos, cr.y() + lineDist, markerPos,
cr.y() + cr.height() - lineDist - 1);
}
@@ -279,17 +278,17 @@ void Slider::drawSlider(QPainter *p, const QRect &r)
}
qDrawShadePanel(p,cr.x(),ipos , cr.width(), d_thumbLength,
- colorGroup(),FALSE,d_borderWidth, &brBack);
+ pal,FALSE,d_borderWidth, &brBack);
if (lineDist > 1)
qDrawShadeLine(p, cr.x() + lineDist , markerPos,
cr.x() + cr.width() - lineDist, markerPos,
- colorGroup(), TRUE, 1);
+ pal, TRUE, 1);
else {
- p->setPen(g.dark());
+ p->setPen(pal.dark());
p->drawLine(cr.x() + lineDist, markerPos - 1 ,
cr.x() + cr.width() - lineDist - 1, markerPos - 1);
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(cr.x() + lineDist, markerPos,
cr.x() + cr.width() - lineDist - 1 , markerPos);
}
@@ -314,7 +313,7 @@ void Slider::drawHsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
int ws, ds, dLeft;
int lPos, rPos;
QRect rSlot;
- const QColorGroup &g = colorGroup();
+ const QPalette& pal = palette();
ws = rBound.height();
if ((ws / 2) * 2 != ws)
@@ -339,19 +338,19 @@ void Slider::drawHsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
p->fillRect(rBound.x(),rSlot.y(),
rPos - rBound.left(),ws,brBack);
- p->setPen(g.dark());
+ p->setPen(pal.dark());
if (rSlot.x() < rThumb.left())
p->drawLine(rSlot.x(), rSlot.bottom(), rSlot.x(), rSlot.top());
if (rSlot.x() < rThumb.left() - 1)
{
p->drawLine(rSlot.x(), rSlot.top(), rThumb.left() - 1, rSlot.top());
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(rSlot.x() + 1, rSlot.bottom(),
rThumb.left() - 1, rSlot.bottom());
p->fillRect(rSlot.x() + 1, rSlot.y() + 1, dLeft - ds -1,
- rSlot.height() -2, QBrush(Qt::black));
-
+ rSlot.height() -2, QBrush(pal.currentColorGroup() == QPalette::Disabled ?
+ pal.color(QPalette::Disabled, QPalette::WindowText) : Qt::black));
}
}
@@ -366,22 +365,23 @@ void Slider::drawHsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
if (lPos <= rBound.right())
p->fillRect(lPos, rSlot.y() , rBound.right() - lPos + 1, ws ,brBack);
- p->setPen(g.dark());
+ p->setPen(pal.dark());
if (rSlot.right() > rThumb.right())
{
p->drawLine(rThumb.right() + 1, rSlot.top(), rSlot.right(), rSlot.top());
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(rSlot.right(), rSlot.bottom(), rSlot.right(), rSlot.top() + 1);
}
if (rSlot.right() > rThumb.right() + 1)
{
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(rThumb.right() + 1, rSlot.bottom(),
rSlot.right() -1, rSlot.bottom());
p->fillRect(rThumb.right() + 1, rSlot.y() + 1,
rSlot.right() - rThumb.right() - 1,
- rSlot.height() -2, QBrush(Qt::black));
+ rSlot.height() -2, QBrush(pal.currentColorGroup() == QPalette::Disabled ?
+ pal.color(QPalette::Disabled, QPalette::WindowText) : Qt::black));
}
}
@@ -409,7 +409,7 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
int ws, ds, dTop;
int lPos, hPos;
QRect rSlot;
- const QColorGroup &g = colorGroup();
+ const QPalette& pal = palette();
ws = rBound.width();
if ((ws / 2) * 2 != ws)
@@ -434,7 +434,7 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
p->fillRect(rSlot.x(),rBound.y(), ws,
hPos - rBound.top(),brBack);
- p->setPen(g.dark());
+ p->setPen(pal.dark());
if (rSlot.top() < rThumb.top())
p->drawLine(rSlot.left(), rSlot.top(), rSlot.right(), rSlot.top());
@@ -442,12 +442,13 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
if (rSlot.top() < rThumb.top() - 1)
{
p->drawLine(rSlot.left(), rThumb.top() - 1, rSlot.left(), rSlot.top());
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(rSlot.right(), rSlot.top() + 1, rSlot.right(),
rThumb.top() - 1);
p->fillRect(rSlot.x() + 1, rSlot.y() + 1, rSlot.width() - 2,
- dTop - ds -1, QBrush(Qt::black));
+ dTop - ds -1, QBrush(pal.currentColorGroup() == QPalette::Disabled ?
+ pal.color(QPalette::Disabled, QPalette::WindowText) : Qt::black));
}
}
@@ -464,22 +465,23 @@ void Slider::drawVsBgSlot(QPainter *p, const QRect &rBound, const QRect &rThumb,
if (lPos <= rBound.bottom())
p->fillRect(rSlot.left(), lPos, ws, rBound.bottom() - lPos + 1, brBack);
- p->setPen(g.dark());
+ p->setPen(pal.dark());
if (rSlot.bottom() > rThumb.bottom())
{
p->drawLine(rSlot.left(), rThumb.bottom() + 1, rSlot.left(), rSlot.bottom());
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(rSlot.left() * 1, rSlot.bottom(), rSlot.right(), rSlot.bottom());
}
if (rSlot.bottom() > rThumb.bottom() + 1)
{
- p->setPen(g.light());
+ p->setPen(pal.light());
p->drawLine(rSlot.right(), rThumb.bottom() + 1, rSlot.right(),
rSlot.bottom());
p->fillRect(rSlot.left() + 1, rThumb.bottom() + 1,
rSlot.width() - 2, rSlot.bottom() - rThumb.bottom() - 1,
- QBrush(Qt::black));
+ QBrush(pal.currentColorGroup() == QPalette::Disabled ?
+ pal.color(QPalette::Disabled, QPalette::WindowText) : Qt::black));
}
}
@@ -663,7 +665,7 @@ void Slider::paintEvent(QPaintEvent* /*e*/)
if (p.begin(this)) {
if (d_scalePos != None) {
- p.fillRect(this->rect(), this->backgroundColor());
+ p.fillRect(rect(), palette().window());
d_scale.draw(&p);
}
drawSlider(&p, d_sliderRect);
diff --git a/muse2/muse/widgets/slider.h b/muse2/muse/widgets/slider.h
index 499229e1..79969807 100644
--- a/muse2/muse/widgets/slider.h
+++ b/muse2/muse/widgets/slider.h
@@ -17,7 +17,6 @@
#include "sclif.h"
#include "sliderbase.h"
#include "scldraw.h"
-//Added by qt3to4:
#include <QResizeEvent>
#include <QPaintEvent>
diff --git a/muse2/muse/widgets/sliderbase.cpp b/muse2/muse/widgets/sliderbase.cpp
index 0d814d3c..3ce15c1e 100644
--- a/muse2/muse/widgets/sliderbase.cpp
+++ b/muse2/muse/widgets/sliderbase.cpp
@@ -14,7 +14,6 @@
#include <cmath>
#include "sliderbase.h"
#include "mmath.h"
-//Added by qt3to4:
#include <QWheelEvent>
#include <QMouseEvent>
#include <QTimerEvent>
diff --git a/muse2/muse/widgets/sliderbase.h b/muse2/muse/widgets/sliderbase.h
index 47084246..0dd39659 100644
--- a/muse2/muse/widgets/sliderbase.h
+++ b/muse2/muse/widgets/sliderbase.h
@@ -16,11 +16,10 @@
#include "drange.h"
#include <QFrame>
-#include <qpixmap.h>
-#include <qdatetime.h>
+#include <QPixmap>
+#include <QDateTime>
//#include <qbutton.h>
#include <QtGui>
-//Added by qt3to4:
#include <QWheelEvent>
#include <QMouseEvent>
#include <QTimerEvent>