Skip to content

Commit

Permalink
Timeline UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Oct 21, 2023
1 parent 3f2e6af commit 921bdfd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/app/GUI/BoxesList/boxscroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void BoxScroller::paintEvent(QPaintEvent *) {

TimelineHighlightWidget *BoxScroller::requestHighlighter() {
if(!mHighlighter) {
mHighlighter = new TimelineHighlightWidget(false, this);
mHighlighter = new TimelineHighlightWidget(false, this, true);
mHighlighter->resize(size());
}
return mHighlighter;
Expand Down
8 changes: 4 additions & 4 deletions src/app/GUI/animationwidgetscrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void FrameScrollBar::paintEvent(QPaintEvent *) {

// draw minor ticks
if (!mRange) {
p.setPen(mHandleColor);
p.setPen(QPen(Qt::white, 2));
while (xxL < maxX) {
p.drawLine(QPointF(xxL, threeFourthsHeight + 2), QPointF(xxL, height()));
xxL += inc/5;
Expand All @@ -120,9 +120,9 @@ void FrameScrollBar::paintEvent(QPaintEvent *) {
const qreal handleLeft = mBottom ? (hLeftFrames*pixPerFrame + x0) : ((hLeftFrames*pixPerFrame + x0)+(handleWidth/2)-(handleFixedWidth/2));

handleRect.setLeft(handleLeft);
handleRect.setTop(mBottom ? 2 : 5);
handleRect.setTop(mBottom ? 2 : 0);
handleRect.setWidth(mBottom ? handleWidth : handleFixedWidth);
handleRect.setBottom(mBottom ? 6 : height());
handleRect.setBottom(mBottom ? 6 : height()/2);
if (mRange) { p.fillRect(handleRect, col); }
else { // triangle
QPainterPath path;
Expand All @@ -133,7 +133,7 @@ void FrameScrollBar::paintEvent(QPaintEvent *) {
p.fillPath(path, QColor(180, 0, 0));
}

p.setPen(Qt::white);
p.setPen(QPen(Qt::white, 2));

// draw main ticks
if (!mRange) {
Expand Down
21 changes: 10 additions & 11 deletions src/app/GUI/keysview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ KeysView::KeysView(BoxScrollWidget *boxesListVisible,

TimelineHighlightWidget *KeysView::requestHighlighter() {
if(!mHighlighter) {
mHighlighter = new TimelineHighlightWidget(true, this);
mHighlighter = new TimelineHighlightWidget(true, this, false);
mHighlighter->resize(size());
}
return mHighlighter;
Expand Down Expand Up @@ -499,16 +499,6 @@ void KeysView::paintEvent(QPaintEvent *) {
p.drawLine(QPointF(xTT, 0), QPointF(xTT, height()));
}

if(mCurrentScene) {
if(mCurrentScene->getCurrentFrame() <= maxFrame &&
mCurrentScene->getCurrentFrame() >= minFrame) {
xT = (mCurrentScene->getCurrentFrame() - mMinViewedFrame)*mPixelsPerFrame +
mPixelsPerFrame*0.5;
p.setPen(QPen(QColor(180, 0, 0), 2));
p.drawLine(QPointF(xT, 0), QPointF(xT, height()));
}
}

p.setPen(QPen(Qt::black, 1));

if(mGraphViewed) {
Expand Down Expand Up @@ -536,6 +526,15 @@ void KeysView::paintEvent(QPaintEvent *) {
}
}

if (mCurrentScene) {
if (mCurrentScene->getCurrentFrame() <= maxFrame &&
mCurrentScene->getCurrentFrame() >= minFrame) {
xT = (mCurrentScene->getCurrentFrame() - mMinViewedFrame)*mPixelsPerFrame + mPixelsPerFrame*0.5;
p.setPen(QPen(QColor(180, 0, 0), 2));
p.drawLine(QPointF(xT, 0), QPointF(xT, height()));
}
}

p.resetTransform();
if(mMovingKeys && mValueInput.inputEnabled())
mValueInput.draw(&p, height() - eSizesUI::widget);
Expand Down
17 changes: 10 additions & 7 deletions src/app/GUI/timelinehighlightwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
#include "GUI/global.h"
#include "Private/esettings.h"

TimelineHighlightWidget::TimelineHighlightWidget(
const bool track, QWidget * const parent) :
QWidget(parent),
mSettings(*eSettings::sInstance) {
TimelineHighlightWidget::TimelineHighlightWidget(const bool track,
QWidget * const parent,
const bool alt)
: QWidget(parent)
, mAlt(alt)
, mSettings(*eSettings::sInstance)
{
setAttribute(Qt::WA_TranslucentBackground);
setMouseTracking(track);
}
Expand All @@ -53,14 +56,14 @@ void TimelineHighlightWidget::leaveEvent(QEvent *) {

void TimelineHighlightWidget::paintEvent(QPaintEvent *) {
QPainter p(this);
if(mSettings.fTimelineAlternateRow) {
if (mSettings.fTimelineAlternateRow && mAlt) {
const int height = this->height();
const QColor color = mSettings.fTimelineAlternateRowColor;
for(int i = 0; i < height; i += 2*eSizesUI::widget) {
for (int i = 0; i < height; i += 2*eSizesUI::widget) {
p.fillRect(0, i, width(), eSizesUI::widget, color);
}
}
if(mSettings.fTimelineHighlightRow && mHoverRow >= 0) {
if (mSettings.fTimelineHighlightRow && mHoverRow >= 0) {
p.fillRect(0, mHoverRow*eSizesUI::widget,
width(), eSizesUI::widget,
mSettings.fTimelineHighlightRowColor);
Expand Down
5 changes: 4 additions & 1 deletion src/app/GUI/timelinehighlightwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class eSettings;

class TimelineHighlightWidget : public QWidget {
public:
TimelineHighlightWidget(const bool track, QWidget* const parent);
TimelineHighlightWidget(const bool track,
QWidget* const parent,
const bool alt);

void setOther(TimelineHighlightWidget* const other);
protected:
Expand All @@ -42,6 +44,7 @@ class TimelineHighlightWidget : public QWidget {
private:
void setHoverRow(const int row);

bool mAlt;
int mHoverRow = -1;
const eSettings& mSettings;
TimelineHighlightWidget* mOther = nullptr;
Expand Down

0 comments on commit 921bdfd

Please sign in to comment.