forked from qt-creator/qt-creator
Make BaseFileWizard async
The side-effect is that WizardEventLoop can go! Change-Id: I0eae0e0fa91a48e2a5010b47cc0de86758969904 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -30,6 +30,136 @@
|
||||
|
||||
#include "basefilewizard.h"
|
||||
|
||||
Core::BaseFileWizard::BaseFileWizard(QWidget *parent) :
|
||||
Utils::Wizard(parent)
|
||||
{ }
|
||||
#include "basefilewizardfactory.h"
|
||||
#include "ifilewizardextension.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Core {
|
||||
|
||||
BaseFileWizard::BaseFileWizard(const BaseFileWizardFactory *factory,
|
||||
const QVariantMap &extraValues,
|
||||
QWidget *parent) :
|
||||
Wizard(parent),
|
||||
m_extraValues(extraValues),
|
||||
m_factory(factory)
|
||||
{
|
||||
// Compile extension pages, purge out unused ones
|
||||
QList<IFileWizardExtension *> extensionList
|
||||
= ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
||||
|
||||
for (auto it = extensionList.begin(); it != extensionList.end(); ) {
|
||||
const QList<QWizardPage *> extensionPages = (*it)->extensionPages(factory);
|
||||
if (extensionPages.empty()) {
|
||||
it = extensionList.erase(it);
|
||||
} else {
|
||||
m_extensionPages += extensionPages;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_extensionPages.empty())
|
||||
m_firstExtensionPage = m_extensionPages.front();
|
||||
}
|
||||
|
||||
void BaseFileWizard::initializePage(int id)
|
||||
{
|
||||
if (page(id) == m_firstExtensionPage) {
|
||||
generateFileList();
|
||||
|
||||
QList<IFileWizardExtension *> extensionList
|
||||
= ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
||||
foreach (IFileWizardExtension *ex, extensionList)
|
||||
ex->firstExtensionPageShown(m_files, m_extraValues);
|
||||
}
|
||||
}
|
||||
|
||||
QList<QWizardPage *> BaseFileWizard::extensionPages()
|
||||
{
|
||||
return m_extensionPages;
|
||||
}
|
||||
|
||||
void BaseFileWizard::accept()
|
||||
{
|
||||
if (m_files.isEmpty())
|
||||
generateFileList();
|
||||
|
||||
QString errorMessage;
|
||||
|
||||
// Compile result list and prompt for overwrite
|
||||
switch (m_factory->promptOverwrite(&m_files, &errorMessage)) {
|
||||
case BaseFileWizardFactory::OverwriteCanceled:
|
||||
reject();
|
||||
return;
|
||||
case BaseFileWizardFactory::OverwriteError:
|
||||
QMessageBox::critical(0, tr("Existing files"), errorMessage);
|
||||
reject();
|
||||
return;
|
||||
case BaseFileWizardFactory::OverwriteOk:
|
||||
break;
|
||||
}
|
||||
|
||||
QList<IFileWizardExtension *> extensionList
|
||||
= ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
||||
foreach (IFileWizardExtension *ex, extensionList) {
|
||||
for (int i = 0; i < m_files.count(); i++) {
|
||||
ex->applyCodeStyle(&m_files[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Write
|
||||
if (!m_factory->writeFiles(m_files, &errorMessage)) {
|
||||
QMessageBox::critical(parentWidget(), tr("File Generation Failure"), errorMessage);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
bool removeOpenProjectAttribute = false;
|
||||
// Run the extensions
|
||||
foreach (IFileWizardExtension *ex, extensionList) {
|
||||
bool remove;
|
||||
if (!ex->processFiles(m_files, &remove, &errorMessage)) {
|
||||
if (!errorMessage.isEmpty())
|
||||
QMessageBox::critical(parentWidget(), tr("File Generation Failure"), errorMessage);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
removeOpenProjectAttribute |= remove;
|
||||
}
|
||||
|
||||
if (removeOpenProjectAttribute) {
|
||||
for (int i = 0; i < m_files.count(); i++) {
|
||||
if (m_files[i].attributes() & GeneratedFile::OpenProjectAttribute)
|
||||
m_files[i].setAttributes(GeneratedFile::OpenEditorAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
// Post generation handler
|
||||
if (!m_factory->postGenerateFiles(this, m_files, &errorMessage))
|
||||
if (!errorMessage.isEmpty())
|
||||
QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
|
||||
|
||||
Wizard::accept();
|
||||
}
|
||||
|
||||
void BaseFileWizard::reject()
|
||||
{
|
||||
m_files.clear();
|
||||
Wizard::reject();
|
||||
}
|
||||
|
||||
void BaseFileWizard::generateFileList()
|
||||
{
|
||||
QString errorMessage;
|
||||
m_files = m_factory->generateFiles(this, &errorMessage);
|
||||
if (m_files.empty()) {
|
||||
QMessageBox::critical(parentWidget(), tr("File Generation Failure"), errorMessage);
|
||||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -33,16 +33,39 @@
|
||||
|
||||
#include "core_global.h"
|
||||
|
||||
#include "generatedfile.h"
|
||||
|
||||
#include <utils/wizard.h>
|
||||
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class BaseFileWizardFactory;
|
||||
|
||||
class CORE_EXPORT BaseFileWizard : public Utils::Wizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BaseFileWizard(QWidget *parent = 0);
|
||||
explicit BaseFileWizard(const BaseFileWizardFactory *factory, const QVariantMap &extraValues,
|
||||
QWidget *parent = 0);
|
||||
|
||||
void initializePage(int id);
|
||||
|
||||
QList<QWizardPage *> extensionPages();
|
||||
|
||||
void accept();
|
||||
void reject();
|
||||
|
||||
private:
|
||||
void generateFileList();
|
||||
|
||||
QVariantMap m_extraValues;
|
||||
const BaseFileWizardFactory *m_factory;
|
||||
QList<QWizardPage *> m_extensionPages;
|
||||
QWizardPage *m_firstExtensionPage = 0;
|
||||
GeneratedFiles m_files;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -46,12 +46,6 @@
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
#include <QSharedData>
|
||||
#include <QEventLoop>
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QWizard>
|
||||
#include <QIcon>
|
||||
|
||||
enum { debugWizard = 0 };
|
||||
@@ -67,101 +61,6 @@ static int indexOfFile(const GeneratedFiles &f, const QString &path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Core::Internal::WizardEventLoop
|
||||
\brief The WizardEventLoop class implements a special event
|
||||
loop that runs a QWizard and terminates if the page changes.
|
||||
|
||||
Used by Core::BaseFileWizard to intercept the change from the standard wizard pages
|
||||
to the extension pages (as the latter require the list of Core::GeneratedFile generated).
|
||||
|
||||
Synopsis:
|
||||
\code
|
||||
Wizard wizard(parent);
|
||||
WizardEventLoop::WizardResult wr;
|
||||
do {
|
||||
wr = WizardEventLoop::execWizardPage(wizard);
|
||||
} while (wr == WizardEventLoop::PageChanged);
|
||||
\endcode
|
||||
|
||||
\sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard, Core::StandardFileWizard
|
||||
*/
|
||||
|
||||
class WizardEventLoop : public QEventLoop
|
||||
{
|
||||
Q_OBJECT
|
||||
WizardEventLoop(QObject *parent);
|
||||
|
||||
public:
|
||||
enum WizardResult { Accepted, Rejected , PageChanged };
|
||||
|
||||
static WizardResult execWizardPage(QWizard &w);
|
||||
|
||||
private slots:
|
||||
void pageChanged(int);
|
||||
void accepted();
|
||||
void rejected();
|
||||
|
||||
private:
|
||||
WizardResult execWizardPageI();
|
||||
|
||||
WizardResult m_result;
|
||||
};
|
||||
|
||||
WizardEventLoop::WizardEventLoop(QObject *parent) :
|
||||
QEventLoop(parent),
|
||||
m_result(Rejected)
|
||||
{
|
||||
}
|
||||
|
||||
WizardEventLoop::WizardResult WizardEventLoop::execWizardPage(QWizard &wizard)
|
||||
{
|
||||
/* Install ourselves on the wizard. Main trick is here to connect
|
||||
* to the page changed signal and quit() on it. */
|
||||
WizardEventLoop *eventLoop = wizard.findChild<WizardEventLoop *>();
|
||||
if (!eventLoop) {
|
||||
eventLoop = new WizardEventLoop(&wizard);
|
||||
connect(&wizard, SIGNAL(currentIdChanged(int)), eventLoop, SLOT(pageChanged(int)));
|
||||
connect(&wizard, SIGNAL(accepted()), eventLoop, SLOT(accepted()));
|
||||
connect(&wizard, SIGNAL(rejected()), eventLoop, SLOT(rejected()));
|
||||
wizard.setWindowFlags(wizard.windowFlags());
|
||||
wizard.show();
|
||||
}
|
||||
const WizardResult result = eventLoop->execWizardPageI();
|
||||
// Quitting?
|
||||
if (result != PageChanged)
|
||||
delete eventLoop;
|
||||
if (debugWizard)
|
||||
qDebug() << "WizardEventLoop::runWizard" << wizard.pageIds() << " returns " << result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
WizardEventLoop::WizardResult WizardEventLoop::execWizardPageI()
|
||||
{
|
||||
m_result = Rejected;
|
||||
exec();
|
||||
return m_result;
|
||||
}
|
||||
|
||||
void WizardEventLoop::pageChanged(int /*page*/)
|
||||
{
|
||||
m_result = PageChanged;
|
||||
quit(); // !
|
||||
}
|
||||
|
||||
void WizardEventLoop::accepted()
|
||||
{
|
||||
m_result = Accepted;
|
||||
quit();
|
||||
}
|
||||
|
||||
void WizardEventLoop::rejected()
|
||||
{
|
||||
m_result = Rejected;
|
||||
quit();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Core::BaseFileWizard
|
||||
\brief The BaseFileWizard class implements a generic wizard for
|
||||
@@ -186,27 +85,6 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
|
||||
{
|
||||
QTC_ASSERT(!path.isEmpty(), return 0);
|
||||
|
||||
QString errorMessage;
|
||||
// Compile extension pages, purge out unused ones
|
||||
QList<IFileWizardExtension *> extensionList = ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
||||
WizardPageList allExtensionPages;
|
||||
for (auto it = extensionList.begin(); it != extensionList.end(); ) {
|
||||
const WizardPageList extensionPages = (*it)->extensionPages(this);
|
||||
if (extensionPages.empty()) {
|
||||
it = extensionList.erase(it);
|
||||
} else {
|
||||
allExtensionPages += extensionPages;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (debugWizard)
|
||||
qDebug() << Q_FUNC_INFO << path << parent << "exs" << extensionList.size() << allExtensionPages.size();
|
||||
|
||||
QWizardPage *firstExtensionPage = 0;
|
||||
if (!allExtensionPages.empty())
|
||||
firstExtensionPage = allExtensionPages.front();
|
||||
|
||||
// Create dialog and run it. Ensure that the dialog is deleted when
|
||||
// leaving the func, but not before the IFileWizardExtension::process
|
||||
// has been called
|
||||
@@ -216,92 +94,12 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
|
||||
if (flags().testFlag(ForceCapitalLetterForFileName))
|
||||
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
|
||||
|
||||
const QScopedPointer<QWizard> wizard(create(parent, WizardDialogParameters(path,
|
||||
allExtensionPages,
|
||||
platform,
|
||||
requiredFeatures(),
|
||||
dialogParameterFlags,
|
||||
extraValues)));
|
||||
QTC_ASSERT(!wizard.isNull(), return 0);
|
||||
ICore::registerWindow(wizard.data(), Context("Core.NewWizard"));
|
||||
|
||||
GeneratedFiles files;
|
||||
// Run the wizard: Call generate files on switching to the first extension
|
||||
// page is OR after 'Accepted' if there are no extension pages
|
||||
while (true) {
|
||||
const WizardEventLoop::WizardResult wr = WizardEventLoop::execWizardPage(*wizard);
|
||||
if (wr == WizardEventLoop::Rejected) {
|
||||
files.clear();
|
||||
break;
|
||||
}
|
||||
const bool accepted = wr == WizardEventLoop::Accepted;
|
||||
const bool firstExtensionPageHit = wr == WizardEventLoop::PageChanged
|
||||
&& wizard->page(wizard->currentId()) == firstExtensionPage;
|
||||
const bool needGenerateFiles = firstExtensionPageHit || (accepted && allExtensionPages.empty());
|
||||
if (needGenerateFiles) {
|
||||
QString errorMessage;
|
||||
files = generateFiles(wizard.data(), &errorMessage);
|
||||
if (files.empty()) {
|
||||
QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstExtensionPageHit)
|
||||
foreach (IFileWizardExtension *ex, extensionList)
|
||||
ex->firstExtensionPageShown(files, extraValues);
|
||||
if (accepted)
|
||||
break;
|
||||
}
|
||||
if (files.empty())
|
||||
return 0;
|
||||
// Compile result list and prompt for overwrite
|
||||
switch (promptOverwrite(&files, &errorMessage)) {
|
||||
case OverwriteCanceled:
|
||||
return 0;
|
||||
case OverwriteError:
|
||||
QMessageBox::critical(0, tr("Existing files"), errorMessage);
|
||||
return 0;
|
||||
case OverwriteOk:
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (IFileWizardExtension *ex, extensionList) {
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
ex->applyCodeStyle(&files[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Write
|
||||
if (!writeFiles(files, &errorMessage)) {
|
||||
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool removeOpenProjectAttribute = false;
|
||||
// Run the extensions
|
||||
foreach (IFileWizardExtension *ex, extensionList) {
|
||||
bool remove;
|
||||
if (!ex->processFiles(files, &remove, &errorMessage)) {
|
||||
if (!errorMessage.isEmpty())
|
||||
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
|
||||
return 0;
|
||||
}
|
||||
removeOpenProjectAttribute |= remove;
|
||||
}
|
||||
|
||||
if (removeOpenProjectAttribute) {
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
if (files[i].attributes() & GeneratedFile::OpenProjectAttribute)
|
||||
files[i].setAttributes(GeneratedFile::OpenEditorAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
// Post generation handler
|
||||
if (!postGenerateFiles(wizard.data(), files, &errorMessage))
|
||||
if (!errorMessage.isEmpty())
|
||||
QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
|
||||
|
||||
return 0;
|
||||
Utils::Wizard *wizard = create(parent, WizardDialogParameters(path, platform,
|
||||
requiredFeatures(),
|
||||
dialogParameterFlags,
|
||||
extraValues));
|
||||
QTC_CHECK(wizard);
|
||||
return wizard;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -326,7 +124,7 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
|
||||
Re-implement (calling the base implementation) to create files with CustomGeneratorAttribute set.
|
||||
*/
|
||||
|
||||
bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *errorMessage)
|
||||
bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *errorMessage) const
|
||||
{
|
||||
const GeneratedFile::Attributes noWriteAttributes
|
||||
= GeneratedFile::CustomGeneratorAttribute|GeneratedFile::KeepExistingFileAttribute;
|
||||
@@ -343,7 +141,8 @@ bool BaseFileWizardFactory::writeFiles(const GeneratedFiles &files, QString *err
|
||||
The default implementation opens editors with the newly generated files.
|
||||
*/
|
||||
|
||||
bool BaseFileWizardFactory::postGenerateFiles(const QWizard *, const GeneratedFiles &l, QString *errorMessage)
|
||||
bool BaseFileWizardFactory::postGenerateFiles(const QWizard *, const GeneratedFiles &l,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
return BaseFileWizardFactory::postGenerateOpenEditors(l, errorMessage);
|
||||
}
|
||||
@@ -500,9 +299,6 @@ QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
|
||||
files from path and name.
|
||||
|
||||
\sa Core::GeneratedFile, Core::BaseFileWizardParameters, Core::BaseFileWizard
|
||||
\sa Core::Internal::WizardEventLoop
|
||||
*/
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#include "basefilewizardfactory.moc"
|
||||
|
@@ -62,12 +62,10 @@ public:
|
||||
};
|
||||
Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
|
||||
|
||||
explicit WizardDialogParameters(const QString &defaultPath, const WizardPageList &extensionPages,
|
||||
const QString &platform, const FeatureSet &requiredFeatures,
|
||||
DialogParameterFlags flags,
|
||||
explicit WizardDialogParameters(const QString &defaultPath, const QString &platform,
|
||||
const FeatureSet &requiredFeatures, DialogParameterFlags flags,
|
||||
QVariantMap extraValues)
|
||||
: m_defaultPath(defaultPath),
|
||||
m_extensionPages(extensionPages),
|
||||
m_selectedPlatform(platform),
|
||||
m_requiredFeatures(requiredFeatures),
|
||||
m_parameterFlags(flags),
|
||||
@@ -77,9 +75,6 @@ public:
|
||||
QString defaultPath() const
|
||||
{ return m_defaultPath; }
|
||||
|
||||
WizardPageList extensionPages() const
|
||||
{ return m_extensionPages; }
|
||||
|
||||
QString selectedPlatform() const
|
||||
{ return m_selectedPlatform; }
|
||||
|
||||
@@ -94,7 +89,6 @@ public:
|
||||
|
||||
private:
|
||||
QString m_defaultPath;
|
||||
WizardPageList m_extensionPages;
|
||||
QString m_selectedPlatform;
|
||||
FeatureSet m_requiredFeatures;
|
||||
DialogParameterFlags m_parameterFlags;
|
||||
@@ -105,20 +99,20 @@ class CORE_EXPORT BaseFileWizardFactory : public IWizardFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class BaseFileWizard;
|
||||
|
||||
public:
|
||||
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
|
||||
|
||||
protected:
|
||||
typedef QList<QWizardPage *> WizardPageList;
|
||||
|
||||
virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters ¶meters) const = 0;
|
||||
|
||||
virtual GeneratedFiles generateFiles(const QWizard *w,
|
||||
QString *errorMessage) const = 0;
|
||||
|
||||
virtual bool writeFiles(const GeneratedFiles &files, QString *errorMessage);
|
||||
virtual bool writeFiles(const GeneratedFiles &files, QString *errorMessage) const;
|
||||
|
||||
virtual bool postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage);
|
||||
virtual bool postGenerateFiles(const QWizard *w, const GeneratedFiles &l, QString *errorMessage) const;
|
||||
|
||||
static QString preferredSuffix(const QString &mimeType);
|
||||
|
||||
|
@@ -257,6 +257,7 @@ Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, c
|
||||
ICore::validateNewDialogIsRunning();
|
||||
wizard->deleteLater();
|
||||
});
|
||||
wizard->show();
|
||||
Core::ICore::registerWindow(wizard, Core::Context("Core.NewWizard"));
|
||||
} else {
|
||||
s_isWizardRunning = false;
|
||||
|
@@ -63,8 +63,7 @@ QString FormClassWizard::formSuffix() const
|
||||
|
||||
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(parameters.extensionPages(),
|
||||
parent);
|
||||
FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(this, parent);
|
||||
wizardDialog->setPath(parameters.defaultPath());
|
||||
return wizardDialog;
|
||||
}
|
||||
|
@@ -40,9 +40,9 @@ namespace Designer {
|
||||
namespace Internal {
|
||||
|
||||
// ----------------- FormClassWizardDialog
|
||||
FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPages,
|
||||
FormClassWizardDialog::FormClassWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
QWidget *parent) :
|
||||
Core::BaseFileWizard(parent),
|
||||
Core::BaseFileWizard(factory, QVariantMap(), parent),
|
||||
m_formPage(new FormTemplateWizardPage),
|
||||
m_classPage(new FormClassWizardPage)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ FormClassWizardDialog::FormClassWizardDialog(const WizardPageList &extensionPage
|
||||
setPage(FormPageId, m_formPage);
|
||||
setPage(ClassPageId, m_classPage);
|
||||
|
||||
foreach (QWizardPage *p, extensionPages)
|
||||
foreach (QWizardPage *p, extensionPages())
|
||||
addPage(p);
|
||||
}
|
||||
|
||||
|
@@ -49,8 +49,7 @@ class FormClassWizardDialog : public Core::BaseFileWizard
|
||||
public:
|
||||
typedef QList<QWizardPage *> WizardPageList;
|
||||
|
||||
explicit FormClassWizardDialog(const WizardPageList &extensionPages,
|
||||
QWidget *parent = 0);
|
||||
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0);
|
||||
|
||||
QString path() const;
|
||||
|
||||
|
@@ -60,8 +60,9 @@ static const char *const ConfigFileTemplate =
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent) :
|
||||
Core::BaseFileWizard(parent)
|
||||
GenericProjectWizardDialog::GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
QWidget *parent) :
|
||||
Core::BaseFileWizard(factory, QVariantMap(), parent)
|
||||
{
|
||||
setWindowTitle(tr("Import Existing Project"));
|
||||
|
||||
@@ -129,13 +130,14 @@ GenericProjectWizard::GenericProjectWizard()
|
||||
setFlags(Core::IWizardFactory::PlatformIndependent);
|
||||
}
|
||||
|
||||
Core::BaseFileWizard *GenericProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
Core::BaseFileWizard *GenericProjectWizard::create(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(parent);
|
||||
GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(this, parent);
|
||||
|
||||
wizard->setPath(parameters.defaultPath());
|
||||
|
||||
foreach (QWizardPage *p, parameters.extensionPages())
|
||||
foreach (QWizardPage *p, wizard->extensionPages())
|
||||
wizard->addPage(p);
|
||||
|
||||
return wizard;
|
||||
@@ -200,7 +202,8 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
||||
return files;
|
||||
}
|
||||
|
||||
bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
|
||||
bool GenericProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
Q_UNUSED(w);
|
||||
return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
|
||||
|
@@ -47,7 +47,7 @@ class GenericProjectWizardDialog : public Core::BaseFileWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GenericProjectWizardDialog(QWidget *parent = 0);
|
||||
explicit GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0);
|
||||
|
||||
QString path() const;
|
||||
void setPath(const QString &path);
|
||||
@@ -69,8 +69,9 @@ public:
|
||||
|
||||
protected:
|
||||
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
|
||||
QString *errorMessage) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -64,9 +64,10 @@ BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectInt
|
||||
{
|
||||
}
|
||||
|
||||
BaseProjectWizardDialog::BaseProjectWizardDialog(QWidget *parent,
|
||||
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
Core::BaseFileWizard(parent),
|
||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||
d(new BaseProjectWizardDialogPrivate(new Utils::ProjectIntroPage))
|
||||
{
|
||||
setPath(parameters.defaultPath());
|
||||
@@ -75,10 +76,11 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(QWidget *parent,
|
||||
init();
|
||||
}
|
||||
|
||||
BaseProjectWizardDialog::BaseProjectWizardDialog(Utils::ProjectIntroPage *introPage, int introId,
|
||||
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
Utils::ProjectIntroPage *introPage, int introId,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
Core::BaseFileWizard(parent),
|
||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||
d(new BaseProjectWizardDialogPrivate(introPage, introId))
|
||||
{
|
||||
setPath(parameters.defaultPath());
|
||||
|
@@ -48,11 +48,13 @@ class PROJECTEXPLORER_EXPORT BaseProjectWizardDialog : public Core::BaseFileWiza
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
explicit BaseProjectWizardDialog(Utils::ProjectIntroPage *introPage, int introId,
|
||||
explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
Utils::ProjectIntroPage *introPage, int introId,
|
||||
QWidget *parent, const Core::WizardDialogParameters ¶meters);
|
||||
|
||||
public:
|
||||
explicit BaseProjectWizardDialog(QWidget *parent, const Core::WizardDialogParameters ¶meters);
|
||||
explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
|
||||
virtual ~BaseProjectWizardDialog();
|
||||
|
||||
|
@@ -138,7 +138,7 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p)
|
||||
Core::BaseFileWizard *CustomWizard::create(QWidget *parent, const Core::WizardDialogParameters &p) const
|
||||
{
|
||||
QTC_ASSERT(!d->m_parameters.isNull(), return 0);
|
||||
Core::BaseFileWizard *wizard = new Core::BaseFileWizard(parent);
|
||||
Core::BaseFileWizard *wizard = new Core::BaseFileWizard(this, p.extraValues(), parent);
|
||||
|
||||
d->m_context->reset();
|
||||
CustomWizardPage *customPage = new CustomWizardPage(d->m_context, parameters());
|
||||
@@ -147,7 +147,7 @@ Core::BaseFileWizard *CustomWizard::create(QWidget *parent, const Core::WizardDi
|
||||
wizard->setPage(parameters()->firstPageId, customPage);
|
||||
else
|
||||
wizard->addPage(customPage);
|
||||
foreach (QWizardPage *ep, p.extensionPages())
|
||||
foreach (QWizardPage *ep, wizard->extensionPages())
|
||||
wizard->addPage(ep);
|
||||
if (CustomWizardPrivate::verbose)
|
||||
qDebug() << "initWizardDialog" << wizard << wizard->pageIds();
|
||||
@@ -243,7 +243,7 @@ Core::GeneratedFiles CustomWizard::generateFiles(const QWizard *dialog, QString
|
||||
return generateWizardFiles(errorMessage);
|
||||
}
|
||||
|
||||
bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorMessage)
|
||||
bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorMessage) const
|
||||
{
|
||||
if (!Core::BaseFileWizardFactory::writeFiles(files, errorMessage))
|
||||
return false;
|
||||
@@ -461,16 +461,16 @@ CustomProjectWizard::CustomProjectWizard()
|
||||
Core::BaseFileWizard *CustomProjectWizard::create(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(parent, parameters);
|
||||
BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(this, parent, parameters);
|
||||
initProjectWizardDialog(projectDialog,
|
||||
parameters.defaultPath(),
|
||||
parameters.extensionPages());
|
||||
projectDialog->extensionPages());
|
||||
return projectDialog;
|
||||
}
|
||||
|
||||
void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
||||
const QString &defaultPath,
|
||||
const WizardPageList &extensionPages) const
|
||||
const QList<QWizardPage *> &extensionPages) const
|
||||
{
|
||||
const CustomWizardParametersPtr pa = parameters();
|
||||
QTC_ASSERT(!pa.isNull(), return);
|
||||
@@ -532,7 +532,7 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin
|
||||
return BaseFileWizardFactory::postGenerateOpenEditors(l, errorMessage);
|
||||
}
|
||||
|
||||
bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage)
|
||||
bool CustomProjectWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage) const
|
||||
{
|
||||
if (CustomWizardPrivate::verbose)
|
||||
qDebug() << "CustomProjectWizard::postGenerateFiles()";
|
||||
|
@@ -115,7 +115,7 @@ protected:
|
||||
Core::GeneratedFiles generateWizardFiles(QString *errorMessage) const;
|
||||
// Create replacement map as static base fields + QWizard fields
|
||||
FieldReplacementMap replacementMap(const QWizard *w) const;
|
||||
bool writeFiles(const Core::GeneratedFiles &files, QString *errorMessage);
|
||||
bool writeFiles(const Core::GeneratedFiles &files, QString *errorMessage) const override;
|
||||
|
||||
CustomWizardParametersPtr parameters() const;
|
||||
CustomWizardContextPtr context() const;
|
||||
@@ -147,10 +147,10 @@ signals:
|
||||
void projectLocationChanged(const QString &path);
|
||||
|
||||
protected:
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const override;
|
||||
|
||||
void initProjectWizardDialog(BaseProjectWizardDialog *w, const QString &defaultPath,
|
||||
const WizardPageList &extensionPages) const;
|
||||
const QList<QWizardPage *> &extensionPages) const;
|
||||
|
||||
private slots:
|
||||
void projectParametersChanged(const QString &project, const QString &path);
|
||||
|
@@ -57,10 +57,8 @@ CustomWidgetWizard::CustomWidgetWizard()
|
||||
|
||||
Core::BaseFileWizard *CustomWidgetWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(displayName(),
|
||||
icon(),
|
||||
parent,
|
||||
parameters);
|
||||
CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(this, displayName(),
|
||||
icon(), parent, parameters);
|
||||
rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(parameters.defaultPath()));
|
||||
rc->setFileNamingParameters(FileNamingParameters(headerSuffix(), sourceSuffix(), QtWizard::lowerCaseFiles()));
|
||||
return rc;
|
||||
|
@@ -42,11 +42,11 @@ namespace Internal {
|
||||
|
||||
enum { IntroPageId = 0};
|
||||
|
||||
CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
CustomWidgetWizardDialog::CustomWidgetWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
const QString &templateName,
|
||||
const QIcon &icon, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
BaseQmakeProjectWizardDialog(false, parent, parameters),
|
||||
BaseQmakeProjectWizardDialog(factory, false, parent, parameters),
|
||||
m_widgetsPage(new CustomWidgetWidgetsWizardPage),
|
||||
m_pluginPage(new CustomWidgetPluginWizardPage)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
|
||||
addPage(m_widgetsPage);
|
||||
m_pluginPageId = addPage(m_pluginPage);
|
||||
|
||||
addExtensionPages(parameters.extensionPages());
|
||||
addExtensionPages(extensionPages());
|
||||
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
|
||||
}
|
||||
|
||||
|
@@ -47,8 +47,8 @@ class CustomWidgetWizardDialog : public BaseQmakeProjectWizardDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomWidgetWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
explicit CustomWidgetWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
const QString &templateName, const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
|
||||
|
@@ -88,7 +88,7 @@ GuiAppWizard::GuiAppWizard()
|
||||
|
||||
Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
GuiAppWizardDialog *dialog = new GuiAppWizardDialog(displayName(), icon(), parent, parameters);
|
||||
GuiAppWizardDialog *dialog = new GuiAppWizardDialog(this, displayName(), icon(), parent, parameters);
|
||||
dialog->setProjectName(GuiAppWizardDialog::uniqueProjectName(parameters.defaultPath()));
|
||||
// Order! suffixes first to generate files correctly
|
||||
dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
|
||||
|
@@ -45,11 +45,11 @@ GuiAppParameters::GuiAppParameters()
|
||||
{
|
||||
}
|
||||
|
||||
GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
GuiAppWizardDialog::GuiAppWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
const QString &templateName,
|
||||
const QIcon &icon, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
BaseQmakeProjectWizardDialog(false, parent, parameters),
|
||||
BaseQmakeProjectWizardDialog(factory, false, parent, parameters),
|
||||
m_filesPage(new FilesPage)
|
||||
{
|
||||
setWindowIcon(icon);
|
||||
@@ -68,7 +68,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
|
||||
m_filesPage->setClassTypeComboVisible(false);
|
||||
addPage(m_filesPage);
|
||||
|
||||
addExtensionPages(parameters.extensionPages());
|
||||
addExtensionPages(extensionPages());
|
||||
}
|
||||
|
||||
void GuiAppWizardDialog::setBaseClasses(const QStringList &baseClasses)
|
||||
|
@@ -59,7 +59,7 @@ class GuiAppWizardDialog : public BaseQmakeProjectWizardDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiAppWizardDialog(const QString &templateName,
|
||||
explicit GuiAppWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
|
@@ -61,7 +61,7 @@ LibraryWizard::LibraryWizard()
|
||||
|
||||
Core::BaseFileWizard *LibraryWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
LibraryWizardDialog *dialog = new LibraryWizardDialog(displayName(), icon(), parent, parameters);
|
||||
LibraryWizardDialog *dialog = new LibraryWizardDialog(this, displayName(), icon(), parent, parameters);
|
||||
dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles());
|
||||
dialog->setProjectName(LibraryWizardDialog::uniqueProjectName(parameters.defaultPath()));
|
||||
dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix());
|
||||
|
@@ -129,11 +129,12 @@ QtProjectParameters::Type LibraryIntroPage::type() const
|
||||
}
|
||||
|
||||
// ------------------- LibraryWizardDialog
|
||||
LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
|
||||
LibraryWizardDialog::LibraryWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
BaseQmakeProjectWizardDialog(true, new LibraryIntroPage, -1, parent, parameters),
|
||||
BaseQmakeProjectWizardDialog(factory, true, new LibraryIntroPage, -1, parent, parameters),
|
||||
m_filesPage(new FilesPage),
|
||||
m_pluginBaseClassesInitialized(false),
|
||||
m_filesPageId(-1), m_modulesPageId(-1), m_targetPageId(-1)
|
||||
@@ -179,7 +180,7 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
|
||||
|
||||
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
|
||||
|
||||
addExtensionPages(parameters.extensionPages());
|
||||
addExtensionPages(extensionPages());
|
||||
}
|
||||
|
||||
void LibraryWizardDialog::setSuffixes(const QString &header, const QString &source, const QString &form)
|
||||
|
@@ -46,7 +46,7 @@ class LibraryWizardDialog : public BaseQmakeProjectWizardDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LibraryWizardDialog(const QString &templateName,
|
||||
LibraryWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
|
@@ -83,7 +83,7 @@ QString QtWizard::profileSuffix()
|
||||
return preferredSuffix(QLatin1String(Constants::PROFILE_MIMETYPE));
|
||||
}
|
||||
|
||||
bool QtWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
|
||||
bool QtWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const
|
||||
{
|
||||
return QtWizard::qt4ProjectPostGenerateFiles(w, l, errorMessage);
|
||||
}
|
||||
@@ -129,24 +129,27 @@ CustomQmakeProjectWizard::CustomQmakeProjectWizard()
|
||||
Core::BaseFileWizard *CustomQmakeProjectWizard::create(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
BaseQmakeProjectWizardDialog *wizard = new BaseQmakeProjectWizardDialog(false, parent, parameters);
|
||||
BaseQmakeProjectWizardDialog *wizard = new BaseQmakeProjectWizardDialog(this, false, parent,
|
||||
parameters);
|
||||
|
||||
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
|
||||
wizard->addTargetSetupPage(targetPageId);
|
||||
|
||||
initProjectWizardDialog(wizard, parameters.defaultPath(), parameters.extensionPages());
|
||||
initProjectWizardDialog(wizard, parameters.defaultPath(), wizard->extensionPages());
|
||||
return wizard;
|
||||
}
|
||||
|
||||
bool CustomQmakeProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage)
|
||||
bool CustomQmakeProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
return QtWizard::qt4ProjectPostGenerateFiles(w, l, errorMessage);
|
||||
}
|
||||
|
||||
// ----------------- BaseQmakeProjectWizardDialog
|
||||
BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(bool showModulesPage, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
ProjectExplorer::BaseProjectWizardDialog(parent, parameters),
|
||||
BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
bool showModulesPage, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
ProjectExplorer::BaseProjectWizardDialog(factory, parent, parameters),
|
||||
m_modulesPage(0),
|
||||
m_targetSetupPage(0),
|
||||
m_profileIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
|
||||
@@ -155,11 +158,12 @@ BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(bool showModulesPage,
|
||||
init(showModulesPage);
|
||||
}
|
||||
|
||||
BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(bool showModulesPage,
|
||||
Utils::ProjectIntroPage *introPage,
|
||||
int introId, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
ProjectExplorer::BaseProjectWizardDialog(introPage, introId, parent, parameters),
|
||||
BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
bool showModulesPage,
|
||||
Utils::ProjectIntroPage *introPage,
|
||||
int introId, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
ProjectExplorer::BaseProjectWizardDialog(factory, introPage, introId, parent, parameters),
|
||||
m_modulesPage(0),
|
||||
m_targetSetupPage(0),
|
||||
m_profileIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
|
||||
|
@@ -77,7 +77,8 @@ public:
|
||||
static bool qt4ProjectPostGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
|
||||
private:
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
|
||||
QString *errorMessage) const override;
|
||||
};
|
||||
|
||||
// A custom wizard with an additional Qt 4 target page
|
||||
@@ -89,8 +90,10 @@ public:
|
||||
CustomQmakeProjectWizard();
|
||||
|
||||
private:
|
||||
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
Core::BaseFileWizard *create(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const override;
|
||||
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l,
|
||||
QString *errorMessage) const override;
|
||||
|
||||
private:
|
||||
enum { targetPageId = 1 };
|
||||
@@ -106,14 +109,15 @@ class BaseQmakeProjectWizardDialog : public ProjectExplorer::BaseProjectWizardDi
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
explicit BaseQmakeProjectWizardDialog(bool showModulesPage,
|
||||
Utils::ProjectIntroPage *introPage,
|
||||
int introId,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
explicit BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
bool showModulesPage,
|
||||
Utils::ProjectIntroPage *introPage,
|
||||
int introId, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
public:
|
||||
explicit BaseQmakeProjectWizardDialog(bool showModulesPage, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
explicit BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
bool showModulesPage, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
~BaseQmakeProjectWizardDialog();
|
||||
|
||||
int addModulesPage(int id = -1);
|
||||
|
@@ -54,9 +54,11 @@ SubdirsProjectWizard::SubdirsProjectWizard()
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT));
|
||||
}
|
||||
|
||||
Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
SubdirsProjectWizardDialog *dialog = new SubdirsProjectWizardDialog(displayName(), icon(), parent, parameters);
|
||||
SubdirsProjectWizardDialog *dialog = new SubdirsProjectWizardDialog(this, displayName(), icon(),
|
||||
parent, parameters);
|
||||
|
||||
dialog->setProjectName(SubdirsProjectWizardDialog::uniqueProjectName(parameters.defaultPath()));
|
||||
const QString buttonText = dialog->wizardStyle() == QWizard::MacStyle
|
||||
@@ -79,7 +81,8 @@ Core::GeneratedFiles SubdirsProjectWizard::generateFiles(const QWizard *w,
|
||||
return Core::GeneratedFiles() << profile;
|
||||
}
|
||||
|
||||
bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &files, QString *errorMessage)
|
||||
bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &files,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
const SubdirsProjectWizardDialog *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
|
||||
|
@@ -44,10 +44,12 @@ public:
|
||||
SubdirsProjectWizard();
|
||||
|
||||
private:
|
||||
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const;
|
||||
Core::BaseFileWizard *create(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const override;
|
||||
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
|
||||
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage);
|
||||
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
|
||||
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l,
|
||||
QString *errorMessage) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -34,11 +34,11 @@
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
BaseQmakeProjectWizardDialog(false, parent, parameters)
|
||||
SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
const QString &templateName,
|
||||
const QIcon &icon, QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
BaseQmakeProjectWizardDialog(factory, false, parent, parameters)
|
||||
{
|
||||
setWindowIcon(icon);
|
||||
setWindowTitle(templateName);
|
||||
@@ -49,7 +49,7 @@ SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const QString &templateNa
|
||||
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
|
||||
addTargetSetupPage();
|
||||
|
||||
addExtensionPages(parameters.extensionPages());
|
||||
addExtensionPages(extensionPages());
|
||||
}
|
||||
|
||||
QtProjectParameters SubdirsProjectWizardDialog::parameters() const
|
||||
|
@@ -42,7 +42,7 @@ class SubdirsProjectWizardDialog : public BaseQmakeProjectWizardDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SubdirsProjectWizardDialog(const QString &templateName,
|
||||
explicit SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
|
@@ -62,7 +62,7 @@ TestWizard::TestWizard()
|
||||
|
||||
Core::BaseFileWizard *TestWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
TestWizardDialog *dialog = new TestWizardDialog(displayName(), icon(), parent, parameters);
|
||||
TestWizardDialog *dialog = new TestWizardDialog(this, displayName(), icon(), parent, parameters);
|
||||
dialog->setProjectName(TestWizardDialog::uniqueProjectName(parameters.defaultPath()));
|
||||
return dialog;
|
||||
}
|
||||
|
@@ -49,11 +49,12 @@ TestWizardParameters::TestWizardParameters() :
|
||||
{
|
||||
}
|
||||
|
||||
TestWizardDialog::TestWizardDialog(const QString &templateName,
|
||||
TestWizardDialog::TestWizardDialog(const Core::BaseFileWizardFactory *factory,
|
||||
const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) :
|
||||
BaseQmakeProjectWizardDialog(true, parent, parameters),
|
||||
BaseQmakeProjectWizardDialog(factory, true, parent, parameters),
|
||||
m_testPage(new TestWizardPage)
|
||||
{
|
||||
setIntroDescription(tr("This wizard generates a Qt Unit Test "
|
||||
@@ -65,7 +66,7 @@ TestWizardDialog::TestWizardDialog(const QString &templateName,
|
||||
addTargetSetupPage();
|
||||
addModulesPage();
|
||||
m_testPageId = addPage(m_testPage);
|
||||
addExtensionPages(parameters.extensionPages());
|
||||
addExtensionPages(extensionPages());
|
||||
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ class TestWizardDialog : public BaseQmakeProjectWizardDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestWizardDialog(const QString &templateName,
|
||||
explicit TestWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
|
||||
const QIcon &icon,
|
||||
QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
|
Reference in New Issue
Block a user