Fixes: - ActionContainer --> ActionContainerPrivate

Details:  - Preparation for IActionContainer --> ActionContainer
This commit is contained in:
con
2009-01-14 12:25:54 +01:00
parent df56b1069d
commit 28acadf899
6 changed files with 43 additions and 43 deletions

View File

@@ -31,7 +31,7 @@
** **
***************************************************************************/ ***************************************************************************/
#include "actioncontainer.h" #include "actioncontainer_p.h"
#include "actionmanager_p.h" #include "actionmanager_p.h"
#include "command.h" #include "command.h"
@@ -116,47 +116,47 @@ using namespace Core::Internal;
\fn virtual IActionContainer::~IActionContainer() \fn virtual IActionContainer::~IActionContainer()
*/ */
// ---------- ActionContainer ------------ // ---------- ActionContainerPrivate ------------
/*! /*!
\class Core::Internal::ActionContainer \class Core::Internal::ActionContainerPrivate
\internal \internal
*/ */
ActionContainer::ActionContainer(int id) ActionContainerPrivate::ActionContainerPrivate(int id)
: m_data(CS_None), m_id(id) : m_data(CS_None), m_id(id)
{ {
} }
void ActionContainer::setEmptyAction(EmptyAction ea) void ActionContainerPrivate::setEmptyAction(EmptyAction ea)
{ {
m_data = ((m_data & ~EA_Mask) | ea); m_data = ((m_data & ~EA_Mask) | ea);
} }
bool ActionContainer::hasEmptyAction(EmptyAction ea) const bool ActionContainerPrivate::hasEmptyAction(EmptyAction ea) const
{ {
return (m_data & EA_Mask) == ea; return (m_data & EA_Mask) == ea;
} }
void ActionContainer::setState(ContainerState state) void ActionContainerPrivate::setState(ContainerState state)
{ {
m_data |= state; m_data |= state;
} }
bool ActionContainer::hasState(ContainerState state) const bool ActionContainerPrivate::hasState(ContainerState state) const
{ {
return (m_data & state); return (m_data & state);
} }
void ActionContainer::appendGroup(const QString &group) void ActionContainerPrivate::appendGroup(const QString &group)
{ {
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
int gid = idmanager->uniqueIdentifier(group); int gid = idmanager->uniqueIdentifier(group);
m_groups << gid; m_groups << gid;
} }
QAction *ActionContainer::insertLocation(const QString &group) const QAction *ActionContainerPrivate::insertLocation(const QString &group) const
{ {
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
int grpid = idmanager->uniqueIdentifier(group); int grpid = idmanager->uniqueIdentifier(group);
@@ -165,7 +165,7 @@ QAction *ActionContainer::insertLocation(const QString &group) const
return beforeAction(pos, &prevKey); return beforeAction(pos, &prevKey);
} }
void ActionContainer::addAction(ICommand *action, const QString &group) void ActionContainerPrivate::addAction(ICommand *action, const QString &group)
{ {
if (!canAddAction(action)) if (!canAddAction(action))
return; return;
@@ -176,7 +176,7 @@ void ActionContainer::addAction(ICommand *action, const QString &group)
QList<CommandLocation> locs = a->locations(); QList<CommandLocation> locs = a->locations();
for (int i=0; i<locs.size(); ++i) { for (int i=0; i<locs.size(); ++i) {
if (IActionContainer *aci = am->actionContainer(locs.at(i).m_container)) { if (IActionContainer *aci = am->actionContainer(locs.at(i).m_container)) {
ActionContainer *ac = static_cast<ActionContainer *>(aci); ActionContainerPrivate *ac = static_cast<ActionContainerPrivate *>(aci);
ac->addAction(action, locs.at(i).m_position, false); ac->addAction(action, locs.at(i).m_position, false);
} }
} }
@@ -193,21 +193,21 @@ void ActionContainer::addAction(ICommand *action, const QString &group)
} }
} }
void ActionContainer::addMenu(IActionContainer *menu, const QString &group) void ActionContainerPrivate::addMenu(IActionContainer *menu, const QString &group)
{ {
ActionContainer *container = static_cast<ActionContainer *>(menu); ActionContainerPrivate *container = static_cast<ActionContainerPrivate *>(menu);
if (!container->canBeAddedToMenu()) if (!container->canBeAddedToMenu())
return; return;
ActionManagerPrivate *am = ActionManagerPrivate::instance(); ActionManagerPrivate *am = ActionManagerPrivate::instance();
MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu); MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu);
if (mc->hasState(ActionContainer::CS_PreLocation)) { if (mc->hasState(ActionContainerPrivate::CS_PreLocation)) {
CommandLocation loc = mc->location(); CommandLocation loc = mc->location();
if (IActionContainer *aci = am->actionContainer(loc.m_container)) { if (IActionContainer *aci = am->actionContainer(loc.m_container)) {
ActionContainer *ac = static_cast<ActionContainer *>(aci); ActionContainerPrivate *ac = static_cast<ActionContainerPrivate *>(aci);
ac->addMenu(menu, loc.m_position, false); ac->addMenu(menu, loc.m_position, false);
} }
mc->setState(ActionContainer::CS_Initialized); mc->setState(ActionContainerPrivate::CS_Initialized);
} else { } else {
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO); int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO);
@@ -220,22 +220,22 @@ void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
} }
} }
int ActionContainer::id() const int ActionContainerPrivate::id() const
{ {
return m_id; return m_id;
} }
QMenu *ActionContainer::menu() const QMenu *ActionContainerPrivate::menu() const
{ {
return 0; return 0;
} }
QMenuBar *ActionContainer::menuBar() const QMenuBar *ActionContainerPrivate::menuBar() const
{ {
return 0; return 0;
} }
bool ActionContainer::canAddAction(ICommand *action) const bool ActionContainerPrivate::canAddAction(ICommand *action) const
{ {
if (action->type() != ICommand::CT_OverridableAction) if (action->type() != ICommand::CT_OverridableAction)
return false; return false;
@@ -247,7 +247,7 @@ bool ActionContainer::canAddAction(ICommand *action) const
return true; return true;
} }
void ActionContainer::addAction(ICommand *action, int pos, bool setpos) void ActionContainerPrivate::addAction(ICommand *action, int pos, bool setpos)
{ {
Action *a = static_cast<Action *>(action); Action *a = static_cast<Action *>(action);
@@ -269,7 +269,7 @@ void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
insertAction(ba, a->action()); insertAction(ba, a->action());
} }
void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos) void ActionContainerPrivate::addMenu(IActionContainer *menu, int pos, bool setpos)
{ {
MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu); MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu);
@@ -289,7 +289,7 @@ void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
insertMenu(ba, mc->menu()); insertMenu(ba, mc->menu());
} }
QAction *ActionContainer::beforeAction(int pos, int *prevKey) const QAction *ActionContainerPrivate::beforeAction(int pos, int *prevKey) const
{ {
ActionManagerPrivate *am = ActionManagerPrivate::instance(); ActionManagerPrivate *am = ActionManagerPrivate::instance();
@@ -319,7 +319,7 @@ QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
return 0; return 0;
} }
int ActionContainer::calcPosition(int pos, int prevKey) const int ActionContainerPrivate::calcPosition(int pos, int prevKey) const
{ {
int grp = (pos & 0xFFFF0000); int grp = (pos & 0xFFFF0000);
if (prevKey == -1) if (prevKey == -1)
@@ -341,7 +341,7 @@ int ActionContainer::calcPosition(int pos, int prevKey) const
*/ */
MenuActionContainer::MenuActionContainer(int id) MenuActionContainer::MenuActionContainer(int id)
: ActionContainer(id), m_menu(0) : ActionContainerPrivate(id), m_menu(0)
{ {
setEmptyAction(EA_Disable); setEmptyAction(EA_Disable);
} }
@@ -417,7 +417,7 @@ bool MenuActionContainer::update()
bool MenuActionContainer::canBeAddedToMenu() const bool MenuActionContainer::canBeAddedToMenu() const
{ {
if (hasState(ActionContainer::CS_Initialized)) if (hasState(ActionContainerPrivate::CS_Initialized))
return false; return false;
return true; return true;
@@ -432,7 +432,7 @@ bool MenuActionContainer::canBeAddedToMenu() const
*/ */
MenuBarActionContainer::MenuBarActionContainer(int id) MenuBarActionContainer::MenuBarActionContainer(int id)
: ActionContainer(id), m_menuBar(0) : ActionContainerPrivate(id), m_menuBar(0)
{ {
setEmptyAction(EA_None); setEmptyAction(EA_None);
} }

View File

@@ -31,8 +31,8 @@
** **
***************************************************************************/ ***************************************************************************/
#ifndef ACTIONCONTAINER_H #ifndef ACTIONCONTAINER_P_H
#define ACTIONCONTAINER_H #define ACTIONCONTAINER_P_H
#include "actionmanager_p.h" #include "actionmanager_p.h"
@@ -42,7 +42,7 @@
namespace Core { namespace Core {
namespace Internal { namespace Internal {
class ActionContainer : public Core::IActionContainer class ActionContainerPrivate : public Core::IActionContainer
{ {
public: public:
enum ContainerState { enum ContainerState {
@@ -52,8 +52,8 @@ public:
CS_UserDefined = 0x040000 CS_UserDefined = 0x040000
}; };
ActionContainer(int id); ActionContainerPrivate(int id);
virtual ~ActionContainer() {} virtual ~ActionContainerPrivate() {}
void setEmptyAction(EmptyAction ea); void setEmptyAction(EmptyAction ea);
bool hasEmptyAction(EmptyAction ea) const; bool hasEmptyAction(EmptyAction ea) const;
@@ -96,7 +96,7 @@ private:
QList<ICommand *> m_commands; QList<ICommand *> m_commands;
}; };
class MenuActionContainer : public ActionContainer class MenuActionContainer : public ActionContainerPrivate
{ {
public: public:
MenuActionContainer(int id); MenuActionContainer(int id);
@@ -118,7 +118,7 @@ private:
CommandLocation m_location; CommandLocation m_location;
}; };
class MenuBarActionContainer : public ActionContainer class MenuBarActionContainer : public ActionContainerPrivate
{ {
public: public:
MenuBarActionContainer(int id); MenuBarActionContainer(int id);
@@ -139,4 +139,4 @@ private:
} // namespace Internal } // namespace Internal
} // namespace Core } // namespace Core
#endif // ACTIONCONTAINER_H #endif // ACTIONCONTAINER_P_H

View File

@@ -33,7 +33,7 @@
#include "actionmanager_p.h" #include "actionmanager_p.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "actioncontainer.h" #include "actioncontainer_p.h"
#include "command.h" #include "command.h"
#include "uniqueidmanager.h" #include "uniqueidmanager.h"
@@ -238,7 +238,7 @@ QList<Command *> ActionManagerPrivate::commands() const
return m_idCmdMap.values(); return m_idCmdMap.values();
} }
QList<ActionContainer *> ActionManagerPrivate::containers() const QList<ActionContainerPrivate *> ActionManagerPrivate::containers() const
{ {
return m_idContainerMap.values(); return m_idContainerMap.values();
} }

View File

@@ -56,7 +56,7 @@ class UniqueIDManager;
namespace Internal { namespace Internal {
class ActionContainer; class ActionContainerPrivate;
class MainWindow; class MainWindow;
class Command; class Command;
@@ -75,7 +75,7 @@ public:
QList<int> defaultGroups() const; QList<int> defaultGroups() const;
QList<Command *> commands() const; QList<Command *> commands() const;
QList<ActionContainer *> containers() const; QList<ActionContainerPrivate *> containers() const;
bool hasContext(int context) const; bool hasContext(int context) const;
@@ -107,7 +107,7 @@ private:
typedef QHash<int, Command *> IdCmdMap; typedef QHash<int, Command *> IdCmdMap;
IdCmdMap m_idCmdMap; IdCmdMap m_idCmdMap;
typedef QHash<int, ActionContainer *> IdContainerMap; typedef QHash<int, ActionContainerPrivate *> IdContainerMap;
IdContainerMap m_idContainerMap; IdContainerMap m_idContainerMap;
// typedef QMap<int, int> GlobalGroupMap; // typedef QMap<int, int> GlobalGroupMap;

View File

@@ -103,7 +103,7 @@ HEADERS += mainwindow.h \
actionmanager/icommand.h \ actionmanager/icommand.h \
actionmanager/actionmanager_p.h \ actionmanager/actionmanager_p.h \
actionmanager/command.h \ actionmanager/command.h \
actionmanager/actioncontainer.h \ actionmanager/actioncontainer_p.h \
actionmanager/commandsfile.h \ actionmanager/commandsfile.h \
dialogs/saveitemsdialog.h \ dialogs/saveitemsdialog.h \
dialogs/newdialog.h \ dialogs/newdialog.h \

View File

@@ -32,7 +32,7 @@
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "mainwindow.h"
#include "actioncontainer.h" #include "iactioncontainer.h"
#include "actionmanager_p.h" #include "actionmanager_p.h"
#include "basemode.h" #include "basemode.h"
#include "coreimpl.h" #include "coreimpl.h"