Commit 8e14a3d4 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Designer: Honour Cpp file settings in form class wizard.

parent da36d051
...@@ -34,15 +34,12 @@ ...@@ -34,15 +34,12 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <cpptools/cpptoolsconstants.h>
#include <QtCore/QFile>
#include <QtCore/QDir>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QSettings> #include <QtCore/QSettings>
using namespace Designer; namespace Designer {
using namespace Designer::Internal; namespace Internal {
FormClassWizard::FormClassWizard(const BaseFileWizardParameters &parameters, QObject *parent) FormClassWizard::FormClassWizard(const BaseFileWizardParameters &parameters, QObject *parent)
: Core::BaseFileWizard(parameters, parent) : Core::BaseFileWizard(parameters, parent)
...@@ -64,16 +61,6 @@ QString FormClassWizard::formSuffix() const ...@@ -64,16 +61,6 @@ QString FormClassWizard::formSuffix() const
return preferredSuffix(QLatin1String(Constants::FORM_MIMETYPE)); 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, QWizard *FormClassWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath, const QString &defaultPath,
const WizardPageList &extensionPages) const const WizardPageList &extensionPages) const
...@@ -123,3 +110,6 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e ...@@ -123,3 +110,6 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
return Core::GeneratedFiles() << headerFile << sourceFile << uiFile; return Core::GeneratedFiles() << headerFile << sourceFile << uiFile;
} }
}
}
...@@ -61,6 +61,8 @@ FormClassWizardPage::FormClassWizardPage(QWidget * parent) : ...@@ -61,6 +61,8 @@ FormClassWizardPage::FormClassWizardPage(QWidget * parent) :
connect(m_ui->newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); connect(m_ui->newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
connect(m_ui->settingsToolButton, SIGNAL(clicked()), this, SLOT(slotSettings())); connect(m_ui->settingsToolButton, SIGNAL(clicked()), this, SLOT(slotSettings()));
initFileGenerationSettings();
} }
FormClassWizardPage::~FormClassWizardPage() FormClassWizardPage::~FormClassWizardPage()
...@@ -79,7 +81,7 @@ static bool inline lowerCaseFiles(const Core::ICore *core) ...@@ -79,7 +81,7 @@ static bool inline lowerCaseFiles(const Core::ICore *core)
} }
// Set up new class widget from settings // Set up new class widget from settings
void FormClassWizardPage::initParameters() void FormClassWizardPage::initFileGenerationSettings()
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
const Core::MimeDatabase *mdb = core->mimeDatabase(); const Core::MimeDatabase *mdb = core->mimeDatabase();
...@@ -88,12 +90,13 @@ void FormClassWizardPage::initParameters() ...@@ -88,12 +90,13 @@ void FormClassWizardPage::initParameters()
m_ui->newClassWidget->setLowerCaseFiles(lowerCaseFiles(core)); m_ui->newClassWidget->setLowerCaseFiles(lowerCaseFiles(core));
} }
// Pop up settings dialog for generation settings
void FormClassWizardPage::slotSettings() void FormClassWizardPage::slotSettings()
{ {
const QString id = QLatin1String(CppTools::Constants::CPP_SETTINGS_ID); const QString id = QLatin1String(CppTools::Constants::CPP_SETTINGS_ID);
const QString cat = QLatin1String(CppTools::Constants::CPP_SETTINGS_CATEGORY); const QString cat = QLatin1String(CppTools::Constants::CPP_SETTINGS_CATEGORY);
if (Core::ICore::instance()->showOptionsDialog(cat, id, this)) { if (Core::ICore::instance()->showOptionsDialog(cat, id, this)) {
initParameters(); initFileGenerationSettings();
m_ui->newClassWidget->triggerUpdateFileNames(); m_ui->newClassWidget->triggerUpdateFileNames();
} }
} }
......
...@@ -72,7 +72,7 @@ private slots: ...@@ -72,7 +72,7 @@ private slots:
void slotValidChanged(); void slotValidChanged();
private: private:
void initParameters(); void initFileGenerationSettings();
Ui::FormClassWizardPage *m_ui; Ui::FormClassWizardPage *m_ui;
bool m_isValid; bool m_isValid;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment