mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-05-30 10:59:30 -04:00
fix: Qt Creator 19 API breaking changes (#328)
* Inherits `QodeAssist::Settings::AgentRolesWidget` from `Core::IOptionsPageWidget` * Adds `QodeAssist::Settings::showSettings` function and use it instead `Core::ICore::showOptionsDialog` --------- Co-authored-by: Ivan Lebedev <ilebedev@flightpath3d.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -34,13 +34,6 @@
|
||||
|
||||
namespace QodeAssist::Settings {
|
||||
|
||||
AgentRolesWidget::AgentRolesWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setupUI();
|
||||
loadRoles();
|
||||
}
|
||||
|
||||
void AgentRolesWidget::setupUI()
|
||||
{
|
||||
auto *mainLayout = new QVBoxLayout(this);
|
||||
|
||||
@@ -19,19 +19,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user