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 void synchronizeDynamicActions();
298
299private Q_SLOTS:
300 void slotLoadCompleted();
301 void slotLoadCanceled(const QString &);
302 void slotSaveCompleted();
303 void slotSaveCanceled(const QString &);
304 void forceDockTabFonts();
305
306 void slotUpdateWidgetStyle();
307
308 void slotUpdateSaveActionTitle(const QString &documentPath);
309 void slotUpdateReadWriteMode(bool readWrite);
310
314 void slotFileSaveAs();
315
317
319
321
323
327 void slotDocumentInfo();
328
332 bool slotFileCloseAll();
333
337 virtual void showAboutApplication();
338
342 void slotFileQuit();
343
347 void slotConfigureToolbars();
348
353 void slotNewToolbarConfig();
354
358 void slotResetConfigurations();
359
363 void slotToolbarToggled(bool toggle);
364
368 void showDockerTitleBars(bool show);
369
375 void slotImportFile();
376
382 void slotExportFile();
383
384 void slotExportAdvance();
385
389 void toggleDockersVisibility(bool visible, bool onWelcomePage = false);
390
394 void updateTheme();
395 void slotThemeChanged();
396
397 void undo();
398 void redo();
399 void updateWindowMenu();
400 void updateSubwindowFlags();
401 void setActiveSubWindow(QWidget *window);
402 void configChanged();
403
404 void newWindow();
405 void closeCurrentWindow();
406 void checkSanity();
407
409 void showErrorAndDie();
410
411 void initializeGeometry();
412 void showManual();
413 void switchTab(int index);
414
415 void slotXmlGuiMakingChanges(bool finished);
416
417 void orientationChanged();
418
419 void restoreWorkspace();
420
421 void openCommandBar();
422
423 void slotStoragesWarning(const QString &location = QString());
424
425protected:
426
427 void closeEvent(QCloseEvent * e) override;
428 void resizeEvent(QResizeEvent * e) override;
429 void showEvent(QShowEvent *event) override;
430
431 // QWidget overrides
432 void dragMoveEvent(QDragMoveEvent *event) override;
433 void dragLeaveEvent(QDragLeaveEvent *event) override;
434
435 bool windowsLayoutSavingAllowed() const override;
436
437private:
438
440 void dragMove(QDragMoveEvent *event);
441 void dragLeave();
442
443private:
444
450 void addView(KisView *view, QMdiSubWindow *subWindow = 0);
451
452 friend class KisPart;
453
454
461 QDockWidget* createDockWidget(KoDockFactoryBase* factory);
462
463 bool openDocumentInternal(const QString &path, KisMainWindow::OpenFlags f = KisMainWindow::OpenFlags());
464
465 void saveWindowSettings();
466
467 QPointer<KisView> activeKisView();
468
469 void createActions();
470
471 void applyToolBarLayout();
472
473 QByteArray borrowWorkspace(KisMainWindow *borrower);
474
475 void customizeTabBar();
476
477 void setMainWindowLayoutForCurrentMainWidget(int widgetIndex, bool widgetIndexChanged);
478 void adjustLayoutForWelcomePage();
479 void applyActionIconOverridesFromLocalXML();
480
481private:
482
488 QWidget *widget;
490 QString title;
492 QString icon;
493 };
494
495 class Private;
496 Private * const d;
497
500};
501
502Q_DECLARE_OPERATORS_FOR_FLAGS(KisMainWindow::OpenFlags)
503
504#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.