feat: modify pienapple-picture with my remix
- change UI layout to make it looks like the default style of Windows image browser. - update icons to material design icon for better looks. add lost icons for those new added button at the bottom bar. - restore window style to normal. remove borderless style. - delete X button at the right-top corner. disable feature that drag window to move, because all functions provided by native window are restored. - move prev next image button to the center of bottom bar. - move navigator view to the right-bottom corner so that it will not overlay on the shown image. - remove all animation effect, including alpha transition, fade out when exiting and etc. - delete function that double click windows to exit. now double clicking windows will do nothing. change default value of double click behavior to do nothing. - change default value of stay on top to false because stay on top is not the default behavior of Windows image browser.
This commit is contained in:
@@ -48,25 +48,25 @@ void ActionManager::setupAction(MainWindow *mainWindow)
|
||||
};
|
||||
#define CREATE_NEW_ICON_ACTION(w, a, i) create_action(w, &a, ICON_NAME(i), ACTION_NAME(a))
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionActualSize, zoom-original);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionToggleMaximize, view-fullscreen);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionFitInView, fit-in-view);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionHorizontalFlip, horizontal-flip);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionZoomIn, zoom-in);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionZoomOut, zoom-out);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionToggleCheckerboard, view-background-checkerboard);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateClockwise, object-rotate-right);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateCounterClockwise, object-rotate-left);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionPrevPicture, go-previous);
|
||||
CREATE_NEW_ICON_ACTION(mainWindow, actionNextPicture, go-next);
|
||||
#undef CREATE_NEW_ICON_ACTION
|
||||
|
||||
#define CREATE_NEW_ACTION(w, a) create_action(w, &a, QString(), ACTION_NAME(a))
|
||||
#define CREATE_NEW_THEMEICON_ACTION(w, a, i) create_action(w, &a, QLatin1String(STRIFY(i)), ACTION_NAME(a), true)
|
||||
CREATE_NEW_ACTION(mainWindow, actionRotateCounterClockwise);
|
||||
CREATE_NEW_ACTION(mainWindow, actionPrevPicture);
|
||||
CREATE_NEW_ACTION(mainWindow, actionNextPicture);
|
||||
CREATE_NEW_ACTION(mainWindow, actionToggleMaximize);
|
||||
|
||||
CREATE_NEW_ACTION(mainWindow, actionTogglePauseAnimation);
|
||||
CREATE_NEW_ACTION(mainWindow, actionAnimationNextFrame);
|
||||
|
||||
CREATE_NEW_THEMEICON_ACTION(mainWindow, actionOpen, document-open);
|
||||
CREATE_NEW_ACTION(mainWindow, actionHorizontalFlip);
|
||||
CREATE_NEW_ACTION(mainWindow, actionFitInView);
|
||||
CREATE_NEW_ACTION(mainWindow, actionFitByWidth);
|
||||
CREATE_NEW_THEMEICON_ACTION(mainWindow, actionCopyPixmap, edit-copy);
|
||||
CREATE_NEW_ACTION(mainWindow, actionCopyFilePath);
|
||||
@@ -161,3 +161,8 @@ void ActionManager::setupShortcuts()
|
||||
});
|
||||
}
|
||||
|
||||
void ActionManager::setPrevNextPictureActionEnabled(bool enabled)
|
||||
{
|
||||
actionPrevPicture->setEnabled(enabled);
|
||||
actionNextPicture->setEnabled(enabled);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
void setupAction(MainWindow * mainWindow);
|
||||
void retranslateUi(MainWindow *MainWindow);
|
||||
void setupShortcuts();
|
||||
void setPrevNextPictureActionEnabled(bool enabled);
|
||||
|
||||
static QIcon loadHidpiIcon(const QString &resp, QSize sz = QSize(32, 32));
|
||||
|
||||
|
||||
@@ -21,11 +21,7 @@ BottomButtonGroup::BottomButtonGroup(const std::vector<QAction *> &actionList, Q
|
||||
this->setLayout(mainLayout);
|
||||
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
this->setStyleSheet("BottomButtonGroup {"
|
||||
"border: 1px solid gray;"
|
||||
"border-top-left-radius: 10px;"
|
||||
"border-top-right-radius: 10px;"
|
||||
"border-style: none;"
|
||||
"background-color:rgba(0,0,0,120)"
|
||||
"}"
|
||||
"QToolButton {"
|
||||
"background:transparent;"
|
||||
@@ -45,6 +41,7 @@ BottomButtonGroup::BottomButtonGroup(const std::vector<QAction *> &actionList, Q
|
||||
for (QAction * action : actionList) {
|
||||
addButton(newActionBtn(action));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BottomButtonGroup::setOpacity(qreal opacity, bool animated)
|
||||
|
||||
@@ -14,22 +14,9 @@
|
||||
FramelessWindow::FramelessWindow(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_centralLayout(new QVBoxLayout(this))
|
||||
, m_oldCursorShape(Qt::ArrowCursor)
|
||||
, m_oldEdges()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint);
|
||||
#else
|
||||
// There is a bug in Qt 5 that will make pressing Meta+Up cause the app
|
||||
// fullscreen under Windows, see QTBUG-91226 to learn more.
|
||||
// The bug seems no longer exists in Qt 6 (I only tested it under Qt 6.3.0).
|
||||
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
this->setMouseTracking(true);
|
||||
this->setAttribute(Qt::WA_Hover, true);
|
||||
this->installEventFilter(this);
|
||||
|
||||
m_centralLayout->setContentsMargins(QMargins());
|
||||
this->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
m_centralLayout->setContentsMargins(QMargins(0, 0, 0, 60));
|
||||
}
|
||||
|
||||
void FramelessWindow::setCentralWidget(QWidget *widget)
|
||||
@@ -42,106 +29,3 @@ void FramelessWindow::setCentralWidget(QWidget *widget)
|
||||
m_centralLayout->addWidget(widget);
|
||||
m_centralWidget = widget;
|
||||
}
|
||||
|
||||
void FramelessWindow::installResizeCapture(QObject* widget)
|
||||
{
|
||||
widget->installEventFilter(this);
|
||||
}
|
||||
|
||||
bool FramelessWindow::eventFilter(QObject* o, QEvent* e)
|
||||
{
|
||||
switch (e->type()) {
|
||||
case QEvent::HoverMove:
|
||||
{
|
||||
QWidget* wg = qobject_cast<QWidget*>(o);
|
||||
if (wg != nullptr)
|
||||
return mouseHover(static_cast<QHoverEvent*>(e), wg);
|
||||
|
||||
break;
|
||||
}
|
||||
case QEvent::MouseButtonPress:
|
||||
return mousePress(static_cast<QMouseEvent*>(e));
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
|
||||
bool FramelessWindow::mouseHover(QHoverEvent* event, QWidget* wg)
|
||||
{
|
||||
if (!isMaximized() && !isFullScreen()) {
|
||||
QWindow* win = window()->windowHandle();
|
||||
Qt::Edges edges = this->getEdgesByPos(wg->mapToGlobal(event->oldPos()), win->frameGeometry());
|
||||
|
||||
// backup & restore cursor shape
|
||||
if (edges && !m_oldEdges)
|
||||
// entering the edge. backup cursor shape
|
||||
m_oldCursorShape = win->cursor().shape();
|
||||
if (!edges && m_oldEdges)
|
||||
// leaving the edge. restore cursor shape
|
||||
win->setCursor(m_oldCursorShape);
|
||||
|
||||
// save the latest edges status
|
||||
m_oldEdges = edges;
|
||||
|
||||
// show resize cursor shape if cursor is within border
|
||||
if (edges) {
|
||||
win->setCursor(this->getCursorByEdge(edges, Qt::ArrowCursor));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FramelessWindow::mousePress(QMouseEvent* event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton && !isMaximized() && !isFullScreen()) {
|
||||
QWindow* win = window()->windowHandle();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
Qt::Edges edges = this->getEdgesByPos(event->globalPosition().toPoint(), win->frameGeometry());
|
||||
#else
|
||||
Qt::Edges edges = this->getEdgesByPos(event->globalPos(), win->frameGeometry());
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (edges) {
|
||||
win->startSystemResize(edges);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::CursorShape FramelessWindow::getCursorByEdge(const Qt::Edges& edges, Qt::CursorShape default_cursor)
|
||||
{
|
||||
if ((edges == (Qt::TopEdge | Qt::LeftEdge)) || (edges == (Qt::RightEdge | Qt::BottomEdge)))
|
||||
return Qt::SizeFDiagCursor;
|
||||
else if ((edges == (Qt::TopEdge | Qt::RightEdge)) || (edges == (Qt::LeftEdge | Qt::BottomEdge)))
|
||||
return Qt::SizeBDiagCursor;
|
||||
else if (edges & (Qt::TopEdge | Qt::BottomEdge))
|
||||
return Qt::SizeVerCursor;
|
||||
else if (edges & (Qt::LeftEdge | Qt::RightEdge))
|
||||
return Qt::SizeHorCursor;
|
||||
else
|
||||
return default_cursor;
|
||||
}
|
||||
|
||||
Qt::Edges FramelessWindow::getEdgesByPos(const QPoint gpos, const QRect& winrect)
|
||||
{
|
||||
const int borderWidth = 8;
|
||||
Qt::Edges edges;
|
||||
|
||||
int x = gpos.x() - winrect.x();
|
||||
int y = gpos.y() - winrect.y();
|
||||
|
||||
if (x < borderWidth)
|
||||
edges |= Qt::LeftEdge;
|
||||
if (x > (winrect.width() - borderWidth))
|
||||
edges |= Qt::RightEdge;
|
||||
if (y < borderWidth)
|
||||
edges |= Qt::TopEdge;
|
||||
if (y > (winrect.height() - borderWidth))
|
||||
edges |= Qt::BottomEdge;
|
||||
|
||||
return edges;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,22 +16,9 @@ class FramelessWindow : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FramelessWindow(QWidget *parent = nullptr);
|
||||
|
||||
void setCentralWidget(QWidget * widget);
|
||||
void installResizeCapture(QObject* widget);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *o, QEvent *e) override;
|
||||
bool mouseHover(QHoverEvent* event, QWidget* wg);
|
||||
bool mousePress(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
Qt::Edges m_oldEdges;
|
||||
Qt::CursorShape m_oldCursorShape;
|
||||
|
||||
Qt::CursorShape getCursorByEdge(const Qt::Edges& edges, Qt::CursorShape default_cursor);
|
||||
Qt::Edges getEdgesByPos(const QPoint pos, const QRect& winrect);
|
||||
|
||||
QVBoxLayout * m_centralLayout = nullptr;
|
||||
QWidget * m_centralWidget = nullptr; // just a pointer, doesn't take the ownership.
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ void GraphicsScene::showText(const QString &text)
|
||||
{
|
||||
this->clear();
|
||||
QGraphicsTextItem * textItem = this->addText(text);
|
||||
textItem->setDefaultTextColor(QColor("White"));
|
||||
textItem->setDefaultTextColor(QColor("Black"));
|
||||
m_theThing = textItem;
|
||||
this->setSceneRect(m_theThing->boundingRect());
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ GraphicsView::GraphicsView(QWidget *parent)
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setResizeAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
setStyleSheet("background-color: rgba(0, 0, 0, 220);"
|
||||
"border-radius: 3px;");
|
||||
setStyleSheet("border-style: none;");
|
||||
setAcceptDrops(false);
|
||||
setCheckerboardEnabled(false);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "settings.h"
|
||||
#include "toolbutton.h"
|
||||
#include "bottombuttongroup.h"
|
||||
#include "graphicsview.h"
|
||||
#include "navigatorview.h"
|
||||
@@ -54,31 +53,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
this->setWindowFlag(Qt::WindowStaysOnTopHint);
|
||||
}
|
||||
|
||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
this->setMinimumSize(350, 330);
|
||||
this->setMinimumSize(600, 400);
|
||||
this->setWindowIcon(QIcon(":/icons/app-icon.svg"));
|
||||
this->setMouseTracking(true);
|
||||
this->setAcceptDrops(true);
|
||||
|
||||
m_pm->setAutoLoadFilterSuffixes(supportedImageFormats());
|
||||
|
||||
m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity");
|
||||
m_fadeOutAnimation->setDuration(300);
|
||||
m_fadeOutAnimation->setStartValue(1);
|
||||
m_fadeOutAnimation->setEndValue(0);
|
||||
m_floatUpAnimation = new QPropertyAnimation(this, "geometry");
|
||||
m_floatUpAnimation->setDuration(300);
|
||||
m_floatUpAnimation->setEasingCurve(QEasingCurve::OutCirc);
|
||||
m_exitAnimationGroup = new QParallelAnimationGroup(this);
|
||||
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
||||
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
||||
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
||||
#ifdef Q_OS_MAC
|
||||
this, &QWidget::hide);
|
||||
#else
|
||||
this, &QWidget::close);
|
||||
#endif
|
||||
|
||||
GraphicsScene * scene = new GraphicsScene(this);
|
||||
|
||||
m_graphicsView = new GraphicsView(this);
|
||||
@@ -86,7 +66,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
this->setCentralWidget(m_graphicsView);
|
||||
|
||||
m_gv = new NavigatorView(this);
|
||||
m_gv->setFixedSize(220, 160);
|
||||
m_gv->setFixedSize(82, 60);
|
||||
m_gv->setScene(scene);
|
||||
m_gv->setMainView(m_graphicsView);
|
||||
m_gv->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
||||
@@ -102,48 +82,25 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(m_graphicsView, &GraphicsView::viewportRectChanged,
|
||||
m_gv, &NavigatorView::updateMainViewportRegion);
|
||||
|
||||
m_closeButton = new ToolButton(true, m_graphicsView);
|
||||
m_closeButton->setIconSize(QSize(32, 32));
|
||||
m_closeButton->setFixedSize(QSize(50, 50));
|
||||
m_closeButton->setIconResourcePath(":/icons/window-close.svg");
|
||||
|
||||
connect(m_closeButton, &QAbstractButton::clicked,
|
||||
this, &MainWindow::closeWindow);
|
||||
|
||||
m_prevButton = new ToolButton(false, m_graphicsView);
|
||||
m_prevButton->setIconSize(QSize(75, 75));
|
||||
m_prevButton->setIconResourcePath(":/icons/go-previous.svg");
|
||||
m_prevButton->setVisible(false);
|
||||
m_prevButton->setOpacity(0, false);
|
||||
m_nextButton = new ToolButton(false, m_graphicsView);
|
||||
m_nextButton->setIconSize(QSize(75, 75));
|
||||
m_nextButton->setIconResourcePath(":/icons/go-next.svg");
|
||||
m_nextButton->setVisible(false);
|
||||
m_nextButton->setOpacity(0, false);
|
||||
|
||||
connect(m_prevButton, &QAbstractButton::clicked,
|
||||
this, &MainWindow::galleryPrev);
|
||||
connect(m_nextButton, &QAbstractButton::clicked,
|
||||
this, &MainWindow::galleryNext);
|
||||
|
||||
m_am->setupAction(this);
|
||||
m_am->setPrevNextPictureActionEnabled(false);
|
||||
|
||||
m_bottomButtonGroup = new BottomButtonGroup({
|
||||
m_am->actionActualSize,
|
||||
m_am->actionToggleMaximize,
|
||||
m_am->actionFitInView,
|
||||
m_am->actionZoomIn,
|
||||
m_am->actionZoomOut,
|
||||
m_am->actionToggleCheckerboard,
|
||||
m_am->actionRotateClockwise
|
||||
m_am->actionPrevPicture,
|
||||
m_am->actionNextPicture,
|
||||
m_am->actionRotateCounterClockwise,
|
||||
m_am->actionRotateClockwise,
|
||||
m_am->actionHorizontalFlip,
|
||||
m_am->actionToggleCheckerboard
|
||||
}, this);
|
||||
|
||||
m_bottomButtonGroup->setOpacity(0, false);
|
||||
m_gv->setOpacity(0, false);
|
||||
m_closeButton->setOpacity(0, false);
|
||||
m_bottomButtonGroup->setFixedHeight(60);
|
||||
|
||||
connect(m_pm, &PlaylistManager::totalCountChanged, this, [this](int galleryFileCount) {
|
||||
m_prevButton->setVisible(galleryFileCount > 1);
|
||||
m_nextButton->setVisible(galleryFileCount > 1);
|
||||
m_am->setPrevNextPictureActionEnabled(galleryFileCount > 1);
|
||||
});
|
||||
|
||||
connect(m_pm->model(), &PlaylistModel::modelReset, this, std::bind(&MainWindow::galleryCurrent, this, false, false));
|
||||
@@ -164,12 +121,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
Settings::instance()->applyUserShortcuts(this);
|
||||
});
|
||||
|
||||
// allow some mouse events can go through these widgets for resizing window.
|
||||
installResizeCapture(m_closeButton);
|
||||
installResizeCapture(m_graphicsView);
|
||||
installResizeCapture(m_graphicsView->viewport());
|
||||
installResizeCapture(m_gv);
|
||||
installResizeCapture(m_gv->viewport());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -304,75 +255,6 @@ void MainWindow::showEvent(QShowEvent *event)
|
||||
return FramelessWindow::showEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::enterEvent(QT_ENTER_EVENT *event)
|
||||
{
|
||||
m_bottomButtonGroup->setOpacity(1);
|
||||
m_gv->setOpacity(1);
|
||||
|
||||
m_closeButton->setOpacity(1);
|
||||
m_prevButton->setOpacity(1);
|
||||
m_nextButton->setOpacity(1);
|
||||
|
||||
return FramelessWindow::enterEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::leaveEvent(QEvent *event)
|
||||
{
|
||||
m_bottomButtonGroup->setOpacity(0);
|
||||
m_gv->setOpacity(0);
|
||||
|
||||
m_closeButton->setOpacity(0);
|
||||
m_prevButton->setOpacity(0);
|
||||
m_nextButton->setOpacity(0);
|
||||
|
||||
return FramelessWindow::leaveEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton && !isMaximized()) {
|
||||
m_clickedOnWindow = true;
|
||||
m_oldMousePos = event->pos();
|
||||
// qDebug() << m_oldMousePos << m_graphicsView->transform().m11()
|
||||
// << m_graphicsView->transform().m22() << m_graphicsView->matrix().m12();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
return FramelessWindow::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton && m_clickedOnWindow && !isMaximized() && !isFullScreen()) {
|
||||
if (!window()->windowHandle()->startSystemMove()) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
move(event->globalPosition().toPoint() - m_oldMousePos);
|
||||
#else
|
||||
move(event->globalPos() - m_oldMousePos);
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
return FramelessWindow::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
m_clickedOnWindow = false;
|
||||
|
||||
// It seems the forward/back mouse button won't generate a key event [1] so we can't use
|
||||
// QShortcut or QKeySequence to indicate these shortcuts, so we do it here.
|
||||
// Reference:
|
||||
// [1]: https://codereview.qt-project.org/c/qt/qtbase/+/177475
|
||||
if (event->button() == Qt::ForwardButton || event->button() == Qt::BackButton) {
|
||||
event->button() == Qt::BackButton ? galleryPrev() : galleryNext();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
return FramelessWindow::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
// The forward/back mouse button can also used to trigger a mouse double-click event
|
||||
@@ -584,20 +466,12 @@ void MainWindow::centerWindow()
|
||||
|
||||
void MainWindow::closeWindow()
|
||||
{
|
||||
QRect windowRect(this->geometry());
|
||||
m_floatUpAnimation->setStartValue(windowRect);
|
||||
m_floatUpAnimation->setEndValue(windowRect.adjusted(0, -80, 0, 0));
|
||||
m_floatUpAnimation->setStartValue(QRect(this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
|
||||
m_floatUpAnimation->setEndValue(QRect(this->geometry().x(), this->geometry().y()-80, this->geometry().width(), this->geometry().height()));
|
||||
m_exitAnimationGroup->start();
|
||||
// YYC Mark: Exit animation is not supported in Remix fork.
|
||||
this->close();
|
||||
}
|
||||
|
||||
void MainWindow::updateWidgetsPosition()
|
||||
{
|
||||
m_closeButton->move(width() - m_closeButton->width(), 0);
|
||||
m_prevButton->move(25, (height() - m_prevButton->sizeHint().height()) / 2);
|
||||
m_nextButton->move(width() - m_nextButton->sizeHint().width() - 25,
|
||||
(height() - m_prevButton->sizeHint().height()) / 2);
|
||||
m_bottomButtonGroup->move((width() - m_bottomButtonGroup->width()) / 2,
|
||||
height() - m_bottomButtonGroup->height());
|
||||
m_gv->move(width() - m_gv->width(), height() - m_gv->height());
|
||||
@@ -606,9 +480,7 @@ void MainWindow::updateWidgetsPosition()
|
||||
void MainWindow::toggleProtectedMode()
|
||||
{
|
||||
m_protectedMode = !m_protectedMode;
|
||||
m_closeButton->setVisible(!m_protectedMode);
|
||||
m_prevButton->setVisible(!m_protectedMode);
|
||||
m_nextButton->setVisible(!m_protectedMode);
|
||||
// YYC Mark: Protected mode is not supported in Remix fork.
|
||||
}
|
||||
|
||||
void MainWindow::toggleStayOnTop()
|
||||
@@ -647,7 +519,9 @@ bool MainWindow::canPaste() const
|
||||
|
||||
void MainWindow::quitAppAction(bool force)
|
||||
{
|
||||
if (!m_protectedMode || force) {
|
||||
// YYC Mark: Protect mode is not supported in Remix fork
|
||||
// Assume we are always in non-protected mode.
|
||||
if (/*!m_protectedMode*/ true || force) {
|
||||
closeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,11 +51,6 @@ public:
|
||||
|
||||
protected slots:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void enterEvent(QT_ENTER_EVENT *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
@@ -119,19 +114,11 @@ private:
|
||||
ActionManager *m_am;
|
||||
PlaylistManager *m_pm;
|
||||
|
||||
QPoint m_oldMousePos;
|
||||
QPropertyAnimation *m_fadeOutAnimation;
|
||||
QPropertyAnimation *m_floatUpAnimation;
|
||||
QParallelAnimationGroup *m_exitAnimationGroup;
|
||||
QFileSystemWatcher *m_fileSystemWatcher;
|
||||
ToolButton *m_closeButton;
|
||||
ToolButton *m_prevButton;
|
||||
ToolButton *m_nextButton;
|
||||
GraphicsView *m_graphicsView;
|
||||
NavigatorView *m_gv;
|
||||
BottomButtonGroup *m_bottomButtonGroup;
|
||||
bool m_protectedMode = false;
|
||||
bool m_clickedOnWindow = false;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
@@ -18,7 +18,7 @@ NavigatorView::NavigatorView(QWidget *parent)
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setStyleSheet("background-color: rgba(0, 0, 0, 120);"
|
||||
"border-radius: 3px;");
|
||||
"border-style: none;");
|
||||
}
|
||||
|
||||
// doesn't take or manage its ownership
|
||||
|
||||
@@ -47,7 +47,7 @@ Settings *Settings::instance()
|
||||
|
||||
bool Settings::stayOnTop()
|
||||
{
|
||||
return m_qsettings->value("stay_on_top", true).toBool();
|
||||
return m_qsettings->value("stay_on_top", false).toBool();
|
||||
}
|
||||
|
||||
bool Settings::useLightCheckerboard()
|
||||
@@ -57,9 +57,9 @@ bool Settings::useLightCheckerboard()
|
||||
|
||||
Settings::DoubleClickBehavior Settings::doubleClickBehavior() const
|
||||
{
|
||||
QString result = m_qsettings->value("double_click_behavior", "Close").toString();
|
||||
QString result = m_qsettings->value("double_click_behavior", "Ignore").toString();
|
||||
|
||||
return QEnumHelper::fromString<DoubleClickBehavior>(result, DoubleClickBehavior::Close);
|
||||
return QEnumHelper::fromString<DoubleClickBehavior>(result, DoubleClickBehavior::Ignore);
|
||||
}
|
||||
|
||||
Settings::MouseWheelBehavior Settings::mouseWheelBehavior() const
|
||||
@@ -71,9 +71,9 @@ Settings::MouseWheelBehavior Settings::mouseWheelBehavior() const
|
||||
|
||||
Settings::WindowSizeBehavior Settings::initWindowSizeBehavior() const
|
||||
{
|
||||
QString result = m_qsettings->value("init_window_size_behavior", "Auto").toString();
|
||||
QString result = m_qsettings->value("init_window_size_behavior", "Maximized").toString();
|
||||
|
||||
return QEnumHelper::fromString<WindowSizeBehavior>(result, WindowSizeBehavior::Auto);
|
||||
return QEnumHelper::fromString<WindowSizeBehavior>(result, WindowSizeBehavior::Maximized);
|
||||
}
|
||||
|
||||
Qt::HighDpiScaleFactorRoundingPolicy Settings::hiDpiScaleFactorBehavior() const
|
||||
|
||||
Reference in New Issue
Block a user