Krita Source Code Documentation
Loading...
Searching...
No Matches
Notifier.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "Notifier.h"
7#include <KisApplication.h>
8#include <KisPart.h>
10#include "View.h"
11#include "Window.h"
12#include "Document.h"
13
16 bool active {true};
17};
18
19Notifier::Notifier(QObject *parent)
20 : QObject(parent)
21 , d(new Private)
22{
23 connect(qApp, SIGNAL(aboutToQuit()), SIGNAL(applicationClosing()));
24
25 connect(KisPart::instance(), SIGNAL(sigDocumentAdded(KisDocument*)), SLOT(imageCreated(KisDocument*)));
26 connect(KisPart::instance(), SIGNAL(sigDocumentSaved(QString)), SIGNAL(imageSaved(QString)));
27 connect(KisPart::instance(), SIGNAL(sigDocumentRemoved(QString)), SIGNAL(imageClosed(QString)));
28
29 connect(KisPart::instance(), SIGNAL(sigViewAdded(KisView*)), SLOT(viewCreated(KisView*)));
30 connect(KisPart::instance(), SIGNAL(sigViewRemoved(KisView*)), SLOT(viewClosed(KisView*)));
31
32 connect(KisPart::instance(), SIGNAL(sigMainWindowIsBeingCreated(KisMainWindow*)), SLOT(windowIsBeingCreated(KisMainWindow*)));
33
34 connect(KisPart::instance(), SIGNAL(sigMainWindowCreated()), SIGNAL(windowCreated()));
35
36 connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SIGNAL(configurationChanged()));
37
38 blockSignals(false);
39}
40
41
43{
44 delete d;
45}
46
47bool Notifier::active() const
48{
49 return d->active;
50}
51
53{
54 d->active = value;
55 blockSignals(!value);
56}
57
59{
60 Document *doc = new Document(document, false);
61 Q_EMIT imageCreated(doc);
62 delete doc;
63}
64
66{
67 View *v = new View(view);
68 Q_EMIT viewCreated(v);
69 delete v;
70}
71
73{
74 View *v = new View(view);
75 Q_EMIT viewClosed(v);
76 delete v;
77}
78
80{
81 Window *w = new Window(window);
82 Q_EMIT windowIsBeingCreated(w);
83 delete w;
84}
85
float value(const T *src, size_t ch)
qreal v
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
static KisConfigNotifier * instance()
Main window for Krita.
static KisPart * instance()
Definition KisPart.cpp:131
bool active() const
Definition Notifier.cpp:47
void applicationClosing()
applicationClosing is emitted when the application is about to close. This happens after any document...
void viewCreated(View *view)
viewCreated is emitted whenever a new view is created.
Private *const d
Definition Notifier.h:111
~Notifier() override
Definition Notifier.cpp:42
void configurationChanged()
configurationChanged is emitted every time Krita's configuration has changed.
void imageCreated(Document *image)
imageCreated is emitted whenever a new image is created and registered with the application.
void windowCreated()
windowIsCreated is emitted after main window is completely created
void viewClosed(View *view)
viewClosed is emitted whenever a view is closed
Notifier(QObject *parent=0)
Definition Notifier.cpp:19
void imageClosed(const QString &filename)
imageClosed is emitted whenever the last view on an image is closed. The image does not exist anymore...
void setActive(bool value)
Definition Notifier.cpp:52
void imageSaved(const QString &filename)
imageSaved is emitted whenever a document is saved.
void windowIsBeingCreated(Window *window)
windowCreated is emitted whenever a window is being created
Definition View.h:25