mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-30 10:09:19 -04:00
71 lines
1.8 KiB
C++
71 lines
1.8 KiB
C++
// Copyright (C) 2025-2026 Petr Mironychev
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
|
|
|
#pragma once
|
|
|
|
#include <QDialog>
|
|
#include <QString>
|
|
#include "CustomInstructionsManager.hpp"
|
|
|
|
class QPlainTextEdit;
|
|
class QToolButton;
|
|
class QLabel;
|
|
class QComboBox;
|
|
class QLineEdit;
|
|
class QFrame;
|
|
|
|
namespace QodeAssist {
|
|
|
|
class QuickRefactorDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit QuickRefactorDialog(
|
|
QWidget *parent = nullptr,
|
|
const QString &lastInstructions = QString(),
|
|
bool refactorAgentAvailable = true);
|
|
~QuickRefactorDialog() override = default;
|
|
|
|
QString instructions() const;
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
private slots:
|
|
void useLastInstructions();
|
|
void useImproveCodeTemplate();
|
|
void useAlternativeSolutionTemplate();
|
|
void updateDialogSize();
|
|
void onCommandSelected(int index);
|
|
void onAddCustomCommand();
|
|
void onEditCustomCommand();
|
|
void onDeleteCustomCommand();
|
|
void onOpenInstructionsFolder();
|
|
void onOpenSettings();
|
|
void loadCustomCommands();
|
|
void validateAndAccept();
|
|
|
|
private:
|
|
void setupUi();
|
|
void createActionButtons();
|
|
CustomInstruction findCurrentInstruction() const;
|
|
|
|
QPlainTextEdit *m_instructionEdit;
|
|
QToolButton *m_repeatButton;
|
|
QToolButton *m_improveButton;
|
|
QToolButton *m_alternativeButton;
|
|
QToolButton *m_addCommandButton;
|
|
QToolButton *m_editCommandButton;
|
|
QToolButton *m_deleteCommandButton;
|
|
QToolButton *m_openFolderButton;
|
|
QToolButton *m_settingsButton;
|
|
QComboBox *m_commandsComboBox;
|
|
|
|
QString m_lastInstructions;
|
|
bool m_refactorAgentAvailable = true;
|
|
};
|
|
|
|
} // namespace QodeAssist
|