diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2019-11-21 07:34:57 +0100 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2019-11-21 07:34:57 +0100 |
commit | f793e3544ca0b3d544269c33257d86ea956798c7 (patch) | |
tree | 706ea81461f5d04d6ad355340c65744021fad4cc /src/widget | |
parent | 35da91b786eb7979d4cacf1c7e650978c33ea499 (diff) |
Revert "Merge pull request #2353 from daschuer/lp1850644"
This reverts commit 35da91b786eb7979d4cacf1c7e650978c33ea499, reversing
changes made to 7b1f4d106b14b5be9bee1a2e3d192c07a5ec5055.
Diffstat (limited to 'src/widget')
-rw-r--r-- | src/widget/colormenu.cpp | 81 | ||||
-rw-r--r-- | src/widget/colormenu.h | 20 | ||||
-rw-r--r-- | src/widget/cuemenu.cpp | 10 | ||||
-rw-r--r-- | src/widget/cuemenu.h | 7 | ||||
-rw-r--r-- | src/widget/woverview.cpp | 138 | ||||
-rw-r--r-- | src/widget/woverview.h | 19 | ||||
-rw-r--r-- | src/widget/wtracktableview.cpp | 2 | ||||
-rw-r--r-- | src/widget/wwidget.cpp | 28 | ||||
-rw-r--r-- | src/widget/wwidget.h | 19 |
9 files changed, 91 insertions, 233 deletions
diff --git a/src/widget/colormenu.cpp b/src/widget/colormenu.cpp index 1ceabc888f..543b271084 100644 --- a/src/widget/colormenu.cpp +++ b/src/widget/colormenu.cpp @@ -1,78 +1,39 @@ #include "widget/colormenu.h" - #include "util/color/color.h" -ColorMenu::ColorMenu(QWidget* parent) - : QMenu(parent), m_pColorDialog(new QColorDialog(this)) { +ColorMenu::ColorMenu(QWidget *parent) + : QMenu(parent) { // If another title would be more appropriate in some context, setTitle // can be called again after construction. setTitle(tr("Set color")); - useColorPalette(ColorPalette::mixxxHotcuesPalette); - - connect(m_pColorDialog, - &QColorDialog::colorSelected, - this, - [this](const QColor& newColor) { - if (newColor.isValid()) { - emit(colorPicked(newColor)); - } - }); -} - -void ColorMenu::useColorPalette(const ColorPalette& colorPalette) { - clear(); - m_pActionGroup = new QActionGroup(this); - m_pActionGroup->setExclusive(true); - - createPaletteColorsActions(colorPalette); - createColorPickerAction(); -} - -void ColorMenu::setCurrentColor(QColor currentColor) { - m_currentColor = currentColor; - selectCurrentColorAction(currentColor); -} - -void ColorMenu::openColorDialog() { - m_pColorDialog->setCurrentColor(m_currentColor); - m_pColorDialog->open(); -} + for (const auto& pColor : Color::kPredefinedColorsSet.allColors) { + if (*pColor == *Color::kPredefinedColorsSet.noColor) { + continue; + } -void ColorMenu::createPaletteColorsActions(const ColorPalette& colorPalette) { - for (const auto& color : colorPalette.m_colorList) { - QAction* pColorAction = new QAction(m_pActionGroup); + QAction* pColorAction = new QAction(pColor->m_sDisplayName, this); QPixmap pixmap(80, 80); - pixmap.fill(color); + pixmap.fill(pColor->m_defaultRgba); pColorAction->setIcon(QIcon(pixmap)); - pColorAction->setCheckable(true); - pColorAction->setData(color); + m_pColorActions.insert(pColor, pColorAction); addAction(pColorAction); - connect(pColorAction, &QAction::triggered, this, [color, this]() { - emit(colorPicked(color)); + connect(pColorAction, &QAction::triggered, this, [pColor, this]() { + emit(colorPicked(pColor)); }); } } -void ColorMenu::createColorPickerAction() { - m_pColorPickerAction = new QAction(m_pActionGroup); - m_pColorPickerAction->setText(tr("Other") + "…"); - m_pColorPickerAction->setCheckable(true); - addAction(m_pColorPickerAction); - connect(m_pColorPickerAction, - &QAction::triggered, - this, - &ColorMenu::openColorDialog); -} - -void ColorMenu::selectCurrentColorAction(const QColor& currentColor) const { - for (QAction* pAction : actions()) { - QColor color = pAction->data().value<QColor>(); - // Other color action is the last one, if we find it, we didn't - // matched to any color action. - if (color == currentColor || pAction == m_pColorPickerAction) { - pAction->setChecked(true); - return; +void ColorMenu::useColorSet(PredefinedColorsRepresentation* pColorRepresentation) { + QMapIterator<PredefinedColorPointer, QAction*> i(m_pColorActions); + while (i.hasNext()) { + i.next(); + QPixmap pixmap(80, 80); + if (pColorRepresentation == nullptr) { + pixmap.fill(i.key()->m_defaultRgba); + } else { + pixmap.fill(pColorRepresentation->representationFor(i.key())); } + i.value()->setIcon(QIcon(pixmap)); } } diff --git a/src/widget/colormenu.h b/src/widget/colormenu.h index e661a8996f..4c82943cbb 100644 --- a/src/widget/colormenu.h +++ b/src/widget/colormenu.h @@ -1,31 +1,19 @@ #pragma once -#include <QColorDialog> #include <QMenu> -#include "util/color/colorpalette.h" +#include "util/color/color.h" class ColorMenu : public QMenu { Q_OBJECT public: ColorMenu(QWidget *parent = nullptr); - void useColorPalette(const ColorPalette& colorPalette); - void setCurrentColor(QColor currentColor); + void useColorSet(PredefinedColorsRepresentation* pColorRepresentation); signals: - void colorPicked(QColor pColor); - - private slots: - void openColorDialog(); + void colorPicked(PredefinedColorPointer pColor); private: - void createPaletteColorsActions(const ColorPalette& colorPalette); - void createColorPickerAction(); - void selectCurrentColorAction(const QColor& currentColor) const; - - QColor m_currentColor; - QAction* m_pColorPickerAction; - QActionGroup* m_pActionGroup; - QColorDialog* m_pColorDialog; + QMap<PredefinedColorPointer, QAction*> m_pColorActions; }; diff --git a/src/widget/cuemenu.cpp b/src/widget/cuemenu.cpp index 53d88736e8..b9d62a3091 100644 --- a/src/widget/cuemenu.cpp +++ b/src/widget/cuemenu.cpp @@ -37,8 +37,14 @@ void CueMenu::slotEditLabel() { } } -void CueMenu::slotChangeCueColor(QColor color) { - m_pCue->setColor(color); +void CueMenu::slotChangeCueColor(PredefinedColorPointer pColor) { + VERIFY_OR_DEBUG_ASSERT(m_pCue != nullptr) { + return; + } + VERIFY_OR_DEBUG_ASSERT(pColor != nullptr) { + return; + } + m_pCue->setColor(pColor); } void CueMenu::slotRemoveCue() { diff --git a/src/widget/cuemenu.h b/src/widget/cuemenu.h index 5bf1a08064..3802292e44 100644 --- a/src/widget/cuemenu.h +++ b/src/widget/cuemenu.h @@ -14,23 +14,22 @@ class CueMenu : public QMenu { void setCue(CuePointer pCue) { m_pCue = pCue; - m_pColorMenu->setCurrentColor(m_pCue->getColor()); } void setTrack(TrackPointer pTrack) { m_pTrack = pTrack; } - void useColorSet(const ColorPalette& colorPalette) { + void useColorSet(PredefinedColorsRepresentation* pColorRepresentation) { if (m_pColorMenu != nullptr) { - m_pColorMenu->useColorPalette(colorPalette); + m_pColorMenu->useColorSet(pColorRepresentation); } } private slots: void slotEditLabel(); void slotRemoveCue(); - void slotChangeCueColor(QColor color); + void slotChangeCueColor(PredefinedColorPointer pColor); private: CuePointer m_pCue; diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index 792ba94447..aa24b3ecf8 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -25,7 +25,6 @@ #include "control/controlproxy.h" #include "engine/engine.h" #include "mixer/playermanager.h" -#include "preferences/hotcuecolorpalettesettings.h" #include "track/track.h" #include "util/color/color.h" #include "util/compatibility.h" @@ -58,14 +57,11 @@ WOverview::WOverview( m_pCueMenu(std::make_unique<CueMenu>(this)), m_bShowCueTimes(true), m_iPosSeconds(0), - m_bLeftClickDragging(false), - m_iPickupPos(0), - m_iPlayPos(0), + m_iPos(0), m_pHoveredMark(nullptr), m_bHotcueMenuShowing(false), m_bTimeRulerActive(false), m_orientation(Qt::Horizontal), - m_iLabelFontSize(10), m_a(1.0), m_b(0.0), m_analyzerProgress(kAnalyzerProgressUnknown), @@ -112,9 +108,9 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { } bool okay = false; - int labelFontSize = context.selectInt(node, "LabelFontSize", &okay); - if (okay) { - m_iLabelFontSize = labelFontSize; + m_iLabelFontSize = context.selectInt(node, "LabelFontSize", &okay); + if (!okay) { + m_iLabelFontSize = 10; } // Clear the background pixmap, if it exists. @@ -135,9 +131,12 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { // setup hotcues and cue and loop(s) m_marks.setup(m_group, node, context, m_signalColors); - HotcueColorPaletteSettings colorPaletteSettings(m_pConfig); - auto colorPalette = colorPaletteSettings.getHotcueColorPalette(); - m_pCueMenu->useColorSet(colorPalette); + WaveformMarkPointer defaultMark(m_marks.getDefaultMark()); + QColor defaultColor = defaultMark + ? defaultMark->fillColor() + : m_signalColors.getAxesColor(); + m_predefinedColorsRepresentation = context.getCueColorRepresentation(node, defaultColor); + m_pCueMenu->useColorSet(&m_predefinedColorsRepresentation); for (const auto& pMark: m_marks) { if (pMark->isValid()) { @@ -205,23 +204,17 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { void WOverview::onConnectedControlChanged(double dParameter, double dValue) { // this is connected via skin to "playposition" Q_UNUSED(dValue); - // Calculate handle position. Clamp the value within 0-1 because that's // all we represent with this widget. dParameter = math_clamp(dParameter, 0.0, 1.0); bool redraw = false; - int oldPos = m_iPlayPos; - m_iPlayPos = valueToPosition(dParameter); - if (oldPos != m_iPlayPos) { + int oldPos = m_iPos; + m_iPos = valueToPosition(dParameter); + if (oldPos != m_iPos) { redraw = true; } - if (!m_bLeftClickDragging) { - // if not dragged the pick-up moves with the play position - m_iPickupPos = m_iPlayPos; - } - // In case the user is hovering a cue point or holding right click, the // calculated time between the playhead and cue/cursor should be updated at // least once per second, regardless of m_iPos which depends on the length @@ -348,7 +341,7 @@ void WOverview::updateCues(const QList<CuePointer> &loadedCues) { const WaveformMarkPointer pMark = m_marks.getHotCueMark(currentCue->getHotCue()); if (pMark != nullptr && pMark->isValid() && pMark->isVisible() && pMark->getSamplePosition() != Cue::kNoPosition) { - QColor newColor = currentCue->getColor(); + QColor newColor = m_predefinedColorsRepresentation.representationFor(currentCue->getColor()); if (newColor != pMark->fillColor() || newColor != pMark->m_textColor) { pMark->setBaseColor(newColor); } @@ -388,14 +381,6 @@ void WOverview::receiveCuesUpdated() { } void WOverview::mouseMoveEvent(QMouseEvent* e) { - if (m_bLeftClickDragging) { - if (m_orientation == Qt::Horizontal) { - m_iPickupPos = math_clamp(e->x(), 0, width() - 1); - } else { - m_iPickupPos = math_clamp(e->y(), 0, height() - 1); - } - } - // Do not activate cue hovering while right click is held down and the // button down event was not on a cue. if (m_bTimeRulerActive) { @@ -442,17 +427,7 @@ void WOverview::mouseReleaseEvent(QMouseEvent* e) { mouseMoveEvent(e); //qDebug() << "WOverview::mouseReleaseEvent" << e->pos() << m_iPos << ">>" << dValue; - if (e->button() == Qt::LeftButton) { - if (m_bLeftClickDragging) { - m_iPlayPos = m_iPickupPos; - double dValue = positionToValue(m_iPickupPos); - setControlParameterUp(dValue); - m_bLeftClickDragging = false; - } - m_bTimeRulerActive = false; - } else if (e->button() == Qt::RightButton) { - // Do not seek when releasing a right click. This is important to - // prevent accidental seeking when trying to right click a hotcue. + if (e->button() == Qt::RightButton) { m_bTimeRulerActive = false; } } @@ -463,30 +438,22 @@ void WOverview::mousePressEvent(QMouseEvent* e) { if (m_pCurrentTrack == nullptr) { return; } + if (e->button() == Qt::LeftButton) { if (m_orientation == Qt::Horizontal) { - m_iPickupPos = math_clamp(e->x(), 0, width() - 1); + m_iPos = math_clamp(e->x(), 0, width() - 1); } else { - m_iPickupPos = math_clamp(e->y(), 0, height() - 1); + m_iPos = math_clamp(e->y(), 0, height() - 1); } - double dValue = positionToValue(m_iPickupPos); + double dValue = positionToValue(m_iPos); if (m_pHoveredMark != nullptr) { dValue = m_pHoveredMark->getSamplePosition() / m_trackSamplesControl->get(); - m_iPickupPos = valueToPosition(dValue); - setControlParameterUp(dValue); - m_bLeftClickDragging = false; - } else { - m_bLeftClickDragging = true; - m_bTimeRulerActive = true; - m_timeRulerPos = e->pos(); + m_iPos = valueToPosition(dValue); } + setControlParameterUp(dValue); } else if (e->button() == Qt::RightButton) { - if (m_bLeftClickDragging) { - m_iPickupPos = m_iPlayPos; - m_bLeftClickDragging = false; - m_bTimeRulerActive = false; - } else if (m_pHoveredMark == nullptr) { + if (m_pHoveredMark == nullptr) { m_bTimeRulerActive = true; m_timeRulerPos = e->pos(); } else if (m_pHoveredMark->getHotCue() != Cue::kNoHotCue) { @@ -524,7 +491,6 @@ void WOverview::leaveEvent(QEvent* e) { if (!m_bHotcueMenuShowing) { m_pHoveredMark.clear(); } - m_bLeftClickDragging = false; m_bTimeRulerActive = false; update(); } @@ -555,7 +521,7 @@ void WOverview::paintEvent(QPaintEvent * /*unused*/) { drawRangeMarks(&painter, offset, gain); drawMarks(&painter, offset, gain); - drawPickupPosition(&painter); + drawCurrentPosition(&painter); drawTimeRuler(&painter); drawMarkLabels(&painter, offset, gain); } @@ -612,24 +578,12 @@ void WOverview::drawWaveformPixmap(QPainter* pPainter) { QColor playedOverlayColor = m_signalColors.getPlayedOverlayColor(); if (playedOverlayColor.alpha() > 0) { if (m_orientation == Qt::Vertical) { - pPainter->fillRect(0, 0, m_waveformImageScaled.width(), m_iPlayPos, playedOverlayColor); + pPainter->fillRect(0, 0, m_waveformImageScaled.width(), m_iPos, playedOverlayColor); } else { - pPainter->fillRect(0, 0, m_iPlayPos, m_waveformImageScaled.height(), playedOverlayColor); + pPainter->fillRect(0, 0, m_iPos, m_waveformImageScaled.height(), playedOverlayColor); } } } - if (m_bLeftClickDragging) { - PainterScope painterScope(pPainter); - QLineF line; - if (m_orientation == Qt::Horizontal) { - line.setLine(m_iPlayPos, 0.0, m_iPlayPos, height()); - } else { - line.setLine(0.0, m_iPlayPos, width(), m_iPlayPos); - } - pPainter->setPen(QPen(m_signalColors.getPlayPosColor(), 1 * m_scaleFactor)); - pPainter->setOpacity(0.5); - pPainter->drawLine(line); - } } void WOverview::drawEndOfTrackFrame(QPainter* pPainter) { @@ -891,7 +845,7 @@ void WOverview::drawMarks(QPainter* pPainter, const float offset, const float ga } } -void WOverview::drawPickupPosition(QPainter* pPainter) { +void WOverview::drawCurrentPosition(QPainter* pPainter) { PainterScope painterScope(pPainter); if (m_orientation == Qt::Vertical) { @@ -900,20 +854,20 @@ void WOverview::drawPickupPosition(QPainter* pPainter) { pPainter->setPen(QPen(QBrush(m_qColorBackground), 1 * m_scaleFactor)); pPainter->setOpacity(0.5); - pPainter->drawLine(m_iPickupPos + 1, 0, m_iPickupPos + 1, breadth()); - pPainter->drawLine(m_iPickupPos - 1, 0, m_iPickupPos - 1, breadth()); + pPainter->drawLine(m_iPos + 1, 0, m_iPos + 1, breadth()); + pPainter->drawLine(m_iPos - 1, 0, m_iPos - 1, breadth()); pPainter->setPen(QPen(m_signalColors.getPlayPosColor(), 1 * m_scaleFactor)); pPainter->setOpacity(1.0); - pPainter->drawLine(m_iPickupPos, 0, m_iPickupPos, breadth()); + pPainter->drawLine(m_iPos, 0, m_iPos, breadth()); - pPainter->drawLine(m_iPickupPos - 2, 0, m_iPickupPos, 2); - pPainter->drawLine(m_iPickupPos, 2, m_iPickupPos + 2, 0); - pPainter->drawLine(m_iPickupPos - 2, 0, m_iPickupPos + 2, 0); + pPainter->drawLine(m_iPos - 2, 0, m_iPos, 2); + pPainter->drawLine(m_iPos, 2, m_iPos + 2, 0); + pPainter->drawLine(m_iPos - 2, 0, m_iPos + 2, 0); - pPainter->drawLine(m_iPickupPos - 2, breadth() - 1, m_iPickupPos, breadth() - 3); - pPainter->drawLine(m_iPickupPos, breadth() - 3, m_iPickupPos + 2, breadth() - 1); - pPainter->drawLine(m_iPickupPos - 2, breadth() - 1, m_iPickupPos + 2, breadth() - 1); + pPainter->drawLine(m_iPos - 2, breadth() - 1, m_iPos, breadth() - 3); + pPainter->drawLine(m_iPos, breadth() - 3, m_iPos + 2, breadth() - 1); + pPainter->drawLine(m_iPos - 2, breadth() - 1, m_iPos + 2, breadth() - 1); } void WOverview::drawTimeRuler(QPainter* pPainter) { @@ -927,19 +881,17 @@ void WOverview::drawTimeRuler(QPainter* pPainter) { QPen shadowPen(Qt::black, 2.5 * m_scaleFactor); if (m_bTimeRulerActive) { - if (!m_bLeftClickDragging) { - QLineF line; - if (m_orientation == Qt::Horizontal) { - line.setLine(m_timeRulerPos.x(), 0.0, m_timeRulerPos.x(), height()); - } else { - line.setLine(0.0, m_timeRulerPos.x(), width(), m_timeRulerPos.x()); - } - pPainter->setPen(shadowPen); - pPainter->drawLine(line); - - pPainter->setPen(QPen(m_signalColors.getPlayPosColor(), 1 * m_scaleFactor)); - pPainter->drawLine(line); + QLineF line; + if (m_orientation == Qt::Horizontal) { + line.setLine(m_timeRulerPos.x(), 0.0, m_timeRulerPos.x(), height()); + } else { + line.setLine(0.0, m_timeRulerPos.x(), width(), m_timeRulerPos.x()); } + pPainter->setPen(shadowPen); + pPainter->drawLine(line); + + pPainter->setPen(Qt::green); + pPainter->drawLine(line); QPointF textPoint = m_timeRulerPos; QPointF textPointDistance = m_timeRulerPos; diff --git a/src/widget/woverview.h b/src/widget/woverview.h index 583b7d132e..d5bcc4792a 100644 --- a/src/widget/woverview.h +++ b/src/widget/woverview.h @@ -57,12 +57,12 @@ class WOverview : public WWidget, public TrackDropTarget { UserSettingsPointer pConfig, QWidget* parent = nullptr); - void mouseMoveEvent(QMouseEvent* e) override; - void mouseReleaseEvent(QMouseEvent* e) override; - void mousePressEvent(QMouseEvent* e) override; + void mouseMoveEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; void leaveEvent(QEvent* event) override; - void paintEvent(QPaintEvent* /*unused*/) override; - void resizeEvent(QResizeEvent* /*unused*/) override; + void paintEvent(QPaintEvent * /*unused*/) override; + void resizeEvent(QResizeEvent * /*unused*/) override; void dragEnterEvent(QDragEnterEvent* event) override; void dropEvent(QDropEvent* event) override; @@ -114,7 +114,7 @@ class WOverview : public WWidget, public TrackDropTarget { void drawAnalyzerProgress(QPainter* pPainter); void drawRangeMarks(QPainter* pPainter, const float& offset, const float& gain); void drawMarks(QPainter* pPainter, const float offset, const float gain); - void drawPickupPosition(QPainter* pPainter); + void drawCurrentPosition(QPainter* pPainter); void drawTimeRuler(QPainter* pPainter); void drawMarkLabels(QPainter* pPainter, const float offset, const float gain); void paintText(const QString& text, QPainter* pPainter); @@ -147,12 +147,8 @@ class WOverview : public WWidget, public TrackDropTarget { bool m_bShowCueTimes; int m_iPosSeconds; - // True if pick-up is dragged. Only used when m_bEventWhileDrag is false - bool m_bLeftClickDragging; // Internal storage of slider position in pixels - int m_iPickupPos; - // position of the overlay shaddow - int m_iPlayPos; + int m_iPos; WaveformMarkPointer m_pHoveredMark; bool m_bHotcueMenuShowing; @@ -171,6 +167,7 @@ class WOverview : public WWidget, public TrackDropTarget { QColor m_labelBackgroundColor; QColor m_endOfTrackColor; + PredefinedColorsRepresentation m_predefinedColorsRepresentation; // All WaveformMarks WaveformMarkSet m_marks; // List of visible WaveformMarks sorted by the order they appear in the track diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index ac8ce5a910..271dd42be0 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -764,7 +764,7 @@ void WTrackTableView::showTrackInfo(QModelIndex index) { if (m_pTrackInfo.isNull()) { // Give a NULL parent because otherwise it inherits our style which can // make it unreadable. Bug #673411 - m_pTrackInfo.reset(new DlgTrackInfo(nullptr, m_pConfig)); + m_pTrackInfo.reset(new DlgTrackInfo(nullptr)); connect(m_pTrackInfo.data(), SIGNAL(next()), this, SLOT(slotNextTrackInfo())); diff --git a/src/widget/wwidget.cpp b/src/widget/wwidget.cpp index 5d52366313..364b46280a 100644 --- a/src/widget/wwidget.cpp +++ b/src/widget/wwidget.cpp @@ -26,8 +26,7 @@ WWidget::WWidget(QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags), WBaseWidget(this), m_activeTouchButton(Qt::NoButton), - m_scaleFactor(1.0), - m_bShouldHighlightBackgroundOnHover(false) { + m_scaleFactor(1.0) { m_pTouchShift = new ControlProxy("[Controls]", "touch_shift"); setAttribute(Qt::WA_StaticContents); setAttribute(Qt::WA_AcceptTouchEvents); @@ -38,31 +37,6 @@ WWidget::~WWidget() { delete m_pTouchShift; } -double WWidget::getBackgroundColorRgba() const { - if (m_backgroundColorRgba >= 0) { - return m_backgroundColorRgba; - } - return -1; -} - -void WWidget::setBackgroundColorRgba(double rgba) { - QColor backgroundColor = QColor::fromRgba(rgba); - QColor highlightedBackgroundColor = backgroundColor.lighter(); - QString style = QString("WWidget { background-color: %1; }"); - if (m_bShouldHighlightBackgroundOnHover) { - style += "WWidget:hover { background-color: %2; }"; - } - - if (rgba >= 0) { - setStyleSheet(style.arg(backgroundColor.name()) - .arg(highlightedBackgroundColor.name())); - } else { - setStyleSheet(""); - } - m_backgroundColorRgba = rgba; - m_bBackgroundIsDark = Color::isDimmColor(backgroundColor); -} - bool WWidget::touchIsRightButton() { return (m_pTouchShift->get() != 0.0); } diff --git a/src/widget/wwidget.h b/src/widget/wwidget.h index 0fbf10631c..cbadf8ab2f 100644 --- a/src/widget/wwidget.h +++ b/src/widget/wwidget.h @@ -23,7 +23,6 @@ #include <QString> #include "preferences/usersettings.h" -#include "util/color/color.h" #include "widget/wbasewidget.h" class ControlProxy; @@ -45,21 +44,6 @@ class WWidget : public QWidget, public WBaseWidget { ~WWidget() override; Q_PROPERTY(double value READ getControlParameterDisplay); - Q_PROPERTY(double backgroundColorRgba READ getBackgroundColorRgba WRITE - setBackgroundColorRgba); - Q_PROPERTY(bool shouldHighlightBackgroundOnHover MEMBER - m_bShouldHighlightBackgroundOnHover); - Q_PROPERTY(bool hasBackgroundColor READ hasBackgroundColor); - Q_PROPERTY(bool backgroundIsDark READ backgroundIsDark); - - double getBackgroundColorRgba() const; - void setBackgroundColorRgba(double rgba); - bool hasBackgroundColor() const { - return m_backgroundColorRgba >= 0; - } - bool backgroundIsDark() const { - return m_bBackgroundIsDark; - } protected: bool touchIsRightButton(); @@ -76,9 +60,6 @@ class WWidget : public QWidget, public WBaseWidget { private: ControlProxy* m_pTouchShift; double m_scaleFactor; - double m_backgroundColorRgba; - bool m_bBackgroundIsDark; - bool m_bShouldHighlightBackgroundOnHover; }; #endif |