UI: Allow volume peak to be customized via .qss

With the addition of the peak volume indicator, themes may wish to change
these colors but there was no way to do so. This change updates the
VolumeControl widget to allow a stylesheet to adjust all possible colors
for the volume bar. In addtion, the Rachni theme is updated to demonstrate
this new capability.
This commit is contained in:
Joel Bethke 2017-08-11 20:58:40 -05:00
parent d3c163b775
commit 5576823f24
3 changed files with 31 additions and 5 deletions

View File

@ -671,9 +671,11 @@ QProgressBar::chunk {
VolumeMeter {
qproperty-bkColor: rgb(35, 38, 41); /* Dark Gray */
qproperty-magColor: rgb(186, 45, 101); /* Dark Pink (Secondary Dark) */
qproperty-peakColor: rgb(240, 98, 146); /* Pink (Secondary) */
qproperty-peakHoldColor: rgb(255, 148, 194); /* Light Pink (Secondary Light) */
qproperty-magColor: rgb(153, 204, 0);
qproperty-peakColor: rgb(96, 128, 0);
qproperty-peakHoldColor: rgb(210, 255, 77);
qproperty-clipColor1: rgb(230, 40, 50);
qproperty-clipColor2: rgb(140, 0, 40);
}
/*******************/
@ -719,8 +721,6 @@ QPushButton:disabled {
color: rgb(162, 161, 162); /* Lighter Gray */
}
/******************************/
/* --- Dialog Box Buttons --- */
/******************************/

View File

@ -255,6 +255,26 @@ void VolumeMeter::setPeakHoldColor(QColor c)
peakHoldColor = c;
}
QColor VolumeMeter::getClipColor1() const
{
return clipColor1;
}
void VolumeMeter::setClipColor1(QColor c)
{
clipColor1 = c;
}
QColor VolumeMeter::getClipColor2() const
{
return clipColor2;
}
void VolumeMeter::setClipColor2(QColor c)
{
clipColor2 = c;
}
VolumeMeter::VolumeMeter(QWidget *parent)
: QWidget(parent)

View File

@ -17,6 +17,8 @@ class VolumeMeter : public QWidget
Q_PROPERTY(QColor magColor READ getMagColor WRITE setMagColor DESIGNABLE true)
Q_PROPERTY(QColor peakColor READ getPeakColor WRITE setPeakColor DESIGNABLE true)
Q_PROPERTY(QColor peakHoldColor READ getPeakHoldColor WRITE setPeakHoldColor DESIGNABLE true)
Q_PROPERTY(QColor clipColor1 READ getClipColor1 WRITE setClipColor1 DESIGNABLE true)
Q_PROPERTY(QColor clipColor2 READ getClipColor2 WRITE setClipColor2 DESIGNABLE true)
private:
static QWeakPointer<VolumeMeterTimer> updateTimer;
@ -46,6 +48,10 @@ public:
void setPeakColor(QColor c);
QColor getPeakHoldColor() const;
void setPeakHoldColor(QColor c);
QColor getClipColor1() const;
void setClipColor1(QColor c);
QColor getClipColor2() const;
void setClipColor2(QColor c);
protected:
void paintEvent(QPaintEvent *event);