From e4a7792d6ed02ef6c74ff30a9d8bc7c2ead41292 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Nov 2009 16:55:23 +0100 Subject: [PATCH] Options dialog: Further polishing. Task-number: QTCREATOR-26 --- .../cmakeprojectmanager.cpp | 17 +- .../coreplugin/dialogs/settingsdialog.cpp | 1 + src/plugins/coreplugin/generalsettings.cpp | 14 ++ src/plugins/coreplugin/generalsettings.h | 2 + src/plugins/coreplugin/generalsettings.ui | 161 ++++++++---------- src/plugins/cpaster/codepastersettings.cpp | 31 ++-- src/plugins/cpaster/pastebindotcomsettings.ui | 88 ++++++---- src/plugins/cpaster/settingspage.cpp | 14 +- src/plugins/cpaster/settingspage.h | 2 + src/plugins/cpaster/settingspage.ui | 6 +- .../cpptools/completionsettingspage.cpp | 14 +- src/plugins/cpptools/completionsettingspage.h | 2 + src/plugins/cpptools/cppfilesettingspage.cpp | 18 ++ src/plugins/cpptools/cppfilesettingspage.h | 4 + 14 files changed, 226 insertions(+), 148 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index d0b683c8b38..e9788ca9b67 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -40,9 +40,12 @@ #include #include #include +#include #include #include #include +#include +#include using namespace CMakeProjectManager::Internal; @@ -258,13 +261,17 @@ QString CMakeSettingsPage::trCategory() const QWidget *CMakeSettingsPage::createPage(QWidget *parent) { - QWidget *w = new QWidget(parent); - QFormLayout *fl = new QFormLayout(w); - m_pathchooser = new Utils::PathChooser(w); + QWidget *outerWidget = new QWidget(parent); + QVBoxLayout *outerLayout = new QVBoxLayout(outerWidget); + QGroupBox *groupBox = new QGroupBox(trCategory()); + outerLayout->addWidget(groupBox); + outerLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding)); + QFormLayout *formLayout = new QFormLayout(groupBox); + m_pathchooser = new Utils::PathChooser; m_pathchooser->setExpectedKind(Utils::PathChooser::Command); - fl->addRow(tr("CMake executable"), m_pathchooser); + formLayout->addRow(tr("Executable:"), m_pathchooser); m_pathchooser->setPath(cmakeExecutable()); - return w; + return outerWidget; } void CMakeSettingsPage::updateInfo() diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index be51bb792d4..34bf4ca2816 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -184,6 +184,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, m_applied(false) { setupUi(this); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); #ifdef Q_OS_MAC setWindowTitle(tr("Preferences")); #else diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 30ce55f36f4..118973ddd2d 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -34,8 +34,11 @@ #include #include #include + #include +#include + #include "ui_generalsettings.h" using namespace Utils; @@ -94,9 +97,20 @@ QWidget *GeneralSettings::createPage(QWidget *parent) this, SLOT(resetTerminal())); #endif + if (m_searchKeywords.isEmpty()) { + QTextStream(&m_searchKeywords) << m_page->colorLabel->text() << ' ' + << m_page->terminalLabel->text() << ' ' << m_page->editorLabel->text() + << ' '<< m_page->modifiedLabel->text(); + m_searchKeywords.remove(QLatin1Char('&')); + } return w; } +bool GeneralSettings::matches(const QString &s) const +{ + return m_searchKeywords.contains(s, Qt::CaseInsensitive); +} + void GeneralSettings::apply() { // Apply the new base color if accepted diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h index 3cf47f242e4..6c2e4ee45c1 100644 --- a/src/plugins/coreplugin/generalsettings.h +++ b/src/plugins/coreplugin/generalsettings.h @@ -55,6 +55,7 @@ public: QWidget* createPage(QWidget *parent); void apply(); void finish(); + virtual bool matches(const QString &) const; private slots: void resetInterfaceColor(); @@ -66,6 +67,7 @@ private slots: private: Ui::GeneralSettings *m_page; + QString m_searchKeywords; QPointer m_dialog; }; diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index b33497825c7..35c3b27963a 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -2,49 +2,28 @@ Core::Internal::GeneralSettings - - - 0 - 0 - 536 - 233 - - - + General settings - - - - - - - User &interface color: - - - colorButton - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - + + + QFormLayout::WrapLongRows + + + + + User &interface color: + + + colorButton + + + + + @@ -93,15 +72,15 @@ - - - - - - Terminal: - - - + + + + Terminal: + + + + + @@ -121,15 +100,15 @@ - - - - - - External editor: - - - + + + + External editor: + + + + + @@ -156,47 +135,43 @@ - - + + + + When files are externally modified: + + + true + + + + + + + + 0 + 0 + + + + 0 + - - - When files are externally modified: - - - true - - + + Always ask + - - - - 0 - 0 - - - - 0 - - - - Always ask - - - - - Reload all modified files - - - - - Ignore modifications - - - + + Reload all modified files + - + + + Ignore modifications + + + diff --git a/src/plugins/cpaster/codepastersettings.cpp b/src/plugins/cpaster/codepastersettings.cpp index 68117000ec7..da2591cc721 100644 --- a/src/plugins/cpaster/codepastersettings.cpp +++ b/src/plugins/cpaster/codepastersettings.cpp @@ -34,6 +34,9 @@ #include #include #include +#include +#include +#include #include #include @@ -70,22 +73,26 @@ QString CodePasterSettingsPage::trCategory() const } QWidget *CodePasterSettingsPage::createPage(QWidget *parent) -{ - QWidget *w = new QWidget(parent); - QLabel *label = new QLabel(tr("Server:")); - QLineEdit *lineedit = new QLineEdit; - lineedit->setText(m_host); +{ + QGroupBox *groupBox = new QGroupBox(category()); + QVBoxLayout *groupBoxLayout = new QVBoxLayout(groupBox); + QFormLayout *formLayout = new QFormLayout; + QLineEdit *lineedit = new QLineEdit(m_host); connect(lineedit, SIGNAL(textChanged(QString)), this, SLOT(serverChanged(QString))); + formLayout->addRow(tr("Server:"), lineedit); + groupBoxLayout->addLayout(formLayout); + groupBoxLayout->addSpacerItem(new QSpacerItem(0, 60, QSizePolicy::Ignored, QSizePolicy::Fixed)); + QLabel *noteLabel = new QLabel(tr("Note: Specify the host name for the CodePaster service " "without any protocol prepended (e.g. codepaster.mycompany.com).")); noteLabel->setWordWrap(true); - QGridLayout* layout = new QGridLayout(); - layout->addWidget(label, 0, 0); - layout->addWidget(lineedit, 0, 1); - layout->addWidget(noteLabel, 1, 1); - layout->addItem(new QSpacerItem(1,1, QSizePolicy::Preferred, QSizePolicy::MinimumExpanding), 2, 0); - w->setLayout(layout); - return w; + groupBoxLayout->addWidget(noteLabel); + + QWidget *outerWidget = new QWidget(parent); + QVBoxLayout *outerLayout = new QVBoxLayout(outerWidget); + outerLayout->addWidget(groupBox); + outerLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding)); + return outerWidget; } void CodePasterSettingsPage::apply() diff --git a/src/plugins/cpaster/pastebindotcomsettings.ui b/src/plugins/cpaster/pastebindotcomsettings.ui index 10a19e05d18..693c8bf6f57 100644 --- a/src/plugins/cpaster/pastebindotcomsettings.ui +++ b/src/plugins/cpaster/pastebindotcomsettings.ui @@ -6,45 +6,67 @@ 0 0 - 400 - 300 + 520 + 475 Form - + - - - - - Server Prefix: - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://pastebin.com"><span style=" text-decoration: underline; color:#0000ff;">pastebin.com</span></a><span style=" font-size:8pt;"> allows to send posts to custom subdomains (eg. qtcreator.pastebin.com). Fill in the desired prefix.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Note that the plugin will use this for posting as well as fetching.</span></p></body></html> - - - Qt::RichText - - - true - - - - + + + PasteBin + + + + + + + + Server Prefix: + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 0 + 60 + + + + + + + + <html><head/><body> +<p><a href="http://pastebin.com">pastebin.com</a> allows to send posts to custom subdomains (eg. qtcreator.pastebin.com). Fill in the desired prefix.</p> +<p>Note that the plugin will use this for posting as well as fetching.</p></body></html> + + + Qt::RichText + + + true + + + + + diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp index c530027f3e6..b1db4f3e415 100644 --- a/src/plugins/cpaster/settingspage.cpp +++ b/src/plugins/cpaster/settingspage.cpp @@ -31,11 +31,13 @@ #include -#include #include #include + #include #include +#include +#include using namespace CodePaster; @@ -86,6 +88,11 @@ QWidget *SettingsPage::createPage(QWidget *parent) m_ui.userEdit->setText(m_username); m_ui.clipboardBox->setChecked(m_copy); m_ui.displayBox->setChecked(m_output); + if (m_searchKeywords.isEmpty()) { + QTextStream(&m_searchKeywords) << m_ui.protocolLabel->text() << ' ' + << m_ui.userNameLabel->text(); + m_searchKeywords.remove(QLatin1Char('&')); + } return w; } @@ -107,6 +114,11 @@ void SettingsPage::apply() m_settings->endGroup(); } +bool SettingsPage::matches(const QString &s) const +{ + return m_searchKeywords.contains(s, Qt::CaseInsensitive); +} + void SettingsPage::addProtocol(const QString &name) { m_protocols.append(name); diff --git a/src/plugins/cpaster/settingspage.h b/src/plugins/cpaster/settingspage.h index 4d97ecb3e8d..72d2cdf8aa2 100644 --- a/src/plugins/cpaster/settingspage.h +++ b/src/plugins/cpaster/settingspage.h @@ -59,6 +59,7 @@ public: QWidget *createPage(QWidget *parent); void apply(); void finish() { } + virtual bool matches(const QString &) const; void addProtocol(const QString& name); QString username() const; @@ -71,6 +72,7 @@ private: Ui_SettingsPage m_ui; QSettings *m_settings; + QString m_searchKeywords; QStringList m_protocols; QString m_username; QString m_protocol; diff --git a/src/plugins/cpaster/settingspage.ui b/src/plugins/cpaster/settingspage.ui index 3dc2f9a939f..2593d6e1a90 100644 --- a/src/plugins/cpaster/settingspage.ui +++ b/src/plugins/cpaster/settingspage.ui @@ -6,7 +6,7 @@ 0 0 - 362 + 453 320 @@ -24,7 +24,7 @@ - + Default Protocol: @@ -50,7 +50,7 @@ - + Username: diff --git a/src/plugins/cpptools/completionsettingspage.cpp b/src/plugins/cpptools/completionsettingspage.cpp index 1972c9822f1..d74cec00ea7 100644 --- a/src/plugins/cpptools/completionsettingspage.cpp +++ b/src/plugins/cpptools/completionsettingspage.cpp @@ -34,6 +34,8 @@ #include #include +#include + using namespace CppTools::Internal; CompletionSettingsPage::CompletionSettingsPage(CppCodeCompletion *completion) @@ -75,7 +77,12 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent) m_page->caseSensitive->setChecked(m_completion->caseSensitivity() == Qt::CaseSensitive); m_page->autoInsertBrackets->setChecked(m_completion->autoInsertBrackets()); m_page->partiallyComplete->setChecked(m_completion->isPartialCompletionEnabled()); - + if (m_searchKeywords.isEmpty()) { + QTextStream(&m_searchKeywords) << m_page->caseSensitive->text() + << ' ' << m_page->autoInsertBrackets->text() + << ' ' << m_page->partiallyComplete->text(); + m_searchKeywords.remove(QLatin1Char('&')); + } return w; } @@ -86,3 +93,8 @@ void CompletionSettingsPage::apply() m_completion->setAutoInsertBrackets(m_page->autoInsertBrackets->isChecked()); m_completion->setPartialCompletionEnabled(m_page->partiallyComplete->isChecked()); } + +bool CompletionSettingsPage::matches(const QString &s) const +{ + return m_searchKeywords.contains(s, Qt::CaseInsensitive); +} diff --git a/src/plugins/cpptools/completionsettingspage.h b/src/plugins/cpptools/completionsettingspage.h index d8683c009d2..0123b3885ef 100644 --- a/src/plugins/cpptools/completionsettingspage.h +++ b/src/plugins/cpptools/completionsettingspage.h @@ -57,10 +57,12 @@ public: QWidget *createPage(QWidget *parent); void apply(); void finish() { } + virtual bool matches(const QString &) const; private: CppCodeCompletion *m_completion; Ui_CompletionSettingsPage *m_page; + QString m_searchKeywords; }; } // namespace Internal diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index a8320a87ccb..86e55461ed3 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -237,6 +238,16 @@ CppFileSettings CppFileSettingsWidget::settings() const return rc; } +QString CppFileSettingsWidget::searchKeywords() const +{ + QString rc; + QTextStream(&rc) << m_ui->headerSuffixLabel->text() + << ' ' << m_ui->sourceSuffixLabel->text() + << ' ' << m_ui->lowerCaseFileNamesCheckBox->text(); + rc.remove(QLatin1Char('&')); + return rc; +} + static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0) { const int index = cb->findText(text); @@ -312,6 +323,8 @@ QWidget *CppFileSettingsPage::createPage(QWidget *parent) m_widget = new CppFileSettingsWidget(parent); m_widget->setSettings(*m_settings); + if (m_searchKeywords.isEmpty()) + m_searchKeywords = m_widget->searchKeywords(); return m_widget; } @@ -327,6 +340,11 @@ void CppFileSettingsPage::apply() } } +bool CppFileSettingsPage::matches(const QString &s) const +{ + return m_searchKeywords.contains(s, Qt::CaseInsensitive); +} + } } diff --git a/src/plugins/cpptools/cppfilesettingspage.h b/src/plugins/cpptools/cppfilesettingspage.h index 7649ce67a27..aa431057d2d 100644 --- a/src/plugins/cpptools/cppfilesettingspage.h +++ b/src/plugins/cpptools/cppfilesettingspage.h @@ -77,6 +77,8 @@ public: CppFileSettings settings() const; void setSettings(const CppFileSettings &s); + QString searchKeywords() const; + private slots: void slotEdit(); @@ -103,10 +105,12 @@ public: virtual QWidget *createPage(QWidget *parent); virtual void apply(); virtual void finish() { } + virtual bool matches(const QString &) const; private: const QSharedPointer m_settings; QPointer m_widget; + QString m_searchKeywords; }; } // namespace Internal