feat: Add moving to api key settings page if needed

This commit is contained in:
Petr Mironychev 2025-02-26 21:51:11 +01:00
parent 903eb50e7a
commit f6fd411b2d
2 changed files with 10 additions and 1 deletions

View File

@ -258,6 +258,7 @@ void GeneralSettings::showModelsNotFoundDialog(Utils::StringAspect &aspect)
auto selectProviderBtn = new QPushButton(TrConstants::SELECT_PROVIDER);
auto selectUrlBtn = new QPushButton(TrConstants::SELECT_URL);
auto enterManuallyBtn = new QPushButton(TrConstants::ENTER_MODEL_MANUALLY);
auto configureApiKeyBtn = new QPushButton(TrConstants::CONFIGURE_API_KEY);
connect(selectProviderBtn, &QPushButton::clicked, &dialog, [this, providerButton, &dialog]() {
dialog.close();
@ -274,9 +275,15 @@ void GeneralSettings::showModelsNotFoundDialog(Utils::StringAspect &aspect)
showModelsNotSupportedDialog(aspect);
});
connect(configureApiKeyBtn, &QPushButton::clicked, &dialog, [&dialog]() {
dialog.close();
Core::ICore::showOptionsDialog(Constants::QODE_ASSIST_PROVIDER_SETTINGS_PAGE_ID);
});
dialog.buttonLayout()->addWidget(selectProviderBtn);
dialog.buttonLayout()->addWidget(selectUrlBtn);
dialog.buttonLayout()->addWidget(enterManuallyBtn);
dialog.buttonLayout()->addWidget(configureApiKeyBtn);
}
auto closeBtn = new QPushButton(TrConstants::CLOSE);

View File

@ -60,7 +60,8 @@ inline const char CHECK_CONNECTION[] = QT_TRANSLATE_NOOP(
"Please verify the following:\n"
"- Server is running and accessible\n"
"- URL is correct\n"
"- Provider is properly configured\n\n"
"- Provider is properly configured\n"
"- API key is correctly set (if required)\n\n"
"You can try selecting a different provider or changing the URL:");
inline const char SELECT_PROVIDER[] = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Select Provider");
inline const char SELECT_URL[] = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Select URL");
@ -78,6 +79,7 @@ inline const char OK[] = QT_TRANSLATE_NOOP("QtC::QodeAssist", "OK");
inline const char CANCEL[] = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Cancel");
inline const char ENTER_MODEL_MANUALLY[]
= QT_TRANSLATE_NOOP("QtC::QodeAssist", "Enter Model Manually");
inline const char CONFIGURE_API_KEY[] = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Configure API Key");
inline const char URL_SELECTION[] = QT_TRANSLATE_NOOP("QtC::QodeAssist", "URL Selection");
inline const char URL_SELECTION_INFO[] = QT_TRANSLATE_NOOP(
"QtC::QodeAssist",