Files
sarasacw-picture/app/mainwindow.h
T

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

99 lines
2.5 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
2026-07-24 14:57:41 +08:00
#include <QWidget>
2025-07-23 21:20:34 +08:00
2019-10-03 11:00:28 +08:00
QT_BEGIN_NAMESPACE
class QFileSystemWatcher;
2026-07-24 14:57:41 +08:00
namespace Ui {
class MainWindow;
}
2019-10-03 11:00:28 +08:00
QT_END_NAMESPACE
2025-07-23 21:20:34 +08:00
class ActionManager;
class PlaylistManager;
2026-07-24 14:57:41 +08:00
2026-07-13 15:59:39 +08:00
class MainWindow : public QWidget
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
2026-07-13 15:40:59 +08:00
void showFiles(const QStringList& files);
void showFiles(const QList<QUrl>& urls);
2022-03-11 16:21:56 +08:00
void initWindowSize();
2025-07-23 21:20:34 +08:00
2020-02-22 17:09:36 +08:00
void clearGallery();
void galleryPrev();
void galleryNext();
2026-07-13 15:40:59 +08:00
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-10-04 09:54:13 +08:00
void wheelEvent(QWheelEvent *event) override;
2019-10-05 13:21:49 +08:00
void contextMenuEvent(QContextMenuEvent *event) override;
2024-07-30 22:54:43 +08:00
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();
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:
2026-07-12 21:00:11 +08:00
void on_actionCopyPixmap_triggered();
void on_actionCopyFilePath_triggered();
2025-07-23 21:20:34 +08:00
void on_actionPrevPicture_triggered();
void on_actionNextPicture_triggered();
2025-07-23 21:20:34 +08:00
2026-07-12 21:00:11 +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();
void on_actionRotateCounterClockwise_triggered();
void on_actionToggleAvoidResetTransform_triggered();
void on_actionToggleCheckerboard_triggered();
void on_actionTogglePauseAnimation_triggered();
void on_actionAnimationNextFrame_triggered();
2025-07-23 21:20:34 +08:00
2024-04-15 01:16:00 +08:00
void on_actionTrash_triggered();
2026-07-12 21:00:11 +08:00
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());
2026-07-13 15:40:59 +08:00
void updateActionState();
2025-07-23 21:20:34 +08:00
2019-09-28 01:18:08 +08:00
private:
2026-07-24 14:57:41 +08:00
QT_PREPEND_NAMESPACE(Ui::MainWindow) *ui;
ActionManager *m_am;
PlaylistManager *m_pm;
QFileSystemWatcher *m_fileSystemWatcher;
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