pineapple-pictures/app/mainwindow.h

84 lines
2.3 KiB
C
Raw Normal View History

2019-09-28 01:18:08 +08:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QPushButton>
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
2019-10-06 14:12:52 +08:00
class ToolButton;
class GraphicsView;
2019-10-03 17:57:14 +08:00
class NavigatorView;
2019-09-29 01:40:19 +08:00
class BottomButtonGroup;
2019-09-28 01:18:08 +08:00
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
void showUrls(const QList<QUrl> &urls);
2019-10-01 11:44:35 +08:00
void adjustWindowSizeBySceneRect();
QUrl currentImageFileUrl() const;
void clearGallery();
void loadGalleryBySingleLocalFile(const QString &path);
void galleryPrev();
void galleryNext();
2020-07-04 13:49:12 +08:00
bool isGalleryAvailable();
signals:
void galleryLoaded();
2019-09-28 01:18:08 +08:00
protected slots:
2019-09-29 01:40:19 +08:00
void showEvent(QShowEvent *event) override;
2019-10-03 11:00:28 +08:00
void enterEvent(QEvent *event) override;
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-09-29 01:40:19 +08:00
bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
2020-07-27 20:47:54 +08:00
QSize sizeHint() const override;
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();
bool stayOnTop();
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
private:
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;
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;
QList<QUrl> m_files;
int m_currentFileIndex = -1;
2019-09-28 01:18:08 +08:00
};
#endif // MAINWINDOW_H