File indexing completed on 2024-05-05 17:04:26
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * Copyright (C) 2013 Dan Leinir Turthra Jensen <admin@leinir.dk> 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Library General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2 of the License, or (at your option) any later version. 0009 * 0010 * This library 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 GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, write to 0017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef MAINWINDOW_H 0022 #define MAINWINDOW_H 0023 0024 #include <QMainWindow> 0025 0026 class MainWindow : public QMainWindow 0027 { 0028 Q_OBJECT 0029 Q_PROPERTY(bool allowClose READ allowClose WRITE setAllowClose) 0030 Q_PROPERTY(bool slateMode READ slateMode NOTIFY slateModeChanged) 0031 Q_PROPERTY(QString applicationName READ applicationName CONSTANT) 0032 Q_PROPERTY(QString currentTouchPage READ currentTouchPage WRITE setCurrentTouchPage NOTIFY currentTouchPageChanged) 0033 Q_PROPERTY(bool temporaryFile READ temporaryFile WRITE setTemporaryFile NOTIFY temporaryFileChanged) 0034 Q_PROPERTY(bool fullScreen READ fullScreen WRITE setFullScreen NOTIFY fullScreenChanged) 0035 Q_PROPERTY(QObject* desktopKoView READ desktopKoView NOTIFY desktopKoViewChanged) 0036 0037 public: 0038 explicit MainWindow(QStringList fileNames, QWidget* parent = 0, Qt::WindowFlags flags = 0); 0039 ~MainWindow() override; 0040 0041 bool allowClose() const; 0042 void setAllowClose(bool allow); 0043 0044 bool slateMode() const; 0045 0046 QString applicationName() const { 0047 return QLatin1String("CALLIGRA GEMINI"); 0048 } 0049 0050 QString currentTouchPage() const; 0051 void setCurrentTouchPage(QString newPage); 0052 0053 bool temporaryFile() const; 0054 void setTemporaryFile(bool newValue); 0055 0056 bool fullScreen() const; 0057 void setFullScreen(bool newValue); 0058 0059 QObject* desktopKoView() const; 0060 Q_INVOKABLE int lastScreen() const; 0061 0062 Q_INVOKABLE void setAlternativeSaveAction(QAction* altAction); 0063 0064 void closeEvent(QCloseEvent* event) override; 0065 0066 Q_INVOKABLE void setDocAndPart(QObject* document, QObject* part); 0067 0068 public Q_SLOTS: 0069 void minimize(); 0070 void closeWindow(); 0071 0072 void switchToTouch(); 0073 void switchToDesktop(); 0074 void documentChanged(); 0075 void resetWindowTitle(); 0076 void resourceChanged(int key, const QVariant& v); 0077 void resourceChangedTouch(int key, const QVariant& v); 0078 /** 0079 * Used to open an arbitrary file from the welcome screen, 0080 * not from the normal UI (desktopproxy does that) 0081 */ 0082 void openFile(); 0083 Q_SIGNALS: 0084 void closeRequested(); 0085 void switchedToTouch(); 0086 void slateModeChanged(); 0087 void currentTouchPageChanged(); 0088 void temporaryFileChanged(); 0089 void fullScreenChanged(); 0090 void desktopKoViewChanged(); 0091 void documentSaved(); 0092 0093 private Q_SLOTS: 0094 void switchDesktopForced(); 0095 void switchTouchForced(); 0096 void touchChange(); 0097 void enableAltSaveAction(); 0098 0099 private: 0100 class Private; 0101 Private * const d; 0102 0103 #ifdef Q_OS_WIN 0104 bool winEvent(MSG * message, long * result); 0105 #endif 0106 }; 0107 0108 #endif // MAINWINDOW_H