forked from qt-creator/qt-creator
Designer: Honour Cpp file settings in form class wizard.
This commit is contained in:
@@ -34,15 +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;
|
||||
namespace Designer {
|
||||
namespace Internal {
|
||||
|
||||
FormClassWizard::FormClassWizard(const BaseFileWizardParameters ¶meters, QObject *parent)
|
||||
: Core::BaseFileWizard(parameters, parent)
|
||||
@@ -64,16 +61,6 @@ 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
|
||||
@@ -123,3 +110,6 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
|
||||
|
||||
return Core::GeneratedFiles() << headerFile << sourceFile << uiFile;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -61,6 +61,8 @@ FormClassWizardPage::FormClassWizardPage(QWidget * parent) :
|
||||
|
||||
connect(m_ui->newClassWidget, SIGNAL(validChanged()), this, SLOT(slotValidChanged()));
|
||||
connect(m_ui->settingsToolButton, SIGNAL(clicked()), this, SLOT(slotSettings()));
|
||||
|
||||
initFileGenerationSettings();
|
||||
}
|
||||
|
||||
FormClassWizardPage::~FormClassWizardPage()
|
||||
@@ -79,7 +81,7 @@ static bool inline lowerCaseFiles(const Core::ICore *core)
|
||||
}
|
||||
|
||||
// Set up new class widget from settings
|
||||
void FormClassWizardPage::initParameters()
|
||||
void FormClassWizardPage::initFileGenerationSettings()
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
const Core::MimeDatabase *mdb = core->mimeDatabase();
|
||||
@@ -88,12 +90,13 @@ void FormClassWizardPage::initParameters()
|
||||
m_ui->newClassWidget->setLowerCaseFiles(lowerCaseFiles(core));
|
||||
}
|
||||
|
||||
// Pop up settings dialog for generation settings
|
||||
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();
|
||||
initFileGenerationSettings();
|
||||
m_ui->newClassWidget->triggerUpdateFileNames();
|
||||
}
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ private slots:
|
||||
void slotValidChanged();
|
||||
|
||||
private:
|
||||
void initParameters();
|
||||
void initFileGenerationSettings();
|
||||
|
||||
Ui::FormClassWizardPage *m_ui;
|
||||
bool m_isValid;
|
||||
|
Reference in New Issue
Block a user