forked from qt-creator/qt-creator
Terminal: Rework commands
This rework fixes the way commands are registered in Qt Creator. Change-Id: I401f3ac7d9194dad8fceb507360ddc3633106eb4 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <aggregation/aggregate.h>
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
|
||||
#include <utils/link.h>
|
||||
#include <utils/process.h>
|
||||
#include <utils/terminalhooks.h>
|
||||
@@ -22,6 +24,8 @@
|
||||
|
||||
namespace Terminal {
|
||||
|
||||
using UnlockedGlobalAction = std::unique_ptr<QAction, std::function<void(QAction *)>>;
|
||||
|
||||
class TerminalWidget : public QAbstractScrollArea
|
||||
{
|
||||
friend class CellIterator;
|
||||
@@ -46,6 +50,8 @@ public:
|
||||
|
||||
void clearContents();
|
||||
|
||||
void closeTerminal();
|
||||
|
||||
TerminalSearch *search() { return m_search.get(); }
|
||||
|
||||
struct Selection
|
||||
@@ -82,6 +88,11 @@ public:
|
||||
|
||||
void restart(const Utils::Terminal::OpenTerminalParameters &openParameters);
|
||||
|
||||
static void initActions();
|
||||
|
||||
[[nodiscard]] static UnlockedGlobalAction unlockGlobalAction(const Utils::Id &commandId,
|
||||
const Core::Context &context);
|
||||
|
||||
signals:
|
||||
void started(qint64 pid);
|
||||
void cwdChanged(const Utils::FilePath &cwd);
|
||||
@@ -178,6 +189,7 @@ protected:
|
||||
void updateCopyState();
|
||||
|
||||
private:
|
||||
Core::Context m_context;
|
||||
std::unique_ptr<Utils::Process> m_process;
|
||||
std::unique_ptr<Internal::TerminalSurface> m_surface;
|
||||
std::unique_ptr<ShellIntegration> m_shellIntegration;
|
||||
@@ -226,6 +238,19 @@ private:
|
||||
|
||||
Aggregation::Aggregate *m_aggregate{nullptr};
|
||||
SearchHit m_lastSelectedHit{};
|
||||
|
||||
QAction m_copy;
|
||||
QAction m_paste;
|
||||
QAction m_clearSelection;
|
||||
QAction m_clearTerminal;
|
||||
QAction m_moveCursorWordLeft;
|
||||
QAction m_moveCursorWordRight;
|
||||
QAction m_close;
|
||||
|
||||
UnlockedGlobalAction m_findInDocument;
|
||||
UnlockedGlobalAction m_exit;
|
||||
UnlockedGlobalAction m_options;
|
||||
UnlockedGlobalAction m_settings;
|
||||
};
|
||||
|
||||
} // namespace Terminal
|
||||
|
||||
Reference in New Issue
Block a user