MCPcopy Create free account
hub / github.com/KDE/kdevelop / saveSettings

Method saveSettings

kdevplatform/sublime/mainwindow.cpp:279–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void MainWindow::saveSettings()
280{
281 Q_D(MainWindow);
282
283 d->disableConcentrationMode();
284
285 KConfigGroup cg(KSharedConfig::openConfig(), configGroupName(d->area));
286
287 // When the current area changes, all shown dock widgets are visible at this point.
288 //
289 // On KDevelop exit, all non-floating dock widgets are always invisible at this point, because hiding
290 // the main window also hides its every child widget that is not a top-level widget (not a window).
291 // Such a desynchronization of visibility of non-floating dock widgets does not affect their visibility
292 // when the main window state is restored, that is, shown tool views remain shown after restarting KDevelop.
293 //
294 // Exiting KDevelop via the Quit action or via the terminating signal handler closes all
295 // top-level windows, including floating dock widgets. After the closing, all floating dock
296 // widgets also become invisible by this time. As a result, none of the floating dock widgets
297 // becomes visible (and consequently shown) when the main window state is restored. Detect this
298 // bug-producing situation here and make the shown floating dock widgets visible while calling
299 // saveMainWindowSettings(), which saves the main window state. This transient change of
300 // visibility does not cause flickering, because no event loop is entered in saveMainWindowSettings().
301
302 const auto shownButInvisibleFloatingDockWidgets = d->idealController->shownButInvisibleFloatingDockWidgets();
303
304 qCDebug(SUBLIME) << "saving settings for" << (d->area ? d->area->objectName() : QString())
305 << (shownButInvisibleFloatingDockWidgets.empty()
306 ? ""
307 : qUtf8Printable(QStringLiteral("(temporarily making %1 floating dock widget(s) visible)")
308 .arg(shownButInvisibleFloatingDockWidgets.size())));
309
310 for (auto* const dockWidget : shownButInvisibleFloatingDockWidgets) {
311 dockWidget->setVisible(true);
312 }
313 saveMainWindowSettings(cg);
314 for (auto* const dockWidget : shownButInvisibleFloatingDockWidgets) {
315 dockWidget->setVisible(false);
316 }
317
318 //debugToolBar visibility is stored separately to allow a area dependent default value
319 const auto toolBars = this->toolBars();
320 for (KToolBar* toolbar : toolBars) {
321 if (toolbar->objectName() == QLatin1String("debugToolBar")) {
322 cg.writeEntry("debugToolBarVisibility", toolbar->isVisibleTo(this));
323 }
324 }
325
326 d->idealController->saveButtonOrderSettings(cg);
327
328 cg.sync();
329}
330
331void MainWindow::loadSettings()
332{

Callers 2

testEnvironmentSetMethod · 0.45
applyMethod · 0.45

Calls 9

emptyMethod · 0.80
writeEntryMethod · 0.80
configGroupNameFunction · 0.70
QStringClass · 0.50
sizeMethod · 0.45
setVisibleMethod · 0.45

Tested by 1

testEnvironmentSetMethod · 0.36