From d49cd07dd0ba488dc7f18f5a6a98df6b9a317844 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Sat, 7 Sep 2024 20:11:54 +0200 Subject: [PATCH] Add empty pages for future settings --- CMakeLists.txt | 4 ++ QodeAssistConstants.hpp | 6 +++ settings/ContextSettings.cpp | 63 ++++++++++++++++++++++++++++++ settings/ContextSettings.hpp | 34 ++++++++++++++++ settings/CustomPromptSettings.cpp | 62 +++++++++++++++++++++++++++++ settings/CustomPromptSettings.hpp | 34 ++++++++++++++++ settings/GeneralSettings.cpp | 62 +++++++++++++++++++++++++++++ settings/GeneralSettings.hpp | 34 ++++++++++++++++ settings/PresetPromptsSettings.cpp | 62 +++++++++++++++++++++++++++++ settings/PresetPromptsSettings.hpp | 34 ++++++++++++++++ 10 files changed, 395 insertions(+) create mode 100644 settings/ContextSettings.cpp create mode 100644 settings/ContextSettings.hpp create mode 100644 settings/CustomPromptSettings.cpp create mode 100644 settings/CustomPromptSettings.hpp create mode 100644 settings/GeneralSettings.cpp create mode 100644 settings/GeneralSettings.hpp create mode 100644 settings/PresetPromptsSettings.cpp create mode 100644 settings/PresetPromptsSettings.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 42f8ec3..6f92826 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,4 +51,8 @@ add_qtc_plugin(QodeAssist DocumentContextReader.hpp DocumentContextReader.cpp QodeAssistData.hpp utils/CounterTooltip.hpp utils/CounterTooltip.cpp + settings/GeneralSettings.hpp settings/GeneralSettings.cpp + settings/ContextSettings.hpp settings/ContextSettings.cpp + settings/CustomPromptSettings.hpp settings/CustomPromptSettings.cpp + settings/PresetPromptsSettings.hpp settings/PresetPromptsSettings.cpp ) diff --git a/QodeAssistConstants.hpp b/QodeAssistConstants.hpp index 57fb905..65a4029 100644 --- a/QodeAssistConstants.hpp +++ b/QodeAssistConstants.hpp @@ -59,6 +59,12 @@ const char USE_FILE_PATH_IN_CONTEXT[] = "QodeAssist.useFilePathInContext"; const char CUSTOM_JSON_TEMPLATE[] = "QodeAssist.customJsonTemplate"; const char QODE_ASSIST_GENERAL_OPTIONS_ID[] = "QodeAssist.GeneralOptions"; +const char QODE_ASSIST_GENERAL_SETTINGS_PAGE_ID[] = "QodeAssist.1GeneralSettingsPageId"; +const char QODE_ASSIST_CONTEXT_SETTINGS_PAGE_ID[] = "QodeAssist.2ContextSettingsPageId"; +const char QODE_ASSIST_PRESET_PROMPTS_SETTINGS_PAGE_ID[] + = "QodeAssist.3PresetPromptsSettingsPageId"; +const char QODE_ASSIST_CUSTOM_PROMPT_SETTINGS_PAGE_ID[] = "QodeAssist.4CustomPromptSettingsPageId"; + const char QODE_ASSIST_GENERAL_OPTIONS_CATEGORY[] = "QodeAssist.Category"; const char QODE_ASSIST_GENERAL_OPTIONS_DISPLAY_CATEGORY[] = "Qode Assist"; diff --git a/settings/ContextSettings.cpp b/settings/ContextSettings.cpp new file mode 100644 index 0000000..e986b2e --- /dev/null +++ b/settings/ContextSettings.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#pragma once + +#include "ContextSettings.hpp" + +#include +#include + +#include "QodeAssistConstants.hpp" +#include "QodeAssisttr.h" + +namespace QodeAssist::Settings { +ContextSettings &contextSettings() +{ + static ContextSettings settings; + return settings; +} + +ContextSettings::ContextSettings() +{ + setAutoApply(false); + + setDisplayName(Tr::tr("Context")); + + setLayouter([this]() { + using namespace Layouting; + return Column{Stretch{1}}; + }); +} + +class ContextSettingsPage : public Core::IOptionsPage +{ +public: + ContextSettingsPage() + { + setId(Constants::QODE_ASSIST_CONTEXT_SETTINGS_PAGE_ID); + setDisplayName(Tr::tr("Context")); + setCategory(Constants::QODE_ASSIST_GENERAL_OPTIONS_CATEGORY); + setSettingsProvider([] { return &contextSettings(); }); + } +}; + +const ContextSettingsPage contextSettingsPage; + +} // namespace QodeAssist::Settings diff --git a/settings/ContextSettings.hpp b/settings/ContextSettings.hpp new file mode 100644 index 0000000..884ce29 --- /dev/null +++ b/settings/ContextSettings.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#pragma once + +#include + +namespace QodeAssist::Settings { + +class ContextSettings : public Utils::AspectContainer +{ +public: + ContextSettings(); +}; + +ContextSettings &contextSettings(); + +} // namespace QodeAssist::Settings diff --git a/settings/CustomPromptSettings.cpp b/settings/CustomPromptSettings.cpp new file mode 100644 index 0000000..aa64ca7 --- /dev/null +++ b/settings/CustomPromptSettings.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#include "CustomPromptSettings.hpp" + +#include +#include + +#include "QodeAssistConstants.hpp" +#include "QodeAssisttr.h" + +namespace QodeAssist::Settings { + +CustomPromptSettings &customPromptSettings() +{ + static CustomPromptSettings settings; + return settings; +} + +CustomPromptSettings::CustomPromptSettings() +{ + setAutoApply(false); + + setDisplayName(Tr::tr("Custom Prompt")); + + setLayouter([this]() { + using namespace Layouting; + return Column{Stretch{1}}; + }); +} + +class CustomPromptSettingsPage : public Core::IOptionsPage +{ +public: + CustomPromptSettingsPage() + { + setId(Constants::QODE_ASSIST_CUSTOM_PROMPT_SETTINGS_PAGE_ID); + setDisplayName(Tr::tr("Custom Prompt")); + setCategory(Constants::QODE_ASSIST_GENERAL_OPTIONS_CATEGORY); + setSettingsProvider([] { return &customPromptSettings(); }); + } +}; + +const CustomPromptSettingsPage customPromptSettingsPage; + +} // namespace QodeAssist::Settings diff --git a/settings/CustomPromptSettings.hpp b/settings/CustomPromptSettings.hpp new file mode 100644 index 0000000..980b28d --- /dev/null +++ b/settings/CustomPromptSettings.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#pragma once + +#include + +namespace QodeAssist::Settings { + +class CustomPromptSettings : public Utils::AspectContainer +{ +public: + CustomPromptSettings(); +}; + +CustomPromptSettings &customPromptSettings(); + +} // namespace QodeAssist::Settings diff --git a/settings/GeneralSettings.cpp b/settings/GeneralSettings.cpp new file mode 100644 index 0000000..335a59c --- /dev/null +++ b/settings/GeneralSettings.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#include "GeneralSettings.hpp" + +#include +#include + +#include "QodeAssistConstants.hpp" +#include "QodeAssisttr.h" + +namespace QodeAssist::Settings { + +GeneralSettings &generalSettings() +{ + static GeneralSettings settings; + return settings; +} + +GeneralSettings::GeneralSettings() +{ + setAutoApply(false); + + setDisplayName(Tr::tr("General")); + + setLayouter([this]() { + using namespace Layouting; + return Column{Stretch{1}}; + }); +} + +class GeneralSettingsPage : public Core::IOptionsPage +{ +public: + GeneralSettingsPage() + { + setId(Constants::QODE_ASSIST_GENERAL_SETTINGS_PAGE_ID); + setDisplayName(Tr::tr("General")); + setCategory(Constants::QODE_ASSIST_GENERAL_OPTIONS_CATEGORY); + setSettingsProvider([] { return &generalSettings(); }); + } +}; + +const GeneralSettingsPage generalSettingsPage; + +} // namespace QodeAssist::Settings diff --git a/settings/GeneralSettings.hpp b/settings/GeneralSettings.hpp new file mode 100644 index 0000000..be876c2 --- /dev/null +++ b/settings/GeneralSettings.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#pragma once + +#include + +namespace QodeAssist::Settings { + +class GeneralSettings : public Utils::AspectContainer +{ +public: + GeneralSettings(); +}; + +GeneralSettings &generalSettings(); + +} // namespace QodeAssist::Settings diff --git a/settings/PresetPromptsSettings.cpp b/settings/PresetPromptsSettings.cpp new file mode 100644 index 0000000..35d5c91 --- /dev/null +++ b/settings/PresetPromptsSettings.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#include "PresetPromptsSettings.hpp" + +#include +#include + +#include "QodeAssistConstants.hpp" +#include "QodeAssisttr.h" + +namespace QodeAssist::Settings { + +PresetPromptsSettings &presetPromptsSettings() +{ + static PresetPromptsSettings settings; + return settings; +} + +PresetPromptsSettings::PresetPromptsSettings() +{ + setAutoApply(false); + + setDisplayName(Tr::tr("Preset Prompts Params")); + + setLayouter([this]() { + using namespace Layouting; + return Column{Stretch{1}}; + }); +} + +class PresetPromptsSettingsPage : public Core::IOptionsPage +{ +public: + PresetPromptsSettingsPage() + { + setId(Constants::QODE_ASSIST_PRESET_PROMPTS_SETTINGS_PAGE_ID); + setDisplayName(Tr::tr("Preset Prompts Params")); + setCategory(Constants::QODE_ASSIST_GENERAL_OPTIONS_CATEGORY); + setSettingsProvider([] { return &presetPromptsSettings(); }); + } +}; + +const PresetPromptsSettingsPage presetPromptsSettingsPage; + +} // namespace QodeAssist::Settings diff --git a/settings/PresetPromptsSettings.hpp b/settings/PresetPromptsSettings.hpp new file mode 100644 index 0000000..7f4e7c1 --- /dev/null +++ b/settings/PresetPromptsSettings.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +#pragma once + +#include + +namespace QodeAssist::Settings { + +class PresetPromptsSettings : public Utils::AspectContainer +{ +public: + PresetPromptsSettings(); +}; + +PresetPromptsSettings &presetPromptsSettings(); + +} // namespace QodeAssist::Settings