Polish the settings dialog.

Add a title label to the pages. Use QGroupBoxes throughout.
Extend SavedAction to work with checkable QGroupBoxes. Polish UI files,
use common layout for VCS plugins. Performance: Apply only visited
settings pages. Add search keywords.

Task-number: QTCREATOR-26
This commit is contained in:
Friedemann Kleint
2009-11-24 15:05:02 +01:00
parent c49bed1199
commit 65e11062bb
68 changed files with 1444 additions and 1295 deletions

View File

@@ -35,6 +35,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QUrl>
#include <QtCore/QTextStream>
#include <QtGui/QMessageBox>
#include <QtGui/QDesktopServices>
@@ -127,6 +128,16 @@ void CdbOptionsPageWidget::downLoadLinkActivated(const QString &link)
QDesktopServices::openUrl(QUrl(link));
}
QString CdbOptionsPageWidget::searchKeywords() const
{
QString rc;
QTextStream(&rc) << m_ui.pathLabel->text() << ' ' << m_ui.symbolPathLabel->text()
<< ' ' << m_ui.sourcePathLabel->text()
<< ' ' << m_ui.verboseSymbolLoadingCheckBox->text();
rc.remove(QLatin1Char('&'));
return rc;
}
// ---------- CdbOptionsPage
CdbOptionsPage::CdbOptionsPage(const QSharedPointer<CdbOptions> &options) :
m_options(options)
@@ -162,6 +173,8 @@ QWidget *CdbOptionsPage::createPage(QWidget *parent)
m_widget = new CdbOptionsPageWidget(parent);
m_widget->setOptions(*m_options);
m_widget->setFailureMessage(m_failureMessage);
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
}
@@ -188,5 +201,10 @@ void CdbOptionsPage::finish()
{
}
bool CdbOptionsPage::matches(const QString &s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace Debugger

View File

@@ -53,6 +53,8 @@ public:
void setFailureMessage(const QString &);
QString searchKeywords() const;
private slots:
void autoDetect();
void downLoadLinkActivated(const QString &);
@@ -78,6 +80,7 @@ public:
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
virtual bool matches(const QString &) const;
static QString settingsId();
@@ -92,6 +95,7 @@ private:
const QSharedPointer<CdbOptions> m_options;
QPointer<CdbOptionsPageWidget> m_widget;
QString m_failureMessage;
QString m_searchKeywords;
};
} // namespace Internal

View File

@@ -2,22 +2,14 @@
<ui version="4.0">
<class>CommonOptionsPage</class>
<widget class="QWidget" name="CommonOptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>379</width>
<height>243</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>User interface</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxListSourceFiles">
<property name="toolTip">
<string>Checking this will populate the source file view automatically but might slow down debugger startup considerably.</string>
@@ -27,28 +19,28 @@
</property>
</widget>
</item>
<item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseMessageBoxForSignals">
<property name="text">
<string>Show a message box when receiving a signal</string>
</property>
</widget>
</item>
<item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseAlternatingRowColors">
<property name="text">
<string>Use alternating row colors in debug views</string>
</property>
</widget>
</item>
<item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxUseToolTipsInMainEditor">
<property name="text">
<string>Use tooltips in main editor while debugging</string>
</property>
</widget>
</item>
<item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
@@ -59,58 +51,38 @@
</property>
</widget>
</item>
<item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxEnableReverseDebugging">
<property name="text">
<string>Enable reverse debugging</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelMaximalStackDepth">
<property name="text">
<string>Maximal stack depth:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxMaximalStackDepth">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="specialValueText">
<string>&lt;unlimited&gt;</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<item row="6" column="0">
<widget class="QLabel" name="labelMaximalStackDepth">
<property name="text">
<string>Maximal stack depth:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="spinBoxMaximalStackDepth">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="specialValueText">
<string>&lt;unlimited&gt;</string>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</widget>

View File

@@ -62,6 +62,7 @@
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/manhattanstyle.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
@@ -328,10 +329,12 @@ public:
QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(settings()); }
void finish() { m_group.finish(); }
virtual bool matches(const QString &s) const;
private:
Ui::CommonOptionsPage m_ui;
Utils::SavedActionSet m_group;
QString m_searchKeywords;
};
QWidget *CommonOptionsPage::createPage(QWidget *parent)
@@ -364,9 +367,25 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_ui.checkBoxEnableReverseDebugging->hide();
#endif
if (m_searchKeywords.isEmpty()) {
QTextStream(&m_searchKeywords) << ' ' << m_ui.checkBoxListSourceFiles->text()
<< ' ' << m_ui.checkBoxUseMessageBoxForSignals->text()
<< ' ' << m_ui.checkBoxUseAlternatingRowColors->text()
<< ' ' << m_ui.checkBoxUseToolTipsInMainEditor->text()
<< ' ' << m_ui.checkBoxSkipKnownFrames->text()
<< ' ' << m_ui.checkBoxEnableReverseDebugging->text()
<< ' ' << m_ui.labelMaximalStackDepth->text();
m_searchKeywords.remove(QLatin1Char('&'));
}
return w;
}
bool CommonOptionsPage::matches(const QString &s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace Debugger
@@ -377,6 +396,13 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
//
///////////////////////////////////////////////////////////////////////
static inline bool oxygenStyle()
{
if (const ManhattanStyle *ms = qobject_cast<const ManhattanStyle *>(qApp->style()))
return !qstrcmp("OxygenStyle", ms->systemStyle()->metaObject()->className());
return false;
}
namespace Debugger {
namespace Internal {
@@ -396,14 +422,12 @@ public:
QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(settings()); }
void finish() { m_group.finish(); }
virtual bool matches(const QString &s) const;
private:
Q_SLOT void updateState();
friend class DebuggerPlugin;
Ui::DebuggingHelperOptionPage m_ui;
Ui::DebuggingHelperOptionPage m_ui;
Utils::SavedActionSet m_group;
QString m_searchKeywords;
};
QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
@@ -416,16 +440,15 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
m_ui.dumperLocationChooser->setInitialBrowsePathBackup(
Core::ICore::instance()->resourcePath() + "../../lib");
connect(m_ui.checkBoxUseDebuggingHelpers, SIGNAL(toggled(bool)),
this, SLOT(updateState()));
connect(m_ui.checkBoxUseCustomDebuggingHelperLocation, SIGNAL(toggled(bool)),
this, SLOT(updateState()));
m_group.clear();
m_group.insert(theDebuggerAction(UseDebuggingHelpers),
m_ui.checkBoxUseDebuggingHelpers);
m_ui.debuggingHelperGroupBox);
m_group.insert(theDebuggerAction(UseCustomDebuggingHelperLocation),
m_ui.checkBoxUseCustomDebuggingHelperLocation);
m_ui.customLocationGroupBox);
// Suppress Oxygen style's giving flat group boxes bold titles
if (oxygenStyle())
m_ui.customLocationGroupBox->setStyleSheet(QLatin1String("QGroupBox::title { font: ; }"));
m_group.insert(theDebuggerAction(CustomDebuggingHelperLocation),
m_ui.dumperLocationChooser);
@@ -439,9 +462,6 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
m_ui.checkBoxDebugDebuggingHelpers->hide();
#endif
m_ui.dumperLocationChooser->
setEnabled(theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool());
#ifndef QT_DEBUG
#if 0
cmd = am->registerAction(m_manager->m_dumpLogAction,
@@ -451,19 +471,22 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
mdebug->addAction(cmd);
#endif
#endif
updateState();
if (m_searchKeywords.isEmpty()) {
QTextStream(&m_searchKeywords)
<< ' ' << m_ui.debuggingHelperGroupBox->title()
<< ' ' << m_ui.customLocationGroupBox->title()
<< ' ' << m_ui.dumperLocationLabel->text()
<< ' ' << m_ui.checkBoxUseCodeModel->text()
<< ' ' << m_ui.checkBoxDebugDebuggingHelpers->text();
m_searchKeywords.remove(QLatin1Char('&'));
}
return w;
}
void DebuggingHelperOptionPage::updateState()
bool DebuggingHelperOptionPage::matches(const QString &s) const
{
m_ui.checkBoxUseCustomDebuggingHelperLocation->setEnabled(
m_ui.checkBoxUseDebuggingHelpers->isChecked());
bool locationEnabled = m_ui.checkBoxUseDebuggingHelpers->isChecked()
&& m_ui.checkBoxUseCustomDebuggingHelperLocation->isChecked();
m_ui.dumperLocationChooser->setEnabled(locationEnabled);
m_ui.dumperLocationLabel->setEnabled(locationEnabled);
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal

View File

@@ -6,87 +6,45 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>434</height>
<width>417</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="debuggingHelperGroupBox">
<property name="title">
<string>Debugging helper</string>
<string>Use Debugging helper</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxUseDebuggingHelpers">
<property name="toolTip">
<string>This will enable nice display of Qt and Standard Library objects in the Locals&amp;Watchers view</string>
<widget class="QGroupBox" name="customLocationGroupBox">
<property name="title">
<string>Use debugging helper from custom location</string>
</property>
<property name="text">
<string>Use debugging helper</string>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="dumperLocationLabel">
<property name="text">
<string>Location: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="dumperLocationChooser"/>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseCustomDebuggingHelperLocation">
<property name="toolTip">
<string>This will load a dumper library</string>
</property>
<property name="text">
<string>Use debugging helper from custom location</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="dumperLocationLabel">
<property name="text">
<string>Location: </string>
</property>
</widget>
</item>
<item>
<widget class="Utils::PathChooser" name="dumperLocationChooser"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseCodeModel">
<property name="toolTip">

View File

@@ -4,6 +4,7 @@
#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QTextStream>
const char * const GDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::GdbOptionsPage", "Gdb");
@@ -73,6 +74,13 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent)
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
if (m_searchKeywords.isEmpty()) {
// TODO: Add breakpoints, environment?
QTextStream(&m_searchKeywords) << ' ' << m_ui.labelGdbLocation->text()
<< ' ' << m_ui.labelEnvironment->text()
<< ' ' << m_ui.labelGdbStartupScript->text();
m_searchKeywords.remove(QLatin1Char('&'));
}
return w;
}
void GdbOptionsPage::apply()
@@ -85,5 +93,10 @@ void GdbOptionsPage::finish()
m_group.finish();
}
bool GdbOptionsPage::matches(const QString &s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace Debugger

View File

@@ -23,12 +23,14 @@ public:
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
virtual bool matches(const QString &) const;
static QString settingsId();
private:
private:
Ui::GdbOptionsPage m_ui;
Utils::SavedActionSet m_group;
QString m_searchKeywords;
};
} // namespace Internal

View File

@@ -2,30 +2,22 @@
<ui version="4.0">
<class>GdbOptionsPage</class>
<widget class="QWidget" name="GdbOptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>452</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBoxLocations">
<property name="title">
<string>Gdb interaction</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="1">
<widget class="QLineEdit" name="environmentEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelGdbLocation">
<property name="toolTip">
@@ -36,6 +28,9 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="gdbLocationChooser"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelEnvironment">
<property name="text">
@@ -46,6 +41,9 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="environmentEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelGdbStartupScript">
<property name="toolTip">
@@ -57,10 +55,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="scriptFileChooser" native="true"/>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="gdbLocationChooser" native="true"/>
<widget class="Utils::PathChooser" name="scriptFileChooser"/>
</item>
</layout>
</widget>
@@ -133,6 +128,9 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>

View File

@@ -76,6 +76,8 @@ QWidget *TrkOptionsPage::createPage(QWidget *parent)
if (!m_widget)
m_widget = new TrkOptionsWidget(parent);
m_widget->setTrkOptions(*m_options);
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
}
@@ -94,5 +96,10 @@ void TrkOptionsPage::finish()
{
}
bool TrkOptionsPage::matches(const QString &s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace Designer

View File

@@ -60,11 +60,13 @@ public:
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
virtual bool matches(const QString &) const;
static QString settingsId();
private:
const TrkOptionsPtr m_options;
QPointer<TrkOptionsWidget> m_widget;
QString m_searchKeywords;
};
} // namespace Internal

View File

@@ -32,6 +32,8 @@
#include "debuggerconstants.h"
#include "ui_trkoptionswidget.h"
#include <QtCore/QTextStream>
namespace Debugger {
namespace Internal {
@@ -88,5 +90,14 @@ TrkOptions TrkOptionsWidget::trkOptions() const
return rc;
}
QString TrkOptionsWidget::searchKeywords() const
{
QString rc;
QTextStream(&rc) << ui->gdbLabel->text() << ' ' << ui->serialLabel->text()
<< ' ' << ui->blueToothLabel->text();
rc.remove(QLatin1Char('&'));
return rc;
}
} // namespace Internal
} // namespace Designer

View File

@@ -50,6 +50,8 @@ public:
void setTrkOptions(const TrkOptions &);
TrkOptions trkOptions() const;
QString searchKeywords() const;
protected:
void changeEvent(QEvent *e);