diff --git a/ChatView/ChatRootView.cpp b/ChatView/ChatRootView.cpp index 0e064e1..43fc598 100644 --- a/ChatView/ChatRootView.cpp +++ b/ChatView/ChatRootView.cpp @@ -750,7 +750,7 @@ void ChatRootView::openRulesFolder() void ChatRootView::openSettings() { - Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_CHAT_ASSISTANT_SETTINGS_PAGE_ID); + Settings::showSettings(Constants::QODE_ASSIST_CHAT_ASSISTANT_SETTINGS_PAGE_ID); } void ChatRootView::openFileInEditor(const QString &filePath) @@ -1515,7 +1515,7 @@ QString ChatRootView::currentAgentRoleSystemPrompt() const void ChatRootView::openAgentRolesSettings() { - Core::ICore::showOptionsDialog(Utils::Id("QodeAssist.AgentRoles")); + Settings::showSettings(Utils::Id("QodeAssist.AgentRoles")); } void ChatRootView::compressCurrentChat() diff --git a/settings/AgentRolesWidget.cpp b/settings/AgentRolesWidget.cpp index 4e3bb3a..7c0f408 100644 --- a/settings/AgentRolesWidget.cpp +++ b/settings/AgentRolesWidget.cpp @@ -34,13 +34,6 @@ namespace QodeAssist::Settings { -AgentRolesWidget::AgentRolesWidget(QWidget *parent) - : QWidget(parent) -{ - setupUI(); - loadRoles(); -} - void AgentRolesWidget::setupUI() { auto *mainLayout = new QVBoxLayout(this); diff --git a/settings/AgentRolesWidget.hpp b/settings/AgentRolesWidget.hpp index 1df709d..9ce27b9 100644 --- a/settings/AgentRolesWidget.hpp +++ b/settings/AgentRolesWidget.hpp @@ -19,19 +19,23 @@ #pragma once -#include +#include class QListWidget; class QPushButton; namespace QodeAssist::Settings { -class AgentRolesWidget : public QWidget +class AgentRolesWidget : public Core::IOptionsPageWidget { Q_OBJECT public: - explicit AgentRolesWidget(QWidget *parent = nullptr); + explicit AgentRolesWidget() + { + setupUI(); + loadRoles(); + } private: void setupUI(); diff --git a/settings/GeneralSettings.cpp b/settings/GeneralSettings.cpp index 6ae9e56..50124d2 100644 --- a/settings/GeneralSettings.cpp +++ b/settings/GeneralSettings.cpp @@ -452,7 +452,7 @@ void GeneralSettings::showModelsNotFoundDialog(Utils::StringAspect &aspect) connect(configureApiKeyBtn, &QPushButton::clicked, &dialog, [&dialog]() { dialog.close(); - Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); + Settings::showSettings(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); }); dialog.buttonLayout()->addWidget(selectProviderBtn); @@ -609,7 +609,7 @@ void GeneralSettings::setupConnections() }); connect(&ccConfigureApiKey, &ButtonAspect::clicked, this, []() { - Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); + Settings::showSettings(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); }); connect(&caPresetConfig, &Utils::SelectionAspect::volatileValueChanged, this, [this]() { @@ -618,7 +618,7 @@ void GeneralSettings::setupConnections() }); connect(&caConfigureApiKey, &ButtonAspect::clicked, this, []() { - Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); + Settings::showSettings(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); }); connect(&qrPresetConfig, &Utils::SelectionAspect::volatileValueChanged, this, [this]() { @@ -627,7 +627,7 @@ void GeneralSettings::setupConnections() }); connect(&qrConfigureApiKey, &ButtonAspect::clicked, this, []() { - Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); + Settings::showSettings(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID); }); connect(&specifyPreset1, &Utils::BoolAspect::volatileValueChanged, this, [this]() { @@ -1046,5 +1046,29 @@ public: }; const GeneralSettingsPage generalSettingsPage; +/*! + \sa {Core::ICore::showOptionsDialog()}, {Core::ICore::showSettings()} + \note This function was added to fix Qt Creator API broken changes in v19.0.0-beta2 version +*/ +void showSettings(const Utils::Id page) +{ +#if QODEASSIST_QT_CREATOR_VERSION >= QT_VERSION_CHECK(18, 0, 83) + Core::ICore::showSettings(page); +#else + Core::ICore::showOptionsDialog(page); +#endif +} +/*! + \sa {Core::ICore::showOptionsDialog()}, {Core::ICore::showSettings()} + \note This function was added to fix Qt Creator API broken changes in v19.0.0-beta2 version + */ +void showSettings(const Utils::Id page, Utils::Id item) +{ +#if QODEASSIST_QT_CREATOR_VERSION >= QT_VERSION_CHECK(18, 0, 83) + Core::ICore::showSettings(page, item); +#else + Core::ICore::showOptionsDialog(page, item); +#endif +} } // namespace QodeAssist::Settings diff --git a/settings/GeneralSettings.hpp b/settings/GeneralSettings.hpp index 16bff35..14b036b 100644 --- a/settings/GeneralSettings.hpp +++ b/settings/GeneralSettings.hpp @@ -187,4 +187,7 @@ private: GeneralSettings &generalSettings(); +void showSettings(const Utils::Id page); +void showSettings(const Utils::Id page, Utils::Id item); + } // namespace QodeAssist::Settings diff --git a/widgets/QuickRefactorDialog.cpp b/widgets/QuickRefactorDialog.cpp index 247c9eb..7fb4811 100644 --- a/widgets/QuickRefactorDialog.cpp +++ b/widgets/QuickRefactorDialog.cpp @@ -589,7 +589,7 @@ void QuickRefactorDialog::onOpenInstructionsFolder() void QuickRefactorDialog::onOpenSettings() { - Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_QUICK_REFACTOR_SETTINGS_PAGE_ID); + Settings::showSettings(Constants::QODE_ASSIST_QUICK_REFACTOR_SETTINGS_PAGE_ID); } QString QuickRefactorDialog::selectedConfiguration() const