mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-21 10:40:57 -04:00
refactor: Restructure project into sources/tests layout and dissolve PluginLLMCore
This commit is contained in:
60
sources/widgets/RefactorWidgetHandler.hpp
Normal file
60
sources/widgets/RefactorWidgetHandler.hpp
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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 <QPointer>
|
||||
#include <functional>
|
||||
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
namespace QodeAssist {
|
||||
|
||||
class RefactorWidget;
|
||||
|
||||
class RefactorWidgetHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RefactorWidgetHandler(QObject *parent = nullptr);
|
||||
~RefactorWidgetHandler() override;
|
||||
|
||||
void showRefactorWidget(
|
||||
TextEditor::TextEditorWidget *editor,
|
||||
const QString &originalText,
|
||||
const QString &refactoredText,
|
||||
const Utils::Text::Range &range);
|
||||
|
||||
void showRefactorWidget(
|
||||
TextEditor::TextEditorWidget *editor,
|
||||
const QString &originalText,
|
||||
const QString &refactoredText,
|
||||
const Utils::Text::Range &range,
|
||||
const QString &contextBefore,
|
||||
const QString &contextAfter);
|
||||
|
||||
void hideRefactorWidget();
|
||||
|
||||
bool isWidgetVisible() const { return !m_refactorWidget.isNull(); }
|
||||
|
||||
void setApplyCallback(std::function<void(const QString &)> callback);
|
||||
void setDeclineCallback(std::function<void()> callback);
|
||||
void setTextToApply(const QString &text);
|
||||
|
||||
private:
|
||||
QPointer<TextEditor::TextEditorWidget> m_editor;
|
||||
QPointer<RefactorWidget> m_refactorWidget;
|
||||
|
||||
std::function<void(const QString &)> m_applyCallback;
|
||||
std::function<void()> m_declineCallback;
|
||||
|
||||
void updateWidgetPosition();
|
||||
QPoint calculateWidgetPosition();
|
||||
int getEditorWidth() const;
|
||||
};
|
||||
|
||||
} // namespace QodeAssist
|
||||
|
||||
Reference in New Issue
Block a user