2019-09-28 01:18:08 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2020-12-29 23:28:17 +08:00
|
|
|
#include "framelesswindow.h"
|
|
|
|
|
2019-09-28 01:18:08 +08:00
|
|
|
#include <QParallelAnimationGroup>
|
|
|
|
#include <QPropertyAnimation>
|
|
|
|
#include <QPushButton>
|
|
|
|
|
2021-10-02 19:57:42 +08:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
typedef QEnterEvent QT_ENTER_EVENT;
|
|
|
|
#else
|
|
|
|
typedef QEvent QT_ENTER_EVENT;
|
|
|
|
#endif // QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
|
2019-10-03 11:00:28 +08:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QGraphicsOpacityEffect;
|
2019-10-03 17:57:14 +08:00
|
|
|
class QGraphicsView;
|
2019-10-03 11:00:28 +08:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2021-01-24 00:07:58 +08:00
|
|
|
class ActionManager;
|
2021-02-09 14:19:09 +08:00
|
|
|
class PlaylistManager;
|
2019-10-06 14:12:52 +08:00
|
|
|
class ToolButton;
|
2019-10-01 10:37:14 +08:00
|
|
|
class GraphicsView;
|
2019-10-03 17:57:14 +08:00
|
|
|
class NavigatorView;
|
2019-09-29 01:40:19 +08:00
|
|
|
class BottomButtonGroup;
|
2020-12-29 23:28:17 +08:00
|
|
|
class MainWindow : public FramelessWindow
|
2019-09-28 01:18:08 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow() override;
|
|
|
|
|
2019-10-01 10:37:14 +08:00
|
|
|
void showUrls(const QList<QUrl> &urls);
|
2019-10-01 11:44:35 +08:00
|
|
|
void adjustWindowSizeBySceneRect();
|
2020-01-01 14:51:46 +08:00
|
|
|
QUrl currentImageFileUrl() const;
|
2019-10-01 10:37:14 +08:00
|
|
|
|
2020-02-22 17:09:36 +08:00
|
|
|
void clearGallery();
|
2019-11-16 15:53:24 +08:00
|
|
|
void loadGalleryBySingleLocalFile(const QString &path);
|
|
|
|
void galleryPrev();
|
|
|
|
void galleryNext();
|
|
|
|
|
2019-09-28 01:18:08 +08:00
|
|
|
protected slots:
|
2019-09-29 01:40:19 +08:00
|
|
|
void showEvent(QShowEvent *event) override;
|
2021-10-02 19:57:42 +08:00
|
|
|
void enterEvent(QT_ENTER_EVENT *event) override;
|
2019-10-03 11:00:28 +08:00
|
|
|
void leaveEvent(QEvent *event) override;
|
2019-09-28 01:18:08 +08:00
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2019-10-04 09:54:13 +08:00
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
2019-09-28 01:18:08 +08:00
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
2019-10-05 13:21:49 +08:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
2019-09-28 01:18:08 +08:00
|
|
|
|
2019-10-01 11:44:35 +08:00
|
|
|
void centerWindow();
|
2019-09-28 01:18:08 +08:00
|
|
|
void closeWindow();
|
2019-09-29 01:40:19 +08:00
|
|
|
void updateWidgetsPosition();
|
2019-10-05 13:21:49 +08:00
|
|
|
void toggleProtectedMode();
|
2019-10-06 12:57:38 +08:00
|
|
|
void toggleStayOnTop();
|
2021-06-07 14:06:57 +08:00
|
|
|
bool stayOnTop() const;
|
|
|
|
bool canPaste() const;
|
2019-11-03 17:15:50 +08:00
|
|
|
void quitAppAction(bool force = false);
|
2020-05-19 14:08:29 +08:00
|
|
|
void toggleFullscreen();
|
2020-07-28 21:14:38 +08:00
|
|
|
void toggleMaximize();
|
2019-09-28 01:18:08 +08:00
|
|
|
|
2021-01-10 14:57:01 +08:00
|
|
|
protected:
|
|
|
|
QSize sizeHint() const override;
|
|
|
|
|
2021-01-24 00:07:58 +08:00
|
|
|
private slots:
|
2021-11-25 22:54:37 +08:00
|
|
|
void on_actionOpen_triggered();
|
|
|
|
|
2021-07-02 00:06:23 +08:00
|
|
|
void on_actionActualSize_triggered();
|
|
|
|
void on_actionToggleMaximize_triggered();
|
2021-02-18 20:03:17 +08:00
|
|
|
void on_actionZoomIn_triggered();
|
|
|
|
void on_actionZoomOut_triggered();
|
2021-07-02 00:06:23 +08:00
|
|
|
void on_actionToggleCheckerboard_triggered();
|
|
|
|
void on_actionRotateClockwise_triggered();
|
|
|
|
|
2021-10-08 14:06:18 +08:00
|
|
|
void on_actionPrevPicture_triggered();
|
|
|
|
void on_actionNextPicture_triggered();
|
|
|
|
|
2021-03-19 23:11:06 +08:00
|
|
|
void on_actionHorizontalFlip_triggered();
|
2021-06-04 13:53:47 +08:00
|
|
|
void on_actionFitInView_triggered();
|
2021-05-14 00:00:03 +08:00
|
|
|
void on_actionFitByWidth_triggered();
|
2021-01-24 00:07:58 +08:00
|
|
|
void on_actionCopyPixmap_triggered();
|
|
|
|
void on_actionCopyFilePath_triggered();
|
|
|
|
void on_actionPaste_triggered();
|
|
|
|
void on_actionToggleStayOnTop_triggered();
|
|
|
|
void on_actionToggleProtectMode_triggered();
|
|
|
|
void on_actionSettings_triggered();
|
|
|
|
void on_actionHelp_triggered();
|
|
|
|
void on_actionProperties_triggered();
|
2022-01-21 16:48:43 +08:00
|
|
|
void on_actionLocateInFileManager_triggered();
|
2021-01-24 00:07:58 +08:00
|
|
|
void on_actionQuitApp_triggered();
|
|
|
|
|
2019-09-28 01:18:08 +08:00
|
|
|
private:
|
2021-01-24 00:07:58 +08:00
|
|
|
ActionManager *m_am;
|
2021-02-09 14:19:09 +08:00
|
|
|
PlaylistManager *m_pm;
|
2021-01-24 00:07:58 +08:00
|
|
|
|
2019-09-28 01:18:08 +08:00
|
|
|
QPoint m_oldMousePos;
|
|
|
|
QPropertyAnimation *m_fadeOutAnimation;
|
|
|
|
QPropertyAnimation *m_floatUpAnimation;
|
|
|
|
QParallelAnimationGroup *m_exitAnimationGroup;
|
2019-10-06 14:12:52 +08:00
|
|
|
ToolButton *m_closeButton;
|
2020-07-04 13:49:12 +08:00
|
|
|
ToolButton *m_prevButton;
|
|
|
|
ToolButton *m_nextButton;
|
2019-10-01 10:37:14 +08:00
|
|
|
GraphicsView *m_graphicsView;
|
2019-10-03 17:57:14 +08:00
|
|
|
NavigatorView *m_gv;
|
2019-09-29 01:40:19 +08:00
|
|
|
BottomButtonGroup *m_bottomButtonGroup;
|
2019-10-05 12:55:09 +08:00
|
|
|
bool m_protectedMode = false;
|
2019-09-28 01:18:08 +08:00
|
|
|
bool m_clickedOnWindow = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|