Commit 768dd19e authored by con's avatar con

Fixes: - API doc for ActionManager and remove some deprecated things

Details:
ActionManager::registerAction(qaction, id):
  use registerAction(qaction, id, QList<int>() << Core::C_GLOBAL_ID)
ActionManager::addAction/Menu:
  use ActionManager::actionContainer + IActionContainer::addAction/Menu
parent 0ec5f954
...@@ -79,8 +79,3 @@ ...@@ -79,8 +79,3 @@
\generatelist functionindex \generatelist functionindex
*/ */
/*!
\group qtc
\title Core Plugin
*/
...@@ -177,13 +177,11 @@ bool ActionContainer::hasState(ContainerState state) const ...@@ -177,13 +177,11 @@ bool ActionContainer::hasState(ContainerState state) const
/*! /*!
... ...
*/ */
void ActionContainer::appendGroup(const QString &group, bool global) void ActionContainer::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;
if (global)
ActionManagerPrivate::instance()->registerGlobalGroup(gid, m_id);
} }
/*! /*!
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
bool hasState(ContainerState state) const; bool hasState(ContainerState state) const;
QAction *insertLocation(const QString &group) const; QAction *insertLocation(const QString &group) const;
void appendGroup(const QString &group, bool global = false); void appendGroup(const QString &group);
void addAction(ICommand *action, const QString &group = QString()); void addAction(ICommand *action, const QString &group = QString());
void addMenu(IActionContainer *menu, const QString &group = QString()); void addMenu(IActionContainer *menu, const QString &group = QString());
......
...@@ -63,11 +63,6 @@ public: ...@@ -63,11 +63,6 @@ public:
virtual ICommand *registerAction(QAction *action, const QString &id, const QList<int> &context) = 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 ICommand *registerShortcut(QShortcut *shortcut, const QString &id, const QList<int> &context) = 0;
virtual ICommand *registerAction(QAction *action, const QString &id) = 0;
virtual void addAction(ICommand *action, const QString &globalGroup) = 0;
virtual void addMenu(IActionContainer *menu, const QString &globalGroup) = 0;
virtual ICommand *command(const QString &id) const = 0; virtual ICommand *command(const QString &id) const = 0;
virtual IActionContainer *actionContainer(const QString &id) const = 0; virtual IActionContainer *actionContainer(const QString &id) const = 0;
}; };
......
...@@ -82,8 +82,6 @@ public: ...@@ -82,8 +82,6 @@ public:
ICommand *command(int uid) const; ICommand *command(int uid) const;
IActionContainer *actionContainer(int uid) const; IActionContainer *actionContainer(int uid) const;
void registerGlobalGroup(int groupId, int containerId);
void initialize(); void initialize();
//ActionManager Interface //ActionManager Interface
...@@ -92,13 +90,9 @@ public: ...@@ -92,13 +90,9 @@ public:
ICommand *registerAction(QAction *action, const QString &id, ICommand *registerAction(QAction *action, const QString &id,
const QList<int> &context); const QList<int> &context);
ICommand *registerAction(QAction *action, const QString &id);
ICommand *registerShortcut(QShortcut *shortcut, const QString &id, ICommand *registerShortcut(QShortcut *shortcut, const QString &id,
const QList<int> &context); const QList<int> &context);
void addAction(Core::ICommand *action, const QString &globalGroup);
void addMenu(Core::IActionContainer *menu, const QString &globalGroup);
Core::ICommand *command(const QString &id) const; Core::ICommand *command(const QString &id) const;
Core::IActionContainer *actionContainer(const QString &id) const; Core::IActionContainer *actionContainer(const QString &id) const;
...@@ -116,9 +110,9 @@ private: ...@@ -116,9 +110,9 @@ private:
typedef QHash<int, ActionContainer *> IdContainerMap; typedef QHash<int, ActionContainer *> IdContainerMap;
IdContainerMap m_idContainerMap; IdContainerMap m_idContainerMap;
typedef QMap<int, int> GlobalGroupMap; // typedef QMap<int, int> GlobalGroupMap;
GlobalGroupMap m_globalgroups; // GlobalGroupMap m_globalgroups;
//
QList<int> m_context; QList<int> m_context;
MainWindow *m_mainWnd; MainWindow *m_mainWnd;
......
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
virtual QMenuBar *menuBar() const = 0; virtual QMenuBar *menuBar() const = 0;
virtual QAction *insertLocation(const QString &group) const = 0; virtual QAction *insertLocation(const QString &group) const = 0;
virtual void appendGroup(const QString &group, bool global = false) = 0; virtual void appendGroup(const QString &group) = 0;
virtual void addAction(Core::ICommand *action, const QString &group = QString()) = 0; virtual void addAction(Core::ICommand *action, const QString &group = QString()) = 0;
virtual void addMenu(Core::IActionContainer *menu, const QString &group = QString()) = 0; virtual void addMenu(Core::IActionContainer *menu, const QString &group = QString()) = 0;
......
...@@ -398,7 +398,7 @@ void MainWindow::registerDefaultContainers() ...@@ -398,7 +398,7 @@ void MainWindow::registerDefaultContainers()
medit->appendGroup(Constants::G_EDIT_COPYPASTE); medit->appendGroup(Constants::G_EDIT_COPYPASTE);
medit->appendGroup(Constants::G_EDIT_SELECTALL); medit->appendGroup(Constants::G_EDIT_SELECTALL);
medit->appendGroup(Constants::G_EDIT_FORMAT); medit->appendGroup(Constants::G_EDIT_FORMAT);
medit->appendGroup(Constants::G_EDIT_FIND, true); medit->appendGroup(Constants::G_EDIT_FIND);
medit->appendGroup(Constants::G_EDIT_OTHER); medit->appendGroup(Constants::G_EDIT_OTHER);
//Tools Menu //Tools Menu
...@@ -417,14 +417,14 @@ void MainWindow::registerDefaultContainers() ...@@ -417,14 +417,14 @@ void MainWindow::registerDefaultContainers()
mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE); mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE);
mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE_GROUPS); mwindow->appendGroup(Constants::G_WINDOW_NAVIGATE_GROUPS);
mwindow->appendGroup(Constants::G_WINDOW_OTHER); mwindow->appendGroup(Constants::G_WINDOW_OTHER);
mwindow->appendGroup(Constants::G_WINDOW_LIST, true); mwindow->appendGroup(Constants::G_WINDOW_LIST);
//Help Menu //Help Menu
ac = am->createMenu(Constants::M_HELP); ac = am->createMenu(Constants::M_HELP);
menubar->addMenu(ac, Constants::G_HELP); menubar->addMenu(ac, Constants::G_HELP);
ac->menu()->setTitle(tr("&Help")); ac->menu()->setTitle(tr("&Help"));
ac->appendGroup(Constants::G_HELP_HELP, true); ac->appendGroup(Constants::G_HELP_HELP);
ac->appendGroup(Constants::G_HELP_ABOUT, true); ac->appendGroup(Constants::G_HELP_ABOUT);
} }
static ICommand *createSeparator(ActionManagerPrivate *am, QObject *parent, static ICommand *createSeparator(ActionManagerPrivate *am, QObject *parent,
...@@ -511,7 +511,7 @@ void MainWindow::registerDefaultActions() ...@@ -511,7 +511,7 @@ void MainWindow::registerDefaultActions()
//Save Action //Save Action
QAction *tmpaction = new QAction(QIcon(Constants::ICON_SAVEFILE), tr("&Save"), this); QAction *tmpaction = new QAction(QIcon(Constants::ICON_SAVEFILE), tr("&Save"), this);
cmd = am->registerAction(tmpaction, Constants::SAVE); cmd = am->registerAction(tmpaction, Constants::SAVE, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Save); cmd->setDefaultKeySequence(QKeySequence::Save);
cmd->setAttribute(ICommand::CA_UpdateText); cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setDefaultText(tr("&Save")); cmd->setDefaultText(tr("&Save"));
...@@ -519,7 +519,7 @@ void MainWindow::registerDefaultActions() ...@@ -519,7 +519,7 @@ void MainWindow::registerDefaultActions()
//Save As Action //Save As Action
tmpaction = new QAction(tr("Save &As..."), this); tmpaction = new QAction(tr("Save &As..."), this);
cmd = am->registerAction(tmpaction, Constants::SAVEAS); cmd = am->registerAction(tmpaction, Constants::SAVEAS, m_globalContext);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+S"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+S")));
#endif #endif
...@@ -538,7 +538,7 @@ void MainWindow::registerDefaultActions() ...@@ -538,7 +538,7 @@ void MainWindow::registerDefaultActions()
//Print Action //Print Action
tmpaction = new QAction(tr("&Print..."), this); tmpaction = new QAction(tr("&Print..."), this);
cmd = am->registerAction(tmpaction, Constants::PRINT); cmd = am->registerAction(tmpaction, Constants::PRINT, m_globalContext);
mfile->addAction(cmd, Constants::G_FILE_PRINT); mfile->addAction(cmd, Constants::G_FILE_PRINT);
//Exit Action //Exit Action
...@@ -550,7 +550,7 @@ void MainWindow::registerDefaultActions() ...@@ -550,7 +550,7 @@ void MainWindow::registerDefaultActions()
//Undo Action //Undo Action
tmpaction = new QAction(QIcon(Constants::ICON_UNDO), tr("&Undo"), this); tmpaction = new QAction(QIcon(Constants::ICON_UNDO), tr("&Undo"), this);
cmd = am->registerAction(tmpaction, Constants::UNDO); cmd = am->registerAction(tmpaction, Constants::UNDO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Undo); cmd->setDefaultKeySequence(QKeySequence::Undo);
cmd->setAttribute(ICommand::CA_UpdateText); cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setDefaultText(tr("&Undo")); cmd->setDefaultText(tr("&Undo"));
...@@ -558,7 +558,7 @@ void MainWindow::registerDefaultActions() ...@@ -558,7 +558,7 @@ void MainWindow::registerDefaultActions()
//Redo Action //Redo Action
tmpaction = new QAction(QIcon(Constants::ICON_REDO), tr("&Redo"), this); tmpaction = new QAction(QIcon(Constants::ICON_REDO), tr("&Redo"), this);
cmd = am->registerAction(tmpaction, Constants::REDO); cmd = am->registerAction(tmpaction, Constants::REDO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Redo); cmd->setDefaultKeySequence(QKeySequence::Redo);
cmd->setAttribute(ICommand::CA_UpdateText); cmd->setAttribute(ICommand::CA_UpdateText);
cmd->setDefaultText(tr("&Redo")); cmd->setDefaultText(tr("&Redo"));
...@@ -566,31 +566,31 @@ void MainWindow::registerDefaultActions() ...@@ -566,31 +566,31 @@ void MainWindow::registerDefaultActions()
//Cut Action //Cut Action
tmpaction = new QAction(QIcon(Constants::ICON_CUT), tr("Cu&t"), this); tmpaction = new QAction(QIcon(Constants::ICON_CUT), tr("Cu&t"), this);
cmd = am->registerAction(tmpaction, Constants::CUT); cmd = am->registerAction(tmpaction, Constants::CUT, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Cut); cmd->setDefaultKeySequence(QKeySequence::Cut);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
//Copy Action //Copy Action
tmpaction = new QAction(QIcon(Constants::ICON_COPY), tr("&Copy"), this); tmpaction = new QAction(QIcon(Constants::ICON_COPY), tr("&Copy"), this);
cmd = am->registerAction(tmpaction, Constants::COPY); cmd = am->registerAction(tmpaction, Constants::COPY, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Copy); cmd->setDefaultKeySequence(QKeySequence::Copy);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
//Paste Action //Paste Action
tmpaction = new QAction(QIcon(Constants::ICON_PASTE), tr("&Paste"), this); tmpaction = new QAction(QIcon(Constants::ICON_PASTE), tr("&Paste"), this);
cmd = am->registerAction(tmpaction, Constants::PASTE); cmd = am->registerAction(tmpaction, Constants::PASTE, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Paste); cmd->setDefaultKeySequence(QKeySequence::Paste);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
//Select All //Select All
tmpaction = new QAction(tr("&Select All"), this); tmpaction = new QAction(tr("&Select All"), this);
cmd = am->registerAction(tmpaction, Constants::SELECTALL); cmd = am->registerAction(tmpaction, Constants::SELECTALL, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::SelectAll); cmd->setDefaultKeySequence(QKeySequence::SelectAll);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL); medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
//Goto Action //Goto Action
tmpaction = new QAction(tr("&Go To Line..."), this); tmpaction = new QAction(tr("&Go To Line..."), this);
cmd = am->registerAction(tmpaction, Constants::GOTO); cmd = am->registerAction(tmpaction, Constants::GOTO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L")));
medit->addAction(cmd, Constants::G_EDIT_OTHER); medit->addAction(cmd, Constants::G_EDIT_OTHER);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment