mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-22 02:22:44 -05:00
feat: Add default option for custom instructions
This commit is contained in:
@ -320,9 +320,16 @@ void QuickRefactorDialog::loadCustomCommands()
|
||||
const QVector<CustomInstruction> &instructions = manager.instructions();
|
||||
|
||||
QStringList instructionNames;
|
||||
for (const CustomInstruction &instruction : instructions) {
|
||||
int defaultInstructionIndex = -1;
|
||||
|
||||
for (int i = 0; i < instructions.size(); ++i) {
|
||||
const CustomInstruction &instruction = instructions[i];
|
||||
m_commandsComboBox->addItem(instruction.name, instruction.id);
|
||||
instructionNames.append(instruction.name);
|
||||
|
||||
if (instruction.isDefault) {
|
||||
defaultInstructionIndex = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_commandsComboBox->completer()) {
|
||||
@ -330,6 +337,10 @@ void QuickRefactorDialog::loadCustomCommands()
|
||||
m_commandsComboBox->completer()->setModel(model);
|
||||
}
|
||||
|
||||
if (defaultInstructionIndex > 0) {
|
||||
m_commandsComboBox->setCurrentIndex(defaultInstructionIndex);
|
||||
}
|
||||
|
||||
bool hasInstructions = !instructions.isEmpty();
|
||||
m_editCommandButton->setEnabled(hasInstructions);
|
||||
m_deleteCommandButton->setEnabled(hasInstructions);
|
||||
|
||||
Reference in New Issue
Block a user