forked from qt-creator/qt-creator
Use FilePath in several file wizards
Change-Id: I9bab9d602096a3872f73fb16d901b8aedcd82516 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -80,6 +80,16 @@ QString FileWizardPage::fileName() const
|
|||||||
return d->m_ui.nameLineEdit->text();
|
return d->m_ui.nameLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath FileWizardPage::filePath() const
|
||||||
|
{
|
||||||
|
return d->m_ui.pathChooser->filePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileWizardPage::setFilePath(const FilePath &filePath)
|
||||||
|
{
|
||||||
|
d->m_ui.pathChooser->setFilePath(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
QString FileWizardPage::path() const
|
QString FileWizardPage::path() const
|
||||||
{
|
{
|
||||||
return d->m_ui.pathChooser->filePath().toString();
|
return d->m_ui.pathChooser->filePath().toString();
|
||||||
@@ -87,7 +97,7 @@ QString FileWizardPage::path() const
|
|||||||
|
|
||||||
void FileWizardPage::setPath(const QString &path)
|
void FileWizardPage::setPath(const QString &path)
|
||||||
{
|
{
|
||||||
d->m_ui.pathChooser->setPath(path);
|
d->m_ui.pathChooser->setFilePath(FilePath::fromString(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileWizardPage::setFileName(const QString &name)
|
void FileWizardPage::setFileName(const QString &name)
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include "filepath.h"
|
||||||
#include "wizardpage.h"
|
#include "wizardpage.h"
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
@@ -44,7 +45,9 @@ public:
|
|||||||
~FileWizardPage() override;
|
~FileWizardPage() override;
|
||||||
|
|
||||||
QString fileName() const;
|
QString fileName() const;
|
||||||
QString path() const;
|
QString path() const; // Deprecated: Use filePath()
|
||||||
|
|
||||||
|
Utils::FilePath filePath() const;
|
||||||
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
|
|
||||||
@@ -64,8 +67,9 @@ signals:
|
|||||||
void pathChanged();
|
void pathChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path); // Deprecated: Use setFilePath
|
||||||
void setFileName(const QString &name);
|
void setFileName(const QString &name);
|
||||||
|
void setFilePath(const Utils::FilePath &filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotValidChanged();
|
void slotValidChanged();
|
||||||
|
@@ -86,11 +86,11 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const FilePath &path, QWidge
|
|||||||
if (flags().testFlag(ForceCapitalLetterForFileName))
|
if (flags().testFlag(ForceCapitalLetterForFileName))
|
||||||
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
|
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
|
||||||
|
|
||||||
Utils::Wizard *wizard = create(parent, WizardDialogParameters(path.toString(),
|
Wizard *wizard = create(parent, WizardDialogParameters(path,
|
||||||
platform,
|
platform,
|
||||||
requiredFeatures(),
|
requiredFeatures(),
|
||||||
dialogParameterFlags,
|
dialogParameterFlags,
|
||||||
extraValues));
|
extraValues));
|
||||||
QTC_CHECK(wizard);
|
QTC_CHECK(wizard);
|
||||||
return wizard;
|
return wizard;
|
||||||
}
|
}
|
||||||
@@ -287,21 +287,17 @@ BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(Ge
|
|||||||
\a baseName already has one.
|
\a baseName already has one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QString BaseFileWizardFactory::buildFileName(const QString &path,
|
FilePath BaseFileWizardFactory::buildFileName(const FilePath &path,
|
||||||
const QString &baseName,
|
const QString &baseName,
|
||||||
const QString &extension)
|
const QString &extension)
|
||||||
{
|
{
|
||||||
QString rc = path;
|
FilePath rc = path.pathAppended(baseName);
|
||||||
const QChar slash = QLatin1Char('/');
|
|
||||||
if (!rc.isEmpty() && !rc.endsWith(slash))
|
|
||||||
rc += slash;
|
|
||||||
rc += baseName;
|
|
||||||
// Add extension unless user specified something else
|
// Add extension unless user specified something else
|
||||||
const QChar dot = QLatin1Char('.');
|
const QChar dot = '.';
|
||||||
if (!extension.isEmpty() && !baseName.contains(dot)) {
|
if (!extension.isEmpty() && !baseName.contains(dot)) {
|
||||||
if (!extension.startsWith(dot))
|
if (!extension.startsWith(dot))
|
||||||
rc += dot;
|
rc = rc.stringAppended(dot);
|
||||||
rc += extension;
|
rc = rc.stringAppended(extension);
|
||||||
}
|
}
|
||||||
if (debugWizard)
|
if (debugWizard)
|
||||||
qDebug() << Q_FUNC_INFO << rc;
|
qDebug() << Q_FUNC_INFO << rc;
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include <coreplugin/iwizardfactory.h>
|
#include <coreplugin/iwizardfactory.h>
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ public:
|
|||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
|
Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
|
||||||
|
|
||||||
explicit WizardDialogParameters(const QString &defaultPath, Utils::Id platform,
|
explicit WizardDialogParameters(const Utils::FilePath &defaultPath, Utils::Id platform,
|
||||||
const QSet<Utils::Id> &requiredFeatures, DialogParameterFlags flags,
|
const QSet<Utils::Id> &requiredFeatures, DialogParameterFlags flags,
|
||||||
const QVariantMap &extraValues)
|
const QVariantMap &extraValues)
|
||||||
: m_defaultPath(defaultPath),
|
: m_defaultPath(defaultPath),
|
||||||
@@ -64,23 +66,14 @@ public:
|
|||||||
m_extraValues(extraValues)
|
m_extraValues(extraValues)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QString defaultPath() const
|
Utils::FilePath defaultPath() const { return m_defaultPath; }
|
||||||
{ return m_defaultPath; }
|
Utils::Id selectedPlatform() const { return m_selectedPlatform; }
|
||||||
|
QSet<Utils::Id> requiredFeatures() const { return m_requiredFeatures; }
|
||||||
Utils::Id selectedPlatform() const
|
DialogParameterFlags flags() const { return m_parameterFlags; }
|
||||||
{ return m_selectedPlatform; }
|
QVariantMap extraValues() const { return m_extraValues; }
|
||||||
|
|
||||||
QSet<Utils::Id> requiredFeatures() const
|
|
||||||
{ return m_requiredFeatures; }
|
|
||||||
|
|
||||||
DialogParameterFlags flags() const
|
|
||||||
{ return m_parameterFlags; }
|
|
||||||
|
|
||||||
QVariantMap extraValues() const
|
|
||||||
{ return m_extraValues; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_defaultPath;
|
Utils::FilePath m_defaultPath;
|
||||||
Utils::Id m_selectedPlatform;
|
Utils::Id m_selectedPlatform;
|
||||||
QSet<Utils::Id> m_requiredFeatures;
|
QSet<Utils::Id> m_requiredFeatures;
|
||||||
DialogParameterFlags m_parameterFlags;
|
DialogParameterFlags m_parameterFlags;
|
||||||
@@ -94,7 +87,7 @@ class CORE_EXPORT BaseFileWizardFactory : public IWizardFactory
|
|||||||
friend class BaseFileWizard;
|
friend class BaseFileWizard;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
|
static Utils::FilePath buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters ¶meters) const = 0;
|
virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters ¶meters) const = 0;
|
||||||
|
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -58,7 +60,7 @@ QString FormClassWizard::formSuffix() const
|
|||||||
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const
|
||||||
{
|
{
|
||||||
auto wizardDialog = new FormClassWizardDialog(this, parent);
|
auto wizardDialog = new FormClassWizardDialog(this, parent);
|
||||||
wizardDialog->setPath(parameters.defaultPath());
|
wizardDialog->setFilePath(parameters.defaultPath());
|
||||||
return wizardDialog;
|
return wizardDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +75,9 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// header
|
// header
|
||||||
const QString formFileName = buildFileName(params.path, params.uiFile, formSuffix());
|
const FilePath formFileName = buildFileName(params.path, params.uiFile, formSuffix());
|
||||||
const QString headerFileName = buildFileName(params.path, params.headerFile, headerSuffix());
|
const FilePath headerFileName = buildFileName(params.path, params.headerFile, headerSuffix());
|
||||||
const QString sourceFileName = buildFileName(params.path, params.sourceFile, sourceSuffix());
|
const FilePath sourceFileName = buildFileName(params.path, params.sourceFile, sourceSuffix());
|
||||||
|
|
||||||
Core::GeneratedFile headerFile(headerFileName);
|
Core::GeneratedFile headerFile(headerFileName);
|
||||||
headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||||
@@ -102,5 +104,5 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
|
|||||||
return Core::GeneratedFiles() << headerFile << sourceFile << uiFile;
|
return Core::GeneratedFiles() << headerFile << sourceFile << uiFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // Internal
|
||||||
}
|
} // Designer
|
||||||
|
@@ -26,9 +26,13 @@
|
|||||||
#include "formclasswizarddialog.h"
|
#include "formclasswizarddialog.h"
|
||||||
#include "formclasswizardpage.h"
|
#include "formclasswizardpage.h"
|
||||||
#include "formclasswizardparameters.h"
|
#include "formclasswizardparameters.h"
|
||||||
|
|
||||||
#include <cppeditor/abstracteditorsupport.h>
|
#include <cppeditor/abstracteditorsupport.h>
|
||||||
#include <designer/formtemplatewizardpage.h>
|
#include <designer/formtemplatewizardpage.h>
|
||||||
#include <qtsupport/codegenerator.h>
|
#include <qtsupport/codegenerator.h>
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
enum { FormPageId, ClassPageId };
|
enum { FormPageId, ClassPageId };
|
||||||
|
|
||||||
@@ -52,14 +56,14 @@ FormClassWizardDialog::FormClassWizardDialog(const Core::BaseFileWizardFactory *
|
|||||||
addPage(p);
|
addPage(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FormClassWizardDialog::path() const
|
FilePath FormClassWizardDialog::filePath() const
|
||||||
{
|
{
|
||||||
return m_classPage->path();
|
return m_classPage->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardDialog::setPath(const QString &p)
|
void FormClassWizardDialog::setFilePath(const FilePath &p)
|
||||||
{
|
{
|
||||||
m_classPage->setPath(p);
|
m_classPage->setFilePath(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardDialog::initializePage(int id)
|
void FormClassWizardDialog::initializePage(int id)
|
||||||
|
@@ -45,8 +45,8 @@ public:
|
|||||||
|
|
||||||
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
explicit FormClassWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
||||||
|
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
void setPath(const QString &);
|
void setFilePath(const Utils::FilePath &);
|
||||||
|
|
||||||
Designer::FormClassWizardParameters parameters() const;
|
Designer::FormClassWizardParameters parameters() const;
|
||||||
|
|
||||||
|
@@ -32,9 +32,8 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
#include <utils/mimetypes/mimedatabase.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -88,20 +87,20 @@ void FormClassWizardPage::setClassName(const QString &suggestedClassName)
|
|||||||
slotValidChanged();
|
slotValidChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FormClassWizardPage::path() const
|
Utils::FilePath FormClassWizardPage::filePath() const
|
||||||
{
|
{
|
||||||
return m_ui->newClassWidget->path();
|
return m_ui->newClassWidget->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardPage::setPath(const QString &p)
|
void FormClassWizardPage::setFilePath(const Utils::FilePath &p)
|
||||||
{
|
{
|
||||||
m_ui->newClassWidget->setPath(p);
|
m_ui->newClassWidget->setFilePath(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClassWizardPage::getParameters(FormClassWizardParameters *p) const
|
void FormClassWizardPage::getParameters(FormClassWizardParameters *p) const
|
||||||
{
|
{
|
||||||
p->className = m_ui->newClassWidget->className();
|
p->className = m_ui->newClassWidget->className();
|
||||||
p->path = path();
|
p->path = filePath();
|
||||||
p->sourceFile = m_ui->newClassWidget->sourceFileName();
|
p->sourceFile = m_ui->newClassWidget->sourceFileName();
|
||||||
p->headerFile = m_ui->newClassWidget->headerFileName();
|
p->headerFile = m_ui->newClassWidget->headerFileName();
|
||||||
p->uiFile = m_ui->newClassWidget-> formFileName();
|
p->uiFile = m_ui->newClassWidget-> formFileName();
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
|
|
||||||
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
|
|
||||||
class FormClassWizardParameters;
|
class FormClassWizardParameters;
|
||||||
@@ -49,8 +51,8 @@ public:
|
|||||||
bool validatePage() override;
|
bool validatePage() override;
|
||||||
|
|
||||||
void setClassName(const QString &suggestedClassName);
|
void setClassName(const QString &suggestedClassName);
|
||||||
void setPath(const QString &);
|
void setFilePath(const Utils::FilePath &);
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
|
|
||||||
// Fill out applicable parameters
|
// Fill out applicable parameters
|
||||||
void getParameters(FormClassWizardParameters *) const;
|
void getParameters(FormClassWizardParameters *) const;
|
||||||
|
@@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QString>
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -39,7 +40,7 @@ class FormClassWizardParameters
|
|||||||
public:
|
public:
|
||||||
QString uiTemplate;
|
QString uiTemplate;
|
||||||
QString className;
|
QString className;
|
||||||
QString path;
|
Utils::FilePath path;
|
||||||
QString sourceFile;
|
QString sourceFile;
|
||||||
QString headerFile;
|
QString headerFile;
|
||||||
QString uiFile;
|
QString uiFile;
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
enum { debugNewClassWidget = 0 };
|
enum { debugNewClassWidget = 0 };
|
||||||
|
|
||||||
/*! \class Utils::NewClassWidget
|
/*! \class Utils::NewClassWidget
|
||||||
@@ -171,14 +173,14 @@ QString NewClassWidget::formFileName() const
|
|||||||
return d->m_ui.formFileLineEdit->text();
|
return d->m_ui.formFileLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NewClassWidget::path() const
|
FilePath NewClassWidget::filePath() const
|
||||||
{
|
{
|
||||||
return d->m_ui.pathChooser->filePath().toString();
|
return d->m_ui.pathChooser->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewClassWidget::setPath(const QString &path)
|
void NewClassWidget::setFilePath(const FilePath &path)
|
||||||
{
|
{
|
||||||
d->m_ui.pathChooser->setPath(path);
|
d->m_ui.pathChooser->setFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NewClassWidget::sourceExtension() const
|
QString NewClassWidget::sourceExtension() const
|
||||||
@@ -305,21 +307,21 @@ static QString ensureSuffix(QString f, const QString &extension)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a non-empty name was passed, expand to directory and suffix
|
// If a non-empty name was passed, expand to directory and suffix
|
||||||
static QString expandFileName(const QDir &dir, const QString &name, const QString &extension)
|
static FilePath expandFileName(const FilePath &dir, const QString &name, const QString &extension)
|
||||||
{
|
{
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
return QString();
|
return {};
|
||||||
return dir.absoluteFilePath(ensureSuffix(name, extension));
|
return dir / ensureSuffix(name, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList NewClassWidget::files() const
|
Utils::FilePaths NewClassWidget::files() const
|
||||||
{
|
{
|
||||||
QStringList rc;
|
const FilePath dir = filePath();
|
||||||
const QDir dir = QDir(path());
|
return {
|
||||||
rc.push_back(expandFileName(dir, headerFileName(), headerExtension()));
|
expandFileName(dir, headerFileName(), headerExtension()),
|
||||||
rc.push_back(expandFileName(dir, sourceFileName(), sourceExtension()));
|
expandFileName(dir, sourceFileName(), sourceExtension()),
|
||||||
rc.push_back(expandFileName(dir, formFileName(), formExtension()));
|
expandFileName(dir, formFileName(), formExtension()),
|
||||||
return rc;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -52,14 +54,14 @@ public:
|
|||||||
QString sourceFileName() const;
|
QString sourceFileName() const;
|
||||||
QString headerFileName() const;
|
QString headerFileName() const;
|
||||||
QString formFileName() const;
|
QString formFileName() const;
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
QString sourceExtension() const;
|
QString sourceExtension() const;
|
||||||
QString headerExtension() const;
|
QString headerExtension() const;
|
||||||
QString formExtension() const;
|
QString formExtension() const;
|
||||||
|
|
||||||
bool isValid(QString *error = nullptr) const;
|
bool isValid(QString *error = nullptr) const;
|
||||||
|
|
||||||
QStringList files() const;
|
Utils::FilePaths files() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void validChanged();
|
void validChanged();
|
||||||
@@ -72,7 +74,7 @@ public slots:
|
|||||||
* valid class name.
|
* valid class name.
|
||||||
*/
|
*/
|
||||||
void setClassName(const QString &suggestedName);
|
void setClassName(const QString &suggestedName);
|
||||||
void setPath(const QString &path);
|
void setFilePath(const Utils::FilePath &filePath);
|
||||||
void setSourceExtension(const QString &e);
|
void setSourceExtension(const QString &e);
|
||||||
void setHeaderExtension(const QString &e);
|
void setHeaderExtension(const QString &e);
|
||||||
void setLowerCaseFiles(bool v);
|
void setLowerCaseFiles(bool v);
|
||||||
|
@@ -59,8 +59,7 @@ FilesSelectionWizardPage::FilesSelectionWizardPage(GenericProjectWizardDialog *g
|
|||||||
|
|
||||||
void FilesSelectionWizardPage::initializePage()
|
void FilesSelectionWizardPage::initializePage()
|
||||||
{
|
{
|
||||||
m_filesWidget->resetModel(Utils::FilePath::fromString(m_genericProjectWizardDialog->path()),
|
m_filesWidget->resetModel(m_genericProjectWizardDialog->filePath(), Utils::FilePaths());
|
||||||
Utils::FilePaths());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilesSelectionWizardPage::cleanupPage()
|
void FilesSelectionWizardPage::cleanupPage()
|
||||||
|
@@ -46,13 +46,14 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static const char *const ConfigFileTemplate =
|
const char ConfigFileTemplate[] =
|
||||||
"// Add predefined macros for your project here. For example:\n"
|
"// Add predefined macros for your project here. For example:\n"
|
||||||
"// #define THE_ANSWER 42\n"
|
"// #define THE_ANSWER 42\n";
|
||||||
;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -79,24 +80,24 @@ GenericProjectWizardDialog::GenericProjectWizardDialog(const Core::BaseFileWizar
|
|||||||
addPage(m_secondPage);
|
addPage(m_secondPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericProjectWizardDialog::path() const
|
FilePath GenericProjectWizardDialog::filePath() const
|
||||||
{
|
{
|
||||||
return m_firstPage->path();
|
return m_firstPage->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePaths GenericProjectWizardDialog::selectedPaths() const
|
FilePaths GenericProjectWizardDialog::selectedPaths() const
|
||||||
{
|
{
|
||||||
return m_secondPage->selectedPaths();
|
return m_secondPage->selectedPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePaths GenericProjectWizardDialog::selectedFiles() const
|
FilePaths GenericProjectWizardDialog::selectedFiles() const
|
||||||
{
|
{
|
||||||
return m_secondPage->selectedFiles();
|
return m_secondPage->selectedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericProjectWizardDialog::setPath(const QString &path)
|
void GenericProjectWizardDialog::setFilePath(const FilePath &path)
|
||||||
{
|
{
|
||||||
m_firstPage->setPath(path);
|
m_firstPage->setFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericProjectWizardDialog::projectName() const
|
QString GenericProjectWizardDialog::projectName() const
|
||||||
@@ -129,7 +130,7 @@ Core::BaseFileWizard *GenericProjectWizard::create(QWidget *parent,
|
|||||||
{
|
{
|
||||||
auto wizard = new GenericProjectWizardDialog(this, parent);
|
auto wizard = new GenericProjectWizardDialog(this, parent);
|
||||||
|
|
||||||
wizard->setPath(parameters.defaultPath());
|
wizard->setFilePath(parameters.defaultPath());
|
||||||
|
|
||||||
foreach (QWizardPage *p, wizard->extensionPages())
|
foreach (QWizardPage *p, wizard->extensionPages())
|
||||||
wizard->addPage(p);
|
wizard->addPage(p);
|
||||||
@@ -143,15 +144,14 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
|||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
auto wizard = qobject_cast<const GenericProjectWizardDialog *>(w);
|
auto wizard = qobject_cast<const GenericProjectWizardDialog *>(w);
|
||||||
const QString projectPath = wizard->path();
|
const FilePath projectPath = wizard->filePath();
|
||||||
const QDir dir(projectPath);
|
|
||||||
const QString projectName = wizard->projectName();
|
const QString projectName = wizard->projectName();
|
||||||
const QString creatorFileName = QFileInfo(dir, projectName + QLatin1String(".creator")).absoluteFilePath();
|
const FilePath creatorFileName = projectPath.pathAppended(projectName + ".creator");
|
||||||
const QString filesFileName = QFileInfo(dir, projectName + QLatin1String(".files")).absoluteFilePath();
|
const FilePath filesFileName = projectPath.pathAppended(projectName + ".files");
|
||||||
const QString includesFileName = QFileInfo(dir, projectName + QLatin1String(".includes")).absoluteFilePath();
|
const FilePath includesFileName = projectPath.pathAppended(projectName + ".includes");
|
||||||
const QString configFileName = QFileInfo(dir, projectName + QLatin1String(".config")).absoluteFilePath();
|
const FilePath configFileName = projectPath.pathAppended(projectName + ".config");
|
||||||
const QString cxxflagsFileName = QFileInfo(dir, projectName + QLatin1String(".cxxflags")).absoluteFilePath();
|
const FilePath cxxflagsFileName = projectPath.pathAppended(projectName + ".cxxflags");
|
||||||
const QString cflagsFileName = QFileInfo(dir, projectName + QLatin1String(".cflags")).absoluteFilePath();
|
const FilePath cflagsFileName = projectPath.pathAppended(projectName + ".cflags");
|
||||||
const QStringList paths = Utils::transform(wizard->selectedPaths(), &Utils::FilePath::toString);
|
const QStringList paths = Utils::transform(wizard->selectedPaths(), &Utils::FilePath::toString);
|
||||||
|
|
||||||
Utils::MimeType headerTy = Utils::mimeTypeForName(QLatin1String("text/x-chdr"));
|
Utils::MimeType headerTy = Utils::mimeTypeForName(QLatin1String("text/x-chdr"));
|
||||||
@@ -159,6 +159,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
|||||||
QStringList nameFilters = headerTy.globPatterns();
|
QStringList nameFilters = headerTy.globPatterns();
|
||||||
|
|
||||||
QStringList includePaths;
|
QStringList includePaths;
|
||||||
|
const QDir dir(projectPath.toString());
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
QFileInfo fileInfo(path);
|
QFileInfo fileInfo(path);
|
||||||
QDir thisDir(fileInfo.absoluteFilePath());
|
QDir thisDir(fileInfo.absoluteFilePath());
|
||||||
|
@@ -44,8 +44,8 @@ class GenericProjectWizardDialog : public Core::BaseFileWizard
|
|||||||
public:
|
public:
|
||||||
explicit GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
explicit GenericProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = nullptr);
|
||||||
|
|
||||||
QString path() const;
|
Utils::FilePath filePath() const;
|
||||||
void setPath(const QString &path);
|
void setFilePath(const Utils::FilePath &path);
|
||||||
Utils::FilePaths selectedFiles() const;
|
Utils::FilePaths selectedFiles() const;
|
||||||
Utils::FilePaths selectedPaths() const;
|
Utils::FilePaths selectedPaths() const;
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
|
|||||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(new Utils::ProjectIntroPage))
|
d(std::make_unique<BaseProjectWizardDialogPrivate>(new Utils::ProjectIntroPage))
|
||||||
{
|
{
|
||||||
setFilePath(FilePath::fromString(parameters.defaultPath()));
|
setFilePath(parameters.defaultPath());
|
||||||
setSelectedPlatform(parameters.selectedPlatform());
|
setSelectedPlatform(parameters.selectedPlatform());
|
||||||
setRequiredFeatures(parameters.requiredFeatures());
|
setRequiredFeatures(parameters.requiredFeatures());
|
||||||
init();
|
init();
|
||||||
@@ -81,7 +81,7 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
|
|||||||
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
|
||||||
d(std::make_unique<BaseProjectWizardDialogPrivate>(introPage, introId))
|
d(std::make_unique<BaseProjectWizardDialogPrivate>(introPage, introId))
|
||||||
{
|
{
|
||||||
setFilePath(FilePath::fromString(parameters.defaultPath()));
|
setFilePath(parameters.defaultPath());
|
||||||
setSelectedPlatform(parameters.selectedPlatform());
|
setSelectedPlatform(parameters.selectedPlatform());
|
||||||
setRequiredFeatures(parameters.requiredFeatures());
|
setRequiredFeatures(parameters.requiredFeatures());
|
||||||
init();
|
init();
|
||||||
@@ -161,9 +161,9 @@ Utils::ProjectIntroPage *BaseProjectWizardDialog::introPage() const
|
|||||||
return d->introPage;
|
return d->introPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseProjectWizardDialog::uniqueProjectName(const QString &path)
|
QString BaseProjectWizardDialog::uniqueProjectName(const FilePath &path)
|
||||||
{
|
{
|
||||||
const QDir pathDir(path);
|
const QDir pathDir(path.toString());
|
||||||
//: File path suggestion for a new project. If you choose
|
//: File path suggestion for a new project. If you choose
|
||||||
//: to translate it, make sure it is a valid path name without blanks
|
//: to translate it, make sure it is a valid path name without blanks
|
||||||
//: and using only ascii chars.
|
//: and using only ascii chars.
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
Utils::FilePath filePath() const;
|
Utils::FilePath filePath() const;
|
||||||
|
|
||||||
// Generate a new project name (untitled<n>) in path.
|
// Generate a new project name (untitled<n>) in path.
|
||||||
static QString uniqueProjectName(const QString &path);
|
static QString uniqueProjectName(const Utils::FilePath &path);
|
||||||
void addExtensionPages(const QList<QWizardPage *> &wizardPageList);
|
void addExtensionPages(const QList<QWizardPage *> &wizardPageList);
|
||||||
|
|
||||||
void setIntroDescription(const QString &d);
|
void setIntroDescription(const QString &d);
|
||||||
|
@@ -166,7 +166,7 @@ BaseFileWizard *CustomWizard::create(QWidget *parent, const WizardDialogParamete
|
|||||||
|
|
||||||
d->m_context->reset();
|
d->m_context->reset();
|
||||||
auto customPage = new CustomWizardPage(d->m_context, parameters());
|
auto customPage = new CustomWizardPage(d->m_context, parameters());
|
||||||
customPage->setPath(p.defaultPath());
|
customPage->setFilePath(p.defaultPath());
|
||||||
if (parameters()->firstPageId >= 0)
|
if (parameters()->firstPageId >= 0)
|
||||||
wizard->setPage(parameters()->firstPageId, customPage);
|
wizard->setPage(parameters()->firstPageId, customPage);
|
||||||
else
|
else
|
||||||
@@ -506,7 +506,7 @@ BaseFileWizard *CustomProjectWizard::create(QWidget *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
||||||
const QString &defaultPath,
|
const FilePath &defaultPath,
|
||||||
const QList<QWizardPage *> &extensionPages) const
|
const QList<QWizardPage *> &extensionPages) const
|
||||||
{
|
{
|
||||||
const CustomWizardParametersPtr pa = parameters();
|
const CustomWizardParametersPtr pa = parameters();
|
||||||
@@ -526,7 +526,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
|
|||||||
}
|
}
|
||||||
for (QWizardPage *ep : extensionPages)
|
for (QWizardPage *ep : extensionPages)
|
||||||
w->addPage(ep);
|
w->addPage(ep);
|
||||||
w->setFilePath(FilePath::fromString(defaultPath));
|
w->setFilePath(defaultPath);
|
||||||
w->setProjectName(BaseProjectWizardDialog::uniqueProjectName(defaultPath));
|
w->setProjectName(BaseProjectWizardDialog::uniqueProjectName(defaultPath));
|
||||||
|
|
||||||
connect(w, &BaseProjectWizardDialog::projectParametersChanged,
|
connect(w, &BaseProjectWizardDialog::projectParametersChanged,
|
||||||
|
@@ -141,7 +141,7 @@ protected:
|
|||||||
|
|
||||||
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const override;
|
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage) const override;
|
||||||
|
|
||||||
void initProjectWizardDialog(BaseProjectWizardDialog *w, const QString &defaultPath,
|
void initProjectWizardDialog(BaseProjectWizardDialog *w, const Utils::FilePath &defaultPath,
|
||||||
const QList<QWizardPage *> &extensionPages) const;
|
const QList<QWizardPage *> &extensionPages) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -437,9 +437,9 @@ FilePath CustomWizardPage::filePath() const
|
|||||||
return m_pathChooser->filePath();
|
return m_pathChooser->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomWizardPage::setPath(const QString &path)
|
void CustomWizardPage::setFilePath(const FilePath &path)
|
||||||
{
|
{
|
||||||
m_pathChooser->setPath(path);
|
m_pathChooser->setFilePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomWizardPage::isComplete() const
|
bool CustomWizardPage::isComplete() const
|
||||||
|
@@ -127,7 +127,7 @@ public:
|
|||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
Utils::FilePath filePath() const;
|
Utils::FilePath filePath() const;
|
||||||
void setPath(const QString &path);
|
void setFilePath(const Utils::FilePath &path);
|
||||||
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
|
|
||||||
|
@@ -47,17 +47,17 @@ void JsonFilePage::initializePage()
|
|||||||
|
|
||||||
if (fileName().isEmpty())
|
if (fileName().isEmpty())
|
||||||
setFileName(wiz->stringValue(QLatin1String("InitialFileName")));
|
setFileName(wiz->stringValue(QLatin1String("InitialFileName")));
|
||||||
if (path().isEmpty())
|
if (filePath().isEmpty())
|
||||||
setPath(wiz->stringValue(QLatin1String("InitialPath")));
|
setPath(wiz->stringValue(QLatin1String("InitialPath")));
|
||||||
setDefaultSuffix(wiz->stringValue("DefaultSuffix"));
|
setDefaultSuffix(wiz->stringValue("DefaultSuffix"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonFilePage::validatePage()
|
bool JsonFilePage::validatePage()
|
||||||
{
|
{
|
||||||
if (path().isEmpty() || fileName().isEmpty())
|
if (filePath().isEmpty() || fileName().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const FilePath dir = FilePath::fromString(path());
|
const FilePath dir = filePath();
|
||||||
if (!dir.isDir())
|
if (!dir.isDir())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -148,8 +148,8 @@ public:
|
|||||||
addPage(m_secondPage);
|
addPage(m_secondPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString path() const { return m_firstPage->path(); }
|
Utils::FilePath projectDir() const { return m_firstPage->filePath(); }
|
||||||
void setPath(const QString &path) { m_firstPage->setPath(path); }
|
void setProjectDir(const Utils::FilePath &path) { m_firstPage->setFilePath(path); }
|
||||||
FilePaths selectedFiles() const { return m_secondPage->selectedFiles(); }
|
FilePaths selectedFiles() const { return m_secondPage->selectedFiles(); }
|
||||||
FilePaths selectedPaths() const { return m_secondPage->selectedPaths(); }
|
FilePaths selectedPaths() const { return m_secondPage->selectedPaths(); }
|
||||||
QString qtModules() const { return m_secondPage->qtModules(); }
|
QString qtModules() const { return m_secondPage->qtModules(); }
|
||||||
@@ -162,8 +162,7 @@ public:
|
|||||||
|
|
||||||
void FilesSelectionWizardPage::initializePage()
|
void FilesSelectionWizardPage::initializePage()
|
||||||
{
|
{
|
||||||
m_filesWidget->resetModel(FilePath::fromString(m_simpleProjectWizardDialog->path()),
|
m_filesWidget->resetModel(m_simpleProjectWizardDialog->projectDir(), FilePaths());
|
||||||
FilePaths());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleProjectWizard::SimpleProjectWizard()
|
SimpleProjectWizard::SimpleProjectWizard()
|
||||||
@@ -187,7 +186,7 @@ BaseFileWizard *SimpleProjectWizard::create(QWidget *parent,
|
|||||||
const WizardDialogParameters ¶meters) const
|
const WizardDialogParameters ¶meters) const
|
||||||
{
|
{
|
||||||
auto wizard = new SimpleProjectWizardDialog(this, parent);
|
auto wizard = new SimpleProjectWizardDialog(this, parent);
|
||||||
wizard->setPath(parameters.defaultPath());
|
wizard->setProjectDir(parameters.defaultPath());
|
||||||
|
|
||||||
for (QWizardPage *p : wizard->extensionPages())
|
for (QWizardPage *p : wizard->extensionPages())
|
||||||
wizard->addPage(p);
|
wizard->addPage(p);
|
||||||
@@ -199,7 +198,7 @@ GeneratedFiles generateQmakeFiles(const SimpleProjectWizardDialog *wizard,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const QString projectPath = wizard->path();
|
const QString projectPath = wizard->projectDir().toString();
|
||||||
const QDir dir(projectPath);
|
const QDir dir(projectPath);
|
||||||
const QString projectName = wizard->projectName();
|
const QString projectName = wizard->projectName();
|
||||||
const FilePath proFileName = Utils::FilePath::fromString(QFileInfo(dir, projectName + ".pro").absoluteFilePath());
|
const FilePath proFileName = Utils::FilePath::fromString(QFileInfo(dir, projectName + ".pro").absoluteFilePath());
|
||||||
@@ -257,8 +256,7 @@ GeneratedFiles generateCmakeFiles(const SimpleProjectWizardDialog *wizard,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const QString projectPath = wizard->path();
|
const QDir dir(wizard->projectDir().toString());
|
||||||
const QDir dir(projectPath);
|
|
||||||
const QString projectName = wizard->projectName();
|
const QString projectName = wizard->projectName();
|
||||||
const FilePath projectFileName = Utils::FilePath::fromString(QFileInfo(dir, "CMakeLists.txt").absoluteFilePath());
|
const FilePath projectFileName = Utils::FilePath::fromString(QFileInfo(dir, "CMakeLists.txt").absoluteFilePath());
|
||||||
const QStringList paths = Utils::transform(wizard->selectedPaths(), &FilePath::toString);
|
const QStringList paths = Utils::transform(wizard->selectedPaths(), &FilePath::toString);
|
||||||
|
@@ -32,19 +32,17 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// ----------- QtProjectParameters
|
// ----------- QtProjectParameters
|
||||||
QtProjectParameters::QtProjectParameters() = default;
|
QtProjectParameters::QtProjectParameters() = default;
|
||||||
|
|
||||||
QString QtProjectParameters::projectPath() const
|
FilePath QtProjectParameters::projectPath() const
|
||||||
{
|
{
|
||||||
QString rc = path;
|
return path / fileName;
|
||||||
if (!rc.isEmpty())
|
|
||||||
rc += QLatin1Char('/');
|
|
||||||
rc += fileName;
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out a QT module line.
|
// Write out a QT module line.
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -41,14 +43,15 @@ QString createMacro(const QString &name, const QString &suffix);
|
|||||||
// Base parameters for application project generation with functionality to
|
// Base parameters for application project generation with functionality to
|
||||||
// write a .pro-file section.
|
// write a .pro-file section.
|
||||||
|
|
||||||
struct QtProjectParameters {
|
struct QtProjectParameters
|
||||||
|
{
|
||||||
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, QtPlugin, EmptyProject };
|
enum Type { ConsoleApp, GuiApp, StaticLibrary, SharedLibrary, QtPlugin, EmptyProject };
|
||||||
enum QtVersionSupport { SupportQt4And5, SupportQt4Only, SupportQt5Only };
|
enum QtVersionSupport { SupportQt4And5, SupportQt4Only, SupportQt5Only };
|
||||||
enum Flags { WidgetsRequiredFlag = 0x1 };
|
enum Flags { WidgetsRequiredFlag = 0x1 };
|
||||||
|
|
||||||
QtProjectParameters();
|
QtProjectParameters();
|
||||||
// Return project path as "path/name"
|
// Return project path as "path/name"
|
||||||
QString projectPath() const;
|
Utils::FilePath projectPath() const;
|
||||||
void writeProFile(QTextStream &) const;
|
void writeProFile(QTextStream &) const;
|
||||||
static void writeProFileHeader(QTextStream &);
|
static void writeProFileHeader(QTextStream &);
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ struct QtProjectParameters {
|
|||||||
QtVersionSupport qtVersionSupport = SupportQt4And5;
|
QtVersionSupport qtVersionSupport = SupportQt4And5;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString target;
|
QString target;
|
||||||
QString path;
|
Utils::FilePath path;
|
||||||
QStringList selectedModules;
|
QStringList selectedModules;
|
||||||
QStringList deselectedModules;
|
QStringList deselectedModules;
|
||||||
QString targetDirectory;
|
QString targetDirectory;
|
||||||
|
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -70,8 +72,8 @@ Core::GeneratedFiles SubdirsProjectWizard::generateFiles(const QWizard *w,
|
|||||||
{
|
{
|
||||||
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||||
const QtProjectParameters params = wizard->parameters();
|
const QtProjectParameters params = wizard->parameters();
|
||||||
const QString projectPath = params.projectPath();
|
const FilePath projectPath = params.projectPath();
|
||||||
const QString profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
const FilePath profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
||||||
|
|
||||||
Core::GeneratedFile profile(profileName);
|
Core::GeneratedFile profile(profileName);
|
||||||
profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute | Core::GeneratedFile::OpenEditorAttribute);
|
profile.setAttributes(Core::GeneratedFile::OpenProjectAttribute | Core::GeneratedFile::OpenEditorAttribute);
|
||||||
@@ -85,10 +87,10 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
|
|||||||
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
const auto *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
|
||||||
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
|
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
|
||||||
const QtProjectParameters params = wizard->parameters();
|
const QtProjectParameters params = wizard->parameters();
|
||||||
const QString projectPath = params.projectPath();
|
const FilePath projectPath = params.projectPath();
|
||||||
const QString profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
const FilePath profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE), profileName);
|
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE), profileName.toVariant());
|
||||||
map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS),
|
map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS),
|
||||||
Utils::transform<QStringList>(wizard->selectedKits(), &Utils::Id::toString));
|
Utils::transform<QStringList>(wizard->selectedKits(), &Utils::Id::toString));
|
||||||
IWizardFactory::requestNewItemDialog(tr("New Subproject", "Title of dialog"),
|
IWizardFactory::requestNewItemDialog(tr("New Subproject", "Title of dialog"),
|
||||||
@@ -96,7 +98,7 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
|
|||||||
[](Core::IWizardFactory *f) {
|
[](Core::IWizardFactory *f) {
|
||||||
return f->supportedProjectTypes().contains(Constants::QMAKEPROJECT_ID);
|
return f->supportedProjectTypes().contains(Constants::QMAKEPROJECT_ID);
|
||||||
}),
|
}),
|
||||||
Utils::FilePath::fromString(wizard->parameters().projectPath()),
|
wizard->parameters().projectPath(),
|
||||||
map);
|
map);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -55,7 +55,7 @@ QtProjectParameters SubdirsProjectWizardDialog::parameters() const
|
|||||||
QtProjectParameters rc;
|
QtProjectParameters rc;
|
||||||
rc.type = QtProjectParameters::EmptyProject;
|
rc.type = QtProjectParameters::EmptyProject;
|
||||||
rc.fileName = projectName();
|
rc.fileName = projectName();
|
||||||
rc.path = filePath().toString();
|
rc.path = filePath();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user