Commit 8bf142fb authored by con's avatar con
Browse files

Let ModeManager::addAction take a QAction instead of Command

There was no reason, and using QAction is more flexible.
parent e7ad89ff
......@@ -71,7 +71,7 @@ struct ModeManagerPrivate
Internal::MainWindow *m_mainWindow;
Internal::FancyTabWidget *m_modeStack;
Internal::FancyActionBar *m_actionBar;
QMap<Command*, int> m_actions;
QMap<QAction*, int> m_actions;
QVector<IMode*> m_modes;
QVector<Command*> m_modeShortcuts;
QSignalMapper *m_signalMapper;
......@@ -269,9 +269,9 @@ void ModeManager::aboutToRemoveObject(QObject *obj)
d->m_mainWindow->removeContextObject(mode);
}
void ModeManager::addAction(Command *command, int priority)
void ModeManager::addAction(QAction *action, int priority)
{
d->m_actions.insert(command, priority);
d->m_actions.insert(action, priority);
// Count the number of commands with a higher priority
int index = 0;
......@@ -280,7 +280,7 @@ void ModeManager::addAction(Command *command, int priority)
++index;
}
d->m_actionBar->insertAction(index, command->action());
d->m_actionBar->insertAction(index, action);
}
void ModeManager::addProjectSelector(QAction *action)
......
......@@ -43,8 +43,8 @@ QT_END_NAMESPACE
namespace Core {
class Command;
class IMode;
namespace Internal {
class MainWindow;
class FancyTabWidget;
......@@ -66,7 +66,7 @@ public:
IMode* currentMode() const;
IMode* mode(const QString &id) const;
void addAction(Command *command, int priority);
void addAction(QAction *action, int priority);
void addProjectSelector(QAction *action);
void addWidget(QWidget *widget);
......
......@@ -2836,7 +2836,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd->setDefaultText(tr("Start Debugging"));
cmd->setDefaultKeySequence(QKeySequence(Constants::DEBUG_KEY));
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
Core::ICore::instance()->modeManager()->addAction(cmd, Constants::P_ACTION_DEBUG);
Core::ICore::instance()->modeManager()->addAction(cmd->action(), Constants::P_ACTION_DEBUG);
cmd = am->registerAction(m_actions.continueAction,
Constants::DEBUG, m_continuableContext);
......
......@@ -582,7 +582,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
// Add to mode bar
modeManager->addAction(cmd, Constants::P_ACTION_BUILDSESSION);
modeManager->addAction(cmd->action(), Constants::P_ACTION_BUILDSESSION);
// rebuild session action
QIcon rebuildIcon(Constants::ICON_REBUILD);
......@@ -705,7 +705,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
mbuild->addAction(cmd, Constants::G_BUILD_RUN);
modeManager->addAction(cmd, Constants::P_ACTION_RUN);
modeManager->addAction(cmd->action(), Constants::P_ACTION_RUN);
d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext);
......
......@@ -99,7 +99,7 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
qemuCommand->setAttribute(Core::Command::CA_UpdateIcon);
Core::ModeManager *modeManager = core->modeManager();
modeManager->addAction(qemuCommand, 1);
modeManager->addAction(qemuCommand->action(), 1);
// listen to qt version changes to update the start button
connect(QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>)),
......
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