Krita Source Code Documentation
Loading...
Searching...
No Matches
Notifier Class Reference

#include <Notifier.h>

+ Inheritance diagram for Notifier:

Classes

struct  Private
 

Signals

void applicationClosing ()
 applicationClosing is emitted when the application is about to close. This happens after any documents and windows are closed.
 
void configurationChanged ()
 configurationChanged is emitted every time Krita's configuration has changed.
 
void imageClosed (const QString &filename)
 imageClosed is emitted whenever the last view on an image is closed. The image does not exist anymore in Krita
 
void imageCreated (Document *image)
 imageCreated is emitted whenever a new image is created and registered with the application.
 
void imageSaved (const QString &filename)
 imageSaved is emitted whenever a document is saved.
 
void viewClosed (View *view)
 viewClosed is emitted whenever a view is closed
 
void viewCreated (View *view)
 viewCreated is emitted whenever a new view is created.
 
void windowCreated ()
 windowIsCreated is emitted after main window is completely created
 
void windowIsBeingCreated (Window *window)
 windowCreated is emitted whenever a window is being created
 

Public Member Functions

bool active () const
 
 Notifier (QObject *parent=0)
 
void setActive (bool value)
 
 ~Notifier () override
 

Properties

bool Active
 

Private Slots

void imageCreated (KisDocument *document)
 
void viewClosed (KisView *view)
 
void viewCreated (KisView *view)
 
void windowIsBeingCreated (KisMainWindow *window)
 

Private Attributes

Private *const d
 

Detailed Description

The Notifier can be used to be informed of state changes in the Krita application.

Definition at line 22 of file Notifier.h.

Constructor & Destructor Documentation

◆ Notifier()

Notifier::Notifier ( QObject * parent = 0)
explicit

Definition at line 19 of file Notifier.cpp.

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}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
static KisConfigNotifier * instance()
Main window for Krita.
static KisPart * instance()
Definition KisPart.cpp:131
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
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
void imageClosed(const QString &filename)
imageClosed is emitted whenever the last view on an image is closed. The image does not exist anymore...
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

References applicationClosing(), configurationChanged(), connect(), imageClosed(), imageCreated(), imageSaved(), KisConfigNotifier::instance(), KisPart::instance(), viewClosed(), viewCreated(), windowCreated(), and windowIsBeingCreated().

◆ ~Notifier()

Notifier::~Notifier ( )
override

Definition at line 42 of file Notifier.cpp.

43{
44 delete d;
45}

References d.

Member Function Documentation

◆ active()

bool Notifier::active ( ) const
Returns
true if the Notifier is active.

Definition at line 47 of file Notifier.cpp.

48{
49 return d->active;
50}

References Notifier::Private::active, and d.

◆ applicationClosing

void Notifier::applicationClosing ( )
signal

applicationClosing is emitted when the application is about to close. This happens after any documents and windows are closed.

◆ configurationChanged

void Notifier::configurationChanged ( )
signal

configurationChanged is emitted every time Krita's configuration has changed.

◆ imageClosed

void Notifier::imageClosed ( const QString & filename)
signal

imageClosed is emitted whenever the last view on an image is closed. The image does not exist anymore in Krita

Parameters
filenamethe filename of the image.

◆ imageCreated [1/2]

void Notifier::imageCreated ( Document * image)
signal

imageCreated is emitted whenever a new image is created and registered with the application.

◆ imageCreated [2/2]

void Notifier::imageCreated ( KisDocument * document)
privateslot

Definition at line 58 of file Notifier.cpp.

59{
60 Document *doc = new Document(document, false);
61 Q_EMIT imageCreated(doc);
62 delete doc;
63}

References imageCreated().

◆ imageSaved

void Notifier::imageSaved ( const QString & filename)
signal

imageSaved is emitted whenever a document is saved.

Parameters
filenamethe filename of the document that has been saved.

◆ setActive()

void Notifier::setActive ( bool value)

Enable or disable the Notifier

Definition at line 52 of file Notifier.cpp.

53{
54 d->active = value;
55 blockSignals(!value);
56}
float value(const T *src, size_t ch)

References Notifier::Private::active, d, and value().

◆ viewClosed [1/2]

void Notifier::viewClosed ( KisView * view)
privateslot

Definition at line 72 of file Notifier.cpp.

73{
74 View *v = new View(view);
75 Q_EMIT viewClosed(v);
76 delete v;
77}
qreal v
Definition View.h:25

References v, and viewClosed().

◆ viewClosed [2/2]

void Notifier::viewClosed ( View * view)
signal

viewClosed is emitted whenever a view is closed

Parameters
viewthe view

◆ viewCreated [1/2]

void Notifier::viewCreated ( KisView * view)
privateslot

Definition at line 65 of file Notifier.cpp.

66{
67 View *v = new View(view);
68 Q_EMIT viewCreated(v);
69 delete v;
70}

References v, and viewCreated().

◆ viewCreated [2/2]

void Notifier::viewCreated ( View * view)
signal

viewCreated is emitted whenever a new view is created.

Parameters
viewthe view

◆ windowCreated

void Notifier::windowCreated ( )
signal

windowIsCreated is emitted after main window is completely created

◆ windowIsBeingCreated [1/2]

void Notifier::windowIsBeingCreated ( KisMainWindow * window)
privateslot

Definition at line 79 of file Notifier.cpp.

80{
81 Window *w = new Window(window);
82 Q_EMIT windowIsBeingCreated(w);
83 delete w;
84}

References windowIsBeingCreated().

◆ windowIsBeingCreated [2/2]

void Notifier::windowIsBeingCreated ( Window * window)
signal

windowCreated is emitted whenever a window is being created

Parameters
windowthe window; this is called from the constructor of the window, before the xmlgui file is loaded

Member Data Documentation

◆ d

Private* const Notifier::d
private

Definition at line 111 of file Notifier.h.

Property Documentation

◆ Active

bool Notifier::Active
readwrite

Definition at line 27 of file Notifier.h.


The documentation for this class was generated from the following files: