Commit 78dc4ee1 authored by hjk's avatar hjk Committed by Eike Ziller
Browse files

Debugger: Add view menu to toolbar



Change-Id: I8783ce66d28626e9a484d6aa729fccd07bbda0b8
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 14cca9e9
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <QDockWidget> #include <QDockWidget>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QToolButton>
using namespace Core; using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
...@@ -113,6 +114,7 @@ public: ...@@ -113,6 +114,7 @@ public:
DebuggerLanguages m_supportedLanguages; DebuggerLanguages m_supportedLanguages;
QWidget *m_debugToolBar; QWidget *m_debugToolBar;
QToolButton *m_viewButton;
QHBoxLayout *m_debugToolBarLayout; QHBoxLayout *m_debugToolBarLayout;
QHash<DebuggerLanguage, Context> m_contextsForLanguage; QHash<DebuggerLanguage, Context> m_contextsForLanguage;
...@@ -500,6 +502,12 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) ...@@ -500,6 +502,12 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
documentAndRightPane->setStretchFactor(0, 1); documentAndRightPane->setStretchFactor(0, 1);
documentAndRightPane->setStretchFactor(1, 0); documentAndRightPane->setStretchFactor(1, 0);
d->m_viewButton = new QToolButton();
// FIXME: Use real thing after string freeze.
QString hackyName = QCoreApplication::translate("Core::Internal::MainWindow", "&Views");
hackyName.replace(QLatin1Char('&'), QString());
d->m_viewButton->setText(hackyName);
Utils::StyledBar *debugToolBar = new Utils::StyledBar; Utils::StyledBar *debugToolBar = new Utils::StyledBar;
debugToolBar->setProperty("topBorder", true); debugToolBar->setProperty("topBorder", true);
QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar); QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar);
...@@ -507,6 +515,9 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) ...@@ -507,6 +515,9 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
debugToolBarLayout->setSpacing(0); debugToolBarLayout->setSpacing(0);
debugToolBarLayout->addWidget(d->m_debugToolBar); debugToolBarLayout->addWidget(d->m_debugToolBar);
debugToolBarLayout->addWidget(new Utils::StyledSeparator); debugToolBarLayout->addWidget(new Utils::StyledSeparator);
debugToolBarLayout->addWidget(d->m_viewButton);
connect(d->m_viewButton, SIGNAL(clicked()), this, SLOT(showViewsMenu()));
QDockWidget *dock = new QDockWidget(DebuggerMainWindowPrivate::tr("Debugger Toolbar")); QDockWidget *dock = new QDockWidget(DebuggerMainWindowPrivate::tr("Debugger Toolbar"));
dock->setObjectName(QLatin1String("Debugger Toolbar")); dock->setObjectName(QLatin1String("Debugger Toolbar"));
...@@ -569,6 +580,13 @@ void DebuggerMainWindow::writeSettings() const ...@@ -569,6 +580,13 @@ void DebuggerMainWindow::writeSettings() const
settings->endGroup(); settings->endGroup();
} }
void DebuggerMainWindow::showViewsMenu()
{
QMenu *menu = createPopupMenu();
menu->exec(d->m_viewButton->mapToGlobal(QPoint()));
delete menu;
}
void DebuggerMainWindow::readSettings() void DebuggerMainWindow::readSettings()
{ {
QSettings *settings = ICore::settings(); QSettings *settings = ICore::settings();
......
...@@ -95,6 +95,9 @@ public: ...@@ -95,6 +95,9 @@ public:
void readSettings(); void readSettings();
void writeSettings() const; void writeSettings() const;
private slots:
void showViewsMenu();
private: private:
friend class Internal::DebuggerMainWindowPrivate; friend class Internal::DebuggerMainWindowPrivate;
Internal::DebuggerMainWindowPrivate *d; Internal::DebuggerMainWindowPrivate *d;
......
...@@ -1253,6 +1253,7 @@ public: ...@@ -1253,6 +1253,7 @@ public:
QIcon m_locationMarkIcon; QIcon m_locationMarkIcon;
StatusLabel *m_statusLabel; StatusLabel *m_statusLabel;
QMenu *m_viewMenu;
QComboBox *m_threadBox; QComboBox *m_threadBox;
BaseWindow *m_breakWindow; BaseWindow *m_breakWindow;
......
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