mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
disabled drop preview animation
This commit is contained in:
parent
463a1f1945
commit
5fcf42f1fc
|
@ -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.messageSeperator = isLight ? QColor(127, 127, 127) : QColor(60, 60, 60);
|
||||||
this->splits.background = getColor(0, sat, 1);
|
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.border
|
||||||
// this->splits.borderFocused
|
// this->splits.borderFocused
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
QColor border;
|
QColor border;
|
||||||
QColor borderFocused;
|
QColor borderFocused;
|
||||||
QColor dropPreview;
|
QColor dropPreview;
|
||||||
|
QColor dropPreviewBorder;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
QColor border;
|
QColor border;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "widgets/helper/droppreview.hpp"
|
#include "widgets/helper/droppreview.hpp"
|
||||||
|
#include "application.hpp"
|
||||||
#include "singletons/thememanager.hpp"
|
#include "singletons/thememanager.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -9,9 +10,9 @@ namespace widgets {
|
||||||
|
|
||||||
NotebookPageDropPreview::NotebookPageDropPreview(BaseWidget *parent)
|
NotebookPageDropPreview::NotebookPageDropPreview(BaseWidget *parent)
|
||||||
: 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);
|
this->setHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,34 +20,35 @@ void NotebookPageDropPreview::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
painter.fillRect(8, 8, this->width() - 17, this->height() - 17,
|
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||||
this->themeManager->splits.dropPreview);
|
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||||
|
painter.drawRect(8, 8, this->width() - 17, this->height() - 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPageDropPreview::hideEvent(QHideEvent *)
|
void NotebookPageDropPreview::hideEvent(QHideEvent *)
|
||||||
{
|
{
|
||||||
this->animate = false;
|
// this->animate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPageDropPreview::setBounds(const QRect &rect)
|
void NotebookPageDropPreview::setBounds(const QRect &rect)
|
||||||
{
|
{
|
||||||
if (rect == this->desiredGeometry) {
|
// if (rect == this->desiredGeometry) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (this->animate) {
|
// if (this->animate) {
|
||||||
this->positionAnimation.stop();
|
// this->positionAnimation.stop();
|
||||||
this->positionAnimation.setDuration(50);
|
// this->positionAnimation.setDuration(50);
|
||||||
this->positionAnimation.setStartValue(this->geometry());
|
// this->positionAnimation.setStartValue(this->geometry());
|
||||||
this->positionAnimation.setEndValue(rect);
|
// this->positionAnimation.setEndValue(rect);
|
||||||
this->positionAnimation.start();
|
// this->positionAnimation.start();
|
||||||
} else {
|
// } else {
|
||||||
this->setGeometry(rect);
|
this->setGeometry(rect);
|
||||||
}
|
// }
|
||||||
|
|
||||||
this->desiredGeometry = rect;
|
// this->desiredGeometry = rect;
|
||||||
|
|
||||||
this->animate = true;
|
// this->animate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|
|
@ -19,9 +19,9 @@ protected:
|
||||||
void paintEvent(QPaintEvent *) override;
|
void paintEvent(QPaintEvent *) override;
|
||||||
void hideEvent(QHideEvent *) override;
|
void hideEvent(QHideEvent *) override;
|
||||||
|
|
||||||
QPropertyAnimation positionAnimation;
|
// QPropertyAnimation positionAnimation;
|
||||||
QRect desiredGeometry;
|
// QRect desiredGeometry;
|
||||||
bool animate = false;
|
// bool animate = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|
|
@ -62,10 +62,14 @@ SplitOverlay::SplitOverlay(Split *parent)
|
||||||
up->setFocusPolicy(Qt::NoFocus);
|
up->setFocusPolicy(Qt::NoFocus);
|
||||||
down->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) {
|
this->managedConnect(this->scaleChanged, [=](float _scale) {
|
||||||
int a = scale * 40;
|
int a = _scale * 40;
|
||||||
QSize size(a, a);
|
QSize size(a, a);
|
||||||
|
|
||||||
move->setIconSize(size);
|
move->setIconSize(size);
|
||||||
|
@ -97,8 +101,8 @@ void SplitOverlay::paintEvent(QPaintEvent *event)
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
if (!rect.isNull()) {
|
if (!rect.isNull()) {
|
||||||
painter.setPen(QColor(0, 148, 255, 0x70));
|
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||||
painter.setBrush(QColor(0, 148, 255, 0x30));
|
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||||
painter.drawRect(rect);
|
painter.drawRect(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,6 +403,7 @@ void SplitContainer::setPreviewRect(QPoint mousePos)
|
||||||
this->dropPreview.setBounds(region.rect);
|
this->dropPreview.setBounds(region.rect);
|
||||||
|
|
||||||
if (!this->dropPreview.isVisible()) {
|
if (!this->dropPreview.isVisible()) {
|
||||||
|
this->dropPreview.setGeometry(this->rect());
|
||||||
this->dropPreview.show();
|
this->dropPreview.show();
|
||||||
this->dropPreview.raise();
|
this->dropPreview.raise();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue