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

Method loadAllAreas

kdevplatform/shell/uicontroller.cpp:676–747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

674}
675
676void UiController::loadAllAreas(const KSharedConfigPtr& config)
677{
678 Q_D(UiController);
679
680 KConfigGroup uiConfig(config, QStringLiteral("User Interface"));
681 int wc = uiConfig.readEntry("Main Windows Count", 1);
682
683 /* It is expected the main windows are restored before
684 restoring areas. */
685 if (wc > mainWindows().size())
686 wc = mainWindows().size();
687
688 /* Offer all tool views to the default areas. */
689 for (Sublime::Area* area : defaultAreas()) {
690 QHash<IToolViewFactory*, Sublime::ToolDocument*>::const_iterator i, e;
691 for (i = d->factoryDocuments.constBegin(),
692 e = d->factoryDocuments.constEnd(); i != e; ++i)
693 {
694 addToolViewIfWanted(i.key(), i.value(), area);
695 }
696 }
697
698 /* Restore per-windows areas. */
699 for (int w = 0; w < wc; ++w)
700 {
701 KConfigGroup mainWindowConfig(&uiConfig,
702 QStringLiteral("Main Window %1").arg(w));
703
704 Sublime::MainWindow *mw = mainWindows()[w];
705
706 /* We loop over default areas. This means that if
707 the config file has an area of some type that is not
708 in default set, we'd just ignore it. I think it's fine --
709 the model were a given mainwindow can has it's own
710 area types not represented in the default set is way
711 too complex. */
712 for (Sublime::Area* defaultArea : defaultAreas()) {
713 QString type = defaultArea->objectName();
714 Sublime::Area* area = this->area(w, type);
715
716 KConfigGroup areaConfig(&mainWindowConfig, QLatin1String("Area ") + type);
717
718 qCDebug(SHELL) << "Trying to restore area " << type;
719
720 /* This is just an easy check that a group exists, to
721 avoid "restoring" area from empty config group, wiping
722 away programmatically installed defaults. */
723 if (areaConfig.readEntry("id", "") == type)
724 {
725 qCDebug(SHELL) << "Restoring area " << type;
726 loadArea(area, areaConfig);
727 }
728
729 // At this point we know which tool views the area wants.
730 // Tender all tool views we have.
731 QHash<IToolViewFactory*, Sublime::ToolDocument*>::const_iterator i, e;
732 for (i = d->factoryDocuments.constBegin(),
733 e = d->factoryDocuments.constEnd(); i != e; ++i)

Callers 1

initializeMethod · 0.80

Calls 12

readEntryMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
QStringClass · 0.70
sizeMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45
areaMethod · 0.45
setWorkingSetMethod · 0.45
configMethod · 0.45
activeSessionMethod · 0.45

Tested by

no test coverage detected