From 5fcf42f1fc78cc9e48a1f325389fbdab64f318bc Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 8 May 2018 20:35:31 +0200 Subject: [PATCH] disabled drop preview animation --- src/singletons/thememanager.cpp | 3 ++- src/singletons/thememanager.hpp | 1 + src/widgets/helper/droppreview.cpp | 40 +++++++++++++++-------------- src/widgets/helper/droppreview.hpp | 6 ++--- src/widgets/helper/splitoverlay.cpp | 14 ++++++---- src/widgets/splitcontainer.cpp | 1 + 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/singletons/thememanager.cpp b/src/singletons/thememanager.cpp index 348afd837..8296dbefc 100644 --- a/src/singletons/thememanager.cpp +++ b/src/singletons/thememanager.cpp @@ -118,7 +118,8 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier) this->splits.messageSeperator = isLight ? QColor(127, 127, 127) : QColor(60, 60, 60); this->splits.background = getColor(0, sat, 1); - this->splits.dropPreview = getColor(hue, 0.5, 0.5, 0.6); + this->splits.dropPreview = QColor(0, 148, 255, 0x30); + this->splits.dropPreviewBorder = QColor(0, 148, 255, 0x70); // this->splits.border // this->splits.borderFocused diff --git a/src/singletons/thememanager.hpp b/src/singletons/thememanager.hpp index a44a2a364..443f04824 100644 --- a/src/singletons/thememanager.hpp +++ b/src/singletons/thememanager.hpp @@ -57,6 +57,7 @@ public: QColor border; QColor borderFocused; QColor dropPreview; + QColor dropPreviewBorder; struct { QColor border; diff --git a/src/widgets/helper/droppreview.cpp b/src/widgets/helper/droppreview.cpp index 237c06199..3bc8fefe3 100644 --- a/src/widgets/helper/droppreview.cpp +++ b/src/widgets/helper/droppreview.cpp @@ -1,4 +1,5 @@ #include "widgets/helper/droppreview.hpp" +#include "application.hpp" #include "singletons/thememanager.hpp" #include @@ -9,9 +10,9 @@ namespace widgets { NotebookPageDropPreview::NotebookPageDropPreview(BaseWidget *parent) : BaseWidget(parent) - , positionAnimation(this, "geometry") +// , positionAnimation(this, "geometry") { - this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic)); + // this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic)); this->setHidden(true); } @@ -19,34 +20,35 @@ void NotebookPageDropPreview::paintEvent(QPaintEvent *) { QPainter painter(this); - painter.fillRect(8, 8, this->width() - 17, this->height() - 17, - this->themeManager->splits.dropPreview); + painter.setPen(getApp()->themes->splits.dropPreviewBorder); + painter.setBrush(getApp()->themes->splits.dropPreview); + painter.drawRect(8, 8, this->width() - 17, this->height() - 17); } void NotebookPageDropPreview::hideEvent(QHideEvent *) { - this->animate = false; + // this->animate = false; } void NotebookPageDropPreview::setBounds(const QRect &rect) { - if (rect == this->desiredGeometry) { - return; - } + // if (rect == this->desiredGeometry) { + // return; + // } - if (this->animate) { - this->positionAnimation.stop(); - this->positionAnimation.setDuration(50); - this->positionAnimation.setStartValue(this->geometry()); - this->positionAnimation.setEndValue(rect); - this->positionAnimation.start(); - } else { - this->setGeometry(rect); - } + // if (this->animate) { + // this->positionAnimation.stop(); + // this->positionAnimation.setDuration(50); + // this->positionAnimation.setStartValue(this->geometry()); + // this->positionAnimation.setEndValue(rect); + // this->positionAnimation.start(); + // } else { + this->setGeometry(rect); + // } - this->desiredGeometry = rect; + // this->desiredGeometry = rect; - this->animate = true; + // this->animate = true; } } // namespace widgets diff --git a/src/widgets/helper/droppreview.hpp b/src/widgets/helper/droppreview.hpp index 990ece25a..763555172 100644 --- a/src/widgets/helper/droppreview.hpp +++ b/src/widgets/helper/droppreview.hpp @@ -19,9 +19,9 @@ protected: void paintEvent(QPaintEvent *) override; void hideEvent(QHideEvent *) override; - QPropertyAnimation positionAnimation; - QRect desiredGeometry; - bool animate = false; + // QPropertyAnimation positionAnimation; + // QRect desiredGeometry; + // bool animate = false; }; } // namespace widgets diff --git a/src/widgets/helper/splitoverlay.cpp b/src/widgets/helper/splitoverlay.cpp index 45758b3af..0943111a6 100644 --- a/src/widgets/helper/splitoverlay.cpp +++ b/src/widgets/helper/splitoverlay.cpp @@ -62,10 +62,14 @@ SplitOverlay::SplitOverlay(Split *parent) up->setFocusPolicy(Qt::NoFocus); down->setFocusPolicy(Qt::NoFocus); - move->setCursor(Qt::SizeAllCursor); + move->setCursor(Qt::PointingHandCursor); + left->setCursor(Qt::PointingHandCursor); + right->setCursor(Qt::PointingHandCursor); + up->setCursor(Qt::PointingHandCursor); + down->setCursor(Qt::PointingHandCursor); - this->managedConnect(this->scaleChanged, [=](float scale) { - int a = scale * 40; + this->managedConnect(this->scaleChanged, [=](float _scale) { + int a = _scale * 40; QSize size(a, a); move->setIconSize(size); @@ -97,8 +101,8 @@ void SplitOverlay::paintEvent(QPaintEvent *event) } break; } if (!rect.isNull()) { - painter.setPen(QColor(0, 148, 255, 0x70)); - painter.setBrush(QColor(0, 148, 255, 0x30)); + painter.setPen(getApp()->themes->splits.dropPreviewBorder); + painter.setBrush(getApp()->themes->splits.dropPreview); painter.drawRect(rect); } } diff --git a/src/widgets/splitcontainer.cpp b/src/widgets/splitcontainer.cpp index f1b3bbec5..578e0ad69 100644 --- a/src/widgets/splitcontainer.cpp +++ b/src/widgets/splitcontainer.cpp @@ -403,6 +403,7 @@ void SplitContainer::setPreviewRect(QPoint mousePos) this->dropPreview.setBounds(region.rect); if (!this->dropPreview.isVisible()) { + this->dropPreview.setGeometry(this->rect()); this->dropPreview.show(); this->dropPreview.raise(); }