Open up some gui elements to theming (#7314)

* Theming for current step note

* Theming for EnvelopeGraph

* Theming for LfoGraph

* curStepNoteColor - don't break old themes

* EnvelopeGraph - don't break old themes

* LfoGraph - don't break old themea

* currentStepNoteColor
This commit is contained in:
Oskar Wallgren
2024-11-30 14:54:45 +01:00
committed by GitHub
parent e311832ffb
commit 3562bbed3c
9 changed files with 67 additions and 19 deletions

View File

@@ -148,6 +148,7 @@ lmms--gui--PianoRoll {
qproperty-noteModeColor: rgb( 255, 255, 255 );
qproperty-noteColor: rgb( 119, 199, 216 );
qproperty-stepNoteColor: #9b1313;
qproperty-currentStepNoteColor: rgb(245, 3, 139);
qproperty-noteTextColor: rgb( 255, 255, 255 );
qproperty-noteOpacity: 128;
qproperty-noteBorders: true; /* boolean property, set false to have borderless notes */
@@ -796,6 +797,21 @@ lmms--gui--SubWindow > QPushButton:hover{
border-radius: 2px;
}
/* Instrument */
/* Envelope graph */
lmms--gui--EnvelopeGraph {
qproperty-noAmountColor: rgb(96, 91, 96);
qproperty-fullAmountColor: rgb(0, 255, 128);
qproperty-markerFillColor: rgb(153, 175, 255);
qproperty-markerOutlineColor: rgb(0, 0, 0);
}
/* LFO graph */
lmms--gui--LfoGraph {
qproperty-noAmountColor: rgb(96, 91, 96);
qproperty-fullAmountColor: rgb(0, 255, 128);
}
/* Plugins */

View File

@@ -179,6 +179,7 @@ lmms--gui--PianoRoll {
qproperty-noteModeColor: #0bd556;
qproperty-noteColor: #0bd556;
qproperty-stepNoteColor: #9b1313;
qproperty-currentStepNoteColor: rgb(245, 3, 139);
qproperty-noteTextColor: #ffffff;
qproperty-noteOpacity: 165;
qproperty-noteBorders: false; /* boolean property, set false to have borderless notes */
@@ -835,6 +836,21 @@ lmms--gui--SubWindow > QPushButton:hover{
border-radius: 2px;
}
/* Instrument */
/* Envelope graph */
lmms--gui--EnvelopeGraph {
qproperty-noAmountColor: rgb(96, 91, 96);
qproperty-fullAmountColor: rgb(0, 255, 128);
qproperty-markerFillColor: rgb(153, 175, 255);
qproperty-markerOutlineColor: rgb(0, 0, 0);
}
/* LFO graph */
lmms--gui--LfoGraph {
qproperty-noAmountColor: rgb(96, 91, 96);
qproperty-fullAmountColor: rgb(0, 255, 128);
}
/* Plugins */

View File

@@ -41,6 +41,12 @@ namespace gui
class EnvelopeGraph : public QWidget, public ModelView
{
Q_OBJECT
Q_PROPERTY(QColor noAmountColor MEMBER m_noAmountColor)
Q_PROPERTY(QColor fullAmountColor MEMBER m_fullAmountColor)
Q_PROPERTY(QColor markerFillColor MEMBER m_markerFillColor)
Q_PROPERTY(QColor markerOutlineColor MEMBER m_markerOutlineColor)
public:
enum class ScalingMode
{
@@ -68,6 +74,11 @@ private:
EnvelopeAndLfoParameters* m_params = nullptr;
ScalingMode m_scaling = ScalingMode::Dynamic;
QColor m_noAmountColor;
QColor m_fullAmountColor;
QColor m_markerFillColor;
QColor m_markerOutlineColor;
};
} // namespace gui

View File

@@ -41,6 +41,10 @@ namespace gui
class LfoGraph : public QWidget, public ModelView
{
Q_OBJECT
Q_PROPERTY(QColor noAmountColor MEMBER m_noAmountColor)
Q_PROPERTY(QColor fullAmountColor MEMBER m_fullAmountColor)
public:
LfoGraph(QWidget* parent);
@@ -56,6 +60,8 @@ private:
QPixmap m_lfoGraph = embed::getIconPixmap("lfo_graph");
float m_randomGraph {0.};
QColor m_noAmountColor;
QColor m_fullAmountColor;
};
} // namespace gui

View File

@@ -74,6 +74,7 @@ class PianoRoll : public QWidget
Q_PROPERTY(QColor noteModeColor MEMBER m_noteModeColor)
Q_PROPERTY(QColor noteColor MEMBER m_noteColor)
Q_PROPERTY(QColor stepNoteColor MEMBER m_stepNoteColor)
Q_PROPERTY(QColor currentStepNoteColor MEMBER m_currentStepNoteColor)
Q_PROPERTY(QColor ghostNoteColor MEMBER m_ghostNoteColor)
Q_PROPERTY(QColor noteTextColor MEMBER m_noteTextColor)
Q_PROPERTY(QColor ghostNoteTextColor MEMBER m_ghostNoteTextColor)
@@ -471,6 +472,7 @@ private:
QColor m_noteModeColor;
QColor m_noteColor;
QColor m_stepNoteColor;
QColor m_currentStepNoteColor;
QColor m_noteTextColor;
QColor m_ghostNoteColor;
QColor m_ghostNoteTextColor;

View File

@@ -66,11 +66,6 @@ class StepRecorder : public QObject
return m_isRecording;
}
QColor curStepNoteColor() const
{
return QColor(245,3,139); // radiant pink
}
private slots:
void removeNotesReleasedForTooLong();

View File

@@ -197,6 +197,9 @@ PianoRoll::PianoRoll() :
m_lineColor( 0, 0, 0 ),
m_noteModeColor( 0, 0, 0 ),
m_noteColor( 0, 0, 0 ),
m_stepNoteColor(0, 0, 0),
m_currentStepNoteColor(245, 3, 139),
m_noteTextColor(0, 0, 0),
m_ghostNoteColor( 0, 0, 0 ),
m_ghostNoteTextColor( 0, 0, 0 ),
m_barColor( 0, 0, 0 ),
@@ -3596,7 +3599,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
// we've done and checked all, let's draw the note
drawNoteRect(
p, x + m_whiteKeyWidth, noteYPos(note->key()), note_width,
note, m_stepRecorder.curStepNoteColor(), m_noteTextColor, m_selectedNoteColor,
note, m_currentStepNoteColor, m_noteTextColor, m_selectedNoteColor,
m_noteOpacity, m_noteBorders, drawNoteNames);
}
}

View File

@@ -44,7 +44,11 @@ namespace gui
EnvelopeGraph::EnvelopeGraph(QWidget* parent) :
QWidget(parent),
ModelView(nullptr, this)
ModelView(nullptr, this),
m_noAmountColor(96, 91, 96),
m_fullAmountColor(0, 255, 128),
m_markerFillColor(153, 175, 255),
m_markerOutlineColor(0, 0, 0)
{
setMinimumSize(m_envGraph.size());
}
@@ -206,9 +210,7 @@ void EnvelopeGraph::paintEvent(QPaintEvent*)
// Compute the color of the lines based on the amount of the envelope
const float absAmount = std::abs(amount);
const QColor noAmountColor{96, 91, 96};
const QColor fullAmountColor{0, 255, 128};
const QColor lineColor{ColorHelper::interpolateInRgb(noAmountColor, fullAmountColor, absAmount)};
const QColor lineColor{ColorHelper::interpolateInRgb(m_noAmountColor, m_fullAmountColor, absAmount)};
// Determine the line width so that it scales with the widget
// Use the minimum value of the current width and height to compute it.
@@ -221,14 +223,11 @@ void EnvelopeGraph::paintEvent(QPaintEvent*)
p.drawPolyline(linePoly);
// Now draw all marker on top of the lines
const QColor markerFillColor{153, 175, 255};
const QColor markerOutlineColor{0, 0, 0};
QPen pen;
pen.setWidthF(lineWidth * 0.75);
pen.setBrush(markerOutlineColor);
pen.setBrush(m_markerOutlineColor);
p.setPen(pen);
p.setBrush(markerFillColor);
p.setBrush(m_markerFillColor);
// Compute the size of the circle we will draw based on the line width
const qreal baseRectSize = lineWidth * 3;

View File

@@ -44,7 +44,9 @@ namespace gui
LfoGraph::LfoGraph(QWidget* parent) :
QWidget(parent),
ModelView(nullptr, this)
ModelView(nullptr, this),
m_noAmountColor(96, 91, 96),
m_fullAmountColor(0, 255, 128)
{
setMinimumSize(m_lfoGraph.size());
}
@@ -143,9 +145,7 @@ void LfoGraph::paintEvent(QPaintEvent*)
// Compute the color of the lines based on the amount of the LFO
const float absAmount = std::abs(amount);
const QColor noAmountColor{96, 91, 96};
const QColor fullAmountColor{0, 255, 128};
const QColor lineColor{ColorHelper::interpolateInRgb(noAmountColor, fullAmountColor, absAmount)};
const QColor lineColor{ColorHelper::interpolateInRgb(m_noAmountColor, m_fullAmountColor, absAmount)};
p.setPen(QPen(lineColor, 1.5));