mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-18 21:14:34 -04:00
chore: Run clang-format over the codebase (#82)
This commit is a result of the following commands: clang-format-19 --style=file -i $(git ls-files | fgrep .cpp) clang-format-19 --style=file -i $(git ls-files | fgrep .hpp)
This commit is contained in:
committed by
GitHub
parent
102bb114a1
commit
61196cae90
@ -19,9 +19,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QPushButton>
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <QPushButton>
|
||||
|
||||
class ButtonAspect : public Utils::BaseAspect
|
||||
{
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
#include "ChatAssistantSettings.hpp"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "SettingsConstants.hpp"
|
||||
#include "SettingsTr.hpp"
|
||||
@ -195,10 +195,11 @@ ChatAssistantSettings::ChatAssistantSettings()
|
||||
|
||||
void ChatAssistantSettings::setupConnections()
|
||||
{
|
||||
connect(&resetToDefaults,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&ChatAssistantSettings::resetSettingsToDefaults);
|
||||
connect(
|
||||
&resetToDefaults,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&ChatAssistantSettings::resetSettingsToDefaults);
|
||||
}
|
||||
|
||||
void ChatAssistantSettings::resetSettingsToDefaults()
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
#include "CodeCompletionSettings.hpp"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "SettingsConstants.hpp"
|
||||
#include "SettingsTr.hpp"
|
||||
@ -250,17 +250,18 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
contextGrid.addRow({Row{readFullFile}});
|
||||
contextGrid.addRow({Row{readFileParts, readStringsBeforeCursor, readStringsAfterCursor}});
|
||||
|
||||
auto contextItem = Column{Row{contextGrid, Stretch{1}},
|
||||
Row{useSystemPrompt, Stretch{1}},
|
||||
Group{title(Tr::tr("Prompts for FIM models")),
|
||||
Column{systemPrompt}},
|
||||
Group{title(Tr::tr("Prompts for Non FIM models")),
|
||||
Column{
|
||||
Row{useUserMessageTemplateForCC, Stretch{1}},
|
||||
systemPromptForNonFimModels,
|
||||
userMessageTemplateForCC,
|
||||
}},
|
||||
Row{useProjectChangesCache, maxChangesCacheSize, Stretch{1}}};
|
||||
auto contextItem = Column{
|
||||
Row{contextGrid, Stretch{1}},
|
||||
Row{useSystemPrompt, Stretch{1}},
|
||||
Group{title(Tr::tr("Prompts for FIM models")), Column{systemPrompt}},
|
||||
Group{
|
||||
title(Tr::tr("Prompts for Non FIM models")),
|
||||
Column{
|
||||
Row{useUserMessageTemplateForCC, Stretch{1}},
|
||||
systemPromptForNonFimModels,
|
||||
userMessageTemplateForCC,
|
||||
}},
|
||||
Row{useProjectChangesCache, maxChangesCacheSize, Stretch{1}}};
|
||||
|
||||
return Column{
|
||||
Row{Stretch{1}, resetToDefaults},
|
||||
@ -297,10 +298,11 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
|
||||
void CodeCompletionSettings::setupConnections()
|
||||
{
|
||||
connect(&resetToDefaults,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CodeCompletionSettings::resetSettingsToDefaults);
|
||||
connect(
|
||||
&resetToDefaults,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CodeCompletionSettings::resetSettingsToDefaults);
|
||||
|
||||
connect(&readFullFile, &Utils::BoolAspect::volatileValueChanged, this, [this]() {
|
||||
if (readFullFile.volatileValue()) {
|
||||
|
@ -19,12 +19,12 @@
|
||||
|
||||
#include "CustomPromptSettings.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QJsonParseError>
|
||||
#include <QMessageBox>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <QFileDialog>
|
||||
#include <QJsonParseError>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "SettingsConstants.hpp"
|
||||
#include "SettingsTr.hpp"
|
||||
@ -86,30 +86,36 @@ CustomPromptSettings::CustomPromptSettings()
|
||||
|
||||
setLayouter([this]() {
|
||||
using namespace Layouting;
|
||||
return Column{Group{title(Tr::tr("Custom prompt for FIM model")),
|
||||
Column{Row{customJsonLabel, Stretch{1}, resetToDefaults},
|
||||
Row{customJsonTemplate,
|
||||
Column{saveCustomTemplateButton,
|
||||
loadCustomTemplateButton,
|
||||
customJsonLegend,
|
||||
Stretch{1}}}}}};
|
||||
return Column{Group{
|
||||
title(Tr::tr("Custom prompt for FIM model")),
|
||||
Column{
|
||||
Row{customJsonLabel, Stretch{1}, resetToDefaults},
|
||||
Row{customJsonTemplate,
|
||||
Column{
|
||||
saveCustomTemplateButton,
|
||||
loadCustomTemplateButton,
|
||||
customJsonLegend,
|
||||
Stretch{1}}}}}};
|
||||
});
|
||||
}
|
||||
|
||||
void CustomPromptSettings::setupConnection()
|
||||
{
|
||||
connect(&resetToDefaults,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CustomPromptSettings::resetSettingsToDefaults);
|
||||
connect(&saveCustomTemplateButton,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CustomPromptSettings::saveCustomTemplate);
|
||||
connect(&loadCustomTemplateButton,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CustomPromptSettings::loadCustomTemplate);
|
||||
connect(
|
||||
&resetToDefaults,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CustomPromptSettings::resetSettingsToDefaults);
|
||||
connect(
|
||||
&saveCustomTemplateButton,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CustomPromptSettings::saveCustomTemplate);
|
||||
connect(
|
||||
&loadCustomTemplateButton,
|
||||
&ButtonAspect::clicked,
|
||||
this,
|
||||
&CustomPromptSettings::loadCustomTemplate);
|
||||
}
|
||||
|
||||
void CustomPromptSettings::resetSettingsToDefaults()
|
||||
@ -128,10 +134,8 @@ void CustomPromptSettings::resetSettingsToDefaults()
|
||||
|
||||
void CustomPromptSettings::saveCustomTemplate()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(nullptr,
|
||||
Tr::tr("Save JSON Template"),
|
||||
QString(),
|
||||
Tr::tr("JSON Files (*.json)"));
|
||||
QString fileName = QFileDialog::getSaveFileName(
|
||||
nullptr, Tr::tr("Save JSON Template"), QString(), Tr::tr("JSON Files (*.json)"));
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
@ -140,22 +144,19 @@ void CustomPromptSettings::saveCustomTemplate()
|
||||
QTextStream out(&file);
|
||||
out << customJsonTemplate.value();
|
||||
file.close();
|
||||
QMessageBox::information(nullptr,
|
||||
Tr::tr("Save Successful"),
|
||||
Tr::tr("JSON template has been saved successfully."));
|
||||
QMessageBox::information(
|
||||
nullptr,
|
||||
Tr::tr("Save Successful"),
|
||||
Tr::tr("JSON template has been saved successfully."));
|
||||
} else {
|
||||
QMessageBox::critical(nullptr,
|
||||
Tr::tr("Save Failed"),
|
||||
Tr::tr("Failed to save JSON template."));
|
||||
QMessageBox::critical(nullptr, Tr::tr("Save Failed"), Tr::tr("Failed to save JSON template."));
|
||||
}
|
||||
}
|
||||
|
||||
void CustomPromptSettings::loadCustomTemplate()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(nullptr,
|
||||
Tr::tr("Load JSON Template"),
|
||||
QString(),
|
||||
Tr::tr("JSON Files (*.json)"));
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
nullptr, Tr::tr("Load JSON Template"), QString(), Tr::tr("JSON Files (*.json)"));
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
@ -169,18 +170,16 @@ void CustomPromptSettings::loadCustomTemplate()
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonContent.toUtf8(), &parseError);
|
||||
if (parseError.error == QJsonParseError::NoError) {
|
||||
customJsonTemplate.setVolatileValue(jsonContent);
|
||||
QMessageBox::information(nullptr,
|
||||
Tr::tr("Load Successful"),
|
||||
Tr::tr("JSON template has been loaded successfully."));
|
||||
QMessageBox::information(
|
||||
nullptr,
|
||||
Tr::tr("Load Successful"),
|
||||
Tr::tr("JSON template has been loaded successfully."));
|
||||
} else {
|
||||
QMessageBox::critical(nullptr,
|
||||
Tr::tr("Invalid JSON"),
|
||||
Tr::tr("The selected file contains invalid JSON."));
|
||||
QMessageBox::critical(
|
||||
nullptr, Tr::tr("Invalid JSON"), Tr::tr("The selected file contains invalid JSON."));
|
||||
}
|
||||
} else {
|
||||
QMessageBox::critical(nullptr,
|
||||
Tr::tr("Load Failed"),
|
||||
Tr::tr("Failed to load JSON template."));
|
||||
QMessageBox::critical(nullptr, Tr::tr("Load Failed"), Tr::tr("Failed to load JSON template."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,16 +392,17 @@ void GeneralSettings::setupConnections()
|
||||
|
||||
connect(&specifyPreset1, &Utils::BoolAspect::volatileValueChanged, this, [this]() {
|
||||
updatePreset1Visiblity(specifyPreset1.volatileValue());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void GeneralSettings::resetPageToDefaults()
|
||||
{
|
||||
QMessageBox::StandardButton reply;
|
||||
reply = QMessageBox::question(Core::ICore::dialogParent(),
|
||||
TrConstants::RESET_SETTINGS,
|
||||
TrConstants::CONFIRMATION,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
reply = QMessageBox::question(
|
||||
Core::ICore::dialogParent(),
|
||||
TrConstants::RESET_SETTINGS,
|
||||
TrConstants::CONFIRMATION,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (reply == QMessageBox::Yes) {
|
||||
resetAspect(enableQodeAssist);
|
||||
|
@ -94,10 +94,11 @@ public:
|
||||
|
||||
Utils::StringAspect caTemplateDescription{this};
|
||||
|
||||
void showSelectionDialog(const QStringList &data,
|
||||
Utils::StringAspect &aspect,
|
||||
const QString &title = {},
|
||||
const QString &text = {});
|
||||
void showSelectionDialog(
|
||||
const QStringList &data,
|
||||
Utils::StringAspect &aspect,
|
||||
const QString &title = {},
|
||||
const QString &text = {});
|
||||
|
||||
void showModelsNotFoundDialog(Utils::StringAspect &aspect);
|
||||
|
||||
|
@ -26,8 +26,8 @@ namespace QodeAssist::Settings {
|
||||
namespace TrConstants {
|
||||
inline const char *ENABLE_QODE_ASSIST = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Enable Qode Assist");
|
||||
inline const char *GENERAL = QT_TRANSLATE_NOOP("QtC::QodeAssist", "General");
|
||||
inline const char *RESET_TO_DEFAULTS = QT_TRANSLATE_NOOP("QtC::QodeAssist",
|
||||
"Reset Page to Defaults");
|
||||
inline const char *RESET_TO_DEFAULTS
|
||||
= QT_TRANSLATE_NOOP("QtC::QodeAssist", "Reset Page to Defaults");
|
||||
inline const char *CHECK_UPDATE = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Check Update");
|
||||
inline const char *SELECT = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Select...");
|
||||
inline const char *PROVIDER = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Provider:");
|
||||
@ -46,9 +46,8 @@ inline const char *ENABLE_CHAT = QT_TRANSLATE_NOOP(
|
||||
inline const char *CODE_COMPLETION = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Code Completion");
|
||||
inline const char *CHAT_ASSISTANT = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Chat Assistant");
|
||||
inline const char *RESET_SETTINGS = QT_TRANSLATE_NOOP("QtC::QodeAssist", "Reset Settings");
|
||||
inline const char *CONFIRMATION
|
||||
= QT_TRANSLATE_NOOP("QtC::QodeAssist",
|
||||
"Are you sure you want to reset all settings to default values?");
|
||||
inline const char *CONFIRMATION = QT_TRANSLATE_NOOP(
|
||||
"QtC::QodeAssist", "Are you sure you want to reset all settings to default values?");
|
||||
inline const char *CURRENT_TEMPLATE_DESCRIPTION
|
||||
= QT_TRANSLATE_NOOP("QtC::QodeAssist", "Current template description:");
|
||||
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <QCoreApplication>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QPushButton>
|
||||
#include <QtCore/qtimer.h>
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
namespace QodeAssist::Settings {
|
||||
|
||||
@ -67,10 +67,11 @@ void resetAspect(AspectType &aspect)
|
||||
aspect.setVolatileValue(aspect.defaultValue());
|
||||
}
|
||||
|
||||
inline void initStringAspect(Utils::StringAspect &aspect,
|
||||
const Utils::Key &settingsKey,
|
||||
const QString &labelText,
|
||||
const QString &defaultValue)
|
||||
inline void initStringAspect(
|
||||
Utils::StringAspect &aspect,
|
||||
const Utils::Key &settingsKey,
|
||||
const QString &labelText,
|
||||
const QString &defaultValue)
|
||||
{
|
||||
aspect.setSettingsKey(settingsKey);
|
||||
aspect.setLabelText(labelText);
|
||||
|
Reference in New Issue
Block a user