aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/texteditoractionhandler.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2023-11-09 10:26:06 +0100
committerEike Ziller <eike.ziller@qt.io>2023-11-09 12:10:33 +0000
commit2f7bfd3ef897a2ce9f1f9863f072879bf169671e (patch)
tree67bada85b75968cf02ebe982c95d4bac9ae15c8d /src/plugins/texteditor/texteditoractionhandler.cpp
parent09e495f01a6ef1592b51dde08f459fadafaa9e05 (diff)
TextEditorActionHandler: Reduce noise
By using namespace Core Change-Id: I97f4f6c42d5e0e9487b174b6837dc4cbb3452f2b Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditoractionhandler.cpp')
-rw-r--r--src/plugins/texteditor/texteditoractionhandler.cpp80
1 files changed, 46 insertions, 34 deletions
diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp
index f16c94249b..cf94a3f03e 100644
--- a/src/plugins/texteditor/texteditoractionhandler.cpp
+++ b/src/plugins/texteditor/texteditoractionhandler.cpp
@@ -29,6 +29,8 @@
#include <functional>
+using namespace Core;
+
namespace TextEditor {
namespace Internal {
@@ -37,13 +39,17 @@ class TextEditorActionHandlerPrivate : public QObject
public:
TextEditorActionHandlerPrivate(Utils::Id editorId, Utils::Id contextId, uint optionalActions);
- QAction *registerActionHelper(Utils::Id id, bool scriptable, const QString &title,
- const QKeySequence &keySequence, Utils::Id menueGroup,
- Core::ActionContainer *container,
- std::function<void(bool)> slot)
+ QAction *registerActionHelper(Utils::Id id,
+ bool scriptable,
+ const QString &title,
+ const QKeySequence &keySequence,
+ Utils::Id menueGroup,
+ ActionContainer *container,
+ std::function<void(bool)> slot)
{
auto result = new QAction(title, this);
- Core::Command *command = Core::ActionManager::registerAction(result, id, Core::Context(m_contextId), scriptable);
+ Command *command
+ = ActionManager::registerAction(result, id, Context(m_contextId), scriptable);
if (!keySequence.isEmpty())
command->setDefaultKeySequence(keySequence);
@@ -60,7 +66,7 @@ public:
const QString &title = QString(),
const QKeySequence &keySequence = QKeySequence(),
Utils::Id menueGroup = Utils::Id(),
- Core::ActionContainer *container = nullptr)
+ ActionContainer *container = nullptr)
{
return registerActionHelper(id,
scriptable,
@@ -77,24 +83,24 @@ public:
}
QAction *registerBoolAction(Utils::Id id,
- std::function<void(TextEditorWidget *, bool)> slot,
- bool scriptable = false,
- const QString &title = QString(),
- const QKeySequence &keySequence = QKeySequence(),
- Utils::Id menueGroup = Utils::Id(),
- Core::ActionContainer *container = nullptr)
+ std::function<void(TextEditorWidget *, bool)> slot,
+ bool scriptable = false,
+ const QString &title = QString(),
+ const QKeySequence &keySequence = QKeySequence(),
+ Utils::Id menueGroup = Utils::Id(),
+ ActionContainer *container = nullptr)
{
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
[this, slot](bool on) { if (m_currentEditorWidget) slot(m_currentEditorWidget, on); });
}
QAction *registerIntAction(Utils::Id id,
- std::function<void(TextEditorWidget *, int)> slot,
- bool scriptable = false,
- const QString &title = QString(),
- const QKeySequence &keySequence = QKeySequence(),
- Utils::Id menueGroup = Utils::Id(),
- Core::ActionContainer *container = nullptr)
+ std::function<void(TextEditorWidget *, int)> slot,
+ bool scriptable = false,
+ const QString &title = QString(),
+ const QKeySequence &keySequence = QKeySequence(),
+ Utils::Id menueGroup = Utils::Id(),
+ ActionContainer *container = nullptr)
{
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
[this, slot](bool on) { if (m_currentEditorWidget) slot(m_currentEditorWidget, on); });
@@ -108,7 +114,7 @@ public:
void updateUndoAction(bool on);
void updateCopyAction(bool on);
- void updateCurrentEditor(Core::IEditor *editor);
+ void updateCurrentEditor(IEditor *editor);
void setCanUndoCallback(const TextEditorActionHandler::Predicate &callback);
void setCanRedoCallback(const TextEditorActionHandler::Predicate &callback);
@@ -139,7 +145,7 @@ public:
uint m_optionalActions = TextEditorActionHandler::None;
QPointer<TextEditorWidget> m_currentEditorWidget;
- QPointer<Core::IEditor> m_currentEditor;
+ QPointer<IEditor> m_currentEditor;
Utils::Id m_editorId;
Utils::Id m_contextId;
@@ -156,8 +162,10 @@ TextEditorActionHandlerPrivate::TextEditorActionHandlerPrivate
, m_contextId(contextId)
{
createActions();
- connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
- this, &TextEditorActionHandlerPrivate::updateCurrentEditor);
+ connect(EditorManager::instance(),
+ &EditorManager::currentEditorChanged,
+ this,
+ &TextEditorActionHandlerPrivate::updateCurrentEditor);
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
this, &TextEditorActionHandlerPrivate::updateActions);
}
@@ -179,11 +187,12 @@ void TextEditorActionHandlerPrivate::createActions()
[] (TextEditorWidget *w) { w->paste(); }, true);
registerAction(SELECTALL,
[] (TextEditorWidget *w) { w->selectAll(); }, true);
- registerAction(GOTO, [] (TextEditorWidget *) {
- Core::LocatorManager::showFilter(TextEditorPlugin::lineNumberFilter());
- });
- m_modifyingActions << registerAction(PRINT,
- [] (TextEditorWidget *widget) { widget->print(Core::ICore::printer()); });
+ registerAction(GOTO, [](TextEditorWidget *) {
+ LocatorManager::showFilter(TextEditorPlugin::lineNumberFilter());
+ });
+ m_modifyingActions << registerAction(PRINT, [](TextEditorWidget *widget) {
+ widget->print(ICore::printer());
+ });
m_modifyingActions << registerAction(DELETE_LINE,
[] (TextEditorWidget *w) { w->deleteLine(); }, true, Tr::tr("Delete &Line"));
m_modifyingActions << registerAction(DELETE_END_OF_LINE,
@@ -192,9 +201,12 @@ void TextEditorActionHandlerPrivate::createActions()
[] (TextEditorWidget *w) { w->deleteEndOfWord(); }, true, Tr::tr("Delete Word from Cursor On"));
m_modifyingActions << registerAction(DELETE_END_OF_WORD_CAMEL_CASE,
[] (TextEditorWidget *w) { w->deleteEndOfWordCamelCase(); }, true, Tr::tr("Delete Word Camel Case from Cursor On"));
- m_modifyingActions << registerAction(DELETE_START_OF_LINE,
- [] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, Tr::tr("Delete Line up to Cursor"),
- Core::useMacShortcuts ? QKeySequence(Tr::tr("Ctrl+Backspace")) : QKeySequence());
+ m_modifyingActions << registerAction(
+ DELETE_START_OF_LINE,
+ [](TextEditorWidget *w) { w->deleteStartOfLine(); },
+ true,
+ Tr::tr("Delete Line up to Cursor"),
+ Core::useMacShortcuts ? QKeySequence(Tr::tr("Ctrl+Backspace")) : QKeySequence());
m_modifyingActions << registerAction(DELETE_START_OF_WORD,
[] (TextEditorWidget *w) { w->deleteStartOfWord(); }, true, Tr::tr("Delete Word up to Cursor"));
m_modifyingActions << registerAction(DELETE_START_OF_WORD_CAMEL_CASE,
@@ -273,7 +285,7 @@ void TextEditorActionHandlerPrivate::createActions()
QKeySequence(Tr::tr("Ctrl+Down")));
// register "Edit" Menu Actions
- Core::ActionContainer *editMenu = Core::ActionManager::actionContainer(M_EDIT);
+ ActionContainer *editMenu = ActionManager::actionContainer(M_EDIT);
registerAction(SELECT_ENCODING,
[] (TextEditorWidget *w) { w->selectEncoding(); }, false, Tr::tr("Select Encoding..."),
QKeySequence(), G_EDIT_OTHER, editMenu);
@@ -285,7 +297,7 @@ void TextEditorActionHandlerPrivate::createActions()
QKeySequence(Core::useMacShortcuts ? Tr::tr("Ctrl+Alt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu);
// register "Edit -> Advanced" Menu Actions
- Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED);
+ ActionContainer *advancedEditMenu = ActionManager::actionContainer(M_EDIT_ADVANCED);
m_autoIndentAction = registerAction(AUTO_INDENT_SELECTION,
[] (TextEditorWidget *w) { w->autoIndent(); }, true, Tr::tr("Auto-&indent Selection"),
QKeySequence(Tr::tr("Ctrl+I")),
@@ -567,7 +579,7 @@ void TextEditorActionHandlerPrivate::updateCopyAction(bool hasCopyableText)
m_copyHtmlAction->setEnabled(hasCopyableText);
}
-void TextEditorActionHandlerPrivate::updateCurrentEditor(Core::IEditor *editor)
+void TextEditorActionHandlerPrivate::updateCurrentEditor(IEditor *editor)
{
if (m_currentEditorWidget)
m_currentEditorWidget->disconnect(this);
@@ -619,7 +631,7 @@ TextEditorActionHandler::~TextEditorActionHandler()
void TextEditorActionHandler::updateCurrentEditor()
{
- d->updateCurrentEditor(Core::EditorManager::currentEditor());
+ d->updateCurrentEditor(EditorManager::currentEditor());
}
void TextEditorActionHandler::updateActions()