forked from qt-creator/qt-creator
Fixes: - Command --> CommandPrivate
Details: - Preparation for ICommand rename
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
#include "actioncontainer_p.h"
|
||||
#include "actionmanager_p.h"
|
||||
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include "coreconstants.h"
|
||||
@@ -171,7 +171,7 @@ void ActionContainerPrivate::addAction(ICommand *action, const QString &group)
|
||||
|
||||
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
||||
Action *a = static_cast<Action *>(action);
|
||||
if (a->stateFlags() & Command::CS_PreLocation) {
|
||||
if (a->stateFlags() & CommandPrivate::CS_PreLocation) {
|
||||
QList<CommandLocation> locs = a->locations();
|
||||
for (int i=0; i<locs.size(); ++i) {
|
||||
if (ActionContainer *aci = am->actionContainer(locs.at(i).m_container)) {
|
||||
@@ -179,7 +179,7 @@ void ActionContainerPrivate::addAction(ICommand *action, const QString &group)
|
||||
ac->addAction(action, locs.at(i).m_position, false);
|
||||
}
|
||||
}
|
||||
a->setStateFlags(a->stateFlags() | Command::CS_Initialized);
|
||||
a->setStateFlags(a->stateFlags() | CommandPrivate::CS_Initialized);
|
||||
} else {
|
||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||
int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO);
|
||||
@@ -239,8 +239,8 @@ bool ActionContainerPrivate::canAddAction(ICommand *action) const
|
||||
if (action->type() != ICommand::CT_OverridableAction)
|
||||
return false;
|
||||
|
||||
Command *cmd = static_cast<Command *>(action);
|
||||
if (cmd->stateFlags() & Command::CS_Initialized)
|
||||
CommandPrivate *cmd = static_cast<CommandPrivate *>(action);
|
||||
if (cmd->stateFlags() & CommandPrivate::CS_Initialized)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "actionmanager_p.h"
|
||||
#include "mainwindow.h"
|
||||
#include "actioncontainer_p.h"
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
#include "uniqueidmanager.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -233,7 +233,7 @@ QList<int> ActionManagerPrivate::defaultGroups() const
|
||||
return m_defaultGroups;
|
||||
}
|
||||
|
||||
QList<Command *> ActionManagerPrivate::commands() const
|
||||
QList<CommandPrivate *> ActionManagerPrivate::commands() const
|
||||
{
|
||||
return m_idCmdMap.values();
|
||||
}
|
||||
@@ -322,7 +322,7 @@ ICommand *ActionManagerPrivate::registerOverridableAction(QAction *action, const
|
||||
{
|
||||
OverrideableAction *a = 0;
|
||||
const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
if (Command *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (c->type() != ICommand::CT_OverridableAction) {
|
||||
qWarning() << "registerAction: id" << id << "is registered with a different command type.";
|
||||
return c;
|
||||
@@ -368,7 +368,7 @@ ICommand *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QStr
|
||||
{
|
||||
Shortcut *sc = 0;
|
||||
int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id);
|
||||
if (Command *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) {
|
||||
if (c->type() != ICommand::CT_Shortcut) {
|
||||
qWarning() << "registerShortcut: id" << id << "is registered with a different command type.";
|
||||
return c;
|
||||
@@ -476,7 +476,7 @@ void ActionManagerPrivate::saveSettings(QSettings *settings)
|
||||
const IdCmdMap::const_iterator cmdcend = m_idCmdMap.constEnd();
|
||||
for (IdCmdMap::const_iterator j = m_idCmdMap.constBegin(); j != cmdcend; ++j) {
|
||||
const int id = j.key();
|
||||
Command *cmd = j.value();
|
||||
CommandPrivate *cmd = j.value();
|
||||
QKeySequence key = cmd->keySequence();
|
||||
if (key != cmd->defaultKeySequence()) {
|
||||
const QString sid = m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(id);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Internal {
|
||||
|
||||
class ActionContainerPrivate;
|
||||
class MainWindow;
|
||||
class Command;
|
||||
class CommandPrivate;
|
||||
|
||||
class ActionManagerPrivate : public Core::ActionManager
|
||||
{
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
void saveSettings(QSettings *settings);
|
||||
QList<int> defaultGroups() const;
|
||||
|
||||
QList<Command *> commands() const;
|
||||
QList<CommandPrivate *> commands() const;
|
||||
QList<ActionContainerPrivate *> containers() const;
|
||||
|
||||
bool hasContext(int context) const;
|
||||
@@ -104,7 +104,7 @@ private:
|
||||
static ActionManagerPrivate* m_instance;
|
||||
QList<int> m_defaultGroups;
|
||||
|
||||
typedef QHash<int, Command *> IdCmdMap;
|
||||
typedef QHash<int, CommandPrivate *> IdCmdMap;
|
||||
IdCmdMap m_idCmdMap;
|
||||
|
||||
typedef QHash<int, ActionContainerPrivate *> IdContainerMap;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QShortcut>
|
||||
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
|
||||
/*!
|
||||
\class Core::ICommand
|
||||
@@ -105,170 +105,111 @@
|
||||
using namespace Core::Internal;
|
||||
|
||||
/*!
|
||||
\class Command
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
\class CommandPrivate
|
||||
\inheaderfile command_p.h
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Command::CommandState
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Command::Command(CommandType type, int id)
|
||||
*/
|
||||
Command::Command(CommandType type, int id)
|
||||
CommandPrivate::CommandPrivate(CommandType type, int id)
|
||||
: m_type(type), m_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual Command::~Command()
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setStateFlags(int state)
|
||||
void CommandPrivate::setStateFlags(int state)
|
||||
{
|
||||
m_type |= (state & CS_Mask);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
int Command::stateFlags() const
|
||||
int CommandPrivate::stateFlags() const
|
||||
{
|
||||
return (m_type & CS_Mask);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual QString Command::name() const
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setCategory(const QString &name)
|
||||
void CommandPrivate::setCategory(const QString &name)
|
||||
{
|
||||
m_category = name;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QString Command::category() const
|
||||
QString CommandPrivate::category() const
|
||||
{
|
||||
if (m_category.isEmpty())
|
||||
return QObject::tr("Other");
|
||||
return m_category;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setDefaultKeySequence(const QKeySequence &key)
|
||||
void CommandPrivate::setDefaultKeySequence(const QKeySequence &key)
|
||||
{
|
||||
m_defaultKey = key;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QKeySequence Command::defaultKeySequence() const
|
||||
QKeySequence CommandPrivate::defaultKeySequence() const
|
||||
{
|
||||
return m_defaultKey;
|
||||
}
|
||||
|
||||
void Command::setDefaultText(const QString &text)
|
||||
void CommandPrivate::setDefaultText(const QString &text)
|
||||
{
|
||||
m_defaultText = text;
|
||||
}
|
||||
|
||||
QString Command::defaultText() const
|
||||
QString CommandPrivate::defaultText() const
|
||||
{
|
||||
return m_defaultText;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
int Command::id() const
|
||||
int CommandPrivate::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
Command::CommandType Command::type() const
|
||||
CommandPrivate::CommandType CommandPrivate::type() const
|
||||
{
|
||||
return (CommandType)(m_type & CT_Mask);
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QAction *Command::action() const
|
||||
QAction *CommandPrivate::action() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
QShortcut *Command::shortcut() const
|
||||
QShortcut *CommandPrivate::shortcut() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::setAttribute(CommandAttribute attr)
|
||||
void CommandPrivate::setAttribute(CommandAttribute attr)
|
||||
{
|
||||
m_type |= attr;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
void Command::removeAttribute(CommandAttribute attr)
|
||||
void CommandPrivate::removeAttribute(CommandAttribute attr)
|
||||
{
|
||||
m_type &= ~attr;
|
||||
}
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
bool Command::hasAttribute(CommandAttribute attr) const
|
||||
bool CommandPrivate::hasAttribute(CommandAttribute attr) const
|
||||
{
|
||||
return (m_type & attr);
|
||||
}
|
||||
|
||||
QString Command::stringWithAppendedShortcut(const QString &str) const
|
||||
QString CommandPrivate::stringWithAppendedShortcut(const QString &str) const
|
||||
{
|
||||
return QString("%1 <span style=\"color: gray; font-size: small\">%2</span>").arg(str).arg(
|
||||
keySequence().toString(QKeySequence::NativeText));
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn virtual bool Command::setCurrentContext(const QList<int> &context) = 0
|
||||
*/
|
||||
|
||||
// ---------- Shortcut ------------
|
||||
|
||||
/*!
|
||||
\class Shortcut
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
Shortcut::Shortcut(int id)
|
||||
: Command(CT_Shortcut, id), m_shortcut(0)
|
||||
: CommandPrivate(CT_Shortcut, id), m_shortcut(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -322,7 +263,7 @@ QList<int> Shortcut::context() const
|
||||
void Shortcut::setDefaultKeySequence(const QKeySequence &key)
|
||||
{
|
||||
setKeySequence(key);
|
||||
Command::setDefaultKeySequence(key);
|
||||
CommandPrivate::setDefaultKeySequence(key);
|
||||
}
|
||||
|
||||
void Shortcut::setKeySequence(const QKeySequence &key)
|
||||
@@ -374,14 +315,13 @@ bool Shortcut::isActive() const
|
||||
/*!
|
||||
\class Action
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
...
|
||||
*/
|
||||
Action::Action(CommandType type, int id)
|
||||
: Command(type, id), m_action(0)
|
||||
: CommandPrivate(type, id), m_action(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -439,7 +379,7 @@ QList<CommandLocation> Action::locations() const
|
||||
void Action::setDefaultKeySequence(const QKeySequence &key)
|
||||
{
|
||||
setKeySequence(key);
|
||||
Command::setDefaultKeySequence(key);
|
||||
CommandPrivate::setDefaultKeySequence(key);
|
||||
}
|
||||
|
||||
void Action::setKeySequence(const QKeySequence &key)
|
||||
@@ -467,7 +407,6 @@ QKeySequence Action::keySequence() const
|
||||
/*!
|
||||
\class OverrideableAction
|
||||
\ingroup qwb
|
||||
\inheaderfile command.h
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef COMMAND_H
|
||||
#define COMMAND_H
|
||||
#ifndef COMMAND_P_H
|
||||
#define COMMAND_P_H
|
||||
|
||||
#include "icommand.h"
|
||||
#include "actionmanager_p.h"
|
||||
@@ -45,7 +45,7 @@
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class Command : public Core::ICommand
|
||||
class CommandPrivate : public Core::ICommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -56,8 +56,8 @@ public:
|
||||
CS_Mask = 0xFF0000
|
||||
};
|
||||
|
||||
Command(CommandType type, int id);
|
||||
virtual ~Command() {}
|
||||
CommandPrivate(CommandType type, int id);
|
||||
virtual ~CommandPrivate() {}
|
||||
|
||||
void setStateFlags(int state);
|
||||
int stateFlags() const;
|
||||
@@ -95,7 +95,7 @@ protected:
|
||||
QString m_defaultText;
|
||||
};
|
||||
|
||||
class Shortcut : public Command
|
||||
class Shortcut : public CommandPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
QString m_defaultText;
|
||||
};
|
||||
|
||||
class Action : public Command
|
||||
class Action : public CommandPrivate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -176,4 +176,4 @@ private:
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
#endif // COMMAND_H
|
||||
#endif // COMMAND_P_H
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "coreimpl.h"
|
||||
#include "commandsfile.h"
|
||||
#include "shortcutsettings.h"
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ HEADERS += mainwindow.h \
|
||||
actionmanager/actionmanager.h \
|
||||
actionmanager/icommand.h \
|
||||
actionmanager/actionmanager_p.h \
|
||||
actionmanager/command.h \
|
||||
actionmanager/command_p.h \
|
||||
actionmanager/actioncontainer_p.h \
|
||||
actionmanager/commandsfile.h \
|
||||
dialogs/saveitemsdialog.h \
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "shortcutsettings.h"
|
||||
#include "ui_shortcutsettings.h"
|
||||
#include "actionmanager_p.h"
|
||||
#include "command.h"
|
||||
#include "command_p.h"
|
||||
#include "coreconstants.h"
|
||||
#include "coreimpl.h"
|
||||
#include "commandsfile.h"
|
||||
@@ -285,10 +285,10 @@ void ShortcutSettings::initialize()
|
||||
UniqueIDManager *uidm =
|
||||
CoreImpl::instance()->uniqueIDManager();
|
||||
|
||||
QList<Command *> cmds = m_am->commands();
|
||||
QList<CommandPrivate *> cmds = m_am->commands();
|
||||
for (int i = 0; i < cmds.size(); ++i) {
|
||||
Command *c = cmds.at(i);
|
||||
if (c->hasAttribute(Command::CA_NonConfigureable))
|
||||
CommandPrivate *c = cmds.at(i);
|
||||
if (c->hasAttribute(CommandPrivate::CA_NonConfigureable))
|
||||
continue;
|
||||
if (c->action() && c->action()->isSeparator())
|
||||
continue;
|
||||
@@ -313,7 +313,7 @@ void ShortcutSettings::initialize()
|
||||
item->setText(0, uidm->stringForUniqueIdentifier(c->id()));
|
||||
|
||||
if (c->action()) {
|
||||
QString text = c->hasAttribute(Command::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
|
||||
QString text = c->hasAttribute(CommandPrivate::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text();
|
||||
s->m_key = c->action()->shortcut();
|
||||
item->setText(1, text);
|
||||
} else {
|
||||
|
||||
@@ -52,7 +52,6 @@ class ICommand;
|
||||
namespace Internal {
|
||||
|
||||
class ActionManagerPrivate;
|
||||
class Command;
|
||||
class MainWindow;
|
||||
|
||||
struct ShortcutItem
|
||||
|
||||
Reference in New Issue
Block a user