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

#include <kmainwindow_p.h>

+ Inheritance diagram for KisKMainWindowPrivate:

Public Types

enum  CallCompression { NoCompressCalls = 0 , CompressCalls }
 

Public Member Functions

void _k_slotSaveAutoSaveSize ()
 
void _k_slotSettingsChanged (int category)
 
void init (KisKMainWindow *_q)
 
void polish (KisKMainWindow *q)
 
void setSettingsDirty (CallCompression callCompression=CompressCalls)
 
void setSizeDirty ()
 
virtual ~KisKMainWindowPrivate ()=default
 

Public Attributes

KConfigGroup autoSaveGroup
 
bool autoSaveSettings: 1
 
bool autoSaveWindowSize: 1
 
QString dbusName
 
QRect defaultWindowSize
 
QPointer< QObject > dockResizeListener
 
KisKHelpMenuhelpMenu
 
bool letDirtySettings
 
QEventLoopLocker locker
 
KisKMainWindowq
 
bool settingsDirty: 1
 
QTimer * settingsTimer
 
bool sizeApplied: 1
 
QTimer * sizeTimer
 

Detailed Description

Definition at line 31 of file kmainwindow_p.h.

Member Enumeration Documentation

◆ CallCompression

Enumerator
NoCompressCalls 
CompressCalls 

Definition at line 58 of file kmainwindow_p.h.

Constructor & Destructor Documentation

◆ ~KisKMainWindowPrivate()

virtual KisKMainWindowPrivate::~KisKMainWindowPrivate ( )
virtualdefault

Member Function Documentation

◆ _k_slotSaveAutoSaveSize()

void KisKMainWindowPrivate::_k_slotSaveAutoSaveSize ( )

Definition at line 792 of file kmainwindow.cpp.

793{
794 if (autoSaveGroup.isValid()) {
795 KWindowConfig::saveWindowSize(q->windowHandle(), autoSaveGroup);
796 }
797}
KisKMainWindow * q
KConfigGroup autoSaveGroup

References autoSaveGroup, and q.

◆ _k_slotSettingsChanged()

void KisKMainWindowPrivate::_k_slotSettingsChanged ( int category)

Definition at line 779 of file kmainwindow.cpp.

780{
781 Q_UNUSED(category);
782
783 // This slot will be called when the style KCM changes settings that need
784 // to be set on the already running applications.
785
786 // At this level (KisKMainWindow) the only thing we need to restore is the
787 // animations setting (whether the user wants builtin animations or not).
788
789 q->setAnimated(q->style()->styleHint(QStyle::SH_Widget_Animate, 0, q));
790}

References q.

◆ init()

void KisKMainWindowPrivate::init ( KisKMainWindow * _q)

Definition at line 171 of file kmainwindow.cpp.

172{
173 q = _q;
174
175 q->setAnimated(q->style()->styleHint(QStyle::SH_Widget_Animate, 0, q));
176
177 q->setAttribute(Qt::WA_DeleteOnClose);
178
179 helpMenu = 0;
180
181 //actionCollection()->setWidget( this );
182#ifdef HAVE_GLOBALACCEL
183 QObject::connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)),
184 q, SLOT(_k_slotSettingsChanged(int)));
185#endif
186
187 // force KMWSessionManager creation
188 ksm();
189
190 sMemberList()->append(q);
191
192 settingsDirty = false;
193 autoSaveSettings = false;
194 autoSaveWindowSize = true; // for compatibility
195 //d->kaccel = actionCollection()->kaccel();
196 settingsTimer = 0;
197 sizeTimer = 0;
198
200 letDirtySettings = true;
201
202 sizeApplied = false;
203}
KisKHelpMenu * helpMenu
QPointer< QObject > dockResizeListener
void _k_slotSettingsChanged(int category)

References _k_slotSettingsChanged(), autoSaveSettings, autoSaveWindowSize, dockResizeListener, helpMenu, letDirtySettings, q, settingsDirty, settingsTimer, sizeApplied, and sizeTimer.

◆ polish()

void KisKMainWindowPrivate::polish ( KisKMainWindow * q)

Definition at line 229 of file kmainwindow.cpp.

230{
231 // Set a unique object name. Required by session management, window management, and for the dbus interface.
232 QString objname;
233 QString s;
234 int unusedNumber = 1;
235 const QString name = q->objectName();
236 bool startNumberingImmediately = true;
237 bool tryReuse = false;
238 if (name.isEmpty()) {
239 // no name given
240 objname = QStringLiteral("MainWindow#");
241 } else if (name.endsWith(QLatin1Char('#'))) {
242 // trailing # - always add a number - KWin uses this for better grouping
243 objname = name;
244 } else if (endsWithHashNumber(name)) {
245 // trailing # with a number - like above, try to use the given number first
246 objname = name;
247 tryReuse = true;
248 startNumberingImmediately = false;
249 } else {
250 objname = name;
251 startNumberingImmediately = false;
252 }
253
254 s = objname;
255 if (startNumberingImmediately) {
256 s += QLatin1Char('1');
257 }
258
259 for (;;) {
260 const QList<QWidget *> list = qApp->topLevelWidgets();
261 bool found = false;
262 foreach (QWidget *w, list) {
263 if (w != q && w->objectName() == s) {
264 found = true;
265 break;
266 }
267 }
268 if (!found) {
269 break;
270 }
271 if (tryReuse) {
272 objname = name.left(name.length() - 1); // lose the hash
273 unusedNumber = 0; // start from 1 below
274 tryReuse = false;
275 }
276 s.setNum(++unusedNumber);
277 s = objname + s;
278 }
279 q->setObjectName(s);
280 q->winId(); // workaround for setWindowRole() crashing, and set also window role, just in case TT
281 q->setWindowRole(s); // will keep insisting that object name suddenly should not be used for window role
282
283#ifdef HAVE_DBUS
284 dbusName = QLatin1Char('/') + QCoreApplication::applicationName() + QLatin1Char('/');
285 dbusName += q->objectName().replace(QLatin1Char('/'), QLatin1Char('_'));
286 // Clean up for dbus usage: any non-alphanumeric char should be turned into '_'
287 const int len = dbusName.length();
288 for (int i = 0; i < len; ++i) {
289 if (!isValidDBusObjectPathCharacter(dbusName[i])) {
290 dbusName[i] = QLatin1Char('_');
291 }
292 }
293
294 QDBusConnection::sessionBus().registerObject(dbusName, q, QDBusConnection::ExportScriptableSlots |
295 QDBusConnection::ExportScriptableProperties |
296 QDBusConnection::ExportNonScriptableSlots |
297 QDBusConnection::ExportNonScriptableProperties |
298 QDBusConnection::ExportAdaptors);
299#endif
300}
static bool endsWithHashNumber(const QString &s)
const char * name(StandardAction id)

References dbusName, endsWithHashNumber(), and q.

◆ setSettingsDirty()

void KisKMainWindowPrivate::setSettingsDirty ( CallCompression callCompression = CompressCalls)

Definition at line 302 of file kmainwindow.cpp.

303{
304 if (!letDirtySettings) {
305 return;
306 }
307
308 settingsDirty = true;
309 if (autoSaveSettings) {
310 if (callCompression == CompressCalls) {
311 if (!settingsTimer) {
312 settingsTimer = new QTimer(q);
313 settingsTimer->setInterval(500);
314 settingsTimer->setSingleShot(true);
315 QObject::connect(settingsTimer, SIGNAL(timeout()), q, SLOT(saveAutoSaveSettings()));
316 }
317 settingsTimer->start();
318 } else {
320 }
321 }
322}
void saveAutoSaveSettings()

References autoSaveSettings, CompressCalls, letDirtySettings, q, KisKMainWindow::saveAutoSaveSettings(), settingsDirty, and settingsTimer.

◆ setSizeDirty()

void KisKMainWindowPrivate::setSizeDirty ( )

Definition at line 324 of file kmainwindow.cpp.

325{
326 if (autoSaveWindowSize) {
327 if (!sizeTimer) {
328 sizeTimer = new QTimer(q);
329 sizeTimer->setInterval(500);
330 sizeTimer->setSingleShot(true);
331 QObject::connect(sizeTimer, SIGNAL(timeout()), q, SLOT(_k_slotSaveAutoSaveSize()));
332 }
333 sizeTimer->start();
334 }
335}

References _k_slotSaveAutoSaveSize(), autoSaveWindowSize, q, and sizeTimer.

Member Data Documentation

◆ autoSaveGroup

KConfigGroup KisKMainWindowPrivate::autoSaveGroup

Definition at line 40 of file kmainwindow_p.h.

◆ autoSaveSettings

bool KisKMainWindowPrivate::autoSaveSettings

Definition at line 36 of file kmainwindow_p.h.

◆ autoSaveWindowSize

bool KisKMainWindowPrivate::autoSaveWindowSize

Definition at line 38 of file kmainwindow_p.h.

◆ dbusName

QString KisKMainWindowPrivate::dbusName

Definition at line 47 of file kmainwindow_p.h.

◆ defaultWindowSize

QRect KisKMainWindowPrivate::defaultWindowSize

Definition at line 43 of file kmainwindow_p.h.

◆ dockResizeListener

QPointer<QObject> KisKMainWindowPrivate::dockResizeListener

Definition at line 46 of file kmainwindow_p.h.

◆ helpMenu

KisKHelpMenu* KisKMainWindowPrivate::helpMenu

Definition at line 44 of file kmainwindow_p.h.

◆ letDirtySettings

bool KisKMainWindowPrivate::letDirtySettings

Definition at line 48 of file kmainwindow_p.h.

◆ locker

QEventLoopLocker KisKMainWindowPrivate::locker

Definition at line 49 of file kmainwindow_p.h.

◆ q

KisKMainWindow* KisKMainWindowPrivate::q

Definition at line 45 of file kmainwindow_p.h.

◆ settingsDirty

bool KisKMainWindowPrivate::settingsDirty

Definition at line 37 of file kmainwindow_p.h.

◆ settingsTimer

QTimer* KisKMainWindowPrivate::settingsTimer

Definition at line 41 of file kmainwindow_p.h.

◆ sizeApplied

bool KisKMainWindowPrivate::sizeApplied

Definition at line 39 of file kmainwindow_p.h.

◆ sizeTimer

QTimer* KisKMainWindowPrivate::sizeTimer

Definition at line 42 of file kmainwindow_p.h.


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