mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-12-05 00:42:50 -05:00
fix: Remove unusing variables from settings
This commit is contained in:
@ -362,7 +362,7 @@ LLMCore::ContextData QuickRefactorHandler::prepareContext(
|
||||
"\n- Preserve the original code structure when possible"
|
||||
"\n- Only change what is necessary to fulfill the user's request";
|
||||
|
||||
if (Settings::codeCompletionSettings().useOpenFilesInQuickRefactor()) {
|
||||
if (Settings::quickRefactorSettings().useOpenFilesInQuickRefactor()) {
|
||||
systemPrompt += "\n\n" + m_contextManager.openedFilesContext({documentInfo.filePath});
|
||||
}
|
||||
|
||||
|
||||
@ -287,18 +287,6 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
maxChangesCacheSize.setRange(2, 1000);
|
||||
maxChangesCacheSize.setDefaultValue(10);
|
||||
|
||||
// Quick refactor command settings
|
||||
useOpenFilesInQuickRefactor.setSettingsKey(Constants::CC_USE_OPEN_FILES_IN_QUICK_REFACTOR);
|
||||
useOpenFilesInQuickRefactor.setLabelText(
|
||||
Tr::tr("Include context from open files in quick refactor"));
|
||||
useOpenFilesInQuickRefactor.setDefaultValue(false);
|
||||
quickRefactorSystemPrompt.setSettingsKey(Constants::CC_QUICK_REFACTOR_SYSTEM_PROMPT);
|
||||
quickRefactorSystemPrompt.setDisplayStyle(Utils::StringAspect::TextEditDisplay);
|
||||
quickRefactorSystemPrompt.setDefaultValue(
|
||||
"You are an expert C++, Qt, and QML code completion assistant. Your task is to provide"
|
||||
"precise and contextually appropriate code completions to insert depending on user "
|
||||
"instructions.\n\n");
|
||||
|
||||
// Ollama Settings
|
||||
ollamaLivetime.setSettingsKey(Constants::CC_OLLAMA_LIVETIME);
|
||||
ollamaLivetime.setToolTip(
|
||||
@ -417,9 +405,6 @@ CodeCompletionSettings::CodeCompletionSettings()
|
||||
Space{8},
|
||||
Group{title(Tr::tr("Context Settings")), contextItem},
|
||||
Space{8},
|
||||
Group{title(Tr::tr("Quick Refactor Settings")),
|
||||
Column{useOpenFilesInQuickRefactor, quickRefactorSystemPrompt}},
|
||||
Space{8},
|
||||
Group{title(Tr::tr("OpenAI Responses API")), Column{Row{openAIResponsesGrid, Stretch{1}}}},
|
||||
Space{8},
|
||||
Group{title(Tr::tr("Ollama Settings")), Column{Row{ollamaGrid, Stretch{1}}}},
|
||||
@ -489,8 +474,6 @@ void CodeCompletionSettings::resetSettingsToDefaults()
|
||||
resetAspect(customLanguages);
|
||||
resetAspect(showProgressWidget);
|
||||
resetAspect(useOpenFilesContext);
|
||||
resetAspect(useOpenFilesInQuickRefactor);
|
||||
resetAspect(quickRefactorSystemPrompt);
|
||||
resetAspect(modelOutputHandler);
|
||||
resetAspect(completionTriggerMode);
|
||||
resetAspect(hintCharThreshold);
|
||||
|
||||
@ -82,10 +82,6 @@ public:
|
||||
Utils::BoolAspect useProjectChangesCache{this};
|
||||
Utils::IntegerAspect maxChangesCacheSize{this};
|
||||
|
||||
// Quick refactor command settings
|
||||
Utils::BoolAspect useOpenFilesInQuickRefactor{this};
|
||||
Utils::StringAspect quickRefactorSystemPrompt{this};
|
||||
|
||||
// Ollama Settings
|
||||
Utils::StringAspect ollamaLivetime{this};
|
||||
Utils::IntegerAspect contextWindow{this};
|
||||
|
||||
@ -93,7 +93,8 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
// Ollama Settings
|
||||
ollamaLivetime.setSettingsKey(Constants::QR_OLLAMA_LIVETIME);
|
||||
ollamaLivetime.setToolTip(
|
||||
Tr::tr("Time to suspend Ollama after completion request (in minutes), "
|
||||
Tr::tr(
|
||||
"Time to suspend Ollama after completion request (in minutes), "
|
||||
"Only Ollama, -1 to disable"));
|
||||
ollamaLivetime.setLabelText("Livetime:");
|
||||
ollamaLivetime.setDefaultValue("5m");
|
||||
@ -107,21 +108,24 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
useTools.setSettingsKey(Constants::QR_USE_TOOLS);
|
||||
useTools.setLabelText(Tr::tr("Enable Tools"));
|
||||
useTools.setToolTip(
|
||||
Tr::tr("Enable AI tools/functions for quick refactoring (allows reading project files, "
|
||||
Tr::tr(
|
||||
"Enable AI tools/functions for quick refactoring (allows reading project files, "
|
||||
"searching code, etc.)"));
|
||||
useTools.setDefaultValue(false);
|
||||
|
||||
useThinking.setSettingsKey(Constants::QR_USE_THINKING);
|
||||
useThinking.setLabelText(Tr::tr("Enable Thinking Mode"));
|
||||
useThinking.setToolTip(
|
||||
Tr::tr("Enable extended thinking mode for complex refactoring tasks (supported by "
|
||||
Tr::tr(
|
||||
"Enable extended thinking mode for complex refactoring tasks (supported by "
|
||||
"compatible models like Claude and Google AI)"));
|
||||
useThinking.setDefaultValue(false);
|
||||
|
||||
thinkingBudgetTokens.setSettingsKey(Constants::QR_THINKING_BUDGET_TOKENS);
|
||||
thinkingBudgetTokens.setLabelText(Tr::tr("Thinking Budget Tokens:"));
|
||||
thinkingBudgetTokens.setToolTip(
|
||||
Tr::tr("Number of tokens allocated for thinking process. Use -1 for dynamic thinking "
|
||||
Tr::tr(
|
||||
"Number of tokens allocated for thinking process. Use -1 for dynamic thinking "
|
||||
"(model decides), 0 to disable, or positive value for custom budget"));
|
||||
thinkingBudgetTokens.setRange(-1, 100000);
|
||||
thinkingBudgetTokens.setDefaultValue(10000);
|
||||
@ -129,7 +133,8 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
thinkingMaxTokens.setSettingsKey(Constants::QR_THINKING_MAX_TOKENS);
|
||||
thinkingMaxTokens.setLabelText(Tr::tr("Thinking Max Output Tokens:"));
|
||||
thinkingMaxTokens.setToolTip(
|
||||
Tr::tr("Maximum output tokens when thinking mode is enabled (includes thinking + response)"));
|
||||
Tr::tr(
|
||||
"Maximum output tokens when thinking mode is enabled (includes thinking + response)"));
|
||||
thinkingMaxTokens.setRange(1000, 200000);
|
||||
thinkingMaxTokens.setDefaultValue(16000);
|
||||
|
||||
@ -144,7 +149,8 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
openAIResponsesReasoningEffort.addOption("High");
|
||||
openAIResponsesReasoningEffort.setDefaultValue("Medium");
|
||||
openAIResponsesReasoningEffort.setToolTip(
|
||||
Tr::tr("Constrains effort on reasoning for OpenAI gpt-5 and o-series models:\n\n"
|
||||
Tr::tr(
|
||||
"Constrains effort on reasoning for OpenAI gpt-5 and o-series models:\n\n"
|
||||
"None: No reasoning (gpt-5.1 only)\n"
|
||||
"Minimal: Minimal reasoning effort (o-series only)\n"
|
||||
"Low: Low reasoning effort\n"
|
||||
@ -177,8 +183,10 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
displayMode.setSettingsKey(Constants::QR_DISPLAY_MODE);
|
||||
displayMode.setLabelText(Tr::tr("Display Mode:"));
|
||||
displayMode.setToolTip(
|
||||
Tr::tr("Choose how to display refactoring suggestions:\n"
|
||||
"- Inline Widget: Shows refactor in a widget overlay with Apply/Decline buttons (default)\n"
|
||||
Tr::tr(
|
||||
"Choose how to display refactoring suggestions:\n"
|
||||
"- Inline Widget: Shows refactor in a widget overlay with Apply/Decline buttons "
|
||||
"(default)\n"
|
||||
"- Qt Creator Suggestion: Uses Qt Creator's built-in suggestion system"));
|
||||
displayMode.addOption(Tr::tr("Inline Widget"));
|
||||
displayMode.addOption(Tr::tr("Qt Creator Suggestion"));
|
||||
@ -187,7 +195,8 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
widgetOrientation.setSettingsKey(Constants::QR_WIDGET_ORIENTATION);
|
||||
widgetOrientation.setLabelText(Tr::tr("Widget Orientation:"));
|
||||
widgetOrientation.setToolTip(
|
||||
Tr::tr("Choose default orientation for refactor widget:\n"
|
||||
Tr::tr(
|
||||
"Choose default orientation for refactor widget:\n"
|
||||
"- Horizontal: Original and refactored code side by side (default)\n"
|
||||
"- Vertical: Original and refactored code stacked vertically"));
|
||||
widgetOrientation.addOption(Tr::tr("Horizontal"));
|
||||
@ -226,6 +235,11 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
"precise and contextually appropriate code completions to insert depending on user "
|
||||
"instructions.\n\n");
|
||||
|
||||
useOpenFilesInQuickRefactor.setSettingsKey(Constants::QR_USE_OPEN_FILES_IN_QUICK_REFACTOR);
|
||||
useOpenFilesInQuickRefactor.setLabelText(
|
||||
Tr::tr("Include context from open files in quick refactor"));
|
||||
useOpenFilesInQuickRefactor.setDefaultValue(false);
|
||||
|
||||
resetToDefaults.m_buttonText = TrConstants::RESET_TO_DEFAULTS;
|
||||
|
||||
readSettings();
|
||||
@ -262,7 +276,10 @@ QuickRefactorSettings::QuickRefactorSettings()
|
||||
|
||||
auto contextGrid = Grid{};
|
||||
contextGrid.addRow({Row{readFullFile}});
|
||||
contextGrid.addRow({Row{readFileParts, readStringsBeforeCursor, readStringsAfterCursor}});
|
||||
contextGrid.addRow({
|
||||
Row{readFileParts, readStringsBeforeCursor, readStringsAfterCursor},
|
||||
});
|
||||
contextGrid.addRow({Row{useOpenFilesInQuickRefactor}});
|
||||
|
||||
auto displayGrid = Grid{};
|
||||
displayGrid.addRow({Row{displayMode}});
|
||||
@ -324,8 +341,11 @@ void QuickRefactorSettings::setupConnections()
|
||||
widgetOrientation.setEnabled(isInlineWidget);
|
||||
};
|
||||
|
||||
connect(&displayMode, &Utils::SelectionAspect::volatileValueChanged,
|
||||
this, updateWidgetOrientationEnabled);
|
||||
connect(
|
||||
&displayMode,
|
||||
&Utils::SelectionAspect::volatileValueChanged,
|
||||
this,
|
||||
updateWidgetOrientationEnabled);
|
||||
|
||||
updateWidgetOrientationEnabled();
|
||||
|
||||
@ -382,6 +402,7 @@ void QuickRefactorSettings::resetSettingsToDefaults()
|
||||
resetAspect(widgetMinHeight);
|
||||
resetAspect(widgetMaxHeight);
|
||||
resetAspect(systemPrompt);
|
||||
resetAspect(useOpenFilesInQuickRefactor);
|
||||
writeSettings();
|
||||
}
|
||||
}
|
||||
@ -401,4 +422,3 @@ public:
|
||||
const QuickRefactorSettingsPage quickRefactorSettingsPage;
|
||||
|
||||
} // namespace QodeAssist::Settings
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ public:
|
||||
|
||||
// Prompt Settings
|
||||
Utils::StringAspect systemPrompt{this};
|
||||
Utils::BoolAspect useOpenFilesInQuickRefactor{this};
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
|
||||
@ -165,10 +165,6 @@ const char CC_MAX_CHANGES_CACHE_SIZE[] = "QodeAssist.ccMaxChangesCacheSize";
|
||||
const char CA_USE_SYSTEM_PROMPT[] = "QodeAssist.useChatSystemPrompt";
|
||||
const char CA_SYSTEM_PROMPT[] = "QodeAssist.chatSystemPrompt";
|
||||
|
||||
// quick refactor command settings
|
||||
const char CC_QUICK_REFACTOR_SYSTEM_PROMPT[] = "QodeAssist.ccQuickRefactorSystemPrompt";
|
||||
const char CC_USE_OPEN_FILES_IN_QUICK_REFACTOR[] = "QodeAssist.ccUseOpenFilesInQuickRefactor";
|
||||
|
||||
// preset prompt settings
|
||||
const char CC_TEMPERATURE[] = "QodeAssist.ccTemperature";
|
||||
const char CC_MAX_TOKENS[] = "QodeAssist.ccMaxTokens";
|
||||
@ -237,6 +233,7 @@ const char QR_READ_FULL_FILE[] = "QodeAssist.qrReadFullFile";
|
||||
const char QR_READ_STRINGS_BEFORE_CURSOR[] = "QodeAssist.qrReadStringsBeforeCursor";
|
||||
const char QR_READ_STRINGS_AFTER_CURSOR[] = "QodeAssist.qrReadStringsAfterCursor";
|
||||
const char QR_SYSTEM_PROMPT[] = "QodeAssist.qrSystemPrompt";
|
||||
const char QR_USE_OPEN_FILES_IN_QUICK_REFACTOR[] = "QodeAssist.qrUseOpenFilesInQuickRefactor";
|
||||
const char QR_DISPLAY_MODE[] = "QodeAssist.qrDisplayMode";
|
||||
const char QR_WIDGET_ORIENTATION[] = "QodeAssist.qrWidgetOrientation";
|
||||
const char QR_WIDGET_MIN_WIDTH[] = "QodeAssist.qrWidgetMinWidth";
|
||||
|
||||
Reference in New Issue
Block a user