File indexing completed on 2024-05-05 04:19:18
0001 /* 0002 Gwenview: an image viewer 0003 Copyright 2007 Aurélien Gâteau <agateau@kde.org> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public License 0007 as published by the Free Software Foundation; either version 2 0008 of the License, or (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 0019 */ 0020 #ifndef MAINWINDOW_H 0021 #define MAINWINDOW_H 0022 0023 // Qt 0024 #include <QAction> 0025 0026 // KF 0027 #include <KXmlGuiWindow> 0028 0029 class QModelIndex; 0030 0031 class QUrl; 0032 0033 class QMouseEvent; 0034 0035 namespace Gwenview 0036 { 0037 class ViewMainPage; 0038 class ContextManager; 0039 0040 class MainWindow : public KXmlGuiWindow 0041 { 0042 Q_OBJECT 0043 public: 0044 MainWindow(); 0045 ~MainWindow() override; 0046 /** 0047 * Defines the url to display when the window is shown for the first time. 0048 */ 0049 void setInitialUrl(const QUrl &); 0050 0051 void startSlideShow(); 0052 0053 ViewMainPage *viewMainPage() const; 0054 0055 ContextManager *contextManager() const; 0056 0057 void setDistractionFreeMode(bool); 0058 0059 public Q_SLOTS: 0060 void showStartMainPage(); 0061 0062 /** 0063 * Go to url, without changing current mode 0064 */ 0065 void goToUrl(const QUrl &); 0066 0067 Q_SIGNALS: 0068 void viewModeChanged(); 0069 0070 public Q_SLOTS: 0071 void setCaption(const QString &) override; 0072 0073 void setCaption(const QString &, bool modified) override; 0074 0075 protected: 0076 bool queryClose() override; 0077 QSize sizeHint() const override; 0078 void showEvent(QShowEvent *) override; 0079 void resizeEvent(QResizeEvent *) override; 0080 void saveProperties(KConfigGroup &) override; 0081 void readProperties(const KConfigGroup &) override; 0082 bool eventFilter(QObject *, QEvent *) override; 0083 void mousePressEvent(QMouseEvent *) override; 0084 void mouseDoubleClickEvent(QMouseEvent *) override; 0085 0086 private Q_SLOTS: 0087 void setActiveViewModeAction(QAction *action); 0088 void openDirUrl(const QUrl &); 0089 void slotThumbnailViewIndexActivated(const QModelIndex &); 0090 0091 void slotStartMainPageUrlSelected(const QUrl &); 0092 0093 void goUp(); 0094 void toggleSideBar(bool visible); 0095 void toggleOperationsSideBar(bool visible); 0096 void slotModifiedDocumentListChanged(); 0097 void slotUpdateCaption(const QString &caption); 0098 void slotPartCompleted(); 0099 void slotDirModelNewItems(); 0100 void slotDirListerCompleted(); 0101 0102 void slotSelectionChanged(); 0103 void slotCurrentDirUrlChanged(const QUrl &url); 0104 0105 void goToPrevious(); 0106 void goToNext(); 0107 void goToFirst(); 0108 void goToLast(); 0109 void updatePreviousNextActions(); 0110 0111 void leaveFullScreen(); 0112 void toggleFullScreen(bool); 0113 void leaveSpotlightMode(); 0114 void toggleSpotlightMode(bool); 0115 void toggleSlideShow(); 0116 void updateSlideShowAction(); 0117 0118 void saveCurrent(); 0119 void saveCurrentAs(); 0120 void openFile(); 0121 void openUrl(const QUrl &url); 0122 void reload(); 0123 0124 void showDocumentInFullScreen(const QUrl &); 0125 0126 /** 0127 * Shows Gwenview's settings dialog. 0128 * @param page defines which page should be shown initially. 0129 */ 0130 void showConfigDialog(int page = 0); 0131 void loadConfig(); 0132 void print(); 0133 void printPreview(); 0134 0135 void preloadNextUrl(); 0136 0137 void toggleMenuBar(); 0138 void toggleStatusBar(bool visible); 0139 0140 void showFirstDocumentReached(); 0141 void showLastDocumentReached(); 0142 0143 void replaceLocation(); 0144 0145 void onFocusChanged(QWidget *old, QWidget *now); 0146 0147 private: 0148 struct Private; 0149 MainWindow::Private *const d; 0150 0151 void openSelectedDocuments(); 0152 void saveConfig(); 0153 void configureShortcuts(); 0154 0155 void mouseButtonNavigate(QMouseEvent *); 0156 0157 void folderViewUrlChanged(const QUrl &url); 0158 void syncSortOrder(const QUrl &url); 0159 }; 0160 0161 } // namespace 0162 0163 #endif /* MAINWINDOW_H */