|
Krita Source Code Documentation
|
#include <KisPart.h>
Inheritance diagram for KisPart:Public Slots | |
| void | openExistingFile (const QString &path) |
| void | openTemplate (const QUrl &url) |
| void | startCustomDocument (KisDocument *doc) |
| startCustomDocument adds the given document to the document list and deletes the sender() | |
Signals | |
| void | documentClosed (const QString &ref) |
| void | documentOpened (const QString &ref) |
| void | playbackEngineChanged (KisPlaybackEngine *newPlaybackEngine) |
| void | sigDocumentAdded (KisDocument *document) |
| void | sigDocumentRemoved (const QString &filename) |
| void | sigDocumentSaved (const QString &url) |
| void | sigMainWindowCreated () |
| void | sigMainWindowIsBeingCreated (KisMainWindow *window) |
| void | sigViewAdded (KisView *view) |
| void | sigViewRemoved (KisView *view) |
Static Public Member Functions | |
| static bool | exists () |
| static KisPart * | instance () |
Public Attributes | |
| KisAnimationCachePopulator | animationCachePopulator |
| bool | closingSession {false} |
| KisSessionResourceSP | currentSession |
| QList< QPointer< KisDocument > > | documents |
| KisIdleWatcher | idleWatcher |
| QList< QPointer< KisMainWindow > > | mainWindows |
| KisPart * | part |
| QMap< QUrl, QUrl > | pendingAddRecentUrlMap |
| std::unique_ptr< KisPlaybackEngine > | playbackEngine |
| QPointer< KisSessionManagerDialog > | sessionManager |
| QList< QPointer< KisView > > | views |
Private Slots | |
| void | slotDocumentSaved (const QString &filePath) |
| void | updateIdleWatcherConnections () |
| void | updateShortcuts () |
Private Member Functions | |
| void | setPlaybackEngine (KisPlaybackEngine *p_playbackEngine) |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
KisPart a singleton class which provides the main entry point to the application. Krita supports multiple documents, multiple main windows, and multiple components. KisPart manages these resources and provides them to the rest of Krita. It manages lists of Actions and shortcuts as well.
The terminology comes from KParts, which is a system allowing one KDE app to be run from inside another, like pressing F4 inside dolphin to run konsole.
Needless to say, KisPart hasn't got much to do with KParts anymore.
Definition at line 89 of file KisPart.cpp.
|
inline |
Definition at line 100 of file KisPart.cpp.
|
explicit |
Constructor.
| parent | may be another KisDocument, or anything else. Usually passed by KPluginFactory::create. |
Definition at line 147 of file KisPart.cpp.
References d, documentClosed(), documentOpened(), KisMemoryStatisticsServer::instance(), KisBusyWaitBroker::instance(), KisResourceServerProvider::instance(), KoResourceServerProvider::instance(), KisActionRegistry::instance(), KisBusyWaitBroker::setFeedbackCallback(), setPlaybackEngine(), updateIdleWatcherConnections(), and updateShortcuts().
|
override |
Destructor.
The destructor does not delete any attached KisView objects and it does not delete the attached widget as returned by widget().
Definition at line 175 of file KisPart.cpp.
References d.
| void KisPart::addDocument | ( | KisDocument * | document, |
| bool | notify = true ) |
Add the specified document to the list of documents this KisPart manages.
Definition at line 210 of file KisPart.cpp.
References d, documentOpened(), sigDocumentAdded(), and slotDocumentSaved().
| void KisPart::addRecentURLToAllMainWindows | ( | QUrl | url, |
| QUrl | oldUrl = QUrl() ) |
Definition at line 573 of file KisPart.cpp.
References KisRecentFilesManager::add(), KoResourcePaths::findDirs(), KisRecentFilesManager::instance(), KritaUtils::isSubPath(), and KisRecentFilesManager::remove().
Adds a view to the document. If the part doesn't know yet about the document, it is registered.
This calls KisView::updateReadWrite to tell the new view whether the document is readonly or not.
Definition at line 307 of file KisPart.cpp.
References d, and sigViewAdded().
| KisAnimationCachePopulator * KisPart::cachePopulator | ( | ) | const |
Definition at line 495 of file KisPart.cpp.
References d.
| bool KisPart::closeSession | ( | bool | keepWindows = false | ) |
Attempts to save the session and close all windows. This may involve asking the user to save open files.
Definition at line 381 of file KisPart.cpp.
References d, KisConfig::saveSessionOnQuit(), ResourceType::Sessions, and KisResourceModel::updateResource().
| bool KisPart::closingSession | ( | ) | const |
Are we in the process of closing the application through closeSession().
| KisDocument * KisPart::createDocument | ( | ) | const |
create an empty document. The document is not automatically registered with the part.
Definition at line 229 of file KisPart.cpp.
| KisMainWindow * KisPart::createMainWindow | ( | QUuid | id = QUuid() | ) |
Create a new main window.
Definition at line 259 of file KisPart.cpp.
References d, dbgUI, and KisMainWindow::synchronizeDynamicActions().
| KisDocument * KisPart::createTemporaryDocument | ( | ) | const |
create a throwaway empty document. The document does not register a resource storage
Definition at line 235 of file KisPart.cpp.
| KisView * KisPart::createView | ( | KisDocument * | document, |
| KisViewManager * | viewManager, | ||
| QWidget * | parent ) |
Create a new view for the document. The view is added to the list of views, and if the document wasn't known yet, it's registered as well.
Definition at line 276 of file KisPart.cpp.
References addView(), KisConfig::canvasState(), and KisConfig::disableOpenGL().
| KisInputManager * KisPart::currentInputManager | ( | ) |
Definition at line 618 of file KisPart.cpp.
References currentMainwindow(), KisViewManager::inputManager(), and KisMainWindow::viewManager.
| KisMainWindow * KisPart::currentMainwindow | ( | ) | const |
Definition at line 458 of file KisPart.cpp.
References mainWindows.
| QWidget * KisPart::currentMainwindowAsQWidget | ( | ) | const |
Gets the currently active KisMainWindow as a QWidget, useful when you just need it to be used as a parent to a dialog or window without needing to include KisMainWindow.h.
Definition at line 474 of file KisPart.cpp.
References currentMainwindow().
|
signal |
emitted when an old document is closed. (for the idle watcher)
| int KisPart::documentCount | ( | ) | const |
Definition at line 242 of file KisPart.cpp.
References d.
|
signal |
emitted when a new document is opened. (for the idle watcher)
| QList< QPointer< KisDocument > > KisPart::documents | ( | ) | const |
|
static |
This function returns true if the instance has already been initialized, false otherwise. This to prevent premature initialization that causes crash on android see 1fbb25506a
Definition at line 376 of file KisPart.cpp.
| KisIdleWatcher * KisPart::idleWatcher | ( | ) | const |
|
static |
Definition at line 131 of file KisPart.cpp.
| int KisPart::mainwindowCount | ( | ) | const |
Definition at line 452 of file KisPart.cpp.
References d.
| const QList< QPointer< KisMainWindow > > & KisPart::mainWindows | ( | ) | const |
| void KisPart::notifyMainWindowIsBeingCreated | ( | KisMainWindow * | mainWindow | ) |
notifyMainWindowIsBeingCreated emits the sigMainWindowCreated signal
| mainWindow |
Definition at line 270 of file KisPart.cpp.
References sigMainWindowIsBeingCreated().
|
slot |
This slot loads an existing file.
| path | the file to load |
Definition at line 512 of file KisPart.cpp.
References currentMainwindow(), KIS_SAFE_ASSERT_RECOVER_RETURN, KisMainWindow::None, and KisMainWindow::openDocument().
|
slot |
This slot loads a template and deletes the sender.
| url | the template to load |
Definition at line 533 of file KisPart.cpp.
References addDocument(), KisMainWindow::addViewAndNotifyLoadingCompleted(), createDocument(), currentMainwindow(), KisMimeDatabase::mimeTypeForFile(), and v.
| class KisPlaybackEngine * KisPart::playbackEngine | ( | ) | const |
|
signal |
Emitted when the animation PlaybackEngine is changed. GUI objects that want to control playback should watch this signal and connect to the new playbackEgine as needed.
| void KisPart::prioritizeFrameForCache | ( | KisImageSP | image, |
| int | frame ) |
Adds a frame time index to a priority stack, which should be cached immediately and irregardless of whether it is the the currently occupied frame. The process of regeneration is started immediately.
Definition at line 505 of file KisPart.cpp.
References KisImage::animationInterface(), KisTimeSpan::contains(), d, and KisImageAnimationInterface::documentPlaybackRange().
|
inline |
Definition at line 92 of file KisPart.cpp.
|
inline |
Definition at line 119 of file KisPart.cpp.
| void KisPart::queueAddRecentURLToAllMainWindowsOnFileSaved | ( | QUrl | url, |
| QUrl | oldUrl = QUrl() ) |
Registers a file path to be added to the recents list, but do not apply until the file has finished saving.
Definition at line 605 of file KisPart.cpp.
References d.
| void KisPart::removeDocument | ( | KisDocument * | document, |
| bool | deleteDocument = true ) |
Definition at line 247 of file KisPart.cpp.
References d, documentClosed(), and sigDocumentRemoved().
| void KisPart::removeMainWindow | ( | KisMainWindow * | mainWindow | ) |
Removes a main window from the list of managed windows.
This is called by the MainWindow after it finishes its shutdown routine.
Definition at line 439 of file KisPart.cpp.
Removes a view of the document.
HACK ALERT: we check here explicitly if the document (or main window), is saving the stuff. If we close the document before the saving is completed, a crash will happen.
Definition at line 319 of file KisPart.cpp.
References d, KisView::document, KisMainWindow::hackIsSaving(), KIS_ASSERT_RECOVER_RETURN, KisView::mainWindow(), removeDocument(), and sigViewRemoved().
| bool KisPart::restoreSession | ( | const QString & | sessionName | ) |
Restores a saved session by name
Definition at line 644 of file KisPart.cpp.
References KisResourceServerProvider::instance(), KoResourceServer< T >::resource(), restoreSession(), and KisResourceServerProvider::sessionServer().
| bool KisPart::restoreSession | ( | KisSessionResourceSP | session | ) |
Definition at line 655 of file KisPart.cpp.
References d.
| void KisPart::setCurrentSession | ( | KisSessionResourceSP | session | ) |
Definition at line 662 of file KisPart.cpp.
References d.
|
private |
Definition at line 695 of file KisPart.cpp.
References d, KisUsageLogger::log(), and playbackEngineChanged().
| void KisPart::showSessionManager | ( | ) |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
privateslot |
Definition at line 422 of file KisPart.cpp.
References addRecentURLToAllMainWindows(), d, KisRecentFileIconCache::instance(), KisRecentFileIconCache::reloadFileIcon(), and sigDocumentSaved().
| void KisPart::startBlankSession | ( | ) |
Definition at line 636 of file KisPart.cpp.
References createMainWindow(), and KisMainWindow::initializeGeometry().
|
slot |
startCustomDocument adds the given document to the document list and deletes the sender()
| doc |
Definition at line 610 of file KisPart.cpp.
References addDocument(), KisMainWindow::addViewAndNotifyLoadingCompleted(), and currentMainwindow().
| void KisPart::unloadPlaybackEngine | ( | ) |
Called on application to make sure that the engine is unloaded before the MLT library is actually unloaded
Definition at line 686 of file KisPart.cpp.
References d.
|
privateslot |
Update memory stats on changing the amount of images open in Krita
Definition at line 192 of file KisPart.cpp.
|
privateslot |
Definition at line 522 of file KisPart.cpp.
References KisKXMLGUIClient::actionCollection(), d, and KisKActionCollection::updateShortcuts().
| void KisPart::upgradeToPlaybackEngineMLT | ( | class KoCanvasBase * | canvas | ) |
Definition at line 667 of file KisPart.cpp.
References Private::canvas, d, and setPlaybackEngine().
| int KisPart::viewCount | ( | KisDocument * | doc | ) | const |
Definition at line 355 of file KisPart.cpp.
References d.
| KisMainWindow * KisPart::windowById | ( | QUuid | id | ) | const |
Definition at line 479 of file KisPart.cpp.
References d.
| KisAnimationCachePopulator KisPart::animationCachePopulator |
Definition at line 110 of file KisPart.cpp.
| bool KisPart::closingSession {false} |
Definition at line 114 of file KisPart.cpp.
| KisSessionResourceSP KisPart::currentSession |
Definition at line 113 of file KisPart.cpp.
| QList< QPointer< KisDocument > > KisPart::documents |
Definition at line 108 of file KisPart.cpp.
| KisIdleWatcher * KisPart::idleWatcher |
Definition at line 109 of file KisPart.cpp.
| const QList< QPointer< KisMainWindow > > & KisPart::mainWindows |
Definition at line 107 of file KisPart.cpp.
| KisPart* KisPart::part |
Definition at line 104 of file KisPart.cpp.
| QMap<QUrl, QUrl> KisPart::pendingAddRecentUrlMap |
Definition at line 117 of file KisPart.cpp.
| KisPlaybackEngine * KisPart::playbackEngine |
Definition at line 111 of file KisPart.cpp.
| QPointer<KisSessionManagerDialog> KisPart::sessionManager |
Definition at line 115 of file KisPart.cpp.
Definition at line 106 of file KisPart.cpp.