| 346 | |
| 347 | |
| 348 | void MainWindow::initialize() |
| 349 | { |
| 350 | Q_D(MainWindow); |
| 351 | |
| 352 | KStandardAction::keyBindings(this, SLOT(configureShortcuts()), actionCollection()); |
| 353 | |
| 354 | // Do not pass the Save option to setupGUI(), because main window settings are loaded from and saved to |
| 355 | // different config groups depending on the current area. So KMainWindow::autoSaveGroup() would have to |
| 356 | // be changed accordingly each time another area is switched to. Also Sublime::MainWindow::saveSettings() |
| 357 | // and Sublime::MainWindow::loadSettings() do more than just call saveMainWindowSettings() and |
| 358 | // applyMainWindowSettings() respectively. applyMainWindowSettings() is virtual and can be overridden, but |
| 359 | // there is no way to customize behavior of the non-virtual function KMainWindow::saveMainWindowSettings(). |
| 360 | // Auto-saving also requires recovering from a possible last auto-save while in Concentration Mode - perhaps |
| 361 | // force-exit Concentration Mode even if it is off at the end of Sublime::MainWindow::loadSettings(). |
| 362 | // On KDevelop exit, UiController::cleanup() calls Sublime::MainWindow::saveSettings() for each main window. |
| 363 | // Therefore, auto-saving main window settings is useful only in case KDevelop crashes. Auto-saving correctly |
| 364 | // might be possible, but perhaps not worth the likely significant implementation complexity increase. |
| 365 | setupGUI(QSize{870, 650}, ToolBar); |
| 366 | createGUI(nullptr); |
| 367 | |
| 368 | Core::self()->partController()->addManagedTopLevelWidget(this); |
| 369 | qCDebug(SHELL) << "Adding plugin-added connection"; |
| 370 | |
| 371 | connect( Core::self()->pluginController(), &IPluginController::pluginLoaded, |
| 372 | d, &MainWindowPrivate::addPlugin); |
| 373 | connect( Core::self()->pluginController(), &IPluginController::pluginUnloaded, |
| 374 | d, &MainWindowPrivate::removePlugin); |
| 375 | connect( Core::self()->partController(), &IPartController::activePartChanged, |
| 376 | d, &MainWindowPrivate::activePartChanged); |
| 377 | connect( this, &MainWindow::activeViewChanged, |
| 378 | d, &MainWindowPrivate::changeActiveView); |
| 379 | connect(Core::self()->sourceFormatterControllerInternal(), &SourceFormatterController::hasFormattersChanged, |
| 380 | d, &MainWindowPrivate::updateSourceFormatterGuiClient); |
| 381 | |
| 382 | const auto plugins = Core::self()->pluginController()->loadedPlugins(); |
| 383 | for (IPlugin* plugin : plugins) { |
| 384 | d->addPlugin(plugin); |
| 385 | } |
| 386 | |
| 387 | guiFactory()->addClient(Core::self()->sessionController()); |
| 388 | if (Core::self()->sourceFormatterControllerInternal()->hasFormatters()) { |
| 389 | guiFactory()->addClient(Core::self()->sourceFormatterControllerInternal()); |
| 390 | } |
| 391 | |
| 392 | // Needed to re-plug the actions from the sessioncontroller as xmlguiclients don't |
| 393 | // seem to remember which actions where plugged in. |
| 394 | Core::self()->sessionController()->updateXmlGuiActionList(); |
| 395 | |
| 396 | d->setupGui(); |
| 397 | |
| 398 | qRegisterMetaType<QPointer<KTextEditor::Document>>(); |
| 399 | |
| 400 | //Queued so we process it with some delay, to make sure the rest of the UI has already adapted |
| 401 | connect(Core::self()->documentController(), &IDocumentController::documentActivated, |
| 402 | // Use a queued connection, because otherwise the view is not yet fully set up |
| 403 | // but wrap the document in a smart pointer to guard against crashes when it |
| 404 | // gets deleted in the meantime |
| 405 | this, [this](IDocument *doc) { |
nothing calls this directly
no test coverage detected