diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp new file mode 100644 index 00000000000..39ff1f53e4e --- /dev/null +++ b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "jsonfilepage.h" + +#include +#include + +namespace ProjectExplorer { + +JsonFilePage::JsonFilePage(QWidget *parent) : + Utils::FileWizardPage(parent) +{ } + +bool JsonFilePage::validatePage() +{ + if (path().isEmpty() || fileName().isEmpty()) + return false; + + QFileInfo d(path()); + if (!d.isDir()) + return false; + + QString target = d.absoluteFilePath(); + if (!target.endsWith(QLatin1Char('/'))) + target += QLatin1Char('/'); + target += fileName(); + + wizard()->setProperty("TargetPath", target); + return true; +} + +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h new file mode 100644 index 00000000000..27841ddedb2 --- /dev/null +++ b/src/plugins/projectexplorer/jsonwizard/jsonfilepage.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef JSONFILEPAGE_H +#define JSONFILEPAGE_H + +#include + +namespace ProjectExplorer { + +// Documentation inside. +class JsonFilePage : public Utils::FileWizardPage +{ + Q_OBJECT + +public: + JsonFilePage(QWidget *parent = 0); + + bool validatePage(); +}; + +} // namespace ProjectExplorer + +#endif // JSONFILEPAGE_H diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp new file mode 100644 index 00000000000..c606f25e7fc --- /dev/null +++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "jsonsummarypage.h" + +#include "jsonwizard.h" +#include "../addnewmodel.h" +#include "../projectexplorerconstants.h" +#include "../projectnodes.h" + +#include + +#include +#include + +#include +#include + +using namespace Core; + +namespace ProjectExplorer { + +// -------------------------------------------------------------------- +// Helper: +// -------------------------------------------------------------------- + +static QString generatedProjectFilePath(const QList &files) +{ + foreach (const JsonWizard::GeneratorFile &file, files) + if (file.file.attributes() & GeneratedFile::OpenProjectAttribute) + return file.file.path(); + return QString(); +} + +static IWizardFactory::WizardKind wizardKind(JsonWizard *wiz) +{ + IWizardFactory::WizardKind kind = IWizardFactory::ProjectWizard; + const QString kindStr = wiz->value(QLatin1String("kind")).toString(); + if (kindStr == QLatin1String(Core::Constants::WIZARD_KIND_PROJECT)) + kind = IWizardFactory::ProjectWizard; + else if (kindStr == QLatin1String(Core::Constants::WIZARD_KIND_CLASS)) + kind = IWizardFactory::ClassWizard; + else if (kindStr == QLatin1String(Core::Constants::WIZARD_KIND_FILE)) + kind = IWizardFactory::FileWizard; + else + QTC_CHECK(false); + return kind; +} + +// -------------------------------------------------------------------- +// JsonSummaryPage: +// -------------------------------------------------------------------- + +JsonSummaryPage::JsonSummaryPage(QWidget *parent) : + Internal::ProjectWizardPage(parent) +{ } + +void JsonSummaryPage::initializePage() +{ + JsonWizard *wiz = qobject_cast(wizard()); + QTC_ASSERT(wiz, return); + + connect(wiz, &JsonWizard::filesReady, this, &JsonSummaryPage::triggerCommit); + connect(wiz, &JsonWizard::filesReady, this, &JsonSummaryPage::addToProject); + + JsonWizard::GeneratorFiles files = wiz->fileList(); + QStringList filePaths = Utils::transform(files, [](const JsonWizard::GeneratorFile &f) + { return f.file.path(); }); + IWizardFactory::WizardKind kind = wizardKind(wiz); + bool isProject = (kind == IWizardFactory::ProjectWizard); + + setFiles(filePaths); + + if (isProject) { + filePaths.clear(); + JsonWizard::GeneratorFile f + = Utils::findOrDefault(files, [](const JsonWizard::GeneratorFile &f) { + return f.file.attributes() & GeneratedFile::OpenProjectAttribute; + }); + filePaths << f.file.path(); + } + + Node *contextNode = wiz->value(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE)) + .value(); + initializeProjectTree(contextNode, filePaths, kind, + isProject ? ProjectExplorer::AddSubProject : ProjectExplorer::AddNewFile); + + initializeVersionControls(); +} + +void JsonSummaryPage::cleanupPage() +{ + JsonWizard *wiz = qobject_cast(wizard()); + QTC_ASSERT(wiz, return); + + wiz->resetFileList(); + + disconnect(wiz, &JsonWizard::filesReady, this, 0); +} + +void JsonSummaryPage::triggerCommit(const JsonWizard::GeneratorFiles &files) +{ + GeneratedFiles coreFiles + = Utils::transform(files, [](const JsonWizard::GeneratorFile &f) -> GeneratedFile + { return f.file; }); + + QString errorMessage; + if (!runVersionControl(coreFiles, &errorMessage)) { + QMessageBox::critical(wizard(), tr("Failed to Commit to Version Control"), + tr("Error message from Version Control System: '%1'.") + .arg(errorMessage)); + } +} + +void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files) +{ + JsonWizard *wiz = qobject_cast(wizard()); + QTC_ASSERT(wiz, return); + + QString generatedProject = generatedProjectFilePath(files); + IWizardFactory::WizardKind kind = wizardKind(wiz); + + FolderNode *folder = currentNode(); + if (!folder) + return; + if (kind == IWizardFactory::ProjectWizard) { + if (!static_cast(folder)->addSubProjects(QStringList(generatedProject))) { + QMessageBox::critical(wizard(), tr("Failed to Add to Project"), + tr("Failed to add subproject \"%1\"\nto project \"%2\".") + .arg(QDir::toNativeSeparators(generatedProject)) + .arg(QDir::toNativeSeparators(folder->path()))); + return; + } + wiz->removeAttributeFromAllFiles(GeneratedFile::OpenProjectAttribute); + } else { + QStringList filePaths = Utils::transform(files, [](const JsonWizard::GeneratorFile &f) { + return f.file.path(); + }); + if (!folder->addFiles(filePaths)) { + QStringList nativeFilePaths = Utils::transform(filePaths, &QDir::toNativeSeparators); + QMessageBox::critical(wizard(), tr("Failed to Add to Project"), + tr("Failed to add one or more files to project\n\"%1\" (%2).") + .arg(QDir::toNativeSeparators(folder->path()), + nativeFilePaths.join(QLatin1String(", ")))); + return; + } + } + return; +} + +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h new file mode 100644 index 00000000000..111267676cb --- /dev/null +++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef JSONSUMMARYPAGE_H +#define JSONSUMMARYPAGE_H + +#include "../projectwizardpage.h" +#include "jsonwizard.h" + +#include + +namespace ProjectExplorer { + +// Documentation inside. +class JsonSummaryPage : public Internal::ProjectWizardPage +{ + Q_OBJECT + +public: + JsonSummaryPage(QWidget *parent = 0); + + void initializePage(); + void cleanupPage(); + +public slots: + void triggerCommit(const JsonWizard::GeneratorFiles &files); + void addToProject(const JsonWizard::GeneratorFiles &files); +}; + +} // namespace ProjectExplorer + +#endif // JSONSUMMARYPAGE_H diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index 6c56be6d371..31757d41b64 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -65,6 +65,11 @@ Utils::AbstractMacroExpander *JsonWizard::expander() const return m_expander; } +void JsonWizard::resetFileList() +{ + m_files.clear(); +} + JsonWizard::GeneratorFiles JsonWizard::fileList() { QString errorMessage; @@ -130,6 +135,12 @@ bool JsonWizard::boolFromVariant(const QVariant &v, Utils::AbstractMacroExpander return v.toBool(); } +void JsonWizard::removeAttributeFromAllFiles(Core::GeneratedFile::Attribute a) +{ + for (int i = 0; i < m_files.count(); ++i) + m_files[i].file.setAttributes(m_files.at(i).file.attributes() ^ a); +} + void JsonWizard::accept() { diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.h b/src/plugins/projectexplorer/jsonwizard/jsonwizard.h index ad967489eb1..f2baef3070e 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.h @@ -72,6 +72,7 @@ public: Utils::AbstractMacroExpander *expander() const; + void resetFileList(); GeneratorFiles fileList(); QVariant value(const QString &n) const; @@ -79,6 +80,8 @@ public: static bool boolFromVariant(const QVariant &v, Utils::AbstractMacroExpander *expander); + void removeAttributeFromAllFiles(Core::GeneratedFile::Attribute a); + signals: void preGenerateFiles(); // emitted before files are generated. void postGenerateFiles(const JsonWizard::GeneratorFiles &files); // emitted after files are generated. diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.pri b/src/plugins/projectexplorer/jsonwizard/jsonwizard.pri index 3b8713de315..ba9e728065a 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.pri +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.pri @@ -1,13 +1,19 @@ -HEADERS += $$PWD/jsonwizard.h \ +HEADERS += $$PWD/jsonfilepage.h \ + $$PWD/jsonsummarypage.h \ + $$PWD/jsonwizard.h \ $$PWD/jsonwizardexpander.h \ $$PWD/jsonwizardfactory.h \ $$PWD/jsonwizardfilegenerator.h \ $$PWD/jsonwizardgeneratorfactory.h \ - $$PWD/jsonwizardpagefactory.h + $$PWD/jsonwizardpagefactory.h \ + $$PWD/jsonwizardpagefactory_p.h -SOURCES += $$PWD/jsonwizard.cpp \ +SOURCES += $$PWD/jsonfilepage.cpp \ + $$PWD/jsonsummarypage.cpp \ + $$PWD/jsonwizard.cpp \ $$PWD/jsonwizardexpander.cpp \ $$PWD/jsonwizardfactory.cpp \ $$PWD/jsonwizardfilegenerator.cpp \ $$PWD/jsonwizardgeneratorfactory.cpp \ - $$PWD/jsonwizardpagefactory.cpp + $$PWD/jsonwizardpagefactory.cpp \ + $$PWD/jsonwizardpagefactory_p.cpp diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 651e2ac3446..a58a011e3ce 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -374,7 +374,7 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS for (auto i = variables.constBegin(); i != variables.constEnd(); ++i) wizard.setProperty(i.key().toUtf8(), i.value()); - wizard.setValue(QStringLiteral("GivenPath"), path); + wizard.setValue(QStringLiteral("InitialPath"), path); wizard.setValue(QStringLiteral("Platform"), platform); QString kindStr = QLatin1String(Core::Constants::WIZARD_KIND_UNKNOWN); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp new file mode 100644 index 00000000000..9d6b8b0927c --- /dev/null +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "jsonwizardpagefactory_p.h" + +#include "jsonfilepage.h" +#include "jsonsummarypage.h" + +#include +#include + +#include +#include + +namespace ProjectExplorer { +namespace Internal { + +// -------------------------------------------------------------------- +// FilePageFactory: +// -------------------------------------------------------------------- + +FilePageFactory::FilePageFactory() +{ + setTypeIdsSuffix(QLatin1String("File")); +} + +Utils::WizardPage *FilePageFactory::create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) +{ + Q_UNUSED(data); + QTC_ASSERT(canCreate(typeId), return 0); + + JsonFilePage *page = new JsonFilePage; + page->setPath(wizard->value(QStringLiteral("InitialPath")).toString()); + return page; +} + +bool FilePageFactory::validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) +{ + QTC_ASSERT(canCreate(typeId), return false); + if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) { + *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", + "\"data\" for a \"File\" page needs to be unset or an empty object."); + return false; + } + + return true; +} + +// -------------------------------------------------------------------- +// SummaryPageFactory: +// -------------------------------------------------------------------- + +SummaryPageFactory::SummaryPageFactory() +{ + setTypeIdsSuffix(QLatin1String("Summary")); +} + +Utils::WizardPage *SummaryPageFactory::create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) +{ + Q_UNUSED(wizard); + Q_UNUSED(data); + QTC_ASSERT(canCreate(typeId), return 0); + + return new JsonSummaryPage; +} + +bool SummaryPageFactory::validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) +{ + QTC_ASSERT(canCreate(typeId), return false); + if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) { + *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", + "\"data\" for a \"Summary\" page needs to be unset or an empty object."); + return false; + } + + return true; +} + +} // namespace Internal +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h new file mode 100644 index 00000000000..0e7f2f21b1a --- /dev/null +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef JSONWIZARDPAGEFACTORY_P_H +#define JSONWIZARDPAGEFACTORY_P_H + +#include "jsonwizardpagefactory.h" + +namespace ProjectExplorer { +namespace Internal { + +class FilePageFactory : public JsonWizardPageFactory +{ +public: + FilePageFactory(); + + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); +}; + +class SummaryPageFactory : public JsonWizardPageFactory +{ +public: + SummaryPageFactory(); + + Utils::WizardPage *create(JsonWizard *wizard, Core::Id typeId, const QVariant &data); + bool validateData(Core::Id typeId, const QVariant &data, QString *errorMessage); +}; + +} // namespace Internal +} // namespace ProjectExplorer + +#endif // JSONWIZARDPAGEFACTORY_P_H diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 94e53a96dc4..1330c141e79 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -37,6 +37,7 @@ #include "gcctoolchainfactories.h" #include "jsonwizard/jsonwizardfactory.h" #include "jsonwizard/jsonwizardgeneratorfactory.h" +#include "jsonwizard/jsonwizardpagefactory_p.h" #include "project.h" #include "projectexplorersettings.h" #include "projectmacroexpander.h" @@ -448,6 +449,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new CustomWizardMetaFactory(Core::IWizardFactory::ClassWizard)); // For JsonWizard: + JsonWizardFactory::registerPageFactory(new FilePageFactory); + JsonWizardFactory::registerPageFactory(new SummaryPageFactory); + JsonWizardFactory::registerGeneratorFactory(new FileGeneratorFactory); dd->m_proWindow = new ProjectWindow; diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 45e8f5c92bd..4d9b515dd51 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -170,12 +170,15 @@ QtcPlugin { name: "JsonWizard" prefix: "jsonwizard/" files: [ + "jsonfilepage.cpp", "jsonfilepage.h", + "jsonsummarypage.cpp", "jsonsummarypage.h", "jsonwizard.cpp", "jsonwizard.h", "jsonwizardexpander.cpp", "jsonwizardexpander.h", "jsonwizardfactory.cpp", "jsonwizardfactory.h", "jsonwizardfilegenerator.cpp", "jsonwizardfilegenerator.h", "jsonwizardgeneratorfactory.cpp", "jsonwizardgeneratorfactory.h", - "jsonwizardpagefactory.cpp", "jsonwizardpagefactory.h" + "jsonwizardpagefactory.cpp", "jsonwizardpagefactory.h", + "jsonwizardpagefactory_p.cpp", "jsonwizardpagefactory_p.h" ] } diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index 18cfae206ca..aaabaa06f40 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -243,7 +243,7 @@ static inline AddNewTree *getChoices(const QStringList &generatedFiles, // -------------------------------------------------------------------- ProjectWizardPage::ProjectWizardPage(QWidget *parent) : - QWizardPage(parent), + WizardPage(parent), m_ui(new Ui::WizardPage), m_model(0), m_repositoryExists(false) diff --git a/src/plugins/projectexplorer/projectwizardpage.h b/src/plugins/projectexplorer/projectwizardpage.h index aa37dbbab29..4b1816f9422 100644 --- a/src/plugins/projectexplorer/projectwizardpage.h +++ b/src/plugins/projectexplorer/projectwizardpage.h @@ -35,7 +35,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE class QTreeView; @@ -52,7 +52,7 @@ class AddNewTree; namespace Ui { class WizardPage; } // Documentation inside. -class ProjectWizardPage : public QWizardPage +class ProjectWizardPage : public Utils::WizardPage { Q_OBJECT