From f8bbdf6f07b909690da5b55244cfa1ba064901c6 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 2 Oct 2023 17:54:48 +0200 Subject: [PATCH] Core: Inline ICore::init() into ICore constructor More natural setup. Change-Id: I5a51cdec3f955e4b887613bd3dea4b25d485e844 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/coreplugin.cpp | 3 +-- src/plugins/coreplugin/icore.cpp | 27 ++++++++++----------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index bfd0669c338..17f1a08031f 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -157,12 +157,11 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) CheckableMessageBox::initialize(ICore::settings()); new ActionManager(this); ActionManager::setPresentationModeEnabled(args.presentationMode); - m_core = new ICore; if (args.overrideColor.isValid()) ICore::setOverrideColor(args.overrideColor); + m_core = new ICore; m_locator = new Locator; std::srand(unsigned(QDateTime::currentDateTime().toSecsSinceEpoch())); - ICore::init(); m_editMode = new EditMode; ModeManager::activateMode(m_editMode->id()); m_folderNavigationWidgetFactory = new FolderNavigationWidgetFactory; diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 1c04ebd2b6d..45afbfafd4f 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -244,7 +244,7 @@ private: void mousePressEvent(QMouseEvent *event) override; }; -} // Internal +static QColor s_overrideColor; // The Core Singleton static ICore *m_core = nullptr; @@ -253,9 +253,6 @@ static NewDialog *defaultDialogFactory(QWidget *parent) { return new NewDialogWidget(parent); } - -namespace Internal { - class ICorePrivate : public QObject { public: @@ -344,7 +341,6 @@ public: QToolButton *m_toggleLeftSideBarButton = nullptr; QToolButton *m_toggleRightSideBarButton = nullptr; - QColor m_overrideColor; QList> m_preCloseListeners; }; @@ -412,6 +408,10 @@ ICore::ICore() }); Utils::FileUtils::setDialogParentGetter(&ICore::dialogParent); + + d->m_progressManager->init(); // needs the status bar manager + MessageManager::init(); + OutputPaneManager::create(); } /*! @@ -1103,7 +1103,7 @@ void ICore::saveSettings(SaveSettingsReason reason) QtcSettings *settings = PluginManager::settings(); settings->beginGroup(settingsGroup); - if (!(d->m_overrideColor.isValid() && StyleHelper::baseColor() == d->m_overrideColor)) + if (!(s_overrideColor.isValid() && StyleHelper::baseColor() == s_overrideColor)) settings->setValueWithDefault(colorKey, StyleHelper::requestedBaseColor(), QColor(StyleHelper::DEFAULT_BASE_COLOR)); @@ -1347,13 +1347,6 @@ ICorePrivate::~ICorePrivate() } // Internal -void ICore::init() -{ - d->m_progressManager->init(); // needs the status bar manager - MessageManager::init(); - OutputPaneManager::create(); -} - void ICore::extensionsInitialized() { EditorManagerPrivate::extensionsInitialized(); @@ -2232,10 +2225,10 @@ void ICorePrivate::readSettings() QtcSettings *settings = PluginManager::settings(); settings->beginGroup(settingsGroup); - if (m_overrideColor.isValid()) { - StyleHelper::setBaseColor(m_overrideColor); + if (s_overrideColor.isValid()) { + StyleHelper::setBaseColor(s_overrideColor); // Get adapted base color. - m_overrideColor = StyleHelper::baseColor(); + s_overrideColor = StyleHelper::baseColor(); } else { StyleHelper::setBaseColor(settings->value(colorKey, QColor(StyleHelper::DEFAULT_BASE_COLOR)).value()); @@ -2545,7 +2538,7 @@ void ICorePrivate::restoreWindowState() void ICore::setOverrideColor(const QColor &color) { - d->m_overrideColor = color; + s_overrideColor = color; } } // namespace Core