File indexing completed on 2024-05-19 04:29:22
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Jouni Pentikäinen <joupent@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISWINDOWLAYOUTMANAGER_H 0008 #define KISWINDOWLAYOUTMANAGER_H 0009 0010 #include <QObject> 0011 #include <QUuid> 0012 #include <QVector> 0013 #include <QSize> 0014 0015 #include <KisWindowLayoutResource.h> 0016 0017 class QScreen; 0018 class KisDocument; 0019 0020 class KisWindowLayoutManager : public QObject 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 struct Display 0026 { 0027 QSize resolution; 0028 0029 bool matches(QScreen* screen) const; 0030 }; 0031 0032 struct DisplayLayout 0033 { 0034 QString name; 0035 0036 QVector<Display> displays; 0037 QString preferredWindowLayout; 0038 0039 bool matches(QList<QScreen*> screens) const; 0040 }; 0041 0042 explicit KisWindowLayoutManager(); 0043 ~KisWindowLayoutManager(); 0044 0045 static KisWindowLayoutManager *instance(); 0046 0047 /** 0048 * When enabled, a workspace dedicated as primary is used for any main window which receives focus. 0049 * Meanwhile, the workspace of that window is used for the window which originally had the primary workspace. 0050 */ 0051 bool primaryWorkspaceFollowsFocus() const; 0052 void setPrimaryWorkspaceFollowsFocus(bool enabled, QUuid primaryWindow); 0053 QUuid primaryWindowId() const; 0054 0055 /** 0056 * When enabled, main windows will synchronize to keep the same document active 0057 */ 0058 bool isShowImageInAllWindowsEnabled() const; 0059 void setShowImageInAllWindowsEnabled(bool showInAll); 0060 0061 void activeDocumentChanged(KisDocument *document); 0062 0063 void setLastUsedLayout(KisWindowLayoutResource *layout); 0064 0065 private Q_SLOTS: 0066 void slotFocusChanged(QWidget*, QWidget*); 0067 void slotScreensChanged(); 0068 0069 private: 0070 struct Private; 0071 QScopedPointer<Private> d; 0072 }; 0073 0074 #endif