ui: removed last of the widget proxies

This commit is contained in:
itsmattkc
2020-07-23 23:11:00 +10:00
parent e570abb556
commit 86b66004b0
11 changed files with 19 additions and 154 deletions
+3
View File
@@ -56,6 +56,9 @@ public:
};
// FIXME: Hardcoded (but that might be okay here)
#define PLAYHEAD_COLOR Qt::red
OLIVE_NAMESPACE_EXIT
#endif // TIMELINECOMMON_H
-12
View File
@@ -22,15 +22,3 @@
QPushButton:checked {
background: #191919;
}
/* Node styling */
NodeViewItemWidget {
qproperty-titlebarColor: #4040a0;
qproperty-borderColor: #000000;
}
/* Timeline playhead styling */
TimelinePlayhead {
qproperty-playheadColor: #ff0000;
qproperty-playheadHighlightColor: rgba(255, 255, 255, 0.2);
}
-15
View File
@@ -17,18 +17,3 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
/* Hack that forces checked QPushButtons to use dark color */
/* Node styling */
NodeViewItemWidget {
qproperty-titlebarColor: #a0a0ff;
qproperty-borderColor: #000000;
}
/* Timeline playhead styling */
TimelinePlayhead {
qproperty-playheadColor: #ff0000;
qproperty-playheadHighlightColor: rgba(0, 0, 0, 0.25);
}
@@ -18,8 +18,6 @@ set(OLIVE_SOURCES
${OLIVE_SOURCES}
widget/timelinewidget/view/handmovableview.h
widget/timelinewidget/view/handmovableview.cpp
widget/timelinewidget/view/timelineplayhead.h
widget/timelinewidget/view/timelineplayhead.cpp
widget/timelinewidget/view/timelineview.h
widget/timelinewidget/view/timelineview.cpp
widget/timelinewidget/view/timelineviewmouseevent.h
@@ -1,54 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "timelineplayhead.h"
#include <QPainter>
const QColor &TimelinePlayhead::GetPlayheadColor() const
{
return playhead_color_;
}
const QColor &TimelinePlayhead::GetPlayheadHighlightColor() const
{
return playhead_highlight_color_;
}
void TimelinePlayhead::SetPlayheadColor(QColor c)
{
playhead_color_ = c;
}
void TimelinePlayhead::SetPlayheadHighlightColor(QColor c)
{
playhead_highlight_color_ = c;
}
void TimelinePlayhead::Draw(QPainter* painter, const QRectF& playhead_rect) const
{
painter->setPen(Qt::NoPen);
painter->setBrush(GetPlayheadHighlightColor());
painter->drawRect(playhead_rect);
painter->setPen(GetPlayheadColor());
painter->setBrush(Qt::NoBrush);
painter->drawLine(QLineF(playhead_rect.topLeft(), playhead_rect.bottomLeft()));
}
@@ -1,52 +0,0 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef TIMELINEPLAYHEADSTYLE_H
#define TIMELINEPLAYHEADSTYLE_H
#include <QWidget>
/**
* @brief A QWidget proxy for TimeRuler and TimelinePlayheadItem to allow them to share CSS values
*
* To allow Qt CSS customization (which is only available to QWidgets) to be accessed by TimeRuler
*/
class TimelinePlayhead : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor playheadColor READ GetPlayheadColor WRITE SetPlayheadColor DESIGNABLE true)
Q_PROPERTY(QColor playheadHighlightColor READ GetPlayheadHighlightColor WRITE SetPlayheadHighlightColor DESIGNABLE true)
public:
TimelinePlayhead() = default;
const QColor& GetPlayheadColor() const;
const QColor& GetPlayheadHighlightColor() const;
void SetPlayheadColor(QColor c);
void SetPlayheadHighlightColor(QColor c);
void Draw(QPainter *painter, const QRectF &rect) const;
private:
QColor playhead_color_;
QColor playhead_highlight_color_;
};
#endif // TIMELINEPLAYHEADSTYLE_H
@@ -132,7 +132,19 @@ void TimelineViewBase::drawForeground(QPainter *painter, const QRectF &rect)
playhead_scene_left_ = GetPlayheadX();
playhead_scene_right_ = playhead_scene_left_ + width;
playhead_style_.Draw(painter, QRectF(playhead_scene_left_, rect.top(), width, rect.height()));
QRectF playhead_rect(playhead_scene_left_, rect.top(), width, rect.height());
// Get playhead highlight color
QColor highlight = palette().text().color();
highlight.setAlpha(128);
painter->setPen(Qt::NoPen);
painter->setBrush(highlight);
painter->drawRect(playhead_rect);
// FIXME: Hardcoded...
painter->setPen(PLAYHEAD_COLOR);
painter->setBrush(Qt::NoBrush);
painter->drawLine(QLineF(playhead_rect.topLeft(), playhead_rect.bottomLeft()));
}
if (snapped_) {
@@ -25,7 +25,6 @@
#include "core.h"
#include "handmovableview.h"
#include "timelineplayhead.h"
#include "widget/timelinewidget/snapservice.h"
#include "widget/timelinewidget/timelinescaledobject.h"
@@ -101,8 +100,6 @@ private:
int64_t playhead_;
TimelinePlayhead playhead_style_;
double playhead_scene_left_;
double playhead_scene_right_;
-13
View File
@@ -24,7 +24,6 @@
#include "common/rational.h"
#include "timeline/timelinepoints.h"
#include "widget/timelinewidget/snapservice.h"
#include "widget/timelinewidget/view/timelineplayhead.h"
#include "widget/timelinewidget/timelinescaledobject.h"
OLIVE_NAMESPACE_ENTER
@@ -80,16 +79,6 @@ protected:
return playhead_width_;
}
inline const QColor& GetPlayheadColor() const
{
return style_.GetPlayheadColor();
}
inline const QColor& GetPlayheadHighlightColor() const
{
return style_.GetPlayheadHighlightColor();
}
signals:
/**
* @brief Signal emitted whenever the time changes on this ruler, either by user or programmatically
@@ -99,8 +88,6 @@ signals:
private:
int64_t time_;
TimelinePlayhead style_;
TimelinePoints* timeline_points_;
int scroll_;
+1 -1
View File
@@ -281,7 +281,7 @@ void TimeRuler::paintEvent(QPaintEvent *)
// Draw the playhead if it's on screen at the moment
int playhead_pos = UnitToScreen(GetTime());
p.setPen(Qt::NoPen);
p.setBrush(GetPlayheadColor());
p.setBrush(PLAYHEAD_COLOR);
DrawPlayhead(&p, playhead_pos, line_bottom);
}
+2 -1
View File
@@ -26,6 +26,7 @@
#include "common/clamp.h"
#include "config/config.h"
#include "timeline/timelinecommon.h"
OLIVE_NAMESPACE_ENTER
@@ -130,7 +131,7 @@ void AudioWaveformView::paintEvent(QPaintEvent *event)
p.drawPixmap(0, 0, cached_waveform_);
// Draw playhead
p.setPen(GetPlayheadColor());
p.setPen(PLAYHEAD_COLOR);
int playhead_x = UnitToScreen(GetTime());
p.drawLine(playhead_x, 0, playhead_x, height());