Changeset View
Changeset View
Standalone View
Standalone View
shell/uicontroller.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | #include "settings/bgpreferences.h" | 55 | #include "settings/bgpreferences.h" | ||
56 | #include "settings/languagepreferences.h" | 56 | #include "settings/languagepreferences.h" | ||
57 | #include "settings/environmentpreferences.h" | 57 | #include "settings/environmentpreferences.h" | ||
58 | #include "settings/pluginpreferences.h" | 58 | #include "settings/pluginpreferences.h" | ||
59 | #include "settings/projectpreferences.h" | 59 | #include "settings/projectpreferences.h" | ||
60 | #include "settings/sourceformattersettings.h" | 60 | #include "settings/sourceformattersettings.h" | ||
61 | #include "settings/uipreferences.h" | 61 | #include "settings/uipreferences.h" | ||
62 | #include "settings/templateconfig.h" | 62 | #include "settings/templateconfig.h" | ||
63 | #include "settings/analyzerspreferences.h" | ||||
63 | 64 | | |||
64 | namespace KDevelop { | 65 | namespace KDevelop { | ||
65 | 66 | | |||
66 | class UiControllerPrivate { | 67 | class UiControllerPrivate { | ||
67 | public: | 68 | public: | ||
68 | UiControllerPrivate(UiController *controller) | 69 | UiControllerPrivate(UiController *controller) | ||
69 | : areasRestored(false), m_controller(controller) | 70 | : areasRestored(false), m_controller(controller) | ||
70 | { | 71 | { | ||
▲ Show 20 Lines • Show All 415 Lines • ▼ Show 20 Line(s) | 484 | { | |||
486 | Sublime::View *view = doc->createView(); | 487 | Sublime::View *view = doc->createView(); | ||
487 | mw->area()->addToolView(view, | 488 | mw->area()->addToolView(view, | ||
488 | Sublime::dockAreaToPosition(current->factory->defaultPosition())); | 489 | Sublime::dockAreaToPosition(current->factory->defaultPosition())); | ||
489 | current->factory->viewCreated(view); | 490 | current->factory->viewCreated(view); | ||
490 | } | 491 | } | ||
491 | 492 | | |||
492 | void UiController::showSettingsDialog() | 493 | void UiController::showSettingsDialog() | ||
493 | { | 494 | { | ||
494 | auto editorConfigPage = new EditorConfigPage(activeMainWindow()); | 495 | auto parent = activeMainWindow(); | ||
495 | auto languageConfigPage = new LanguagePreferences(activeMainWindow()); | 496 | | ||
497 | auto editorConfigPage = new EditorConfigPage(parent); | ||||
498 | auto languageConfigPage = new LanguagePreferences(parent); | ||||
499 | auto analyzersPreferences = new AnalyzersPreferences(parent); | ||||
496 | 500 | | |||
497 | auto configPages = QVector<KDevelop::ConfigPage*> { | 501 | auto configPages = QVector<KDevelop::ConfigPage*> { | ||
498 | new UiPreferences(activeMainWindow()), | 502 | new UiPreferences(parent), | ||
499 | new PluginPreferences(activeMainWindow()), | 503 | new PluginPreferences(parent), | ||
500 | new SourceFormatterSettings(activeMainWindow()), | 504 | new SourceFormatterSettings(parent), | ||
501 | new ProjectPreferences(activeMainWindow()), | 505 | new ProjectPreferences(parent), | ||
502 | new EnvironmentPreferences(QString(), activeMainWindow()), | 506 | new EnvironmentPreferences(QString(), parent), | ||
503 | new BGPreferences(activeMainWindow()), | 507 | new TemplateConfig(parent), | ||
504 | new TemplateConfig(activeMainWindow()), | | |||
505 | editorConfigPage | 508 | editorConfigPage | ||
506 | }; | 509 | }; | ||
507 | 510 | | |||
508 | ConfigDialog cfgDlg(configPages, activeMainWindow()); | 511 | ConfigDialog cfgDlg(configPages, parent); | ||
509 | 512 | | |||
510 | auto addPluginPages = [&](IPlugin* plugin) { | 513 | auto addPluginPages = [&](IPlugin* plugin) { | ||
511 | for (int i = 0, numPages = plugin->configPages(); i < numPages; ++i) { | 514 | for (int i = 0, numPages = plugin->configPages(); i < numPages; ++i) { | ||
512 | auto page = plugin->configPage(i, &cfgDlg); | 515 | auto page = plugin->configPage(i, &cfgDlg); | ||
513 | if(page && page->configPageType() == ConfigPage::LanguageConfigPage){ | 516 | if (!page) | ||
517 | continue; | ||||
518 | | ||||
519 | if (page->configPageType() == ConfigPage::LanguageConfigPage) { | ||||
514 | cfgDlg.addSubConfigPage(languageConfigPage, page); | 520 | cfgDlg.addSubConfigPage(languageConfigPage, page); | ||
521 | } else if (page->configPageType() == ConfigPage::AnalyzerConfigPage) { | ||||
522 | cfgDlg.addSubConfigPage(analyzersPreferences, page); | ||||
515 | } else { | 523 | } else { | ||
516 | // insert them before the editor config page | 524 | // insert them before the editor config page | ||
517 | cfgDlg.addConfigPage(page, editorConfigPage); | 525 | cfgDlg.addConfigPage(page, editorConfigPage); | ||
518 | } | 526 | } | ||
519 | } | 527 | } | ||
520 | }; | 528 | }; | ||
521 | 529 | | |||
522 | cfgDlg.addConfigPage(languageConfigPage, configPages[5]); | 530 | cfgDlg.addConfigPage(analyzersPreferences, configPages[5]); | ||
531 | | ||||
kfunk: I don't think we should move the background parser settings page to the Analyzers category. | |||||
antonanikin: Ok, you right. Parser moved to "Language Support" category. | |||||
532 | cfgDlg.addConfigPage(languageConfigPage, analyzersPreferences); | ||||
533 | cfgDlg.addSubConfigPage(languageConfigPage, new BGPreferences(parent)); | ||||
523 | 534 | | |||
524 | foreach (IPlugin* plugin, ICore::self()->pluginController()->loadedPlugins()) { | 535 | foreach (IPlugin* plugin, ICore::self()->pluginController()->loadedPlugins()) { | ||
525 | addPluginPages(plugin); | 536 | addPluginPages(plugin); | ||
526 | } | 537 | } | ||
538 | | ||||
527 | // TODO: only load settings if a UI related page was changed? | 539 | // TODO: only load settings if a UI related page was changed? | ||
528 | connect(&cfgDlg, &ConfigDialog::configSaved, activeSublimeWindow(), &Sublime::MainWindow::loadSettings); | 540 | connect(&cfgDlg, &ConfigDialog::configSaved, activeSublimeWindow(), &Sublime::MainWindow::loadSettings); | ||
529 | // make sure that pages get added whenever a new plugin is loaded (probably from the plugin selection dialog) | 541 | // make sure that pages get added whenever a new plugin is loaded (probably from the plugin selection dialog) | ||
530 | // removal on plugin unload is already handled in ConfigDialog | 542 | // removal on plugin unload is already handled in ConfigDialog | ||
531 | connect(ICore::self()->pluginController(), &IPluginController::pluginLoaded, &cfgDlg, addPluginPages); | 543 | connect(ICore::self()->pluginController(), &IPluginController::pluginLoaded, &cfgDlg, addPluginPages); | ||
532 | cfgDlg.exec(); | 544 | cfgDlg.exec(); | ||
533 | } | 545 | } | ||
534 | 546 | | |||
▲ Show 20 Lines • Show All 206 Lines • Show Last 20 Lines |
I don't think we should move the background parser settings page to the Analyzers category. Thinking about it, it probably makes more sense to move it to the Language Support category.