Commit 1781617f authored by Eike Ziller's avatar Eike Ziller Committed by hjk

Get rid of lots of ifdef Q_OS_MAC for shortcuts.

Using a central enum now.

Change-Id: I20d88c9a3f8c62cf33e4b89a3442269f71918b06
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 1a81c33e
......@@ -245,11 +245,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_diffFile, Core::Id(Constants::DIFF), context);
command->setAttribute(Core::Command::CA_UpdateText);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+Z,Meta+D")));
#else
command->setDefaultKeySequence(QKeySequence(tr("ALT+Z,Alt+D")));
#endif
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D")));
connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
......@@ -257,11 +253,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
m_logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_logFile, Core::Id(Constants::LOG), context);
command->setAttribute(Core::Command::CA_UpdateText);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+Z,Meta+L")));
#else
command->setDefaultKeySequence(QKeySequence(tr("ALT+Z,Alt+L")));
#endif
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L")));
connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
......@@ -269,11 +261,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_statusFile, Core::Id(Constants::STATUS), context);
command->setAttribute(Core::Command::CA_UpdateText);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+Z,Meta+S")));
#else
command->setDefaultKeySequence(QKeySequence(tr("ALT+Z,Alt+S")));
#endif
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S")));
connect(m_statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
......@@ -453,11 +441,7 @@ void BazaarPlugin::createRepositoryActions(const Core::Context &context)
action = new QAction(tr("Commit..."), this);
m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::COMMIT), context);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+Z,Meta+C")));
#else
command->setDefaultKeySequence(QKeySequence(tr("ALT+Z,Alt+C")));
#endif
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C")));
connect(action, SIGNAL(triggered()), this, SLOT(commit()));
m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command);
......
......@@ -83,11 +83,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
m_toggleAction = new QAction(tr("Toggle Bookmark"), this);
Core::Command *cmd =
am->registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, textcontext);
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Meta+M")));
#endif
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M")));
mbm->addAction(cmd);
QAction *sep = new QAction(this);
......@@ -98,21 +94,13 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
//Previous
m_prevAction = new QAction(tr("Previous Bookmark"), this);
cmd = am->registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, globalcontext);
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Meta+,")));
#endif
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+,") : tr("Ctrl+,")));
mbm->addAction(cmd);
//Next
m_nextAction = new QAction(tr("Next Bookmark"), this);
cmd = am->registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, globalcontext);
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+.")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Meta+.")));
#endif
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+.") : tr("Ctrl+.")));
mbm->addAction(cmd);
sep = new QAction(this);
......
......@@ -49,6 +49,12 @@ namespace Core {
class Context;
#ifdef Q_OS_MAC
enum { UseMacShortcuts = 1 };
#else
enum { UseMacShortcuts = 0 };
#endif
class CORE_EXPORT Command : public QObject
{
Q_OBJECT
......
......@@ -369,77 +369,55 @@ EditorManager::EditorManager(QWidget *parent) :
// Goto Previous In History Action
cmd = am->registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Tab")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Tab")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Tab") : tr("Ctrl+Tab")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_gotoPreviousDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoPreviousDocHistory()));
// Goto Next In History Action
cmd = am->registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+Tab")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Tab")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Shift+Tab") : tr("Ctrl+Shift+Tab")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory()));
// Go back in navigation history
cmd = am->registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Left")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Left")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Left") : tr("Alt+Left")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_goBackAction, SIGNAL(triggered()), this, SLOT(goBackInNavigationHistory()));
// Go forward in navigation history
cmd = am->registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Right")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Right")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Right") : tr("Alt+Right")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory()));
#ifdef Q_OS_MAC
QString prefix = tr("Meta+E");
#else
QString prefix = tr("Ctrl+E");
#endif
d->m_splitAction = new QAction(tr("Split"), this);
cmd = am->registerAction(d->m_splitAction, Constants::SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("%1,2").arg(prefix)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_splitAction, SIGNAL(triggered()), this, SLOT(split()));
d->m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this);
cmd = am->registerAction(d->m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("%1,3").arg(prefix)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,3") : tr("Ctrl+E,3")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_splitSideBySideAction, SIGNAL(triggered()), this, SLOT(splitSideBySide()));
d->m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
cmd = am->registerAction(d->m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("%1,0").arg(prefix)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,0") : tr("Ctrl+E,0")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit()));
d->m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this);
cmd = am->registerAction(d->m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("%1,1").arg(prefix)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,1") : tr("Ctrl+E,1")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits()));
d->m_gotoOtherSplitAction = new QAction(tr("Go to Next Split"), this);
cmd = am->registerAction(d->m_gotoOtherSplitAction, Constants::GOTO_OTHER_SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("%1,o").arg(prefix)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_gotoOtherSplitAction, SIGNAL(triggered()), this, SLOT(gotoOtherSplit()));
......
......@@ -657,9 +657,7 @@ void MainWindow::registerDefaultActions()
tmpaction = new QAction(icon, tr("Save &As..."), this);
tmpaction->setEnabled(false);
cmd = am->registerAction(tmpaction, Constants::SAVEAS, globalContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+S")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+S") : QString()));
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Save As..."));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
......@@ -667,9 +665,7 @@ void MainWindow::registerDefaultActions()
// SaveAll Action
m_saveAllAction = new QAction(tr("Save A&ll"), this);
cmd = am->registerAction(m_saveAllAction, Constants::SAVEALL, globalContext);
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+S")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("Ctrl+Shift+S")));
mfile->addAction(cmd, Constants::G_FILE_SAVE);
connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll()));
......@@ -755,31 +751,31 @@ void MainWindow::registerDefaultActions()
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
m_optionsAction = new QAction(tr("&Options..."), this);
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
cmd->action()->setMenuRole(QAction::PreferencesRole);
#endif
if (UseMacShortcuts) {
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
cmd->action()->setMenuRole(QAction::PreferencesRole);
}
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
#ifdef Q_OS_MAC
// Minimize Action
m_minimizeAction = new QAction(tr("Minimize"), this);
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
// Zoom Action
m_zoomAction = new QAction(tr("Zoom"), this);
cmd = am->registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
// Window separator
cmd = createSeparator(am, this, Id("QtCreator.Window.Sep.Size"), globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
#endif
if (UseMacShortcuts) {
// Minimize Action
m_minimizeAction = new QAction(tr("Minimize"), this);
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
// Zoom Action
m_zoomAction = new QAction(tr("Zoom"), this);
cmd = am->registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
// Window separator
cmd = createSeparator(am, this, Id("QtCreator.Window.Sep.Size"), globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
}
// Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
......@@ -787,11 +783,7 @@ void MainWindow::registerDefaultActions()
m_toggleSideBarAction->setCheckable(true);
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
cmd->setAttribute(Command::CA_UpdateText);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+0")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+0") : tr("Alt+0")));
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
m_toggleSideBarButton->setDefaultAction(cmd->action());
mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS);
......@@ -799,25 +791,23 @@ void MainWindow::registerDefaultActions()
#if defined(Q_OS_MAC)
bool fullScreenCheckable = false;
QKeySequence fullScreenKeySequence(tr("Ctrl+Meta+F"));
const QString fullScreenActionText(tr("Enter Full Screen"));
if (MacFullScreen::supportsFullScreen()) {
bool supportsFullScreen = MacFullScreen::supportsFullScreen();
#else
bool fullScreenCheckable = true;
QKeySequence fullScreenKeySequence(tr("Ctrl+Shift+F11"));
const QString fullScreenActionText(tr("Full Screen"));
bool supportsFullScreen = true;
#endif
// Full Screen Action
m_toggleFullScreenAction = new QAction(fullScreenActionText, this);
m_toggleFullScreenAction->setCheckable(fullScreenCheckable);
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(fullScreenKeySequence);
cmd->setAttribute(Command::CA_UpdateText); /* for Mac */
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
#ifdef Q_OS_MAC
if (supportsFullScreen) {
// Full Screen Action
m_toggleFullScreenAction = new QAction(fullScreenActionText, this);
m_toggleFullScreenAction->setCheckable(fullScreenCheckable);
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
cmd->setAttribute(Command::CA_UpdateText); /* for Mac */
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
}
#endif
// Window->Views
ActionContainer *mviews = am->createMenu(Constants::M_WINDOW_VIEWS);
......
......@@ -227,10 +227,8 @@ private:
QAction *m_optionsAction;
QAction *m_toggleSideBarAction;
QAction *m_toggleFullScreenAction;
#ifdef Q_OS_MAC
QAction *m_minimizeAction;
QAction *m_zoomAction;
#endif
QToolButton *m_toggleSideBarButton;
QColor m_overrideColor;
......
......@@ -212,11 +212,8 @@ void ModeManager::objectAdded(QObject *obj)
// and still expect the current shortcut to change with it
bool currentlyHasDefaultSequence = (currentCmd->keySequence()
== currentCmd->defaultKeySequence());
#ifdef Q_OS_MAC
currentCmd->setDefaultKeySequence(QKeySequence(QString::fromLatin1("Meta+%1").arg(i+1)));
#else
currentCmd->setDefaultKeySequence(QKeySequence(QString::fromLatin1("Ctrl+%1").arg(i+1)));
#endif
currentCmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString::fromLatin1("Meta+%1").arg(i+1)
: QString::fromLatin1("Ctrl+%1").arg(i+1)));
if (currentlyHasDefaultSequence)
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
}
......
......@@ -236,11 +236,7 @@ void OutputPaneManager::init()
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext);
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+9")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+9")));
#endif
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+9") : tr("Alt+9")));
cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon);
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
......
......@@ -174,11 +174,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
m_postEditorAction = new QAction(tr("Paste Snippet..."), this);
command = actionManager->registerAction(m_postEditorAction, "CodePaster.Post", globalcontext);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+C,Meta+P")));
#else
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+P")));
#endif
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P")));
connect(m_postEditorAction, SIGNAL(triggered()), this, SLOT(postEditor()));
cpContainer->addAction(command);
......@@ -189,11 +185,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
command = actionManager->registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+C,Meta+F")));
#else
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+F")));
#endif
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F")));
connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch()));
cpContainer->addAction(command);
......
......@@ -285,11 +285,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
command = ami->registerAction(m_diffCurrentAction,
CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+C,Meta+D")));
#else
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+D")));
#endif
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D")));
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
......@@ -318,11 +314,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
command = ami->registerAction(m_addAction, CMD_ID_ADD,
globalcontext);
command->setAttribute(Command::CA_UpdateText);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+C,Meta+A")));
#else
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+A")));
#endif
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A")));
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
......@@ -331,11 +323,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
command = ami->registerAction(m_commitCurrentAction,
CMD_ID_COMMIT_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText);
#ifdef Q_OS_MAC
command->setDefaultKeySequence(QKeySequence(tr("Meta+C,Meta+C")));
#else
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+C")));
#endif
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C")));
connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
......
......@@ -54,11 +54,6 @@ const char OPENED_WITH_MEMORY[] = "MemoryView";
// Debug action
const char DEBUG[] = "Debugger.Debug";
const int P_ACTION_DEBUG = 90; // Priority for the modemanager.
#ifdef Q_OS_MAC
const char DEBUG_KEY[] = "Ctrl+Y";
#else
const char DEBUG_KEY[] = "F5";
#endif
} // namespace Constants
......
......@@ -385,38 +385,6 @@ namespace PE = ProjectExplorer::Constants;
namespace Debugger {
namespace Constants {
#ifdef Q_OS_MAC
const char STOP_KEY[] = "Shift+Ctrl+Y";
const char RESET_KEY[] = "Ctrl+Shift+F5";
const char STEP_KEY[] = "Ctrl+Shift+I";
const char STEPOUT_KEY[] = "Ctrl+Shift+T";
const char NEXT_KEY[] = "Ctrl+Shift+O";
const char REVERSE_KEY[] = "";
const char RUN_TO_LINE_KEY[] = "Shift+F8";
const char RUN_TO_SELECTED_FUNCTION_KEY[] = "Ctrl+F6";
const char JUMP_TO_LINE_KEY[] = "Ctrl+D,Ctrl+L";
const char TOGGLE_BREAK_KEY[] = "F8";
const char BREAK_BY_FUNCTION_KEY[] = "Ctrl+D,Ctrl+F";
const char BREAK_AT_MAIN_KEY[] = "Ctrl+D,Ctrl+M";
const char ADD_TO_WATCH_KEY[] = "Ctrl+D,Ctrl+W";
const char SNAPSHOT_KEY[] = "Ctrl+D,Ctrl+S";
#else
const char STOP_KEY[] = "Shift+F5";
const char RESET_KEY[] = "Ctrl+Shift+F5";
const char STEP_KEY[] = "F11";
const char STEPOUT_KEY[] = "Shift+F11";
const char NEXT_KEY[] = "F10";
const char REVERSE_KEY[] = "F12";
const char RUN_TO_LINE_KEY[] = "Ctrl+F10";
const char RUN_TO_SELECTED_FUNCTION_KEY[] = "Ctrl+F6";
const char JUMP_TO_LINE_KEY[] = "";
const char TOGGLE_BREAK_KEY[] = "F9";
const char BREAK_BY_FUNCTION_KEY[] = "";
const char BREAK_AT_MAIN_KEY[] = "";
const char ADD_TO_WATCH_KEY[] = "Ctrl+Alt+Q";
const char SNAPSHOT_KEY[] = "Ctrl+D,Ctrl+S";
#endif
} // namespace Constants
......@@ -2871,6 +2839,8 @@ QMessageBox *showMessageBox(int icon, const QString &title,
void DebuggerPluginPrivate::extensionsInitialized()
{
const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5"));
m_coreSettings = ICore::settings();
m_debuggerSettings = new DebuggerSettings(m_coreSettings);
......@@ -3158,7 +3128,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd = am->registerAction(m_startAction, Constants::DEBUG, globalcontext);
cmd->setDescription(tr("Start Debugging"));
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::DEBUG_KEY)));
cmd->setDefaultKeySequence(debugKey);
cmd->setAttribute(Command::CA_UpdateText);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
......@@ -3254,7 +3224,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd = am->registerAction(m_continueAction,
Constants::CONTINUE, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::DEBUG_KEY)));
cmd->setDefaultKeySequence(debugKey);
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_exitAction,
......@@ -3269,11 +3239,10 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd = am->registerAction(m_hiddenStopAction,
Constants::HIDDEN_STOP, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::STOP_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+Ctrl+Y") : tr("Shift+F5")));
cmd = am->registerAction(m_abortAction,
Constants::ABORT, globalcontext);
//cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::RESET_KEY)));
cmd->setDescription(tr("Reset Debugger"));
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
......@@ -3284,34 +3253,33 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd = am->registerAction(m_nextAction,
Constants::NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::NEXT_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+O") : tr("F10")));
cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
cmd = am->registerAction(m_stepAction,
Constants::STEP, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::STEP_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+I") : tr("F11")));
cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
cmd = am->registerAction(m_stepOutAction,
Constants::STEPOUT, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::STEPOUT_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+T") : tr("Shift+F11")));
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);
cmd = am->registerAction(m_runToLineAction,
"Debugger.RunToLine", cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::RUN_TO_LINE_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+F8") : tr("Ctrl+F10")));
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);
cmd = am->registerAction(m_runToSelectedFunctionAction,
"Debugger.RunToSelectedFunction", cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(
QLatin1String(Constants::RUN_TO_SELECTED_FUNCTION_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+F6") : tr("Ctrl+F6")));
cmd->setAttribute(Command::CA_Hide);
// Don't add to menu by default as keeping its enabled state
// and text up-to-date is a lot of hassle.
......@@ -3329,7 +3297,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd = am->registerAction(m_reverseDirectionAction,
Constants::REVERSE, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::REVERSE_KEY)));
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("F12")));
cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd);
......@@ -3340,7 +3308,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
//cmd = am->registerAction(m_snapshotAction,
// "Debugger.Snapshot", cppDebuggercontext);
//cmd->setDefaultKeySequence(QKeySequence(QLatin1String(Constants::SNAPSHOT_KEY)));
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+S")));