Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMainWindow.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis@kde.org>
3 SPDX-FileCopyrightText: 2000-2004 David Faure <faure@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KIS_MAIN_WINDOW_H
9#define KIS_MAIN_WINDOW_H
10
11#include "kritaui_export.h"
12
13#include <QPointer>
14#include <QPrinter>
15#include <QUuid>
16#include <QUrl>
17
20#include <KoCanvasSupervisor.h>
21#include "KisView.h"
23#include <KoResource.h>
24
25class QCloseEvent;
26class QMoveEvent;
27
29
30class KisDocument;
32class QDockWidget;
33class KisView;
34class KisViewManager;
36
37
46class KRITAUI_EXPORT KisMainWindow : public KXmlGuiWindow, public KoCanvasSupervisor
47{
48 Q_OBJECT
49
50public:
51 enum OpenFlag {
52 None = 0,
53 Import = 0x1,
54 BatchMode = 0x2,
55 RecoveryFile = 0x4
56 };
57 Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
58
59public:
60
64 explicit KisMainWindow(QUuid id = QUuid());
65
69 ~KisMainWindow() override;
70
71 QMenu *createPopupMenu() override;
72
73
74 QUuid id() const;
75
80 virtual void showView(KisView *view, QMdiSubWindow *subWindow = 0);
81
86
93 bool openDocument(const QString &path, OpenFlags flags);
94
98 void showDocument(KisDocument *document);
99
100
109 void showWelcomeScreen(bool show);
110
121 bool saveDocument(KisDocument *document, bool saveas, bool isExporting, bool isAdvancedExporting = false);
122
124 QList<QDockWidget*> dockWidgets() const;
125
126 QDockWidget* dockWidget(const QString &id);
127
129
130 KoCanvasResourceProvider *resourceManager() const;
131
132 int viewCount() const;
133
134 void saveWindowState(bool restoreNormalState =false);
135
136 const KConfigGroup &windowStateConfig() const;
137
143 bool restoreWorkspace(KoResourceSP res);
144 bool restoreWorkspaceState(const QByteArray &state);
145
146 static void swapWorkspaces(KisMainWindow *a, KisMainWindow *b);
147
149
150 KisView *addViewAndNotifyLoadingCompleted(KisDocument *document,
151 QMdiSubWindow *subWindow = 0);
152
153 QStringList showOpenFileDialog(bool isImporting);
154
158 QWidget *canvasWindow() const;
159 bool canvasDetached() const;
160
170 bool hackIsSaving() const;
171
173 bool installBundle(const QString &fileName) const;
174
179 QImage layoutThumbnail();
180
181Q_SIGNALS:
182
187
193
196
199
202
204
207
208#ifdef Q_OS_ANDROID
209 void sigFullscreenOnShow(bool fullScreen);
210#endif
211
212public Q_SLOTS:
213
214
218 void clearRecentFiles();
219
223 void removeRecentFile(QString url);
224
225
232 void slotFileNew();
233
240 void slotFileOpen(bool isImporting = false);
241
248 void slotFileOpenRecent(const QUrl &);
249
253 void slotPreferences();
254
258 void slotFileSave();
259
260
261 void slotShowSessionManager();
262
266 void newOptionWidgets(KoCanvasController *controller, const QList<QPointer<QWidget> > & optionWidgetList);
267
268 KisView *newView(QObject *document, QMdiSubWindow *subWindow = 0);
269
270 void notifyChildViewDestroyed(KisView *view);
271
273 void setActiveView(KisView *view);
274 void unsetActiveView();
275
276 void subWindowActivated();
277
278 void windowFocused();
279
283 void setCanvasDetached(bool detached);
284
288 void viewFullscreen(bool fullScreen);
289
294 bool checkActiveBundlesAvailable();
295 bool checkPaintOpAvailable();
296
297
298private Q_SLOTS:
299 void slotLoadCompleted();
300 void slotLoadCanceled(const QString &);
301 void slotSaveCompleted();
302 void slotSaveCanceled(const QString &);
303 void forceDockTabFonts();
304
305 void slotUpdateWidgetStyle();
306
307 void slotUpdateSaveActionTitle(const QString &documentPath);
308 void slotUpdateReadWriteMode(bool readWrite);
309
313 void slotFileSaveAs();
314
316
318
320
322
326 void slotDocumentInfo();
327
331 bool slotFileCloseAll();
332
336 virtual void showAboutApplication();
337
341 void slotFileQuit();
342
346 void slotConfigureToolbars();
347
352 void slotNewToolbarConfig();
353
357 void slotResetConfigurations();
358
362 void slotToolbarToggled(bool toggle);
363
367 void showDockerTitleBars(bool show);
368
374 void slotImportFile();
375
381 void slotExportFile();
382
383 void slotExportAdvance();
384
388 void toggleDockersVisibility(bool visible, bool onWelcomePage = false);
389
393 void updateTheme();
394 void slotThemeChanged();
395
396 void undo();
397 void redo();
398 void updateWindowMenu();
399 void updateSubwindowFlags();
400 void setActiveSubWindow(QWidget *window);
401 void configChanged();
402
403 void newWindow();
404 void closeCurrentWindow();
405 void checkSanity();
406
408 void showErrorAndDie();
409
410 void initializeGeometry();
411 void showManual();
412 void switchTab(int index);
413
414 void slotXmlGuiMakingChanges(bool finished);
415
416 void orientationChanged();
417
418 void restoreWorkspace();
419
420 void openCommandBar();
421
422 void slotStoragesWarning(const QString &location = QString());
423
424protected:
425
426 void closeEvent(QCloseEvent * e) override;
427 void resizeEvent(QResizeEvent * e) override;
428 void showEvent(QShowEvent *event) override;
429
430 // QWidget overrides
431 void dragMoveEvent(QDragMoveEvent *event) override;
432 void dragLeaveEvent(QDragLeaveEvent *event) override;
433
434 bool windowsLayoutSavingAllowed() const override;
435
436private:
437
439 void dragMove(QDragMoveEvent *event);
440 void dragLeave();
441
442private:
443
449 void addView(KisView *view, QMdiSubWindow *subWindow = 0);
450
451 friend class KisPart;
452
453
460 QDockWidget* createDockWidget(KoDockFactoryBase* factory);
461
462 bool openDocumentInternal(const QString &path, KisMainWindow::OpenFlags f = KisMainWindow::OpenFlags());
463
464 void saveWindowSettings();
465
466 QPointer<KisView> activeKisView();
467
468 void createActions();
469
470 void applyToolBarLayout();
471
472 QByteArray borrowWorkspace(KisMainWindow *borrower);
473
474 void customizeTabBar();
475
476 void setMainWindowLayoutForCurrentMainWidget(int widgetIndex, bool widgetIndexChanged);
477 void adjustLayoutForWelcomePage();
478 void applyActionIconOverridesFromLocalXML();
479
480private:
481
487 QWidget *widget;
489 QString title;
491 QString icon;
492 };
493
494 class Private;
495 Private * const d;
496
499};
500
501Q_DECLARE_OPERATORS_FOR_FLAGS(KisMainWindow::OpenFlags)
502
503#endif
Q_DECLARE_FLAGS(KisUpdaterContextSnapshotEx, KisUpdaterContextSnapshotExTag)
KDE top level main window with predefined action layout
virtual bool windowsLayoutSavingAllowed() const
void closeEvent(QCloseEvent *) override
Main window for Krita.
void importAnimation()
void guiLoadingFinished()
const KConfigGroup & windowStateConfig() const
void themeChanged()
This signal is emitted when the color theme changes.
KisViewManager * viewManager() const
QWidget * canvasWindow() const
void newWindow()
void keyBindingsChanged()
This signal is emitted when the shortcut key configuration has changed.
void loadCompleted()
void renderAnimationAgain()
void importVideoAnimation()
QUuid id() const
Private *const d
void renderAnimation()
QString m_errorMessage
KisView * activeView() const
void documentSaved()
void restoringDone()
This signal is emitted right after the docker states have been successfully restored from config.
void activeViewChanged()
emitted when the current view has changed
A widget for displaying if no documents are open. This will display in the MDI area.
virtual QList< KoCanvasObserverBase * > canvasObservers() const =0
Q_DECLARE_OPERATORS_FOR_FLAGS(KisBaseRectsWalker::SubtreeVisitFlags)
QString icon
icon used in the sidebar. If left empty it will use the unknown icon
QString title
title used in the sidebar. If left empty it will be displayed as "Custom Document"
QWidget * widget
Pointer to the custom document widget.