Commit d2243c97 authored by Daniel Teske's avatar Daniel Teske
Browse files

Add a maximum Qt Version to the wizards



All existing wizards derived from AbstractMobileWizard do not support qt
5. So they won't offer them, nor default to them.

Task-number: QTCREATORBUG-6321
Change-Id: I999e2565cec5b0d7da04c10e38ac2cb101352e5b
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@nokia.com>
parent 4565c12f
......@@ -125,15 +125,18 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::restore(ProjectExplorer::Proj
return 0;
}
Qt4TargetSetupWidget *Qt4DesktopTargetFactory::createTargetSetupWidget(const QString &id, const QString &proFilePath, const QtSupport::QtVersionNumber &number, bool importEnabled, QList<BuildConfigurationInfo> importInfos)
Qt4TargetSetupWidget *Qt4DesktopTargetFactory::createTargetSetupWidget(const QString &id, const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion,
bool importEnabled, QList<BuildConfigurationInfo> importInfos)
{
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, number);
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, minimumQtVersion, maximumQtVersion);
if (infos.isEmpty())
return 0;
Qt4DefaultTargetSetupWidget *widget = new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos,
number, importEnabled,
importInfos,
minimumQtVersion, maximumQtVersion,
importEnabled, importInfos,
Qt4DefaultTargetSetupWidget::USER);
widget->setBuildConfiguraionComboBoxVisible(true);
return widget;
......
......@@ -54,7 +54,10 @@ public:
virtual bool supportsTargetId(const QString &id) const;
Qt4TargetSetupWidget *createTargetSetupWidget(const QString &id, const QString &proFilePath, const QtSupport::QtVersionNumber &minimumQtVersion, bool importEnabled, QList<BuildConfigurationInfo> importInfos);
Qt4TargetSetupWidget *createTargetSetupWidget(const QString &id, const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion,
bool importEnabled, QList<BuildConfigurationInfo> importInfos);
QString buildNameForId(const QString &id) const;
QSet<QString> targetFeatures(const QString &id) const;
ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id);
......
......@@ -164,9 +164,12 @@ QList<ProjectExplorer::Task> Qt4SymbianTargetFactory::reportIssues(const QString
return results;
}
QList<BuildConfigurationInfo> Qt4SymbianTargetFactory::availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtSupport::QtVersionNumber &minimumQtVersion)
QList<BuildConfigurationInfo> Qt4SymbianTargetFactory::availableBuildConfigurations(const QString &id, const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion)
{
QList<BuildConfigurationInfo> infos = Qt4BaseTargetFactory::availableBuildConfigurations(id, proFilePath, minimumQtVersion);
QList<BuildConfigurationInfo> infos
= Qt4BaseTargetFactory::availableBuildConfigurations(id, proFilePath, minimumQtVersion, maximumQtVersion);
if (id != Constants::S60_EMULATOR_TARGET_ID)
return infos;
// For emulator filter out all non debug builds
......
......@@ -59,7 +59,9 @@ public:
QString shadowBuildDirectory(const QString &profilePath, const QString &id, const QString &suffix);
QList<ProjectExplorer::Task> reportIssues(const QString &proFile);
QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtSupport::QtVersionNumber &minimumQtVersion);
QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion);
bool selectByDefault(const QString &id) const;
QSet<QString> targetFeatures(const QString &id) const;
......
......@@ -58,6 +58,7 @@ public:
virtual Qt4TargetSetupWidget *createTargetSetupWidget(const QString &id,
const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion,
bool importEnabled,
QList<BuildConfigurationInfo> importInfos);
......@@ -69,7 +70,9 @@ public:
/// used by the default implementation of createTargetSetupWidget
/// not needed otherwise
/// by default creates one debug + one release buildconfiguration per qtversion
virtual QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtSupport::QtVersionNumber &minimumQtVersion);
virtual QList<BuildConfigurationInfo> availableBuildConfigurations(const QString &id, const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion);
virtual QList<ProjectExplorer::Task> reportIssues(const QString &proFile);
/// only used in the TargetSetupPage
......
......@@ -90,17 +90,18 @@ Qt4BaseTargetFactory::~Qt4BaseTargetFactory()
Qt4TargetSetupWidget *Qt4BaseTargetFactory::createTargetSetupWidget(const QString &id,
const QString &proFilePath,
const QtSupport::QtVersionNumber &number,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion,
bool importEnabled,
QList<BuildConfigurationInfo> importInfos)
{
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, number);
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, minimumQtVersion, maximumQtVersion);
if (infos.isEmpty())
return 0;
const bool supportsShadowBuilds
= targetFeatures(id).contains(Constants::SHADOWBUILD_TARGETFEATURE_ID);
Qt4DefaultTargetSetupWidget *widget
= new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos, number,
= new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos, minimumQtVersion, maximumQtVersion,
importEnabled && supportsShadowBuilds, importInfos,
(supportsShadowBuilds
? Qt4DefaultTargetSetupWidget::ENABLE
......@@ -118,10 +119,13 @@ ProjectExplorer::Target *Qt4BaseTargetFactory::create(ProjectExplorer::Project *
return create(parent, id, w->buildConfigurationInfos());
}
QList<BuildConfigurationInfo> Qt4BaseTargetFactory::availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtSupport::QtVersionNumber &minimumQtVersion)
QList<BuildConfigurationInfo> Qt4BaseTargetFactory::availableBuildConfigurations(const QString &id, const QString &proFilePath,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion)
{
QList<BuildConfigurationInfo> infoList;
QList<QtSupport::BaseQtVersion *> knownVersions = QtSupport::QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion);
QList<QtSupport::BaseQtVersion *> knownVersions
= QtSupport::QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion, maximumQtVersion);
foreach (QtSupport::BaseQtVersion *version, knownVersions) {
if (!version->isValid() || !version->toolChainAvailable(id))
......@@ -422,6 +426,7 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
const QString &proFilePath,
const QList<BuildConfigurationInfo> &infos,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion,
bool importEnabled,
const QList<BuildConfigurationInfo> &importInfos,
ShadowBuildOption shadowBuild)
......@@ -430,6 +435,7 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f
m_factory(factory),
m_proFilePath(proFilePath),
m_minimumQtVersion(minimumQtVersion),
m_maximumQtVersion(maximumQtVersion),
m_importInfos(importInfos),
m_directoriesEnabled(true),
m_hasInSourceBuild(false),
......@@ -652,7 +658,7 @@ void Qt4DefaultTargetSetupWidget::setProFilePath(const QString &proFilePath)
{
m_proFilePath = proFilePath;
m_detailsWidget->setAdditionalSummaryText(issuesListToString(m_factory->reportIssues(m_proFilePath)));
setBuildConfigurationInfos(m_factory->availableBuildConfigurations(m_id, proFilePath, m_minimumQtVersion), false);
setBuildConfigurationInfos(m_factory->availableBuildConfigurations(m_id, proFilePath, m_minimumQtVersion, m_maximumQtVersion), false);
}
void Qt4DefaultTargetSetupWidget::setBuildConfiguraionComboBoxVisible(bool b)
......
......@@ -116,6 +116,7 @@ public:
const QString &proFilePath,
const QList<BuildConfigurationInfo> &info,
const QtSupport::QtVersionNumber &minimumQtVersion,
const QtSupport::QtVersionNumber &maximumQtVersion,
bool importEnabled,
const QList<BuildConfigurationInfo> &importInfos,
ShadowBuildOption shadowBuild);
......@@ -158,6 +159,7 @@ private:
Qt4BaseTargetFactory *m_factory;
QString m_proFilePath;
QtSupport::QtVersionNumber m_minimumQtVersion;
QtSupport::QtVersionNumber m_maximumQtVersion;
Utils::DetailsWidget *m_detailsWidget;
QGridLayout *m_importLayout;
QGridLayout *m_newBuildsLayout;
......
......@@ -49,7 +49,9 @@
namespace Qt4ProjectManager {
AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &minimumQtVersionNumber)
AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent,
const QtSupport::QtVersionNumber &minimumQtVersionNumber,
const QtSupport::QtVersionNumber &maximumQtVersionNumber)
: ProjectExplorer::BaseProjectWizardDialog(parent)
, m_genericOptionsPageId(-1)
, m_symbianOptionsPageId(-1)
......@@ -66,6 +68,7 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent, co
m_targetsPage = new TargetSetupPage;
m_targetsPage->setPreferredFeatures(QSet<QString>() << Constants::MOBILE_TARGETFEATURE_ID);
m_targetsPage->setMinimumQtVersion(minimumQtVersionNumber);
m_targetsPage->setMaximumQtVersion(maximumQtVersionNumber);
resize(900, 450);
m_genericOptionsPage = new Internal::MobileAppWizardGenericOptionsPage;
......
......@@ -57,7 +57,7 @@ class QT4PROJECTMANAGER_EXPORT AbstractMobileAppWizardDialog : public ProjectExp
Q_OBJECT
protected:
explicit AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &minimumQtVersionNumber);
explicit AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &minimumQtVersionNumber, const QtSupport::QtVersionNumber &maximumQtVersionNumber);
void addMobilePages();
public:
......
......@@ -38,6 +38,7 @@
#include "targetsetuppage.h"
#include "qt4projectmanagerconstants.h"
#include <limits>
#include <QtCore/QCoreApplication>
#include <QtGui/QIcon>
......@@ -58,7 +59,7 @@ private:
};
Html5AppWizardDialog::Html5AppWizardDialog(QWidget *parent)
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber())
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber(), QtSupport::QtVersionNumber(4, INT_MAX, INT_MAX))
, m_htmlOptionsPage(0)
{
setWindowTitle(tr("New HTML5 Application"));
......
......@@ -60,7 +60,7 @@ class MobileAppWizardDialog : public AbstractMobileAppWizardDialog
Q_OBJECT
public:
explicit MobileAppWizardDialog(QWidget *parent = 0)
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber())
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber(), QtSupport::QtVersionNumber(4, INT_MAX, INT_MAX))
{
setWindowTitle(DisplayName);
setIntroDescription(Description);
......
......@@ -66,7 +66,7 @@ private:
};
QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent)
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber(4, 7, 0))
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber(4, 7, 0), QtSupport::QtVersionNumber(4, INT_MAX, INT_MAX))
{
setWindowTitle(tr("New Qt Quick Application"));
setIntroDescription(tr("This wizard generates a Qt Quick application project."));
......
......@@ -55,7 +55,8 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
QWizardPage(parent),
m_importSearch(false),
m_spacer(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)),
m_ui(new Internal::Ui::TargetSetupPage)
m_ui(new Internal::Ui::TargetSetupPage),
m_maximumQtVersionNumber(INT_MAX, INT_MAX, INT_MAX)
{
m_ui->setupUi(this);
QWidget *centralWidget = new QWidget(this);
......@@ -112,6 +113,11 @@ void TargetSetupPage::setMinimumQtVersion(const QtSupport::QtVersionNumber &numb
m_minimumQtVersionNumber = number;
}
void TargetSetupPage::setMaximumQtVersion(const QtSupport::QtVersionNumber &number)
{
m_maximumQtVersionNumber = number;
}
void TargetSetupPage::setImportSearch(bool b)
{
m_importSearch = b;
......@@ -129,7 +135,9 @@ void TargetSetupPage::setupWidgets()
QList<BuildConfigurationInfo> infos = BuildConfigurationInfo::filterBuildConfigurationInfos(m_importInfos, id);
Qt4TargetSetupWidget *widget =
factory->createTargetSetupWidget(id, m_proFilePath, m_minimumQtVersionNumber, m_importSearch, infos);
factory->createTargetSetupWidget(id, m_proFilePath,
m_minimumQtVersionNumber, m_maximumQtVersionNumber,
m_importSearch, infos);
if (widget) {
bool selectTarget = false;
if (!m_importInfos.isEmpty()) {
......
......@@ -81,6 +81,9 @@ public:
/// Sets the minimum qt version
/// calls this before \sa initializePage()
void setMinimumQtVersion(const QtSupport::QtVersionNumber &number);
/// Sets the maximum qt version
/// calls this before \sa initializePage()
void setMaximumQtVersion(const QtSupport::QtVersionNumber &number);
/// Sets whether the TargetSetupPage looks on disk for builds of this project
/// call this before \sa initializePage()
void setImportSearch(bool b);
......@@ -102,6 +105,7 @@ private:
QSet<QString> m_requiredFeatures;
bool m_importSearch;
QtSupport::QtVersionNumber m_minimumQtVersionNumber;
QtSupport::QtVersionNumber m_maximumQtVersionNumber;
QString m_proFilePath;
QString m_defaultShadowBuildLocation;
QMap<QString, Qt4TargetSetupWidget *> m_widgets;
......
......@@ -463,11 +463,14 @@ bool QtVersionManager::supportsTargetId(const QString &id) const
return false;
}
QList<BaseQtVersion *> QtVersionManager::versionsForTargetId(const QString &id, const QtVersionNumber &minimumQtVersion) const
QList<BaseQtVersion *> QtVersionManager::versionsForTargetId(const QString &id,
const QtVersionNumber &minimumQtVersion,
const QtVersionNumber &maximumQtVersion) const
{
QList<BaseQtVersion *> targetVersions;
foreach (BaseQtVersion *version, m_versions) {
if (version->supportsTargetId(id) && version->qtVersion() >= minimumQtVersion)
if (version->supportsTargetId(id) && version->qtVersion() >= minimumQtVersion
&& version->qtVersion() <= maximumQtVersion)
targetVersions.append(version);
}
qSort(targetVersions.begin(), targetVersions.end(), &qtVersionNumberCompare);
......
......@@ -95,7 +95,9 @@ public:
// This returns a list of versions that support the target with the given id.
// @return A list of QtVersions that supports a target. This list may be empty!
QList<BaseQtVersion *> versionsForTargetId(const QString &id, const QtVersionNumber &minimumQtVersion = QtVersionNumber()) const;
QList<BaseQtVersion *> versionsForTargetId(const QString &id,
const QtVersionNumber &minimumQtVersion = QtVersionNumber(),
const QtVersionNumber &maximumQtVersion = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) const;
QSet<QString> supportedTargetIds() const;
// Static Methods
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment