Commit fbfcc9a4 authored by con's avatar con

Fixes: - ICommand --> Command

Details:  - Naming convention
parent d9f97aa1
......@@ -87,7 +87,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
//Toggle
m_toggleAction = new QAction(tr("Toggle Bookmark"), this);
Core::ICommand *cmd =
Core::Command *cmd =
am->registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, textcontext);
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
......
......@@ -100,7 +100,7 @@ using namespace Core::Internal;
*/
/*!
\fn virtual void ActionContainer::addAction(Core::ICommand *action, const QString &group)
\fn virtual void ActionContainer::addAction(Core::Command *action, const QString &group)
*/
/*!
......@@ -164,7 +164,7 @@ QAction *ActionContainerPrivate::insertLocation(const QString &group) const
return beforeAction(pos, &prevKey);
}
void ActionContainerPrivate::addAction(ICommand *action, const QString &group)
void ActionContainerPrivate::addAction(Command *action, const QString &group)
{
if (!canAddAction(action))
return;
......@@ -234,9 +234,9 @@ QMenuBar *ActionContainerPrivate::menuBar() const
return 0;
}
bool ActionContainerPrivate::canAddAction(ICommand *action) const
bool ActionContainerPrivate::canAddAction(Command *action) const
{
if (action->type() != ICommand::CT_OverridableAction)
if (action->type() != Command::CT_OverridableAction)
return false;
CommandPrivate *cmd = static_cast<CommandPrivate *>(action);
......@@ -246,7 +246,7 @@ bool ActionContainerPrivate::canAddAction(ICommand *action) const
return true;
}
void ActionContainerPrivate::addAction(ICommand *action, int pos, bool setpos)
void ActionContainerPrivate::addAction(Command *action, int pos, bool setpos)
{
Action *a = static_cast<Action *>(action);
......@@ -309,7 +309,7 @@ QAction *ActionContainerPrivate::beforeAction(int pos, int *prevKey) const
if (baId == -1)
return 0;
if (ICommand *cmd = am->command(baId))
if (Command *cmd = am->command(baId))
return cmd->action();
if (ActionContainer *container = am->actionContainer(baId))
if (QMenu *menu = container->menu())
......@@ -398,7 +398,7 @@ bool MenuActionContainer::update()
}
}
if (!hasitems) {
foreach (ICommand *command, commands()) {
foreach (Command *command, commands()) {
if (command->isActive()) {
hasitems = true;
break;
......
......@@ -42,7 +42,7 @@
namespace Core {
class ICommand;
class Command;
class ActionContainer : public QObject
{
......@@ -63,7 +63,7 @@ public:
virtual QAction *insertLocation(const QString &group) const = 0;
virtual void appendGroup(const QString &group) = 0;
virtual void addAction(Core::ICommand *action, const QString &group = QString()) = 0;
virtual void addAction(Core::Command *action, const QString &group = QString()) = 0;
virtual void addMenu(Core::ActionContainer *menu, const QString &group = QString()) = 0;
virtual bool update() = 0;
......
......@@ -37,7 +37,7 @@
#include "actionmanager_p.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/icommand.h>
#include <coreplugin/actionmanager/command.h>
namespace Core {
namespace Internal {
......@@ -63,7 +63,7 @@ public:
QAction *insertLocation(const QString &group) const;
void appendGroup(const QString &group);
void addAction(ICommand *action, const QString &group = QString());
void addAction(Command *action, const QString &group = QString());
void addMenu(ActionContainer *menu, const QString &group = QString());
int id() const;
......@@ -74,14 +74,14 @@ public:
virtual void insertAction(QAction *before, QAction *action) = 0;
virtual void insertMenu(QAction *before, QMenu *menu) = 0;
QList<ICommand *> commands() const { return m_commands; }
QList<Command *> commands() const { return m_commands; }
QList<ActionContainer *> subContainers() const { return m_subContainers; }
protected:
bool canAddAction(ICommand *action) const;
bool canAddAction(Command *action) const;
bool canAddMenu(ActionContainer *menu) const;
virtual bool canBeAddedToMenu() const = 0;
void addAction(ICommand *action, int pos, bool setpos);
void addAction(Command *action, int pos, bool setpos);
void addMenu(ActionContainer *menu, int pos, bool setpos);
private:
......@@ -93,7 +93,7 @@ private:
int m_id;
QMap<int, int> m_posmap;
QList<ActionContainer *> m_subContainers;
QList<ICommand *> m_commands;
QList<Command *> m_commands;
};
class MenuActionContainer : public ActionContainerPrivate
......
......@@ -70,10 +70,10 @@ namespace {
All actions that are registered with the same string id (but different context lists)
are considered to be overloads of the same command, represented by an instance
of the ICommand class.
The action that is visible to the user is the one returned by ICommand::action().
of the Command class.
The action that is visible to the user is the one returned by Command::action().
If you provide yourself a user visible representation of your action you need
to use ICommand::action() for this.
to use Command::action() for this.
When this action is invoked by the user,
the signal is forwarded to the registered action that is valid for the current context.
......@@ -83,7 +83,7 @@ namespace {
Core::ActionManager *am = ExtensionSystem::PluginManager::instance()
->getObject<Core::ICore>()->actionManager();
QAction *myAction = new QAction(tr("My Action"), this);
Core::ICommand *cmd = am->registerAction(myAction,
Core::Command *cmd = am->registerAction(myAction,
"myplugin.myaction",
QList<int>() << C_GLOBAL_ID);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+u")));
......@@ -92,7 +92,7 @@ namespace {
So the \c connect is done to your own QAction instance. If you create e.g.
a tool button that should represent the action you add the action
from ICommand::action() to it:
from Command::action() to it:
\code
QToolButton *myButton = new QToolButton(someParentWidget);
myButton->setDefaultAction(cmd->action());
......@@ -123,7 +123,7 @@ namespace {
\endlist
\sa Core::ICore
\sa Core::ICommand
\sa Core::Command
\sa Core::ActionContainer
\sa Core::IContext
*/
......@@ -149,7 +149,7 @@ namespace {
*/
/*!
\fn ICommand *ActionManager::registerAction(QAction *action, const QString &id, const QList<int> &context)
\fn Command *ActionManager::registerAction(QAction *action, const QString &id, const QList<int> &context)
\brief Makes an \a action known to the system under the specified string \a id.
Returns a command object that represents the action in the application and is
......@@ -160,7 +160,7 @@ namespace {
*/
/*!
\fn ICommand *ActionManager::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
\fn Command *ActionManager::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
\brief Makes a \a shortcut known to the system under the specified string \a id.
Returns a command object that represents the shortcut in the application and is
......@@ -171,8 +171,8 @@ namespace {
*/
/*!
\fn ICommand *ActionManager::command(const QString &id) const
\brief Returns the ICommand object that is known to the system
\fn Command *ActionManager::command(const QString &id) const
\brief Returns the Command object that is known to the system
under the given string \a id.
\sa ActionManager::registerAction()
......@@ -308,22 +308,22 @@ ActionContainer *ActionManagerPrivate::createMenuBar(const QString &id)
return mbc;
}
ICommand *ActionManagerPrivate::registerAction(QAction *action, const QString &id, const QList<int> &context)
Command *ActionManagerPrivate::registerAction(QAction *action, const QString &id, const QList<int> &context)
{
OverrideableAction *a = 0;
ICommand *c = registerOverridableAction(action, id, false);
Command *c = registerOverridableAction(action, id, false);
a = static_cast<OverrideableAction *>(c);
if (a)
a->addOverrideAction(action, context);
return a;
}
ICommand *ActionManagerPrivate::registerOverridableAction(QAction *action, const QString &id, bool checkUnique)
Command *ActionManagerPrivate::registerOverridableAction(QAction *action, const QString &id, bool checkUnique)
{
OverrideableAction *a = 0;
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) {
if (c->type() != ICommand::CT_OverridableAction) {
if (c->type() != Command::CT_OverridableAction) {
qWarning() << "registerAction: id" << id << "is registered with a different command type.";
return c;
}
......@@ -364,12 +364,12 @@ ICommand *ActionManagerPrivate::registerOverridableAction(QAction *action, const
return a;
}
ICommand *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context)
{
Shortcut *sc = 0;
int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) {
if (c->type() != ICommand::CT_Shortcut) {
if (c->type() != Command::CT_Shortcut) {
qWarning() << "registerShortcut: id" << id << "is registered with a different command type.";
return c;
}
......@@ -401,7 +401,7 @@ ICommand *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QStr
return sc;
}
ICommand *ActionManagerPrivate::command(const QString &id) const
Command *ActionManagerPrivate::command(const QString &id) const
{
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid);
......@@ -425,7 +425,7 @@ ActionContainer *ActionManagerPrivate::actionContainer(const QString &id) const
return it.value();
}
ICommand *ActionManagerPrivate::command(int uid) const
Command *ActionManagerPrivate::command(int uid) const
{
const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid);
if (it == m_idCmdMap.constEnd()) {
......@@ -461,7 +461,7 @@ void ActionManagerPrivate::initialize()
const QKeySequence key(settings->value(QLatin1String(sequenceKey)).toString());
const int id = m_mainWnd->uniqueIDManager()->uniqueIdentifier(sid);
ICommand *cmd = command(id);
Command *cmd = command(id);
if (cmd)
cmd->setKeySequence(key);
}
......
......@@ -37,7 +37,7 @@
#include "coreplugin/core_global.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/icommand.h>
#include <coreplugin/actionmanager/command.h>
#include <QtCore/QObject>
#include <QtCore/QList>
......@@ -60,10 +60,10 @@ public:
virtual ActionContainer *createMenu(const QString &id) = 0;
virtual ActionContainer *createMenuBar(const QString &id) = 0;
virtual ICommand *registerAction(QAction *action, const QString &id, const QList<int> &context) = 0;
virtual ICommand *registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0;
virtual Command *registerAction(QAction *action, const QString &id, const QList<int> &context) = 0;
virtual Command *registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0;
virtual ICommand *command(const QString &id) const = 0;
virtual Command *command(const QString &id) const = 0;
virtual ActionContainer *actionContainer(const QString &id) const = 0;
};
......
......@@ -79,7 +79,7 @@ public:
bool hasContext(int context) const;
ICommand *command(int uid) const;
Command *command(int uid) const;
ActionContainer *actionContainer(int uid) const;
void initialize();
......@@ -88,17 +88,17 @@ public:
ActionContainer *createMenu(const QString &id);
ActionContainer *createMenuBar(const QString &id);
ICommand *registerAction(QAction *action, const QString &id,
Command *registerAction(QAction *action, const QString &id,
const QList<int> &context);
ICommand *registerShortcut(QShortcut *shortcut, const QString &id,
Command *registerShortcut(QShortcut *shortcut, const QString &id,
const QList<int> &context);
Core::ICommand *command(const QString &id) const;
Core::Command *command(const QString &id) const;
Core::ActionContainer *actionContainer(const QString &id) const;
private:
bool hasContext(QList<int> context) const;
ICommand *registerOverridableAction(QAction *action, const QString &id,
Command *registerOverridableAction(QAction *action, const QString &id,
bool checkUnique);
static ActionManagerPrivate* m_instance;
......
......@@ -38,10 +38,9 @@
#include "command_p.h"
/*!
\class Core::ICommand
\class Core::Command
\mainclass
\ingroup qwb
\inheaderfile icommand.h
\brief The class...
......@@ -49,57 +48,57 @@
*/
/*!
\enum ICommand::CommandType
\enum Command::CommandType
*/
/*!
\enum ICommand::CommandAttribute
\enum Command::CommandAttribute
*/
/*!
\fn void ICommand::setCategory(const QString &name)
\fn void Command::setCategory(const QString &name)
Sets the category to \a name.
*/
/*!
\fn virtual void ICommand::setDefaultKeySequence(const QKeySequence &key)
\fn virtual void Command::setDefaultKeySequence(const QKeySequence &key)
*/
/*!
\fn virtual int ICommand::id() const
\fn virtual int Command::id() const
*/
/*!
\fn virtual CommandType ICommand::type() const
\fn virtual CommandType Command::type() const
*/
/*!
\fn virtual QAction *ICommand::action() const
\fn virtual QAction *Command::action() const
*/
/*!
\fn virtual QShortcut *ICommand::shortcut() const
\fn virtual QShortcut *Command::shortcut() const
*/
/*!
\fn virtual void ICommand::setAttribute(CommandAttribute attr)
\fn virtual void Command::setAttribute(CommandAttribute attr)
*/
/*!
\fn virtual void ICommand::removeAttribute(CommandAttribute attr)
\fn virtual void Command::removeAttribute(CommandAttribute attr)
*/
/*!
\fn virtual bool ICommand::hasAttribute(CommandAttribute attr) const
\fn virtual bool Command::hasAttribute(CommandAttribute attr) const
*/
/*!
\fn virtual bool ICommand::isActive() const
\fn virtual bool Command::isActive() const
*/
/*!
\fn virtual ICommand::~ICommand()
\fn virtual Command::~Command()
*/
using namespace Core::Internal;
......
......@@ -31,8 +31,8 @@
**
***************************************************************************/
#ifndef ICOMMAND_H
#define ICOMMAND_H
#ifndef COMMAND_H
#define COMMAND_H
#include <coreplugin/core_global.h>
......@@ -42,7 +42,7 @@
namespace Core {
class CORE_EXPORT ICommand : public QObject
class CORE_EXPORT Command : public QObject
{
Q_OBJECT
public:
......@@ -81,7 +81,7 @@ public:
virtual bool isActive() const = 0;
virtual ~ICommand() {}
virtual ~Command() {}
virtual QString stringWithAppendedShortcut(const QString &str) const = 0;
......@@ -91,4 +91,4 @@ signals:
} // namespace Core
#endif // ICOMMAND_H
#endif // COMMAND_H
......@@ -34,7 +34,7 @@
#ifndef COMMAND_P_H
#define COMMAND_P_H
#include "icommand.h"
#include "command.h"
#include "actionmanager_p.h"
#include <QtCore/QList>
......@@ -45,7 +45,7 @@
namespace Core {
namespace Internal {
class CommandPrivate : public Core::ICommand
class CommandPrivate : public Core::Command
{
Q_OBJECT
public:
......
......@@ -100,7 +100,7 @@ HEADERS += mainwindow.h \
editormanager/ieditorfactory.h \
actionmanager/actioncontainer.h \
actionmanager/actionmanager.h \
actionmanager/icommand.h \
actionmanager/command.h \
actionmanager/actionmanager_p.h \
actionmanager/command_p.h \
actionmanager/actioncontainer_p.h \
......
......@@ -41,7 +41,7 @@
#include "filemanager.h"
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/icommand.h>
#include <coreplugin/actionmanager/command.h>
#include <QtGui/QKeyEvent>
#include <QtGui/QShortcut>
......
......@@ -47,7 +47,7 @@ QT_END_NAMESPACE
namespace Core {
class ICommand;
class Command;
namespace Internal {
......@@ -56,7 +56,7 @@ class MainWindow;
struct ShortcutItem
{
ICommand *m_cmd;
Command *m_cmd;
QKeySequence m_key;
QTreeWidgetItem *m_item;
};
......
......@@ -211,9 +211,9 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
ActionContainer *mfile = am->actionContainer(Constants::M_FILE);
//Revert to saved
ICommand *cmd = am->registerAction(m_d->m_revertToSavedAction,
Command *cmd = am->registerAction(m_d->m_revertToSavedAction,
Constants::REVERTTOSAVED, editManagerContext);
cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("Revert File to Saved"));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
connect(m_d->m_revertToSavedAction, SIGNAL(triggered()), this, SLOT(revertToSaved()));
......@@ -258,7 +258,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
//Close Action
cmd = am->registerAction(m_d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W")));
cmd->setAttribute(Core::ICommand::CA_UpdateText);
cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDefaultText(m_d->m_closeCurrentEditorAction->text());
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
connect(m_d->m_closeCurrentEditorAction, SIGNAL(triggered()), this, SLOT(closeEditor()));
......
......@@ -74,7 +74,7 @@ void EditorSplitter::registerActions()
ActionManager *am = m_core->actionManager();
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
ICommand *cmd;
Command *cmd;
//Horizontal Action
m_horizontalSplitAction = new QAction(tr("Split Left/Right"), this);
......
......@@ -428,13 +428,13 @@ void MainWindow::registerDefaultContainers()
ac->appendGroup(Constants::G_HELP_ABOUT);
}
static ICommand *createSeparator(ActionManagerPrivate *am, QObject *parent,
static Command *createSeparator(ActionManagerPrivate *am, QObject *parent,
const QString &name,
const QList<int> &context)
{
QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true);
ICommand *cmd = am->registerAction(tmpaction, name, context);
Command *cmd = am->registerAction(tmpaction, name, context);
return cmd;
}
......@@ -449,7 +449,7 @@ void MainWindow::registerDefaultActions()
ActionContainer *mhelp = am->actionContainer(Constants::M_HELP);
// File menu separators
ICommand *cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Save"), m_globalContext);
Command *cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Save"), m_globalContext);
mfile->addAction(cmd, Constants::G_FILE_SAVE);
cmd = createSeparator(am, this, QLatin1String("QtCreator.File.Sep.Print"), m_globalContext);
......@@ -514,7 +514,7 @@ void MainWindow::registerDefaultActions()
QAction *tmpaction = new QAction(QIcon(Constants::ICON_SAVEFILE), tr("&Save"), this);
cmd = am->registerAction(tmpaction, Constants::SAVE, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Save);
cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("&Save"));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
......@@ -524,7 +524,7 @@ void MainWindow::registerDefaultActions()
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+S")));
#endif
cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("Save &As..."));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
......@@ -553,7 +553,7 @@ void MainWindow::registerDefaultActions()
tmpaction = new QAction(QIcon(Constants::ICON_UNDO), tr("&Undo"), this);
cmd = am->registerAction(tmpaction, Constants::UNDO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Undo);
cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("&Undo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
......@@ -561,7 +561,7 @@ void MainWindow::registerDefaultActions()
tmpaction = new QAction(QIcon(Constants::ICON_REDO), tr("&Redo"), this);
cmd = am->registerAction(tmpaction, Constants::REDO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Redo);
cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("&Redo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
......
......@@ -40,7 +40,7 @@
#include <aggregation/aggregate.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/icommand.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreimpl.h>
#include <coreplugin/imode.h>
......@@ -144,7 +144,7 @@ void ModeManager::objectAdded(QObject *obj)
const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->uniqueModeName();
QShortcut *shortcut = new QShortcut(m_mainWindow);
shortcut->setWhatsThis(tr("Switch to %1 mode").arg(mode->name()));
ICommand *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);
Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);
m_modeShortcuts.insert(index, cmd);
connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip()));
......@@ -162,7 +162,7 @@ void ModeManager::objectAdded(QObject *obj)
void ModeManager::updateModeToolTip()
{
ICommand *cmd = qobject_cast<ICommand *>(sender());
Command *cmd = qobject_cast<Command *>(sender());
if (cmd) {
int index = m_modeShortcuts.indexOf(cmd);
if (index != -1)
......@@ -184,7 +184,7 @@ void ModeManager::aboutToRemoveObject(QObject *obj)
m_mainWindow->removeContextObject(mode);
}
void ModeManager::addAction(ICommand *command, int priority, QMenu *menu)
void ModeManager::addAction(Command *command, int priority, QMenu *menu)
{
m_actions.insert(command, priority);
......
......@@ -48,7 +48,7 @@ QT_END_NAMESPACE