forked from qt-creator/qt-creator
QmlDesigner/ShortcutManager: Cleanup
Remove some unneeded 0-parents, use nullptr, and do not use parameter actions when they are not needed. Change-Id: Ia556f83f7f1ce296fc08fa76cced7f41102d110f Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -63,25 +63,19 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
ShortCutManager::ShortCutManager()
|
ShortCutManager::ShortCutManager()
|
||||||
: QObject(),
|
: QObject(),
|
||||||
m_revertToSavedAction(0),
|
m_exportAsImageAction(tr("Export as &Image...")),
|
||||||
m_saveAction(0),
|
m_undoAction(tr("&Undo")),
|
||||||
m_saveAsAction(0),
|
m_redoAction(tr("&Redo")),
|
||||||
m_exportAsImageAction(tr("Export as &Image..."), 0),
|
m_deleteAction(tr("Delete")),
|
||||||
m_closeCurrentEditorAction(0),
|
m_cutAction(tr("Cu&t")),
|
||||||
m_closeAllEditorsAction(0),
|
m_copyAction(tr("&Copy")),
|
||||||
m_closeOtherEditorsAction(0),
|
m_pasteAction(tr("&Paste")),
|
||||||
m_undoAction(tr("&Undo"), 0),
|
m_selectAllAction(tr("Select &All")),
|
||||||
m_redoAction(tr("&Redo"), 0),
|
m_collapseExpandStatesAction(tr("Toggle States")),
|
||||||
m_deleteAction(tr("Delete"), tr("Delete \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
m_restoreDefaultViewAction(tr("&Restore Default View")),
|
||||||
m_cutAction(tr("Cu&t"), tr("Cut \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar")),
|
||||||
m_copyAction(tr("&Copy"), tr("Copy \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
m_toggleRightSidebarAction(tr("Toggle &Right Sidebar")),
|
||||||
m_pasteAction(tr("&Paste"), tr("Paste \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
m_switchTextFormAction(tr("Switch Text/Design")),
|
||||||
m_selectAllAction(tr("Select &All"), tr("Select All \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
|
||||||
m_collapseExpandStatesAction(tr("Toggle States"), 0),
|
|
||||||
m_restoreDefaultViewAction(tr("&Restore Default View"), 0),
|
|
||||||
m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar"), 0),
|
|
||||||
m_toggleRightSidebarAction(tr("Toggle &Right Sidebar"), 0),
|
|
||||||
m_switchTextFormAction(tr("Switch Text/Design"), 0),
|
|
||||||
m_escapeAction(this)
|
m_escapeAction(this)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -261,7 +255,7 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor)
|
|||||||
{
|
{
|
||||||
int openedCount = Core::DocumentModel::entryCount();
|
int openedCount = Core::DocumentModel::entryCount();
|
||||||
|
|
||||||
Core::IDocument *document = 0;
|
Core::IDocument *document = nullptr;
|
||||||
if (currentEditor)
|
if (currentEditor)
|
||||||
document = currentEditor->document();
|
document = currentEditor->document();
|
||||||
m_saveAction.setEnabled(document && document->isModified());
|
m_saveAction.setEnabled(document && document->isModified());
|
||||||
@@ -278,7 +272,7 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor)
|
|||||||
m_saveAction.setText(tr("&Save %1").arg(quotedName));
|
m_saveAction.setText(tr("&Save %1").arg(quotedName));
|
||||||
m_revertToSavedAction.setText(tr("Revert %1 to Saved").arg(quotedName));
|
m_revertToSavedAction.setText(tr("Revert %1 to Saved").arg(quotedName));
|
||||||
|
|
||||||
m_closeCurrentEditorAction.setEnabled(currentEditor != 0);
|
m_closeCurrentEditorAction.setEnabled(currentEditor != nullptr);
|
||||||
m_closeCurrentEditorAction.setText(tr("Close %1").arg(quotedName));
|
m_closeCurrentEditorAction.setText(tr("Close %1").arg(quotedName));
|
||||||
m_closeAllEditorsAction.setEnabled(openedCount > 0);
|
m_closeAllEditorsAction.setEnabled(openedCount > 0);
|
||||||
m_closeOtherEditorsAction.setEnabled(openedCount > 1);
|
m_closeOtherEditorsAction.setEnabled(openedCount > 1);
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <utils/parameteraction.h>
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IEditor;
|
class IEditor;
|
||||||
@@ -80,11 +79,11 @@ private:
|
|||||||
QAction m_closeOtherEditorsAction;
|
QAction m_closeOtherEditorsAction;
|
||||||
QAction m_undoAction;
|
QAction m_undoAction;
|
||||||
QAction m_redoAction;
|
QAction m_redoAction;
|
||||||
Utils::ParameterAction m_deleteAction;
|
QAction m_deleteAction;
|
||||||
Utils::ParameterAction m_cutAction;
|
QAction m_cutAction;
|
||||||
Utils::ParameterAction m_copyAction;
|
QAction m_copyAction;
|
||||||
Utils::ParameterAction m_pasteAction;
|
QAction m_pasteAction;
|
||||||
Utils::ParameterAction m_selectAllAction;
|
QAction m_selectAllAction;
|
||||||
QAction m_collapseExpandStatesAction;
|
QAction m_collapseExpandStatesAction;
|
||||||
QAction m_restoreDefaultViewAction;
|
QAction m_restoreDefaultViewAction;
|
||||||
QAction m_toggleLeftSidebarAction;
|
QAction m_toggleLeftSidebarAction;
|
||||||
|
Reference in New Issue
Block a user