1
0
Files
sarasacw-picture/app/mainwindow.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
2.9 KiB
C
Raw Normal View History

// SPDX-FileCopyrightText: 2025 Gary Wang <git@blumia.net>
//
// SPDX-License-Identifier: MIT
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
2025-07-23 21:20:34 +08:00
#include "framelesswindow.h"
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QPushButton>
2025-07-23 21:20:34 +08:00
2019-10-03 11:00:28 +08:00
QT_BEGIN_NAMESPACE
class QMenu;
2019-10-03 17:57:14 +08:00
class QGraphicsView;
class QFileSystemWatcher;
2019-10-03 11:00:28 +08:00
QT_END_NAMESPACE
2025-07-23 21:20:34 +08:00
class ActionManager;
class PlaylistManager;
class GraphicsView;
2019-10-03 17:57:14 +08:00
class NavigatorView;
2019-09-29 01:40:19 +08:00
class BottomButtonGroup;
class MainWindow : public FramelessWindow
2019-09-28 01:18:08 +08:00
{
Q_OBJECT
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
2025-07-23 21:20:34 +08:00
void showFiles(const QStringList& files);
void showFiles(const QList<QUrl>& urls);
void initWindowSize();
2019-10-01 11:44:35 +08:00
void adjustWindowSizeBySceneRect();
2025-07-23 21:20:34 +08:00
void clearGallery();
void galleryPrev();
void galleryNext();
void galleryCurrent(bool fromFileWatcher);
2025-07-23 21:20:34 +08:00
static QStringList supportedImageFormats();
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
protected slots:
2019-09-29 01:40:19 +08:00
void showEvent(QShowEvent *event) override;
2019-09-28 01:18:08 +08:00
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;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
2025-07-23 21:20:34 +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();
void toggleAvoidResetTransform();
2020-05-19 14:08:29 +08:00
void toggleFullscreen();
2020-07-28 21:14:38 +08:00
void toggleMaximize();
2025-07-23 21:20:34 +08:00
2021-01-10 14:57:01 +08:00
protected:
QSize sizeHint() const override;
2025-07-23 21:20:34 +08:00
private slots:
void on_actionCopyPixmap_triggered();
void on_actionCopyFilePath_triggered();
void on_actionPrevPicture_triggered();
void on_actionNextPicture_triggered();
2025-07-23 21:20:34 +08:00
void on_actionActualSize_triggered();
void on_actionFitToScreen_triggered();
void on_actionFitByWidth_triggered();
void on_actionFitByHeight_triggered();
void on_actionZoomIn_triggered();
void on_actionZoomOut_triggered();
void on_actionFlipHorizontal_triggered();
void on_actionFlipVertical_triggered();
void on_actionRotateClockwise_triggered();
2024-07-31 19:41:51 +08:00
void on_actionRotateCounterClockwise_triggered();
2025-07-23 21:20:34 +08:00
void on_actionToggleAvoidResetTransform_triggered();
void on_actionToggleCheckerboard_triggered();
void on_actionTogglePauseAnimation_triggered();
void on_actionAnimationNextFrame_triggered();
2025-07-23 21:20:34 +08:00
void on_actionTrash_triggered();
void on_actionLocateInFileManager_triggered();
void on_actionProperties_triggered();
void on_actionSettings_triggered();
void on_actionHelp_triggered();
2025-07-23 21:20:34 +08:00
private:
bool updateFileWatcher(const QString & basePath = QString());
void updateActionState();
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
private:
ActionManager *m_am;
PlaylistManager *m_pm;
GraphicsView *m_gv;
NavigatorView *m_nav;
2025-07-23 21:20:34 +08:00
QMenu *m_menu;
QFileSystemWatcher *m_fileSystemWatcher;
2019-09-29 01:40:19 +08:00
BottomButtonGroup *m_bottomButtonGroup;
2019-09-28 01:18:08 +08:00
};
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
#endif // MAINWINDOW_H