- 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.
125 lines
3.6 KiB
C++
125 lines
3.6 KiB
C++
// SPDX-FileCopyrightText: 2025 Gary Wang <git@blumia.net>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include "framelesswindow.h"
|
|
|
|
#include <QParallelAnimationGroup>
|
|
#include <QPropertyAnimation>
|
|
#include <QPushButton>
|
|
|
|
#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)
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QGraphicsOpacityEffect;
|
|
class QGraphicsView;
|
|
class QFileSystemWatcher;
|
|
QT_END_NAMESPACE
|
|
|
|
class ActionManager;
|
|
class PlaylistManager;
|
|
class ToolButton;
|
|
class GraphicsView;
|
|
class NavigatorView;
|
|
class BottomButtonGroup;
|
|
class MainWindow : public FramelessWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow() override;
|
|
|
|
void showUrls(const QList<QUrl> &urls);
|
|
void initWindowSize();
|
|
void adjustWindowSizeBySceneRect();
|
|
QUrl currentImageFileUrl() const;
|
|
|
|
void clearGallery();
|
|
void galleryPrev();
|
|
void galleryNext();
|
|
void galleryCurrent(bool showLoadImageHintWhenEmpty, bool reloadImage);
|
|
|
|
static QStringList supportedImageFormats();
|
|
|
|
protected slots:
|
|
void showEvent(QShowEvent *event) override;
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
|
void wheelEvent(QWheelEvent *event) override;
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
|
void dropEvent(QDropEvent *event) override;
|
|
|
|
void centerWindow();
|
|
void closeWindow();
|
|
void updateWidgetsPosition();
|
|
void toggleProtectedMode();
|
|
void toggleStayOnTop();
|
|
void toggleAvoidResetTransform();
|
|
bool stayOnTop() const;
|
|
bool canPaste() const;
|
|
void quitAppAction(bool force = false);
|
|
void toggleFullscreen();
|
|
void toggleMaximize();
|
|
|
|
protected:
|
|
QSize sizeHint() const override;
|
|
|
|
private slots:
|
|
void on_actionOpen_triggered();
|
|
|
|
void on_actionActualSize_triggered();
|
|
void on_actionToggleMaximize_triggered();
|
|
void on_actionZoomIn_triggered();
|
|
void on_actionZoomOut_triggered();
|
|
void on_actionToggleCheckerboard_triggered();
|
|
void on_actionRotateClockwise_triggered();
|
|
void on_actionRotateCounterClockwise_triggered();
|
|
|
|
void on_actionPrevPicture_triggered();
|
|
void on_actionNextPicture_triggered();
|
|
|
|
void on_actionTogglePauseAnimation_triggered();
|
|
void on_actionAnimationNextFrame_triggered();
|
|
|
|
void on_actionHorizontalFlip_triggered();
|
|
void on_actionFitInView_triggered();
|
|
void on_actionFitByWidth_triggered();
|
|
void on_actionCopyPixmap_triggered();
|
|
void on_actionCopyFilePath_triggered();
|
|
void on_actionPaste_triggered();
|
|
void on_actionTrash_triggered();
|
|
void on_actionToggleStayOnTop_triggered();
|
|
void on_actionToggleProtectMode_triggered();
|
|
void on_actionToggleAvoidResetTransform_triggered();
|
|
void on_actionSettings_triggered();
|
|
void on_actionHelp_triggered();
|
|
void on_actionProperties_triggered();
|
|
void on_actionLocateInFileManager_triggered();
|
|
void on_actionQuitApp_triggered();
|
|
|
|
private:
|
|
bool updateFileWatcher(const QString & basePath = QString());
|
|
|
|
private:
|
|
ActionManager *m_am;
|
|
PlaylistManager *m_pm;
|
|
|
|
QFileSystemWatcher *m_fileSystemWatcher;
|
|
GraphicsView *m_graphicsView;
|
|
NavigatorView *m_gv;
|
|
BottomButtonGroup *m_bottomButtonGroup;
|
|
bool m_protectedMode = false;
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|