summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2011-03-16 18:48:14 +0100
committerhjk <qtc-committer@nokia.com>2011-03-16 18:49:01 +0100
commit82b7e9befd0eb6ef32acc1d87b7319c72e1f4bad (patch)
tree4c7d0255a831ab26a527b9b74b95c796f509e90f
parent429ed63f5d4ebcb338a925318fc154e1e9b1fe00 (diff)
downloadqt-creator-82b7e9befd0eb6ef32acc1d87b7319c72e1f4bad.tar.gz
debugger: persist 'AlwaysAdjust*ColumnWidths' settings
Task-number: QTCREATORBUG-2836
-rw-r--r--src/plugins/debugger/breakwindow.cpp18
-rw-r--r--src/plugins/debugger/breakwindow.h2
-rw-r--r--src/plugins/debugger/commonoptionspage.cpp67
-rw-r--r--src/plugins/debugger/debuggeractions.cpp56
-rw-r--r--src/plugins/debugger/debuggeractions.h19
-rw-r--r--src/plugins/debugger/moduleswindow.cpp27
-rw-r--r--src/plugins/debugger/moduleswindow.h2
-rw-r--r--src/plugins/debugger/registerwindow.cpp13
-rw-r--r--src/plugins/debugger/registerwindow.h2
-rw-r--r--src/plugins/debugger/snapshotwindow.cpp16
-rw-r--r--src/plugins/debugger/snapshotwindow.h1
-rw-r--r--src/plugins/debugger/stackwindow.cpp15
-rw-r--r--src/plugins/debugger/stackwindow.h2
-rw-r--r--src/plugins/debugger/threadswindow.cpp20
-rw-r--r--src/plugins/debugger/threadswindow.h2
-rw-r--r--src/plugins/debugger/watchwindow.cpp39
-rw-r--r--src/plugins/debugger/watchwindow.h3
17 files changed, 168 insertions, 136 deletions
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index 355a822299..1ce02e0893 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -442,10 +442,8 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWid
///////////////////////////////////////////////////////////////////////
BreakWindow::BreakWindow(QWidget *parent)
- : QTreeView(parent)
+ : QTreeView(parent)
{
- m_alwaysResizeColumnsToContents = false;
-
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false);
@@ -463,6 +461,9 @@ BreakWindow::BreakWindow(QWidget *parent)
connect(debuggerCore()->action(UseAddressInBreakpointsView),
SIGNAL(toggled(bool)),
SLOT(showAddressColumn(bool)));
+ connect(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths),
+ SIGNAL(toggled(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void BreakWindow::showAddressColumn(bool on)
@@ -559,12 +560,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *adjustColumnAction =
new QAction(tr("Adjust Column Widths to Contents"), &menu);
- QAction *alwaysAdjustAction =
- new QAction(tr("Always Adjust Column Widths to Contents"), &menu);
-
- alwaysAdjustAction->setCheckable(true);
- alwaysAdjustAction->setChecked(m_alwaysResizeColumnsToContents);
-
QAction *editBreakpointAction =
new QAction(tr("Edit Breakpoint..."), &menu);
editBreakpointAction->setEnabled(!selectedIds.isEmpty());
@@ -610,7 +605,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
menu.addAction(adjustColumnAction);
- menu.addAction(alwaysAdjustAction);
+ menu.addAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -624,8 +619,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
deleteBreakpoints(breakpointsInFile);
else if (act == adjustColumnAction)
resizeColumnsToContents();
- else if (act == alwaysAdjustAction)
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == editBreakpointAction)
editBreakpoints(selectedIds);
else if (act == associateBreakpointAction)
@@ -729,7 +722,6 @@ void BreakWindow::resizeColumnsToContents()
void BreakWindow::setAlwaysResizeColumnsToContents(bool on)
{
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
for (int i = model()->columnCount(); --i >= 0; )
diff --git a/src/plugins/debugger/breakwindow.h b/src/plugins/debugger/breakwindow.h
index 895032b22e..d6dfb020e1 100644
--- a/src/plugins/debugger/breakwindow.h
+++ b/src/plugins/debugger/breakwindow.h
@@ -70,8 +70,6 @@ private:
void editBreakpoints(const BreakpointIds &ids);
void associateBreakpoint(const BreakpointIds &ids, int thread);
void setBreakpointsEnabled(const BreakpointIds &ids, bool enabled);
-
- bool m_alwaysResizeColumnsToContents;
};
} // namespace Internal
diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp
index 79364a22d3..c18c77665a 100644
--- a/src/plugins/debugger/commonoptionspage.cpp
+++ b/src/plugins/debugger/commonoptionspage.cpp
@@ -54,38 +54,47 @@ using namespace ProjectExplorer;
namespace Debugger {
namespace Internal {
-CommonOptionsPageWidget::CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group, QWidget *parent) :
- QWidget(parent), m_group(group)
+CommonOptionsPageWidget::CommonOptionsPageWidget
+ (const QSharedPointer<Utils::SavedActionSet> &group, QWidget *parent)
+ : QWidget(parent), m_group(group)
{
m_ui.setupUi(this);
+
+ DebuggerCore *dc = debuggerCore();
m_group->clear();
- m_group->insert(debuggerCore()->action(ListSourceFiles),
+ m_group->insert(dc->action(ListSourceFiles),
m_ui.checkBoxListSourceFiles);
- m_group->insert(debuggerCore()->action(UseAlternatingRowColors),
+ m_group->insert(dc->action(UseAlternatingRowColors),
m_ui.checkBoxUseAlternatingRowColors);
- m_group->insert(debuggerCore()->action(UseToolTipsInMainEditor),
+ m_group->insert(dc->action(UseToolTipsInMainEditor),
m_ui.checkBoxUseToolTipsInMainEditor);
- m_group->insert(debuggerCore()->action(CloseBuffersOnExit),
+ m_group->insert(dc->action(CloseBuffersOnExit),
m_ui.checkBoxCloseBuffersOnExit);
- m_group->insert(debuggerCore()->action(SwitchModeOnExit),
+ m_group->insert(dc->action(SwitchModeOnExit),
m_ui.checkBoxSwitchModeOnExit);
- m_group->insert(debuggerCore()->action(AutoDerefPointers), 0);
- m_group->insert(debuggerCore()->action(UseToolTipsInLocalsView), 0);
- m_group->insert(debuggerCore()->action(UseToolTipsInBreakpointsView), 0);
- m_group->insert(debuggerCore()->action(UseAddressInBreakpointsView), 0);
- m_group->insert(debuggerCore()->action(UseAddressInStackView), 0);
- m_group->insert(debuggerCore()->action(MaximalStackDepth),
+ m_group->insert(dc->action(AutoDerefPointers), 0);
+ m_group->insert(dc->action(UseToolTipsInLocalsView), 0);
+ m_group->insert(dc->action(AlwaysAdjustLocalsColumnWidths), 0);
+ m_group->insert(dc->action(AlwaysAdjustThreadsColumnWidths), 0);
+ m_group->insert(dc->action(AlwaysAdjustSnapshotsColumnWidths), 0);
+ m_group->insert(dc->action(AlwaysAdjustBreakpointsColumnWidths), 0);
+ m_group->insert(dc->action(AlwaysAdjustModulesColumnWidths), 0);
+ m_group->insert(dc->action(UseToolTipsInBreakpointsView), 0);
+ m_group->insert(dc->action(UseAddressInBreakpointsView), 0);
+ m_group->insert(dc->action(UseAddressInStackView), 0);
+ m_group->insert(dc->action(AlwaysAdjustStackColumnWidths), 0);
+ m_group->insert(dc->action(MaximalStackDepth),
m_ui.spinBoxMaximalStackDepth);
- m_group->insert(debuggerCore()->action(ShowStdNamespace), 0);
- m_group->insert(debuggerCore()->action(ShowQtNamespace), 0);
- m_group->insert(debuggerCore()->action(SortStructMembers), 0);
- m_group->insert(debuggerCore()->action(LogTimeStamps), 0);
- m_group->insert(debuggerCore()->action(VerboseLog), 0);
- m_group->insert(debuggerCore()->action(BreakOnThrow), 0);
- m_group->insert(debuggerCore()->action(BreakOnCatch), 0);
+ m_group->insert(dc->action(ShowStdNamespace), 0);
+ m_group->insert(dc->action(ShowQtNamespace), 0);
+ m_group->insert(dc->action(SortStructMembers), 0);
+ m_group->insert(dc->action(LogTimeStamps), 0);
+ m_group->insert(dc->action(VerboseLog), 0);
+ m_group->insert(dc->action(BreakOnThrow), 0);
+ m_group->insert(dc->action(BreakOnCatch), 0);
#ifdef Q_OS_WIN
- Utils::SavedAction *registerAction = debuggerCore()->action(RegisterForPostMortem);
+ Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem);
m_group->insert(registerAction,
m_ui.checkBoxRegisterForPostMortem);
connect(registerAction, SIGNAL(toggled(bool)),
@@ -253,26 +262,28 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
m_ui.setupUi(w);
m_ui.dumperLocationChooser->setExpectedKind(Utils::PathChooser::Command);
- m_ui.dumperLocationChooser->setPromptDialogTitle(QCoreApplication::translate("Debugger",
- "Choose DebuggingHelper Location"));
+ m_ui.dumperLocationChooser->setPromptDialogTitle(QCoreApplication::translate
+ ("Debugger", "Choose DebuggingHelper Location"));
m_ui.dumperLocationChooser->setInitialBrowsePathBackup(
ICore::instance()->resourcePath() + "../../lib");
m_group.clear();
- m_group.insert(debuggerCore()->action(UseDebuggingHelpers),
+ DebuggerCore *dc = debuggerCore();
+
+ m_group.insert(dc->action(UseDebuggingHelpers),
m_ui.debuggingHelperGroupBox);
- m_group.insert(debuggerCore()->action(UseCustomDebuggingHelperLocation),
+ m_group.insert(dc->action(UseCustomDebuggingHelperLocation),
m_ui.customLocationGroupBox);
// Suppress Oxygen style's giving flat group boxes bold titles.
if (oxygenStyle())
m_ui.customLocationGroupBox->setStyleSheet(_("QGroupBox::title { font: ; }"));
- m_group.insert(debuggerCore()->action(CustomDebuggingHelperLocation),
+ m_group.insert(dc->action(CustomDebuggingHelperLocation),
m_ui.dumperLocationChooser);
- m_group.insert(debuggerCore()->action(UseCodeModel),
+ m_group.insert(dc->action(UseCodeModel),
m_ui.checkBoxUseCodeModel);
- m_group.insert(debuggerCore()->action(ShowThreadNames),
+ m_group.insert(dc->action(ShowThreadNames),
m_ui.checkBoxShowThreadNames);
diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp
index 1818ed4403..37b45366b7 100644
--- a/src/plugins/debugger/debuggeractions.cpp
+++ b/src/plugins/debugger/debuggeractions.cpp
@@ -107,14 +107,64 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
// View
//
item = new SavedAction(this);
- item->setText(tr("Adjust Column Widths to Contents"));
- insertItem(AdjustColumnWidths, item);
+ item->setText(tr("Always Adjust Column Widths to Contents"));
+ item->setCheckable(true);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustLocalsColumnWidths"));
+ insertItem(AlwaysAdjustLocalsColumnWidths, item);
+
+ item = new SavedAction(this);
+ item->setText(tr("Always Adjust Column Widths to Contents"));
+ item->setCheckable(true);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustStackColumnWidths"));
+ insertItem(AlwaysAdjustStackColumnWidths, item);
+
+ item = new SavedAction(this);
+ item->setText(tr("Always Adjust Column Widths to Contents"));
+ item->setCheckable(true);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustThreadsColumnWidths"));
+
+ item = new SavedAction(this);
+ item->setText(tr("Always Adjust Column Widths to Contents"));
+ item->setCheckable(true);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustRegistersColumnWidths"));
+
+ item = new SavedAction(this);
+ item->setText(tr("Always Adjust Column Widths to Contents"));
+ item->setCheckable(true);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustSnapshotsColumnWidths"));
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
- insertItem(AlwaysAdjustColumnWidths, item);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustBreakpointsColumnWidths"));
+
+ item = new SavedAction(this);
+ item->setText(tr("Always Adjust Column Widths to Contents"));
+ item->setCheckable(true);
+ item->setValue(false);
+ item->setDefaultValue(false);
+ item->setSettingsKey(debugModeGroup,
+ QLatin1String("AlwaysAdjustModulesColumnWidths"));
+ insertItem(AlwaysAdjustStackColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Use Alternating Row Colors"));
item->setSettingsKey(debugModeGroup, QLatin1String("UseAlternatingRowColours"));
diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h
index 50ca51a648..85ffe8bc5c 100644
--- a/src/plugins/debugger/debuggeractions.h
+++ b/src/plugins/debugger/debuggeractions.h
@@ -90,8 +90,6 @@ enum DebuggerActionCode
{
// General
SettingsDialog,
- AdjustColumnWidths,
- AlwaysAdjustColumnWidths,
UseAlternatingRowColors,
UseMessageBoxForSignals,
AutoQuit,
@@ -128,12 +126,14 @@ enum DebuggerActionCode
MaximalStackDepth,
ExpandStack,
CreateFullBacktrace,
+ AlwaysAdjustStackColumnWidths,
// Watchers & Locals
ShowStdNamespace,
ShowQtNamespace,
SortStructMembers,
AutoDerefPointers,
+ AlwaysAdjustLocalsColumnWidths,
// Source List
ListSourceFiles,
@@ -147,10 +147,23 @@ enum DebuggerActionCode
AllPluginBreakpoints,
SelectedPluginBreakpoints,
AdjustBreakpointLocations,
+ AlwaysAdjustBreakpointsColumnWidths,
NoPluginBreakpoints,
SelectedPluginBreakpointsPattern,
BreakOnThrow,
- BreakOnCatch
+ BreakOnCatch,
+
+ // Registers
+ AlwaysAdjustRegistersColumnWidths,
+
+ // Snapshots
+ AlwaysAdjustSnapshotsColumnWidths,
+
+ // Threads
+ AlwaysAdjustThreadsColumnWidths,
+
+ // Modules
+ AlwaysAdjustModulesColumnWidths
};
} // namespace Internal
diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp
index 25e4f48e53..5e7eb5eff7 100644
--- a/src/plugins/debugger/moduleswindow.cpp
+++ b/src/plugins/debugger/moduleswindow.cpp
@@ -59,7 +59,7 @@ namespace Debugger {
namespace Internal {
ModulesWindow::ModulesWindow(QWidget *parent)
- : QTreeView(parent), m_alwaysResizeColumnsToContents(false)
+ : QTreeView(parent)
{
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setWindowTitle(tr("Modules"));
@@ -73,6 +73,9 @@ ModulesWindow::ModulesWindow(QWidget *parent)
SLOT(moduleActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool)));
+ connect(debuggerCore()->action(AlwaysAdjustModulesColumnWidths),
+ SIGNAL(toggled(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void ModulesWindow::moduleActivated(const QModelIndex &index)
@@ -165,10 +168,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator();
QAction *actAdjustColumnWidths =
menu.addAction(tr("Adjust Column Widths to Contents"));
- QAction *actAlwaysAdjustColumnWidth =
- menu.addAction(tr("Always Adjust Column Widths to Contents"));
- actAlwaysAdjustColumnWidth->setCheckable(true);
- actAlwaysAdjustColumnWidth->setChecked(m_alwaysResizeColumnsToContents);
+ menu.addAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -177,21 +177,19 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == actUpdateModuleList)
engine->reloadModules();
else if (act == actAdjustColumnWidths)
- resizeColumnsToContents();
- else if (act == actAlwaysAdjustColumnWidth)
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
+ resizeColumnsToContents();
else if (act == actShowModuleSources)
- engine->loadSymbols(name);
+ engine->loadSymbols(name);
else if (act == actLoadSymbolsForAllModules)
- engine->loadAllSymbols();
+ engine->loadAllSymbols();
else if (act == actExamineAllModules)
- engine->examineModules();
+ engine->examineModules();
else if (act == actLoadSymbolsForModule)
- engine->loadSymbols(name);
+ engine->loadSymbols(name);
else if (act == actEditFile)
- engine->gotoLocation(name);
+ engine->gotoLocation(name);
else if (act == actShowModuleSymbols)
- engine->requestModuleSymbols(name);
+ engine->requestModuleSymbols(name);
else if (actShowDependencies && act == actShowDependencies)
QProcess::startDetached(QLatin1String("depends"), QStringList(fileName));
}
@@ -206,7 +204,6 @@ void ModulesWindow::resizeColumnsToContents()
void ModulesWindow::setAlwaysResizeColumnsToContents(bool on)
{
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode);
diff --git a/src/plugins/debugger/moduleswindow.h b/src/plugins/debugger/moduleswindow.h
index 9fa1284caf..acbdf5a021 100644
--- a/src/plugins/debugger/moduleswindow.h
+++ b/src/plugins/debugger/moduleswindow.h
@@ -55,8 +55,6 @@ private slots:
private:
void contextMenuEvent(QContextMenuEvent *ev);
void setModel(QAbstractItemModel *model);
-
- bool m_alwaysResizeColumnsToContents;
};
} // namespace Internal
diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp
index 4fa281c6b1..68cdddd017 100644
--- a/src/plugins/debugger/registerwindow.cpp
+++ b/src/plugins/debugger/registerwindow.cpp
@@ -158,7 +158,7 @@ public:
///////////////////////////////////////////////////////////////////////
RegisterWindow::RegisterWindow(QWidget *parent)
- : QTreeView(parent), m_alwaysResizeColumnsToContents(true)
+ : QTreeView(parent)
{
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setFrameStyle(QFrame::NoFrame);
@@ -170,6 +170,9 @@ RegisterWindow::RegisterWindow(QWidget *parent)
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool)));
+ connect(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths),
+ SIGNAL(toggled(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void RegisterWindow::resizeEvent(QResizeEvent *ev)
@@ -223,10 +226,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator();
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
- QAction *actAlwaysAdjust =
- menu.addAction(tr("Always Adjust Column Widths to Contents"));
- actAlwaysAdjust->setCheckable(true);
- actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents);
+ menu.addAction(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths));
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -235,8 +235,6 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == actAdjust)
resizeColumnsToContents();
- else if (act == actAlwaysAdjust)
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == actReload)
engine->reloadRegisters();
else if (act == actShowMemory)
@@ -259,7 +257,6 @@ void RegisterWindow::resizeColumnsToContents()
void RegisterWindow::setAlwaysResizeColumnsToContents(bool on)
{
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode);
diff --git a/src/plugins/debugger/registerwindow.h b/src/plugins/debugger/registerwindow.h
index 8db9d39ee2..c9723302d9 100644
--- a/src/plugins/debugger/registerwindow.h
+++ b/src/plugins/debugger/registerwindow.h
@@ -56,8 +56,6 @@ public slots:
private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
-
- bool m_alwaysResizeColumnsToContents;
};
} // namespace Internal
diff --git a/src/plugins/debugger/snapshotwindow.cpp b/src/plugins/debugger/snapshotwindow.cpp
index 086dc25863..3bad2cb111 100644
--- a/src/plugins/debugger/snapshotwindow.cpp
+++ b/src/plugins/debugger/snapshotwindow.cpp
@@ -58,7 +58,6 @@ namespace Internal {
///////////////////////////////////////////////////////////////////////
SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
- : m_alwaysResizeColumnsToContents(false)
{
m_snapshotHandler = handler;
@@ -76,6 +75,9 @@ SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool)));
+ connect(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths),
+ SIGNAL(toggled(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void SnapshotWindow::rowActivated(const QModelIndex &index)
@@ -107,21 +109,14 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *actCreate = menu.addAction(tr("Create Snapshot"));
actCreate->setEnabled(idx.data(SnapshotCapabilityRole).toBool());
-
menu.addSeparator();
QAction *actRemove = menu.addAction(tr("Remove Snapshot"));
actRemove->setEnabled(idx.isValid());
-
menu.addSeparator();
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
-
- QAction *actAlwaysAdjust =
- menu.addAction(tr("Always Adjust Column Widths to Contents"));
- actAlwaysAdjust->setCheckable(true);
- actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents);
-
+ menu.addAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -134,8 +129,6 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
removeSnapshot(idx.row());
else if (act == actAdjust)
resizeColumnsToContents();
- else if (act == actAlwaysAdjust)
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
}
void SnapshotWindow::removeSnapshot(int i)
@@ -151,7 +144,6 @@ void SnapshotWindow::resizeColumnsToContents()
void SnapshotWindow::setAlwaysResizeColumnsToContents(bool on)
{
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode =
on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
for (int i = model()->columnCount(); --i >= 0; )
diff --git a/src/plugins/debugger/snapshotwindow.h b/src/plugins/debugger/snapshotwindow.h
index 75cbaa1470..651d38db23 100644
--- a/src/plugins/debugger/snapshotwindow.h
+++ b/src/plugins/debugger/snapshotwindow.h
@@ -61,7 +61,6 @@ private:
void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
- bool m_alwaysResizeColumnsToContents;
SnapshotHandler *m_snapshotHandler;
};
diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp
index c337fb43d1..6d684fdc13 100644
--- a/src/plugins/debugger/stackwindow.cpp
+++ b/src/plugins/debugger/stackwindow.cpp
@@ -59,7 +59,7 @@ static DebuggerEngine *currentEngine()
}
StackWindow::StackWindow(QWidget *parent)
- : QTreeView(parent), m_alwaysResizeColumnsToContents(false)
+ : QTreeView(parent)
{
setAttribute(Qt::WA_MacShowFocusRect, false);
setFrameStyle(QFrame::NoFrame);
@@ -83,6 +83,9 @@ StackWindow::StackWindow(QWidget *parent)
SLOT(reloadFullStack()));
connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()),
SLOT(reloadFullStack()));
+ connect(debuggerCore()->action(AlwaysAdjustStackColumnWidths),
+ SIGNAL(triggered(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
showAddressColumn(false);
}
@@ -154,12 +157,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(UseAddressInStackView));
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
-
- QAction *actAlwaysAdjust =
- menu.addAction(tr("Always Adjust Column Widths to Contents"));
- actAlwaysAdjust->setCheckable(true);
- actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents);
-
+ menu.addAction(debuggerCore()->action(AlwaysAdjustStackColumnWidths));
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -172,8 +170,6 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
copyContentsToClipboard();
else if (act == actAdjust)
resizeColumnsToContents();
- else if (act == actAlwaysAdjust)
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == actShowMemory)
engine->openMemoryView(address);
else if (act == actShowDisassembler)
@@ -215,7 +211,6 @@ void StackWindow::resizeColumnsToContents()
void StackWindow::setAlwaysResizeColumnsToContents(bool on)
{
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode =
on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
for (int i = model()->columnCount(); --i >= 0; )
diff --git a/src/plugins/debugger/stackwindow.h b/src/plugins/debugger/stackwindow.h
index 693e849645..3bb8906146 100644
--- a/src/plugins/debugger/stackwindow.h
+++ b/src/plugins/debugger/stackwindow.h
@@ -60,8 +60,6 @@ private:
void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev);
void copyContentsToClipboard();
-
- bool m_alwaysResizeColumnsToContents;
};
} // namespace Internal
diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp
index 91e894a324..6a67367df0 100644
--- a/src/plugins/debugger/threadswindow.cpp
+++ b/src/plugins/debugger/threadswindow.cpp
@@ -50,7 +50,7 @@ namespace Debugger {
namespace Internal {
ThreadsWindow::ThreadsWindow(QWidget *parent)
- : QTreeView(parent), m_alwaysResizeColumnsToContents(false)
+ : QTreeView(parent)
{
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
@@ -64,9 +64,12 @@ ThreadsWindow::ThreadsWindow(QWidget *parent)
header()->setDefaultAlignment(Qt::AlignLeft);
connect(this, SIGNAL(activated(QModelIndex)),
- this, SLOT(rowActivated(QModelIndex)));
+ SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
- this, SLOT(setAlternatingRowColorsHelper(bool)));
+ SLOT(setAlternatingRowColorsHelper(bool)));
+ connect(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths),
+ SIGNAL(toggled(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void ThreadsWindow::rowActivated(const QModelIndex &index)
@@ -87,10 +90,7 @@ void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
QMenu menu;
QAction *adjustColumnAction =
menu.addAction(tr("Adjust Column Widths to Contents"));
- QAction *alwaysAdjustColumnAction =
- menu.addAction(tr("Always Adjust Column Widths to Contents"));
- alwaysAdjustColumnAction->setCheckable(true);
- alwaysAdjustColumnAction->setChecked(m_alwaysResizeColumnsToContents);
+ menu.addAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -99,11 +99,8 @@ void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
if (!act)
return;
- if (act == adjustColumnAction) {
+ if (act == adjustColumnAction)
resizeColumnsToContents();
- } else if (act == alwaysAdjustColumnAction) {
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
- }
}
void ThreadsWindow::resizeColumnsToContents()
@@ -115,7 +112,6 @@ void ThreadsWindow::resizeColumnsToContents()
void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on)
{
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode);
diff --git a/src/plugins/debugger/threadswindow.h b/src/plugins/debugger/threadswindow.h
index 909ce00b59..12286456a6 100644
--- a/src/plugins/debugger/threadswindow.h
+++ b/src/plugins/debugger/threadswindow.h
@@ -57,8 +57,6 @@ private slots:
private:
void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev);
-
- bool m_alwaysResizeColumnsToContents;
};
} // namespace Internal
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 88724359f4..eb93669700 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -147,16 +147,13 @@ private:
WatchWindow::WatchWindow(Type type, QWidget *parent)
: QTreeView(parent),
- m_alwaysResizeColumnsToContents(true),
m_type(type)
{
m_grabbing = false;
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false);
setWindowTitle(tr("Locals and Watchers"));
- setAlternatingRowColors(act->isChecked());
setIndentation(indentation() * 9/10);
setUniformRowHeights(true);
setItemDelegate(new WatchDelegate(this));
@@ -164,12 +161,19 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
setAcceptDrops(true);
setDropIndicatorShown(true);
- connect(act, SIGNAL(toggled(bool)),
- this, SLOT(setAlternatingRowColorsHelper(bool)));
+ QAction *useColors = debuggerCore()->action(UseAlternatingRowColors);
+ setAlternatingRowColors(useColors->isChecked());
+
+ QAction *adjustColumns = debuggerCore()->action(AlwaysAdjustLocalsColumnWidths);
+
+ connect(useColors, SIGNAL(toggled(bool)),
+ SLOT(setAlternatingRowColorsHelper(bool)));
+ connect(adjustColumns, SIGNAL(triggered(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
connect(this, SIGNAL(expanded(QModelIndex)),
- this, SLOT(expandNode(QModelIndex)));
+ SLOT(expandNode(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)),
- this, SLOT(collapseNode(QModelIndex)));
+ SLOT(collapseNode(QModelIndex)));
}
void WatchWindow::expandNode(const QModelIndex &idx)
@@ -468,12 +472,9 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *actAdjustColumnWidths =
menu.addAction(tr("Adjust Column Widths to Contents"));
- QAction *actAlwaysAdjustColumnWidth =
- menu.addAction(tr("Always Adjust Column Widths to Contents"));
- actAlwaysAdjustColumnWidth->setCheckable(true);
- actAlwaysAdjustColumnWidth->setChecked(m_alwaysResizeColumnsToContents);
-
+ menu.addAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
menu.addSeparator();
+
QAction *actClearCodeModelSnapshot
= new QAction(tr("Refresh Code Model Snapshot"), &menu);
actClearCodeModelSnapshot->setEnabled(actionsEnabled
@@ -495,8 +496,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == actAdjustColumnWidths) {
resizeColumnsToContents();
- } else if (act == actAlwaysAdjustColumnWidth) {
- setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
} else if (act == actInsertNewWatchItem) {
watchExpression(QString());
} else if (act == actOpenMemoryEditAtVariableAddress) {
@@ -566,7 +565,6 @@ void WatchWindow::setAlwaysResizeColumnsToContents(bool on)
{
if (!header())
return;
- m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode);
@@ -594,10 +592,13 @@ void WatchWindow::setModel(QAbstractItemModel *model)
QTreeView::setModel(model);
setRootIsDecorated(true);
- header()->setDefaultAlignment(Qt::AlignLeft);
- header()->setResizeMode(QHeaderView::ResizeToContents);
- if (m_type != LocalsType)
- header()->hide();
+ if (header()) {
+ setAlwaysResizeColumnsToContents(
+ debuggerCore()->boolSetting(AlwaysAdjustLocalsColumnWidths));
+ header()->setDefaultAlignment(Qt::AlignLeft);
+ if (m_type != LocalsType)
+ header()->hide();
+ }
connect(model, SIGNAL(layoutChanged()), SLOT(resetHelper()));
connect(model, SIGNAL(enableUpdates(bool)), SLOT(setUpdatesEnabled(bool)));
diff --git a/src/plugins/debugger/watchwindow.h b/src/plugins/debugger/watchwindow.h
index defb4c408a..4f0059d8d2 100644
--- a/src/plugins/debugger/watchwindow.h
+++ b/src/plugins/debugger/watchwindow.h
@@ -57,7 +57,6 @@ public:
public slots:
void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on = true);
void setModel(QAbstractItemModel *model);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void watchExpression(const QString &exp);
@@ -68,6 +67,7 @@ private:
Q_SLOT void expandNode(const QModelIndex &idx);
Q_SLOT void collapseNode(const QModelIndex &idx);
Q_SLOT void setUpdatesEnabled(bool enable);
+ Q_SLOT void setAlwaysResizeColumnsToContents(bool on);
void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
@@ -84,7 +84,6 @@ private:
void setModelData(int role, const QVariant &value = QVariant(),
const QModelIndex &index = QModelIndex());
- bool m_alwaysResizeColumnsToContents;
Type m_type;
bool m_grabbing;
};