diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index b15a67b01d9..3e54c85cc2d 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -264,31 +264,8 @@ FancyActionBar::FancyActionBar(QWidget *parent) spacerLayout->setSpacing(0); setLayout(spacerLayout); setContentsMargins(0,2,0,0); - - m_runButton = m_debugButton = 0; - m_inDebugMode = false; - - connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), - this, SLOT(modeChanged(Core::IMode*))); - -#ifdef Q_WS_MAC - qApp->installEventFilter(this); -#endif - } -#ifdef Q_WS_MAC -bool FancyActionBar::eventFilter(QObject *, QEvent *e) -{ - if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) { - if (static_cast(e)->key() == Qt::Key_Alt) - updateRunDebug(); - } else if (e->type() == QEvent::WindowDeactivate) - updateRunDebug(); - return false; -} -#endif - void FancyActionBar::addProjectSelector(QAction *action) { FancyToolButton* toolButton = new FancyToolButton(this); @@ -300,40 +277,11 @@ void FancyActionBar::addProjectSelector(QAction *action) void FancyActionBar::insertAction(int index, QAction *action) { FancyToolButton *toolButton = new FancyToolButton(this); - if (action->objectName() == QLatin1String("ProjectExplorer.Run")) - m_runButton = toolButton; - if (action->objectName() == QLatin1String("ProjectExplorer.Debug")) - m_debugButton = toolButton; - toolButton->setDefaultAction(action); connect(action, SIGNAL(changed()), toolButton, SLOT(actionChanged())); m_actionsLayout->insertWidget(index, toolButton); } -void FancyActionBar::modeChanged(Core::IMode *mode) -{ - m_inDebugMode = (mode->id() == QLatin1String("Debugger.Mode.Debug")); - updateRunDebug(); -} - -void FancyActionBar::updateRunDebug() -{ - if (!m_runButton || !m_debugButton) - return; - - bool doDebug = m_inDebugMode; -#ifdef Q_WS_MAC - if (QApplication::keyboardModifiers() && Qt::AltModifier) - doDebug = !doDebug; -#endif - - layout()->setEnabled(false); - m_runButton->forceVisible(!doDebug); - m_debugButton->forceVisible(doDebug); - layout()->setEnabled(true); - -} - QLayout *FancyActionBar::actionsLayout() const { return m_actionsLayout; diff --git a/src/plugins/coreplugin/fancyactionbar.h b/src/plugins/coreplugin/fancyactionbar.h index eb1d5271099..1ec1eff4449 100644 --- a/src/plugins/coreplugin/fancyactionbar.h +++ b/src/plugins/coreplugin/fancyactionbar.h @@ -75,23 +75,13 @@ class FancyActionBar : public QWidget public: FancyActionBar(QWidget *parent = 0); -#ifdef Q_WS_MAC - bool eventFilter(QObject *, QEvent *); -#endif void paintEvent(QPaintEvent *event); void insertAction(int index, QAction *action); void addProjectSelector(QAction *action); QLayout *actionsLayout() const; -private slots: - void modeChanged(Core::IMode *mode); - private: - void updateRunDebug(); - bool m_inDebugMode; QVBoxLayout *m_actionsLayout; - FancyToolButton *m_runButton; - FancyToolButton *m_debugButton; }; } // namespace Internal