diff --git a/src/libs/utils/basevalidatinglineedit.cpp b/src/libs/utils/basevalidatinglineedit.cpp index 78ac372c673ac55c92e2f1e0e7e61676dfb24661..e1c71c190d32355fc7632b2bfd2a6cada8ef1eee 100644 --- a/src/libs/utils/basevalidatinglineedit.cpp +++ b/src/libs/utils/basevalidatinglineedit.cpp @@ -150,5 +150,10 @@ void BaseValidatingLineEdit::slotReturnPressed() emit validReturnPressed(); } +void BaseValidatingLineEdit::triggerChanged() +{ + slotChanged(text()); +} + } // namespace Utils } // namespace Core diff --git a/src/libs/utils/basevalidatinglineedit.h b/src/libs/utils/basevalidatinglineedit.h index 1b179c8c8fe66fb4c0766b28132bcd9a57eb2beb..9dd8f8ec5699bf0c9f80891f673fbcc37b447e84 100644 --- a/src/libs/utils/basevalidatinglineedit.h +++ b/src/libs/utils/basevalidatinglineedit.h @@ -72,6 +72,9 @@ public: QColor errorColor() const; void setErrorColor(const QColor &); + // Trigger an update (after changing settings) + void triggerChanged(); + static QColor textColor(const QWidget *w); static void setTextColor(QWidget *w, const QColor &c); diff --git a/src/libs/utils/classnamevalidatinglineedit.cpp b/src/libs/utils/classnamevalidatinglineedit.cpp index 2fcf20f50d849fbad214c8e117635b134b5ca28e..86f86a124d045e0f8f96a27e68c8e3309bb2cd99 100644 --- a/src/libs/utils/classnamevalidatinglineedit.cpp +++ b/src/libs/utils/classnamevalidatinglineedit.cpp @@ -43,13 +43,15 @@ struct ClassNameValidatingLineEditPrivate { const QRegExp m_nameRegexp; const QString m_namespaceDelimiter; bool m_namespacesEnabled; + bool m_lowerCaseFileName; }; // Match something like "Namespace1::Namespace2::ClassName". ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() : m_nameRegexp(QLatin1String("[a-zA-Z_][a-zA-Z0-9_]*(::[a-zA-Z_][a-zA-Z0-9_]*)*")), m_namespaceDelimiter(QLatin1String("::")), - m_namespacesEnabled(false) + m_namespacesEnabled(false), + m_lowerCaseFileName(true) { QTC_ASSERT(m_nameRegexp.isValid(), return); } @@ -96,7 +98,7 @@ void ClassNameValidatingLineEdit::slotChanged(const QString &t) Core::Utils::BaseValidatingLineEdit::slotChanged(t); if (isValid()) { // Suggest file names, strip namespaces - QString fileName = t.toLower(); + QString fileName = m_d->m_lowerCaseFileName ? t.toLower() : t; if (m_d->m_namespacesEnabled) { const int namespaceIndex = fileName.lastIndexOf(m_d->m_namespaceDelimiter); if (namespaceIndex != -1) @@ -132,5 +134,15 @@ QString ClassNameValidatingLineEdit::createClassName(const QString &name) return className; } +bool ClassNameValidatingLineEdit::lowerCaseFileName() const +{ + return m_d->m_lowerCaseFileName; +} + +void ClassNameValidatingLineEdit::setLowerCaseFileName(bool v) +{ + m_d->m_lowerCaseFileName = v; +} + } // namespace Utils } // namespace Core diff --git a/src/libs/utils/classnamevalidatinglineedit.h b/src/libs/utils/classnamevalidatinglineedit.h index 005f241fe2d8aead8b23c3c39ad9f533a7a2d0be..69fb4f749893ab9161a495e1bcf7748b483ad5f0 100644 --- a/src/libs/utils/classnamevalidatinglineedit.h +++ b/src/libs/utils/classnamevalidatinglineedit.h @@ -46,6 +46,7 @@ class QWORKBENCH_UTILS_EXPORT ClassNameValidatingLineEdit { Q_DISABLE_COPY(ClassNameValidatingLineEdit) Q_PROPERTY(bool namespacesEnabled READ namespacesEnabled WRITE setNamespacesEnabled DESIGNABLE true) + Q_PROPERTY(bool lowerCaseFileName READ lowerCaseFileName WRITE setLowerCaseFileName) Q_OBJECT public: @@ -55,6 +56,9 @@ public: bool namespacesEnabled() const; void setNamespacesEnabled(bool b); + bool lowerCaseFileName() const; + void setLowerCaseFileName(bool v); + // Clean an input string to get a valid class name. static QString createClassName(const QString &name); diff --git a/src/libs/utils/newclasswidget.cpp b/src/libs/utils/newclasswidget.cpp index 3559fdfda41fc7586c073faeee4fe8bb96309e0a..5e3f2d93d96363da48ececa41110b7b90f285bf9 100644 --- a/src/libs/utils/newclasswidget.cpp +++ b/src/libs/utils/newclasswidget.cpp @@ -84,7 +84,7 @@ NewClassWidget::NewClassWidget(QWidget *parent) : m_d->m_ui.baseClassComboBox->setEditable(false); connect(m_d->m_ui.classLineEdit, SIGNAL(updateFileName(QString)), - this, SLOT(updateFileNames(QString))); + this, SLOT(slotUpdateFileNames(QString))); connect(m_d->m_ui.classLineEdit, SIGNAL(textEdited(QString)), this, SLOT(classNameEdited())); connect(m_d->m_ui.baseClassComboBox, SIGNAL(currentIndexChanged(int)), @@ -357,6 +357,16 @@ void NewClassWidget::setAllowDirectories(bool v) } } +bool NewClassWidget::lowerCaseFiles() const +{ + return m_d->m_ui.classLineEdit->lowerCaseFileName(); +} + +void NewClassWidget::setLowerCaseFiles(bool v) +{ + m_d->m_ui.classLineEdit->setLowerCaseFileName(v); +} + void NewClassWidget::slotValidChanged() { const bool newValid = isValid(); @@ -415,7 +425,12 @@ bool NewClassWidget::isValid(QString *error) const return true; } -void NewClassWidget::updateFileNames(const QString &baseName) +void NewClassWidget::triggerUpdateFileNames() +{ + m_d->m_ui.classLineEdit->triggerChanged(); +} + +void NewClassWidget::slotUpdateFileNames(const QString &baseName) { if (debugNewClassWidget) qDebug() << Q_FUNC_INFO << baseName << m_d->m_headerExtension << m_d->m_sourceExtension; diff --git a/src/libs/utils/newclasswidget.h b/src/libs/utils/newclasswidget.h index 9711f42afa0dc08b2c45c678acd1f99f2da1e039..15b21fcb0e6eeb5542390473799bb7c94c2c1fc1 100644 --- a/src/libs/utils/newclasswidget.h +++ b/src/libs/utils/newclasswidget.h @@ -70,6 +70,7 @@ class QWORKBENCH_UTILS_EXPORT NewClassWidget : public QWidget Q_PROPERTY(bool formInputCheckable READ formInputCheckable WRITE setFormInputCheckable DESIGNABLE true) Q_PROPERTY(bool formInputChecked READ formInputChecked WRITE setFormInputChecked DESIGNABLE true) Q_PROPERTY(bool allowDirectories READ allowDirectories WRITE setAllowDirectories) + Q_PROPERTY(bool lowerCaseFiles READ lowerCaseFiles WRITE setLowerCaseFiles) // Utility "USER" property for wizards containing file names. Q_PROPERTY(QStringList files READ files DESIGNABLE false USER true) public: @@ -95,6 +96,7 @@ public: QString headerExtension() const; QString formExtension() const; bool allowDirectories() const; + bool lowerCaseFiles() const; bool isValid(QString *error = 0) const; @@ -123,19 +125,25 @@ public slots: void setHeaderExtension(const QString &e); void setFormExtension(const QString &e); void setAllowDirectories(bool v); + void setLowerCaseFiles(bool v); /* Suggest a class name from the base class by stripping the leading 'Q' * character. This will happen automagically if the base class combo * changes until the class line edited is manually edited. */ void suggestClassNameFromBase(); +public slots: + // Trigger an update (after changing settings) + void triggerUpdateFileNames(); + private slots: - void updateFileNames(const QString &t); + void slotUpdateFileNames(const QString &t); void slotValidChanged(); void slotActivated(); void classNameEdited(); void slotFormInputChecked(); + private: void setFormInputCheckable(bool checkable, bool force); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 61de34e01eb16a475f737f166bdc7f749b1f8772..def15f0bba6ace9e25c2c89f0a5eda5679360d92 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -234,15 +234,19 @@ QString CMakeSettingsPage::findCmakeExecutable() const return env.searchInPath("cmake"); } +QString CMakeSettingsPage::id() const +{ + return QLatin1String("CMake"); +} -QString CMakeSettingsPage::name() const +QString CMakeSettingsPage::trName() const { - return "CMake"; + return tr("CMake"); } QString CMakeSettingsPage::category() const { - return "CMake"; + return QLatin1String("CMake"); } QString CMakeSettingsPage::trCategory() const diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h index f4c18f906ad39ca68f3a4c789566b1a846a8366b..2188edb6e99b536de5b429392739c45ca95ef2bc 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h @@ -92,7 +92,8 @@ class CMakeSettingsPage : public Core::IOptionsPage public: CMakeSettingsPage(); virtual ~CMakeSettingsPage(); - virtual QString name() const; + virtual QString id() const; + virtual QString trName() const; virtual QString category() const; virtual QString trCategory() const; diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index c86d50f0b065ad355ef204a633398eea5bf16011..28213df1e897948312824f0f89f0a32cc348d723 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -39,7 +39,11 @@ using namespace CMakeProjectManager; using namespace CMakeProjectManager::Internal; CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title) - : ProjectExplorer::ApplicationRunConfiguration(pro), m_runMode(Gui), m_target(target), m_workingDirectory(workingDirectory), m_title(title) + : ProjectExplorer::ApplicationRunConfiguration(pro) + , m_runMode(Gui) + , m_target(target) + , m_workingDirectory(workingDirectory) + , m_title(title) { setName(title); } diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp index ba0ef7b59a4e952306d2d681d3eab2df32c72b06..102cb5c21fb4bda4432dd80ea5140150224e55e0 100644 --- a/src/plugins/coreplugin/coreimpl.cpp +++ b/src/plugins/coreplugin/coreimpl.cpp @@ -64,9 +64,9 @@ QStringList CoreImpl::showNewItemDialog(const QString &title, return m_mainwindow->showNewItemDialog(title, wizards, defaultLocation); } -void CoreImpl::showOptionsDialog(const QString &group, const QString &page) +bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent) { - m_mainwindow->showOptionsDialog(group, page); + return m_mainwindow->showOptionsDialog(group, page, parent); } ActionManager *CoreImpl::actionManager() const diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h index e0db9a94669682b076ab99523f6036a5ef92bbbf..f821a5af531b63911fb1e92e700667c45d0ff621 100644 --- a/src/plugins/coreplugin/coreimpl.h +++ b/src/plugins/coreplugin/coreimpl.h @@ -47,8 +47,9 @@ public: QStringList showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, const QString &defaultLocation = QString()); - void showOptionsDialog(const QString &group = QString(), - const QString &page = QString()); + bool showOptionsDialog(const QString &group = QString(), + const QString &page = QString(), + QWidget *parent = 0); ActionManager *actionManager() const; FileManager *fileManager() const ; diff --git a/src/plugins/coreplugin/dialogs/ioptionspage.h b/src/plugins/coreplugin/dialogs/ioptionspage.h index 7b0e65148827cba21b346ce3e66c937d7eb4d7ad..35c4b6b4f4676296664461a985e09f9e52369158 100644 --- a/src/plugins/coreplugin/dialogs/ioptionspage.h +++ b/src/plugins/coreplugin/dialogs/ioptionspage.h @@ -38,6 +38,21 @@ namespace Core { +/*! + \class Core::IOptionsPage + \brief The IOptionsPage is an interface for providing options pages. + + Guidelines for implementing: + \list + \o id() is an id used for filtering when calling ICore:: showOptionsDialog() + \o trName() is the (translated) name for display. + \o category() is the category used for filtering when calling ICore:: showOptionsDialog() + \o trCategory() is the translated category + \o apply() is called to store the settings. It should detect if any changes have been + made and store those. + \endlist +*/ + class CORE_EXPORT IOptionsPage : public QObject { Q_OBJECT @@ -45,7 +60,8 @@ public: IOptionsPage(QObject *parent = 0) : QObject(parent) {} virtual ~IOptionsPage() {} - virtual QString name() const = 0; + virtual QString id() const = 0; + virtual QString trName() const = 0; virtual QString category() const = 0; virtual QString trCategory() const = 0; diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index a04afbaf69f9f50b2320ce107462b26cbef8aa79..5e0cac944ef0b64a79bb4e3b71909bba5862a57e 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -39,7 +39,7 @@ using namespace Core::Internal; SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory, const QString &initialPage) - : QDialog(parent) + : QDialog(parent), m_applied(false) { setupUi(this); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); @@ -60,7 +60,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory, int index = 0; foreach (IOptionsPage *page, pages) { QTreeWidgetItem *item = new QTreeWidgetItem; - item->setText(0, page->name()); + item->setText(0, page->trName()); item->setData(0, Qt::UserRole, index); QStringList categoriesId = page->category().split(QLatin1Char('|')); @@ -94,7 +94,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory, m_pages.append(page); stackedPages->addWidget(page->createPage(stackedPages)); - if (page->name() == initialPage && currentCategory == initialCategory) { + if (page->id() == initialPage && currentCategory == initialCategory) { stackedPages->setCurrentIndex(stackedPages->count()); pageTree->setCurrentItem(item); } @@ -123,6 +123,7 @@ void SettingsDialog::pageSelected(QTreeWidgetItem *) void SettingsDialog::accept() { + m_applied = true; foreach (IOptionsPage *page, m_pages) { page->apply(); page->finish(); @@ -141,4 +142,12 @@ void SettingsDialog::apply() { foreach (IOptionsPage *page, m_pages) page->apply(); + m_applied = true; +} + +bool SettingsDialog::execDialog() +{ + m_applied = false; + exec(); + return m_applied; } diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.h b/src/plugins/coreplugin/dialogs/settingsdialog.h index 3cd42863cce871b88320fcfdbb319e8f9dec00c2..36c7d8a1a626a6550a44e15cb45aca5742e7d3b9 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.h +++ b/src/plugins/coreplugin/dialogs/settingsdialog.h @@ -49,6 +49,10 @@ public: const QString &initialPage = QString()); ~SettingsDialog(); + // Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked + // at least once + bool execDialog(); + private slots: void pageSelected(QTreeWidgetItem *cat); void accept(); @@ -57,6 +61,7 @@ private slots: private: QList<Core::IOptionsPage*> m_pages; + bool m_applied; }; } // namespace Internal diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 4a0f36cd2bf1b1a6e261af0677ef8a7f7d5c079b..561b8b182dba9bf1477047cb7fb67cfcb3664fc0 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -59,7 +59,13 @@ ShortcutSettings::~ShortcutSettings() } // IOptionsPage -QString ShortcutSettings::name() const + +QString ShortcutSettings::id() const +{ + return QLatin1String("Keyboard"); +} + +QString ShortcutSettings::trName() const { return tr("Keyboard"); } diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.h b/src/plugins/coreplugin/dialogs/shortcutsettings.h index 7935f58612dc74f391385faf018eba3667af634a..cb0a19c65f00f94aaab72423c9ac2b9693eb5756 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.h +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.h @@ -67,7 +67,8 @@ public: ~ShortcutSettings(); // IOptionsPage - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 864ed529fbc1a521690239432fb71c24fb5ee89a..969599b2d8a9140341aed96ec2f3691e7e04596f 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -43,7 +43,12 @@ GeneralSettings::GeneralSettings(): { } -QString GeneralSettings::name() const +QString GeneralSettings::id() const +{ + return QLatin1String("General"); +} + +QString GeneralSettings::trName() const { return tr("General"); } diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h index 6aa8c24c23ceece82e05845e60e8c15056e82ff3..9135df7f4a303e5c41a3f54492c2dd3f5fee77e6 100644 --- a/src/plugins/coreplugin/generalsettings.h +++ b/src/plugins/coreplugin/generalsettings.h @@ -47,7 +47,8 @@ class GeneralSettings : public IOptionsPage public: GeneralSettings(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; QWidget* createPage(QWidget *parent); diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index fd75686c67a2b5aad987c23eec5050dcf19a24e2..950222a15bd8ba3e2268362d594a17ff29eaec2c 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -70,8 +70,9 @@ public: const QList<IWizard *> &wizards, const QString &defaultLocation = QString()) = 0; - virtual void showOptionsDialog(const QString &group = QString(), - const QString &page = QString()) = 0; + virtual bool showOptionsDialog(const QString &group = QString(), + const QString &page = QString(), + QWidget *parent = 0) = 0; virtual ActionManager *actionManager() const = 0; virtual FileManager *fileManager() const = 0; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 822636d5359413d5488daf4edf4fb869c1eb02ef..9c489e7b96af57bed0e18f949dc04f6b341a937e 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -865,11 +865,15 @@ QStringList MainWindow::showNewItemDialog(const QString &title, return wizard->runWizard(defaultDir, this); } -void MainWindow::showOptionsDialog(const QString &category, const QString &page) +bool MainWindow::showOptionsDialog(const QString &category, + const QString &page, + QWidget *parent) { emit m_coreImpl->optionsDialogRequested(); - SettingsDialog dlg(this, category, page); - dlg.exec(); + if (!parent) + parent = this; + SettingsDialog dlg(parent, category, page); + return dlg.execDialog(); } void MainWindow::saveAll() diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 0c1e413715225bd4814524e9fcf700b9b56a9c35..ea237f53bacc7b298af987f6713d71c634a9d031 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -132,7 +132,9 @@ public slots: const QList<IWizard *> &wizards, const QString &defaultLocation = QString()); - void showOptionsDialog(const QString &category = QString(), const QString &page = QString()); + bool showOptionsDialog(const QString &category = QString(), + const QString &page = QString(), + QWidget *parent = 0); protected: virtual void changeEvent(QEvent *e); diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp index fb6a7a92d90d98ff81b18b141e0617416488d8d7..b4ad118d78749265184848d24dc653e23a46910e 100644 --- a/src/plugins/cpaster/settingspage.cpp +++ b/src/plugins/cpaster/settingspage.cpp @@ -52,14 +52,19 @@ SettingsPage::SettingsPage() } } -QString SettingsPage::name() const +QString SettingsPage::id() const { - return "General"; + return QLatin1String("General"); +} + +QString SettingsPage::trName() const +{ + return tr("General"); } QString SettingsPage::category() const { - return "CodePaster"; + return QLatin1String("CodePaster"); } QString SettingsPage::trCategory() const diff --git a/src/plugins/cpaster/settingspage.h b/src/plugins/cpaster/settingspage.h index 3eef0dcbc4d560f5e403e6cbe51da5a775e4f8c5..88ad5c25904df0ff07fa4e92ba06fe020feb4c29 100644 --- a/src/plugins/cpaster/settingspage.h +++ b/src/plugins/cpaster/settingspage.h @@ -50,7 +50,8 @@ class SettingsPage : public Core::IOptionsPage public: SettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp index a5f21f859bfdca35fab958f62114a18e8c490fe1..d56875e213ca9ea8cdd3232634ea91648a96b561 100644 --- a/src/plugins/cppeditor/cppclasswizard.cpp +++ b/src/plugins/cppeditor/cppclasswizard.cpp @@ -30,6 +30,10 @@ #include "cppclasswizard.h" #include "cppeditorconstants.h" +#include <cpptools/cpptoolsconstants.h> +#include <coreplugin/icore.h> +#include <coreplugin/mimedatabase.h> + #include <utils/codegeneration.h> #include <utils/newclasswidget.h> #include <utils/qtcassert.h> @@ -37,19 +41,21 @@ #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QTextStream> +#include <QtCore/QSettings> #include <QtGui/QVBoxLayout> +#include <QtGui/QHBoxLayout> +#include <QtGui/QPushButton> +#include <QtGui/QToolButton> +#include <QtGui/QSpacerItem> #include <QtGui/QWizard> using namespace CppEditor; using namespace CppEditor::Internal; - // ========= ClassNamePage ========= -ClassNamePage::ClassNamePage(const QString &sourceSuffix, - const QString &headerSuffix, - QWidget *parent) : +ClassNamePage::ClassNamePage(QWidget *parent) : QWizardPage(parent), m_isValid(false) { @@ -58,8 +64,6 @@ ClassNamePage::ClassNamePage(const QString &sourceSuffix, m_newClassWidget = new Core::Utils::NewClassWidget; // Order, set extensions first before suggested name is derived - m_newClassWidget->setHeaderExtension(headerSuffix); - m_newClassWidget->setSourceExtension(sourceSuffix); m_newClassWidget->setBaseClassInputVisible(true); m_newClassWidget->setBaseClassChoices(QStringList() << QString() << QLatin1String("QObject") @@ -70,11 +74,51 @@ ClassNamePage::ClassNamePage(const QString &sourceSuffix, m_newClassWidget->setNamespacesEnabled(true); m_newClassWidget->setAllowDirectories(true); - connect(m_newClassWidget, SIGNAL(validChanged()), - this, SLOT(slotValidChanged())); + connect(m_newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); - QVBoxLayout *pageLayout = new QVBoxLayout(this); + QVBoxLayout *pageLayout = new QVBoxLayout(this); pageLayout->addWidget(m_newClassWidget); + QSpacerItem *vSpacer = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding); + pageLayout->addItem(vSpacer); + QHBoxLayout *buttonLayout = new QHBoxLayout; + pageLayout->addLayout(buttonLayout); + QSpacerItem *hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored); + buttonLayout->addItem(hSpacer); + QToolButton *settingsButton = new QToolButton; + settingsButton->setText(tr("Configure...")); + connect(settingsButton, SIGNAL(clicked()), this, SLOT(slotSettings())); + buttonLayout->addWidget(settingsButton); + initParameters(); +} + +// Retrieve settings of CppTools plugin. +static inline bool lowerCaseFiles(const Core::ICore *core) +{ + QString lowerCaseSettingsKey = QLatin1String(CppTools::Constants::CPPTOOLS_SETTINGSGROUP); + lowerCaseSettingsKey += QLatin1Char('/'); + lowerCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY); + const bool lowerCaseDefault = CppTools::Constants::lowerCaseFilesDefault; + return core->settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); +} + +// Set up new class widget from settings +void ClassNamePage::initParameters() +{ + Core::ICore *core = Core::ICore::instance(); + const Core::MimeDatabase *mdb = core->mimeDatabase(); + m_newClassWidget->setHeaderExtension(mdb->preferredSuffixByType(QLatin1String(Constants::CPP_HEADER_MIMETYPE))); + m_newClassWidget->setSourceExtension(mdb->preferredSuffixByType(QLatin1String(Constants::CPP_SOURCE_MIMETYPE))); + m_newClassWidget->setLowerCaseFiles(lowerCaseFiles(core)); +} + +void ClassNamePage::slotSettings() +{ + const QString id = QLatin1String(CppTools::Constants::CPP_SETTINGS_ID); + const QString cat = QLatin1String(CppTools::Constants::CPP_SETTINGS_CATEGORY); + if (Core::ICore::instance()->showOptionsDialog(cat, id, this)) { + initParameters(); + m_newClassWidget->triggerUpdateFileNames(); + } } void ClassNamePage::slotValidChanged() @@ -86,11 +130,9 @@ void ClassNamePage::slotValidChanged() } } -CppClassWizardDialog::CppClassWizardDialog(const QString &sourceSuffix, - const QString &headerSuffix, - QWidget *parent) : +CppClassWizardDialog::CppClassWizardDialog(QWidget *parent) : QWizard(parent), - m_classNamePage(new ClassNamePage(sourceSuffix, headerSuffix, this)) + m_classNamePage(new ClassNamePage(this)) { Core::BaseFileWizard::setupWizard(this); setWindowTitle(tr("C++ Class Wizard")); @@ -136,7 +178,7 @@ QWizard *CppClassWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const { - CppClassWizardDialog *wizard = new CppClassWizardDialog(sourceSuffix(), headerSuffix(), parent); + CppClassWizardDialog *wizard = new CppClassWizardDialog(parent); foreach (QWizardPage *p, extensionPages) wizard->addPage(p); wizard->setPath(defaultPath); diff --git a/src/plugins/cppeditor/cppclasswizard.h b/src/plugins/cppeditor/cppclasswizard.h index 0c36de7e781161c6a5d8afd0457d38831538ff7c..0ad4d7fcd49499f0eda1f4210c73e7a8d0a995dd 100644 --- a/src/plugins/cppeditor/cppclasswizard.h +++ b/src/plugins/cppeditor/cppclasswizard.h @@ -52,17 +52,18 @@ class ClassNamePage : public QWizardPage Q_OBJECT public: - ClassNamePage(const QString &sourceSuffix, - const QString &headerSuffix, - QWidget *parent = 0); + explicit ClassNamePage(QWidget *parent = 0); bool isComplete() const { return m_isValid; } Core::Utils::NewClassWidget *newClassWidget() const { return m_newClassWidget; } private slots: void slotValidChanged(); + void slotSettings(); private: + void initParameters(); + Core::Utils::NewClassWidget *m_newClassWidget; bool m_isValid; }; @@ -82,9 +83,7 @@ class CppClassWizardDialog : public QWizard Q_OBJECT Q_DISABLE_COPY(CppClassWizardDialog) public: - explicit CppClassWizardDialog(const QString &sourceSuffix, - const QString &headerSuffix, - QWidget *parent = 0); + explicit CppClassWizardDialog(QWidget *parent = 0); void setPath(const QString &path); CppClassWizardParameters parameters() const; diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index cb6ef53f63a87125df395ad8dd3375f18502a6d6..29ad67314517bb22d5a10d5fdd09d2b2c6c03a7f 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -56,9 +56,6 @@ #include <QtGui/QMenu> #include <QtGui/QAction> -static const char *headerSuffixKeyC = "CppEditor/HeaderSuffix"; -static const char *sourceSuffixKeyC = "CppEditor/SourceSuffix"; - using namespace CppEditor::Internal; //////////////////////////// CppEditorFactory ///////////////////////////// @@ -197,18 +194,6 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess | TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCollapseAll); - // Check Suffixes - if (const QSettings *settings = core->settings()) { - const QString headerSuffixKey = QLatin1String(headerSuffixKeyC); - if (settings->contains(headerSuffixKey)) { - const QString headerSuffix = settings->value(headerSuffixKey, QString()).toString(); - if (!headerSuffix.isEmpty()) - core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix); - const QString sourceSuffix = settings->value(QLatin1String(sourceSuffixKeyC), QString()).toString(); - if (!sourceSuffix.isEmpty()) - core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix); - } - } return true; } diff --git a/src/plugins/cpptools/completionsettingspage.cpp b/src/plugins/cpptools/completionsettingspage.cpp index 43945ca67da50cf10ecc3b2a0c8f0c661fffdd30..02638875ba4a0fa2e1d8fc13a91d27035d5b8b71 100644 --- a/src/plugins/cpptools/completionsettingspage.cpp +++ b/src/plugins/cpptools/completionsettingspage.cpp @@ -47,7 +47,12 @@ CompletionSettingsPage::~CompletionSettingsPage() delete m_page; } -QString CompletionSettingsPage::name() const +QString CompletionSettingsPage::id() const +{ + return QLatin1String("Completion"); +} + +QString CompletionSettingsPage::trName() const { return tr("Completion"); } diff --git a/src/plugins/cpptools/completionsettingspage.h b/src/plugins/cpptools/completionsettingspage.h index 39385e3023834981bb53a267b84f66f9a8d99102..48c16a729d1fd8c5e5139f752bd4b0c96627519c 100644 --- a/src/plugins/cpptools/completionsettingspage.h +++ b/src/plugins/cpptools/completionsettingspage.h @@ -47,7 +47,8 @@ public: CompletionSettingsPage(CppCodeCompletion *completion); ~CompletionSettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cdebf13a7c5c28fd600eab8c769d741cca19712c --- /dev/null +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -0,0 +1,185 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#include "cppfilesettingspage.h" +#include "cpptoolsconstants.h" +#include "ui_cppfilesettingspage.h" + +#include <coreplugin/icore.h> +#include <coreplugin/mimedatabase.h> +#include <extensionsystem/pluginmanager.h> + +#include <QtCore/QSettings> +#include <QtCore/QDebug> +#include <QtCore/QCoreApplication> + +static const char *headerSuffixKeyC = "HeaderSuffix"; +static const char *sourceSuffixKeyC = "SourceSuffix"; + +namespace CppTools { +namespace Internal { + +CppFileSettings::CppFileSettings() : + lowerCaseFiles(false) +{ +} + +void CppFileSettings::toSettings(QSettings *s) const +{ + s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP)); + s->setValue(QLatin1String(headerSuffixKeyC), headerSuffix); + s->setValue(QLatin1String(sourceSuffixKeyC), sourceSuffix); + s->setValue(QLatin1String(Constants::LOWERCASE_CPPFILES_KEY), lowerCaseFiles); + s->endGroup(); +} + +void CppFileSettings::fromSettings(QSettings *s) +{ + s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP)); + headerSuffix= s->value(QLatin1String(headerSuffixKeyC), QLatin1String("h")).toString(); + sourceSuffix = s->value(QLatin1String(sourceSuffixKeyC), QLatin1String("cpp")).toString(); + const bool lowerCaseDefault = Constants::lowerCaseFilesDefault; + lowerCaseFiles = s->value(QLatin1String(Constants::LOWERCASE_CPPFILES_KEY), QVariant(lowerCaseDefault)).toBool(); + s->endGroup(); +} + +void CppFileSettings::applySuffixesToMimeDB() +{ + Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + mdb->setPreferredSuffix(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE), sourceSuffix); + mdb->setPreferredSuffix(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE), headerSuffix); +} + +bool CppFileSettings::equals(const CppFileSettings &rhs) const +{ + return lowerCaseFiles == rhs.lowerCaseFiles + && headerSuffix == rhs.headerSuffix + && sourceSuffix == rhs.sourceSuffix; +} + +// ------------------ CppFileSettingsWidget + +CppFileSettingsWidget::CppFileSettingsWidget(QWidget *parent) : + QWidget(parent), + m_ui(new Ui::CppFileSettingsPage) +{ + m_ui->setupUi(this); + const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + // populate suffix combos + if (const Core::MimeType sourceMt = mdb->findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))) + foreach (const QString &suffix, sourceMt.suffixes()) + m_ui->sourceSuffixComboBox->addItem(suffix); + + if (const Core::MimeType headerMt = mdb->findByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))) + foreach (const QString &suffix, headerMt.suffixes()) + m_ui->headerSuffixComboBox->addItem(suffix); +} + +CppFileSettingsWidget::~CppFileSettingsWidget() +{ + delete m_ui; +} + +CppFileSettings CppFileSettingsWidget::settings() const +{ + CppFileSettings rc; + rc.lowerCaseFiles = m_ui->lowerCaseFileNamesCheckBox->isChecked(); + rc.headerSuffix = m_ui->headerSuffixComboBox->currentText(); + rc.sourceSuffix = m_ui->sourceSuffixComboBox->currentText(); + return rc; +} + +static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0) +{ + const int index = cb->findText(text); + cb->setCurrentIndex(index == -1 ? defaultIndex: index); +} + +void CppFileSettingsWidget::setSettings(const CppFileSettings &s) +{ + m_ui->lowerCaseFileNamesCheckBox->setChecked(s.lowerCaseFiles); + setComboText(m_ui->headerSuffixComboBox, s.headerSuffix); + setComboText(m_ui->sourceSuffixComboBox, s.sourceSuffix); +} + +// --------------- CppFileSettingsPage +CppFileSettingsPage::CppFileSettingsPage(QObject *parent) : + Core::IOptionsPage(parent) +{ + m_settings.fromSettings(Core::ICore::instance()->settings()); + m_settings.applySuffixesToMimeDB(); +} + +CppFileSettingsPage::~CppFileSettingsPage() +{ +} + +QString CppFileSettingsPage::id() const +{ + return QLatin1String(Constants::CPP_SETTINGS_ID); +} + +QString CppFileSettingsPage::trName() const +{ + return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_ID); +} + +QString CppFileSettingsPage::category() const +{ + return QLatin1String(Constants::CPP_SETTINGS_CATEGORY); +} + +QString CppFileSettingsPage::trCategory() const +{ + return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_CATEGORY); +} + +QWidget *CppFileSettingsPage::createPage(QWidget *parent) +{ + + m_widget = new CppFileSettingsWidget(parent); + m_widget->setSettings(m_settings); + return m_widget; +} + +void CppFileSettingsPage::apply() +{ + if (m_widget) { + const CppFileSettings newSettings = m_widget->settings(); + if (newSettings != m_settings) { + m_settings = newSettings; + m_settings.toSettings(Core::ICore::instance()->settings()); + m_settings.applySuffixesToMimeDB(); + } + } +} + +} +} + diff --git a/src/plugins/cpptools/cppfilesettingspage.h b/src/plugins/cpptools/cppfilesettingspage.h new file mode 100644 index 0000000000000000000000000000000000000000..53abb7788a5fd52793b404e1e8fa677ef615c610 --- /dev/null +++ b/src/plugins/cpptools/cppfilesettingspage.h @@ -0,0 +1,100 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#ifndef CPPSETTINGSPAGE_H +#define CPPSETTINGSPAGE_H + +#include <coreplugin/dialogs/ioptionspage.h> +#include <QtCore/QPointer> +#include <QtGui/QWidget> + +QT_BEGIN_NAMESPACE +namespace Ui { + class CppFileSettingsPage; +} +class QSettings; +QT_END_NAMESPACE + +namespace CppTools { +namespace Internal { + +struct CppFileSettings { + CppFileSettings(); + + QString headerSuffix; + QString sourceSuffix; + bool lowerCaseFiles; + + void toSettings(QSettings *) const; + void fromSettings(QSettings *); + void applySuffixesToMimeDB(); + + bool equals(const CppFileSettings &rhs) const; +}; + +inline bool operator==(const CppFileSettings &s1, const CppFileSettings &s2) { return s1.equals(s2); } +inline bool operator!=(const CppFileSettings &s1, const CppFileSettings &s2) { return !s1.equals(s2); } + +class CppFileSettingsWidget : public QWidget { + Q_OBJECT +public: + explicit CppFileSettingsWidget(QWidget *parent = 0); + virtual ~CppFileSettingsWidget(); + + CppFileSettings settings() const; + void setSettings(const CppFileSettings &s); + +private: + Ui::CppFileSettingsPage *m_ui; +}; + +class CppFileSettingsPage : public Core::IOptionsPage +{ +public: + explicit CppFileSettingsPage(QObject *parent = 0); + virtual ~CppFileSettingsPage(); + + virtual QString id() const; + virtual QString trName() const; + virtual QString category() const; + virtual QString trCategory() const; + + virtual QWidget *createPage(QWidget *parent); + virtual void apply(); + virtual void finish() { } + +private: + QPointer<CppFileSettingsWidget> m_widget; + CppFileSettings m_settings; +}; + +} // namespace Internal +} // namespace CppTools + +#endif // CPPSETTINGSPAGE_H diff --git a/src/plugins/cpptools/cppfilesettingspage.ui b/src/plugins/cpptools/cppfilesettingspage.ui new file mode 100644 index 0000000000000000000000000000000000000000..f5005ecacb03f2c8c807bef6afca55ef8359f0c3 --- /dev/null +++ b/src/plugins/cpptools/cppfilesettingspage.ui @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CppFileSettingsPage</class> + <widget class="QWidget" name="CppFileSettingsPage"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>424</width> + <height>503</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::ExpandingFieldsGrow</enum> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="headerSuffixLabel"> + <property name="text"> + <string>Header suffix:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="headerSuffixComboBox"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lowerCaseFileNamesLabel"> + <property name="toolTip"> + <string>This determines how the file names of the class wizards are generated ("MyClass.h" versus "myclass.h").</string> + </property> + <property name="text"> + <string>Lower case file names:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="lowerCaseFileNamesCheckBox"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="sourceSuffixLabel"> + <property name="text"> + <string>Source suffix:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="sourceSuffixComboBox"/> + </item> + </layout> + </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> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>430</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro index 21298bef0732215923e64885c45858905e21821a..2094a0edf64794cd3a1357928684f8c113ae02b7 100644 --- a/src/plugins/cpptools/cpptools.pro +++ b/src/plugins/cpptools/cpptools.pro @@ -20,7 +20,8 @@ HEADERS += completionsettingspage.h \ cpptoolseditorsupport.h \ cpptoolsplugin.h \ searchsymbols.h \ - cppdoxygen.h + cppdoxygen.h \ + cppfilesettingspage.h SOURCES += completionsettingspage.cpp \ cppclassesfilter.cpp \ @@ -31,6 +32,8 @@ SOURCES += completionsettingspage.cpp \ cpptoolseditorsupport.cpp \ cpptoolsplugin.cpp \ searchsymbols.cpp \ - cppdoxygen.cpp + cppdoxygen.cpp \ + cppfilesettingspage.cpp -FORMS += completionsettingspage.ui +FORMS += completionsettingspage.ui \ + cppfilesettingspage.ui diff --git a/src/plugins/cpptools/cpptoolsconstants.h b/src/plugins/cpptools/cpptoolsconstants.h index 0696db417691407488ec6dcba7aa7b5c8bb30137..73002aaface593425ddebcf70d1dd8cd71f891f7 100644 --- a/src/plugins/cpptools/cpptoolsconstants.h +++ b/src/plugins/cpptools/cpptoolsconstants.h @@ -30,6 +30,8 @@ #ifndef CPPTOOLSCONSTANTS_H #define CPPTOOLSCONSTANTS_H +#include <QtCore/QtGlobal> + namespace CppTools { namespace Constants { @@ -41,6 +43,14 @@ const char * const C_HEADER_MIMETYPE = "text/x-chdr"; const char * const CPP_SOURCE_MIMETYPE = "text/x-c++src"; const char * const CPP_HEADER_MIMETYPE = "text/x-c++hdr"; +// QSettings keys for use by the "New Class" wizards. +const char * const CPPTOOLS_SETTINGSGROUP = "CppTools"; +const char * const LOWERCASE_CPPFILES_KEY = "LowerCaseFiles"; +enum { lowerCaseFilesDefault = 1 }; + +const char * const CPP_SETTINGS_ID = QT_TRANSLATE_NOOP("CppTools", "File naming conventions"); +const char * const CPP_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("CppTools", "C++"); + } // namespace Constants } // namespace CppTools diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 3ca1db880995ff0101cf697fea9a741c0766a13e..301935530dafb040ad4ba70955687f9b5a2d72c9 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -30,6 +30,7 @@ #include "cpptoolsplugin.h" #include "completionsettingspage.h" +#include "cppfilesettingspage.h" #include "cppclassesfilter.h" #include "cppcodecompletion.h" #include "cppfunctionsfilter.h" @@ -90,6 +91,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CompletionSettingsPage(m_completion)); + addAutoReleasedObject(new CppFileSettingsPage); // Menus Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index a837993124be222f8065442cfbcec454b4ce25fe..c0ca6eda1d9793af694b524066057927fb284bb0 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -244,8 +244,9 @@ public: GdbOptionPage(DebuggerPlugin *plugin) : m_plugin(plugin) {} // IOptionsPage - QString name() const { return tr("Gdb"); } - QString category() const { return "Debugger"; } + QString id() const { return QLatin1String("Gdb"); } + QString trName() const { return tr("Gdb"); } + QString category() const { return QLatin1String("Debugger"); } QString trCategory() const { return tr("Debugger"); } QWidget *createPage(QWidget *parent); diff --git a/src/plugins/designer/cpp/formclasswizard.cpp b/src/plugins/designer/cpp/formclasswizard.cpp index 921ad030341c6e8949c103dd49b365e2f3c3076e..d208372a7247faf41957ab62d7f3d61296781f0b 100644 --- a/src/plugins/designer/cpp/formclasswizard.cpp +++ b/src/plugins/designer/cpp/formclasswizard.cpp @@ -34,10 +34,12 @@ #include <coreplugin/icore.h> #include <cppeditor/cppeditorconstants.h> +#include <cpptools/cpptoolsconstants.h> #include <QtCore/QFile> #include <QtCore/QDir> #include <QtCore/QDebug> +#include <QtCore/QSettings> using namespace Designer; using namespace Designer::Internal; @@ -62,13 +64,22 @@ QString FormClassWizard::formSuffix() const return preferredSuffix(QLatin1String(Constants::FORM_MIMETYPE)); } +// Retrieve settings of CppTools plugin. +static inline bool lowerCaseFiles() +{ + QString lowerCaseSettingsKey = QLatin1String(CppTools::Constants::CPPTOOLS_SETTINGSGROUP); + lowerCaseSettingsKey += QLatin1Char('/'); + lowerCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY); + const bool lowerCaseDefault = CppTools::Constants::lowerCaseFilesDefault; + return Core::ICore::instance()->settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); +} + QWizard *FormClassWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const { FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(extensionPages, parent); - wizardDialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix()); wizardDialog->setPath(defaultPath); return wizardDialog; } diff --git a/src/plugins/designer/cpp/formclasswizarddialog.cpp b/src/plugins/designer/cpp/formclasswizarddialog.cpp index a4eb0769dbef072c53659afa4bf357ff7a270781..2bec6a7982f4cc43862aad6c702c3bf58696c294 100644 --- a/src/plugins/designer/cpp/formclasswizarddialog.cpp +++ b/src/plugins/designer/cpp/formclasswizarddialog.cpp @@ -63,11 +63,6 @@ FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPage connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int))); } -void FormClassWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form) -{ - m_classPage->setSuffixes(header, source, form); -} - QString FormClassWizardDialog::path() const { return m_classPage->path(); diff --git a/src/plugins/designer/cpp/formclasswizarddialog.h b/src/plugins/designer/cpp/formclasswizarddialog.h index 4164e13a71801d471deec593166f0484919cd793..18d354ee1509de7ecf089f3db9599332cd73273e 100644 --- a/src/plugins/designer/cpp/formclasswizarddialog.h +++ b/src/plugins/designer/cpp/formclasswizarddialog.h @@ -54,8 +54,6 @@ public: explicit FormClassWizardDialog(const WizardPageList &extensionPages, QWidget *parent = 0); - void setSuffixes(const QString &header, const QString &source, const QString &form); - QString path() const; FormClassWizardParameters parameters() const; diff --git a/src/plugins/designer/cpp/formclasswizardpage.cpp b/src/plugins/designer/cpp/formclasswizardpage.cpp index bb32d2f1d5f633523e226358a27586e788978421..d469eb9edb77dd1f5a617ef9ed8785f9de20c47c 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.cpp +++ b/src/plugins/designer/cpp/formclasswizardpage.cpp @@ -32,7 +32,9 @@ #include "formclasswizardparameters.h" #include <coreplugin/icore.h> +#include <coreplugin/mimedatabase.h> #include <cppeditor/cppeditorconstants.h> +#include <cpptools/cpptoolsconstants.h> #include <QtCore/QDebug> #include <QtCore/QDir> @@ -66,6 +68,8 @@ FormClassWizardPage::FormClassWizardPage(QWidget * parent) : m_ui->extensionWidget->setVisible(false); connect(m_ui->moreButton, SIGNAL(clicked(bool)), m_ui->extensionWidget, SLOT(setVisible(bool))); + connect(m_ui->settingsToolButton, SIGNAL(clicked()), this, SLOT(slotSettings())); + restoreSettings(); } @@ -74,11 +78,34 @@ FormClassWizardPage::~FormClassWizardPage() delete m_ui; } -void FormClassWizardPage::setSuffixes(const QString &header, const QString &source, const QString &form) +// Retrieve settings of CppTools plugin. +static inline bool lowerCaseFiles(const Core::ICore *core) +{ + QString camelCaseSettingsKey = QLatin1String(CppTools::Constants::CPPTOOLS_SETTINGSGROUP); + camelCaseSettingsKey += QLatin1Char('/'); + camelCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY); + + return core->settings()->value(camelCaseSettingsKey, QVariant(false)).toBool(); +} + +// Set up new class widget from settings +void FormClassWizardPage::initParameters() { - m_ui->newClassWidget->setSourceExtension(source); - m_ui->newClassWidget->setHeaderExtension(header); - m_ui->newClassWidget->setFormExtension(form); + Core::ICore *core = Core::ICore::instance(); + const Core::MimeDatabase *mdb = core->mimeDatabase(); + m_ui->newClassWidget->setHeaderExtension(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))); + m_ui->newClassWidget->setSourceExtension(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))); + m_ui->newClassWidget->setLowerCaseFiles(lowerCaseFiles(core)); +} + +void FormClassWizardPage::slotSettings() +{ + const QString id = QLatin1String(CppTools::Constants::CPP_SETTINGS_ID); + const QString cat = QLatin1String(CppTools::Constants::CPP_SETTINGS_CATEGORY); + if (Core::ICore::instance()->showOptionsDialog(cat, id, this)) { + initParameters(); + m_ui->newClassWidget->triggerUpdateFileNames(); + } } void FormClassWizardPage::setClassName(const QString &suggestedClassName) diff --git a/src/plugins/designer/cpp/formclasswizardpage.h b/src/plugins/designer/cpp/formclasswizardpage.h index 68c2cd45bfa8cebe627dd6f0d31db2a8d96487b4..b777c5e1cd0ff95ce0896525e52ef722a4ec1560 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.h +++ b/src/plugins/designer/cpp/formclasswizardpage.h @@ -49,8 +49,6 @@ public: explicit FormClassWizardPage(QWidget * parent = 0); ~FormClassWizardPage(); - void setSuffixes(const QString &header, const QString &source, const QString &form); - virtual bool isComplete () const; virtual bool validatePage(); @@ -59,18 +57,20 @@ public: QString path() const; // Fill out applicable parameters - void getParameters(FormClassWizardParameters *) const; + void getParameters(FormClassWizardParameters *) const; public slots: void setClassName(const QString &suggestedClassName); void setPath(const QString &); void setRetranslationSupport(bool); void setUiClassEmbedding(int v); + void slotSettings(); private slots: void slotValidChanged(); private: + void initParameters(); void saveSettings(); void restoreSettings(); diff --git a/src/plugins/designer/cpp/formclasswizardpage.ui b/src/plugins/designer/cpp/formclasswizardpage.ui index 236e2059ca4d095d32854c160639cf64b79ad90f..5b739be4f8778e3c34c88226177f2f6fed8fa306 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.ui +++ b/src/plugins/designer/cpp/formclasswizardpage.ui @@ -41,6 +41,13 @@ </property> </spacer> </item> + <item> + <widget class="QToolButton" name="settingsToolButton"> + <property name="text"> + <string>Configure...</string> + </property> + </widget> + </item> <item> <widget class="QToolButton" name="moreButton"> <property name="text"> diff --git a/src/plugins/designer/settingspage.cpp b/src/plugins/designer/settingspage.cpp index 6328fca31f28c87b07d3987e978e8b033b4c4a39..16f9afa94e5e6949765ebf7100d54e9079262825 100644 --- a/src/plugins/designer/settingspage.cpp +++ b/src/plugins/designer/settingspage.cpp @@ -43,7 +43,12 @@ SettingsPage::~SettingsPage() { } -QString SettingsPage::name() const +QString SettingsPage::id() const +{ + return m_designerPage->name(); +} + +QString SettingsPage::trName() const { return m_designerPage->name(); } diff --git a/src/plugins/designer/settingspage.h b/src/plugins/designer/settingspage.h index 04627adf6bcf6a78182d94205632051a311d91db..1761baadfdda4774e220756ef396f31a3580ce03 100644 --- a/src/plugins/designer/settingspage.h +++ b/src/plugins/designer/settingspage.h @@ -49,7 +49,8 @@ public: explicit SettingsPage(QDesignerOptionsPageInterface *designerPage); virtual ~SettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp index cc707266e841a7d3b43c17c47bdd89fed7410688..65ae59f8358c34e1c1dbe0dba17d22a60c704ae2 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.cpp +++ b/src/plugins/genericprojectmanager/genericmakestep.cpp @@ -255,9 +255,9 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt connect(m_ui->targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); - connect(m_ui->makeLineEdit, SIGNAL(textEdited(const QString&)), + connect(m_ui->makeLineEdit, SIGNAL(textEdited(QString)), this, SLOT(makeLineEditTextEdited())); - connect(m_ui->makeArgumentsLineEdit, SIGNAL(textEdited(const QString&)), + connect(m_ui->makeArgumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(makeArgumentsLineEditTextEdited())); } diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index 8404cc55d56bd06183e9e49c54614954900c1832..cc6d06d9b53a402d12a7ddfd8728a68be77d774d 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -31,6 +31,9 @@ #include "gitsettings.h" #include "gitplugin.h" +#include <vcsbase/vcsbaseconstants.h> + +#include <QtCore/QCoreApplication> #include <QtCore/QDebug> #include <QtGui/QMessageBox> @@ -72,19 +75,24 @@ SettingsPage::SettingsPage() { } -QString SettingsPage::name() const +QString SettingsPage::id() const +{ + return QLatin1String("Git"); +} + +QString SettingsPage::trName() const { - return tr("General"); + return tr("Git"); } QString SettingsPage::category() const { - return QLatin1String("Git"); + return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY); } QString SettingsPage::trCategory() const { - return tr("Git"); + return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_CATEGORY); } QWidget *SettingsPage::createPage(QWidget *parent) diff --git a/src/plugins/git/settingspage.h b/src/plugins/git/settingspage.h index 69e6bfb5341d31eada8290206f27e4fbd7ae3eeb..ec247d8a8967d5398f50e5693d064cb612d954ec 100644 --- a/src/plugins/git/settingspage.h +++ b/src/plugins/git/settingspage.h @@ -68,7 +68,8 @@ class SettingsPage : public Core::IOptionsPage public: SettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp index 46e0e0ab1221577f88baaa0d4768016d30003b6e..6f50fc9a76ce252dd36e588603c3976809a0bc70 100644 --- a/src/plugins/help/docsettingspage.cpp +++ b/src/plugins/help/docsettingspage.cpp @@ -41,14 +41,20 @@ DocSettingsPage::DocSettingsPage(QHelpEngine *helpEngine) { } -QString DocSettingsPage::name() const +QString DocSettingsPage::id() const { - return "Documentation"; + return QLatin1String("Documentation"); } +QString DocSettingsPage::trName() const +{ + return tr("Documentation"); +} + + QString DocSettingsPage::category() const { - return "Help"; + return QLatin1String("Help"); } QString DocSettingsPage::trCategory() const diff --git a/src/plugins/help/docsettingspage.h b/src/plugins/help/docsettingspage.h index 3071543a839ad22ff4a3a9991fdedb6d38e742a3..83d6fc38c6c82420b96fc24dc98c39eed334343d 100644 --- a/src/plugins/help/docsettingspage.h +++ b/src/plugins/help/docsettingspage.h @@ -48,7 +48,8 @@ class DocSettingsPage : public Core::IOptionsPage public: DocSettingsPage(QHelpEngine *helpEngine); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/help/filtersettingspage.cpp b/src/plugins/help/filtersettingspage.cpp index 1aaa8381d7b1d4d5a4eaf4f6056efbd5d69fe4ec..9c0252a852273610ae7a23ebcd84d9401284ac9c 100644 --- a/src/plugins/help/filtersettingspage.cpp +++ b/src/plugins/help/filtersettingspage.cpp @@ -36,19 +36,24 @@ using namespace Help::Internal; -FilterSettingsPage::FilterSettingsPage(QHelpEngine *helpEngine) +FilterSettingsPage::FilterSettingsPage(QHelpEngine *helpEngine) : + m_helpEngine(helpEngine) { - m_helpEngine = helpEngine; } -QString FilterSettingsPage::name() const +QString FilterSettingsPage::id() const { - return "Filters"; + return QLatin1String("Filters"); +} + +QString FilterSettingsPage::trName() const +{ + return tr("Filters"); } QString FilterSettingsPage::category() const { - return "Help"; + return QLatin1String("Help"); } QString FilterSettingsPage::trCategory() const diff --git a/src/plugins/help/filtersettingspage.h b/src/plugins/help/filtersettingspage.h index e00de74361dcd6bef0437307d48e7f47f2b88484..f07a81c0b2a01ad1a5cafb1ba8475525c095e231 100644 --- a/src/plugins/help/filtersettingspage.h +++ b/src/plugins/help/filtersettingspage.h @@ -47,7 +47,8 @@ class FilterSettingsPage : public Core::IOptionsPage public: FilterSettingsPage(QHelpEngine *helpEngine); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/perforce/settingspage.cpp b/src/plugins/perforce/settingspage.cpp index c6a7ddfb19ccc8b4e051c0c13722f98edc17ce4f..1672186e9b7fbf210cb2794bd9ee17c90c32f0e3 100644 --- a/src/plugins/perforce/settingspage.cpp +++ b/src/plugins/perforce/settingspage.cpp @@ -31,6 +31,9 @@ #include "perforcesettings.h" #include "perforceplugin.h" +#include <vcsbase/vcsbaseconstants.h> + +#include <QtCore/QCoreApplication> #include <QtGui/QLineEdit> #include <QtGui/QFileDialog> @@ -83,19 +86,24 @@ SettingsPage::SettingsPage() { } -QString SettingsPage::name() const +QString SettingsPage::id() const +{ + return QLatin1String("Perforce"); +} + +QString SettingsPage::trName() const { - return tr("General"); + return tr("Perforce"); } QString SettingsPage::category() const { - return QLatin1String("Perforce"); + return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY); } QString SettingsPage::trCategory() const { - return tr("Perforce"); + return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_CATEGORY); } QWidget *SettingsPage::createPage(QWidget *parent) diff --git a/src/plugins/perforce/settingspage.h b/src/plugins/perforce/settingspage.h index 87b43784f0bf3d2b0cf8718587e7fe4d75f8e67f..0123b2d935abc9712c18e73b516f5b92e236092b 100644 --- a/src/plugins/perforce/settingspage.h +++ b/src/plugins/perforce/settingspage.h @@ -66,7 +66,8 @@ class SettingsPage : public Core::IOptionsPage public: SettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 7aa185d73861b7c0cd46ae210dc64a5305a06f4b..06ab960e35690090a4deac6826c6cb03d2dba7c9 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -61,7 +61,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE { m_runConfiguration = rc; - QFormLayout *layout = new QFormLayout(); + QFormLayout *layout = new QFormLayout; layout->setMargin(0); m_userName = new QLineEdit(this); @@ -147,6 +147,7 @@ void CustomExecutableConfigurationWidget::changed() CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro) : ApplicationRunConfiguration(pro), + m_runMode(Gui), m_userSetName(false) { m_workingDirectory = "$BUILDDIR"; diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp index 362bc881064390ba0a0e5d5b7e5ae1ba77e9f537..b97cf2e4c58eb09a328b5934cfdfeb1ee7e56324 100644 --- a/src/plugins/qt4projectmanager/makestep.cpp +++ b/src/plugins/qt4projectmanager/makestep.cpp @@ -272,9 +272,9 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) : BuildStepConfigWidget(), m_makeStep(makeStep) { m_ui.setupUi(this); - connect(m_ui.makeLineEdit, SIGNAL(textEdited(const QString&)), + connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)), this, SLOT(makeLineEditTextEdited())); - connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(const QString&)), + connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(makeArgumentsLineEditTextEdited())); } @@ -312,5 +312,6 @@ void MakeStepConfigWidget::makeLineEditTextEdited() void MakeStepConfigWidget::makeArgumentsLineEditTextEdited() { Q_ASSERT(!m_buildConfiguration.isNull()); - m_makeStep->setValue(m_buildConfiguration, "makeargs", ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text())); + m_makeStep->setValue(m_buildConfiguration, "makeargs", + ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text())); } diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index 8d784f5f4905ea31fa1269b4b43a97a2f11b4708..433630e54c1163b430472165c43afabaca67f795 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -54,6 +54,7 @@ using ProjectExplorer::PersistentSettingsWriter; Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath) : ApplicationRunConfiguration(pro), m_proFilePath(proFilePath), + m_runMode(Gui), m_userSetName(false), m_configWidget(0), m_executableLabel(0), @@ -111,11 +112,11 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run m_useTerminalCheck->setChecked(m_qt4RunConfiguration->runMode() == ProjectExplorer::ApplicationRunConfiguration::Console); toplayout->addRow(QString(), m_useTerminalCheck); - connect(m_argumentsLineEdit, SIGNAL(textEdited(const QString&)), - this, SLOT(setCommandLineArguments(const QString&))); + connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), + this, SLOT(setCommandLineArguments(QString))); - connect(m_nameLineEdit, SIGNAL(textEdited(const QString&)), - this, SLOT(nameEdited(const QString&))); + connect(m_nameLineEdit, SIGNAL(textEdited(QString)), + this, SLOT(nameEdited(QString))); connect(m_useTerminalCheck, SIGNAL(toggled(bool)), this, SLOT(termToggled(bool))); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index d974138ff4bcfbfd504b00e03ef075a7962184e8..013e7b1ca749934bf09ac04c155bfe64205e2413 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -131,7 +131,12 @@ int QtVersionManager::getUniqueId() return m_idcount++; } -QString QtVersionManager::name() const +QString QtVersionManager::id() const +{ + return QLatin1String(Constants::QTVERSION_PAGE); +} + +QString QtVersionManager::trName() const { return tr(Constants::QTVERSION_PAGE); } diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index e56be598eff6923febe007fb2201f3defc7c9f33..63e2d30c42f06aab87823bcdb4162918a94207d5 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -161,7 +161,8 @@ public: QtVersionManager(); ~QtVersionManager(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/quickopen/quickopenconstants.h b/src/plugins/quickopen/quickopenconstants.h index c2172d0d7db9b4edbf5e1199c89484caac978673..6b7bf6c8e6cc2741d43e9e0665bfc504c40edd43 100644 --- a/src/plugins/quickopen/quickopenconstants.h +++ b/src/plugins/quickopen/quickopenconstants.h @@ -30,11 +30,13 @@ #ifndef QUICKOPENCONSTANTS_H #define QUICKOPENCONSTANTS_H +#include <QtCore/QtGlobal> + namespace QuickOpen { namespace Constants { -const char * const FILTER_OPTIONS_PAGE = "Filters"; -const char * const QUICKOPEN_CATEGORY = "Locator"; +const char * const FILTER_OPTIONS_PAGE = QT_TRANSLATE_NOOP("Locator", "Filters"); +const char * const QUICKOPEN_CATEGORY = QT_TRANSLATE_NOOP("Locator", "Locator"); const char * const TASK_INDEX = "QuickOpen.Task.Index"; } // namespace Constants diff --git a/src/plugins/quickopen/quickopenplugin.cpp b/src/plugins/quickopen/quickopenplugin.cpp index 06cd9ca8d9cd433149fe4089d9654054c507c0ea..5ef84c3ea74601c0189ebeaa61eee83047925587 100644 --- a/src/plugins/quickopen/quickopenplugin.cpp +++ b/src/plugins/quickopen/quickopenplugin.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "quickopenplugin.h" +#include "quickopenconstants.h" #include "quickopenfiltersfilter.h" #include "quickopenmanager.h" #include "quickopentoolwindow.h" @@ -243,7 +244,7 @@ void QuickOpenPlugin::refresh(QList<IQuickOpenFilter*> filters) filters = m_filters; QFuture<void> task = QtConcurrent::run(&IQuickOpenFilter::refresh, filters); Core::FutureProgress *progress = Core::ICore::instance() - ->progressManager()->addTask(task, tr("Indexing"), Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); + ->progressManager()->addTask(task, tr("Indexing"), QuickOpen::Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); connect(progress, SIGNAL(finished()), this, SLOT(saveSettings())); } diff --git a/src/plugins/quickopen/settingspage.cpp b/src/plugins/quickopen/settingspage.cpp index cac458390dce2d08af43de7271f23b2fad6a53c3..bd900e6bba0debb82f0656d23215b03993c6f384 100644 --- a/src/plugins/quickopen/settingspage.cpp +++ b/src/plugins/quickopen/settingspage.cpp @@ -28,6 +28,7 @@ **************************************************************************/ #include "settingspage.h" +#include "quickopenconstants.h" #include "quickopenplugin.h" #include "iquickopenfilter.h" @@ -36,6 +37,8 @@ #include <qtconcurrent/QtConcurrentTools> #include <utils/qtcassert.h> +#include <QtCore/QCoreApplication> + Q_DECLARE_METATYPE(QuickOpen::IQuickOpenFilter*) using namespace QuickOpen; @@ -46,6 +49,26 @@ SettingsPage::SettingsPage(QuickOpenPlugin *plugin) { } +QString SettingsPage::id() const +{ + return QLatin1String(Constants::FILTER_OPTIONS_PAGE); +} + +QString SettingsPage::trName() const +{ + return QCoreApplication::translate("Locator", QuickOpen::Constants::FILTER_OPTIONS_PAGE); +} + +QString SettingsPage::category() const +{ + return Constants::QUICKOPEN_CATEGORY; +} + +QString SettingsPage::trCategory() const +{ + return QCoreApplication::translate("Locator", QuickOpen::Constants::QUICKOPEN_CATEGORY); +} + QWidget *SettingsPage::createPage(QWidget *parent) { if (!m_page) { diff --git a/src/plugins/quickopen/settingspage.h b/src/plugins/quickopen/settingspage.h index 4d7b840c5963a3c08f8a21eb0006329986ef732b..6bb3a2984abaea393380a5c340d9db04306da0e9 100644 --- a/src/plugins/quickopen/settingspage.h +++ b/src/plugins/quickopen/settingspage.h @@ -31,7 +31,6 @@ #define SETTINGSPAGE_H #include "ui_settingspage.h" -#include "quickopenconstants.h" #include <QtCore/QPointer> #include <QtCore/QHash> @@ -56,9 +55,10 @@ class SettingsPage : public Core::IOptionsPage public: explicit SettingsPage(QuickOpenPlugin *plugin); - QString name() const { return tr(Constants::FILTER_OPTIONS_PAGE); } - QString category() const { return Constants::QUICKOPEN_CATEGORY; } - QString trCategory() const { return tr(Constants::QUICKOPEN_CATEGORY); } + QString id() const; + QString trName() const; + QString category() const; + QString trCategory() const; QWidget *createPage(QWidget *parent); void apply(); diff --git a/src/plugins/subversion/settingspage.cpp b/src/plugins/subversion/settingspage.cpp index d8a164736a62d756c0377dc7270e695f4091c682..e06560feddc260704f2f2fdb52a729d124aae346 100644 --- a/src/plugins/subversion/settingspage.cpp +++ b/src/plugins/subversion/settingspage.cpp @@ -33,14 +33,15 @@ #include <coreplugin/icore.h> #include <extensionsystem/pluginmanager.h> +#include <vcsbase/vcsbaseconstants.h> +#include <utils/pathchooser.h> +#include <QtCore/QCoreApplication> #include <QtGui/QFileDialog> -#include <utils/pathchooser.h> using namespace Subversion::Internal; using namespace Core::Utils; - SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent) { @@ -73,19 +74,24 @@ SettingsPage::SettingsPage() { } -QString SettingsPage::name() const +QString SettingsPage::id() const +{ + return QLatin1String("Subversion"); +} + +QString SettingsPage::trName() const { - return tr("General"); + return tr("Subversion"); } QString SettingsPage::category() const { - return QLatin1String("Subversion"); + return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY); } QString SettingsPage::trCategory() const { - return tr("Subversion"); + return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_CATEGORY); } QWidget *SettingsPage::createPage(QWidget *parent) diff --git a/src/plugins/subversion/settingspage.h b/src/plugins/subversion/settingspage.h index 031bca49ebc036b4b654608d81624242758ed370..7808920e04e046bb5f773c6cc262e14e4e51e6b1 100644 --- a/src/plugins/subversion/settingspage.h +++ b/src/plugins/subversion/settingspage.h @@ -67,7 +67,8 @@ class SettingsPage : public Core::IOptionsPage public: SettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp index 156a065f4996d5c0e5cbd7eb23e56371d312ba11..8fa6434e81a89ec67ac874041f35ccc1b22b232b 100644 --- a/src/plugins/texteditor/behaviorsettingspage.cpp +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -73,7 +73,12 @@ BehaviorSettingsPage::~BehaviorSettingsPage() delete m_d; } -QString BehaviorSettingsPage::name() const +QString BehaviorSettingsPage::id() const +{ + return m_d->m_parameters.name; +} + +QString BehaviorSettingsPage::trName() const { return m_d->m_parameters.name; } diff --git a/src/plugins/texteditor/behaviorsettingspage.h b/src/plugins/texteditor/behaviorsettingspage.h index 2437cddc810e783e4800f6326ecbfce11e7f256e..821e5196106fcc23f70772578976f0191e0866d4 100644 --- a/src/plugins/texteditor/behaviorsettingspage.h +++ b/src/plugins/texteditor/behaviorsettingspage.h @@ -59,7 +59,8 @@ public: virtual ~BehaviorSettingsPage(); // IOptionsPage - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index 7d8c670bdcc2980d6d2ebf1c0109aa1818e97e3d..bae904b98ff4fa7771ead20d8f529fd6324ec05a 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -67,7 +67,12 @@ DisplaySettingsPage::~DisplaySettingsPage() delete m_d; } -QString DisplaySettingsPage::name() const +QString DisplaySettingsPage::id() const +{ + return m_d->m_parameters.name; +} + +QString DisplaySettingsPage::trName() const { return m_d->m_parameters.name; } diff --git a/src/plugins/texteditor/displaysettingspage.h b/src/plugins/texteditor/displaysettingspage.h index ec2c96c0d7d216009ecbc10661a1225b3ac1af6d..1d8cd31b032d6599d1ce2e079f60aede10144095 100644 --- a/src/plugins/texteditor/displaysettingspage.h +++ b/src/plugins/texteditor/displaysettingspage.h @@ -57,7 +57,8 @@ public: virtual ~DisplaySettingsPage(); // IOptionsPage - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 6ae8b748a20d414dc1819828147372b990b94126..8f776f04b009e87ceba081f2e188a52699d0d6d5 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -204,7 +204,12 @@ FontSettingsPage::~FontSettingsPage() delete d_ptr; } -QString FontSettingsPage::name() const +QString FontSettingsPage::id() const +{ + return d_ptr->m_name; +} + +QString FontSettingsPage::trName() const { return d_ptr->m_name; } diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index 0d9da298e6a7c3071964e634ec5ee83774c6f399..b0e4b2efbaea5eba61692ca74ed152b3902e6024 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -88,7 +88,8 @@ public: ~FontSettingsPage(); - QString name() const; + QString id() const; + QString trName() const; QString category() const; QString trCategory() const; diff --git a/src/plugins/vcsbase/vcsbaseconstants.h b/src/plugins/vcsbase/vcsbaseconstants.h index d6c0ca8a68abf91376f9683c4528fb50e0bb66e5..6ce3141cb64ac9cd175bcd4c4132d1f18a16909c 100644 --- a/src/plugins/vcsbase/vcsbaseconstants.h +++ b/src/plugins/vcsbase/vcsbaseconstants.h @@ -30,11 +30,15 @@ #ifndef VCSBASE_CONSTANTS_H #define VCSBASE_CONSTANTS_H +#include <QtCore/QtGlobal> + namespace VCSBase { namespace Constants { +const char * const VCS_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control System"); + namespace Internal { -enum { debug = 0 }; + enum { debug = 0 }; } // namespace Internal } // namespace Constants diff --git a/src/tools/qtcreatorwidgets/qtcreatorwidgets.pro b/src/tools/qtcreatorwidgets/qtcreatorwidgets.pro index ce209c86d7709b69b28f4ee9a029cbbfa32a49ff..aa727f405a32527026dea261b4838f3d9d875813 100644 --- a/src/tools/qtcreatorwidgets/qtcreatorwidgets.pro +++ b/src/tools/qtcreatorwidgets/qtcreatorwidgets.pro @@ -11,11 +11,11 @@ SOURCES = customwidgets.cpp linux-* { # form abs path to qtcreator lib dir - GH_LIB=$$dirname(PWD) - GH_LIB=$$dirname(GH_LIB) - GH_LIB=$$dirname(GH_LIB) - GH_LIB=$$GH_LIB/lib - QMAKE_RPATHDIR *= $$GH_LIB + QTC_LIBS=$$dirname(PWD) + QTC_LIBS=$$dirname(QTC_LIBS) + QTC_LIBS=$$dirname(QTC_LIBS) + QTC_LIBS=$$QTC_LIBS/lib/qtcreator + QMAKE_RPATHDIR *= $$QTC_LIBS } INCLUDEPATH += ../../../src/libs @@ -24,7 +24,7 @@ macx { CONFIG(debug, debug|release):LIBS += -lUtils_debug else:LIBS += -lUtils } else { - LIBS += -L../../../lib -lUtils + LIBS += -L$$QTC_LIBS -lUtils } DESTDIR= $$[QT_INSTALL_PLUGINS]/designer