Commit 6313b2ca authored by jkobus's avatar jkobus Committed by Jarek Kobus

Show only those kits that match selected component set

Change-Id: Ic5aa0bc17bc1cd3ce153c28f75233843d9b5944d
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 2111e986
......@@ -197,6 +197,10 @@ void TargetSetupPage::initializePage()
void TargetSetupPage::setRequiredKitMatcher(KitMatcher *matcher)
{
if (matcher == m_requiredMatcher)
return;
if (m_requiredMatcher)
delete m_requiredMatcher;
m_requiredMatcher = matcher;
}
......@@ -216,6 +220,10 @@ QList<Core::Id> TargetSetupPage::selectedKits() const
void TargetSetupPage::setPreferredKitMatcher(KitMatcher *matcher)
{
if (matcher == m_preferredMatcher)
return;
if (m_preferredMatcher)
delete m_preferredMatcher;
m_preferredMatcher = matcher;
}
......@@ -302,6 +310,8 @@ void TargetSetupPage::setProjectPath(const QString &path)
void TargetSetupPage::setProjectImporter(ProjectImporter *importer)
{
if (importer == m_importer)
return;
if (m_importer)
delete m_importer;
m_importer = importer;
......
......@@ -52,9 +52,25 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &parameters)
: ProjectExplorer::BaseProjectWizardDialog(parent, parameters)
, m_kitsPage(0)
, m_minimumQtVersionNumber(minimumQtVersionNumber)
, m_maximumQtVersionNumber(maximumQtVersionNumber)
{
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) {
m_kitsPage = new ProjectExplorer::TargetSetupPage;
updateKitsPage();
resize(900, 450);
}
}
void AbstractMobileAppWizardDialog::addKitsPage()
{
if (m_kitsPage)
addPageWithTitle(m_kitsPage, tr("Kits"));
}
void AbstractMobileAppWizardDialog::updateKitsPage()
{
if (m_kitsPage) {
m_kitsPage->setProjectImporter(new Internal::QmakeProjectImporter(path()));
QString platform = selectedPlatform();
if (platform.isEmpty()) {
......@@ -65,18 +81,11 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent,
m_kitsPage->setPreferredKitMatcher(new QtSupport::QtPlatformKitMatcher(platform));
}
m_kitsPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(requiredFeatures(),
minimumQtVersionNumber,
maximumQtVersionNumber));
resize(900, 450);
m_minimumQtVersionNumber,
m_maximumQtVersionNumber));
}
}
void AbstractMobileAppWizardDialog::addKitsPage()
{
if (m_kitsPage)
addPageWithTitle(m_kitsPage, tr("Kits"));
}
ProjectExplorer::TargetSetupPage *AbstractMobileAppWizardDialog::kitsPage() const
{
return m_kitsPage;
......
......@@ -32,6 +32,7 @@
#include <qmakeprojectmanager/qmakeprojectmanager_global.h>
#include <projectexplorer/baseprojectwizarddialog.h>
#include <qtsupport/baseqtversion.h>
namespace ProjectExplorer { class TargetSetupPage; }
......@@ -53,16 +54,18 @@ protected:
explicit AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &minimumQtVersionNumber,
const QtSupport::QtVersionNumber &maximumQtVersionNumber,
const Core::WizardDialogParameters &parameters);
void addKitsPage();
public:
ProjectExplorer::TargetSetupPage *kitsPage() const;
protected:
int addPageWithTitle(QWizardPage *page, const QString &title);
void addKitsPage();
void updateKitsPage();
private:
ProjectExplorer::TargetSetupPage *m_kitsPage;
const QtSupport::QtVersionNumber m_minimumQtVersionNumber;
const QtSupport::QtVersionNumber m_maximumQtVersionNumber;
};
/// \internal
......
......@@ -39,7 +39,6 @@
#include <projectexplorer/targetsetuppage.h>
#include <QIcon>
#include <QDebug>
namespace QmakeProjectManager {
namespace Internal {
......@@ -52,6 +51,8 @@ public:
explicit QtQuickAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters &parameters);
QtQuickApp::ComponentSet componentSet() const { return m_componentSetPage->componentSet(); }
protected:
void initializePage(int id);
private:
QtQuickComponentSetPage *m_componentSetPage;
......@@ -72,6 +73,29 @@ QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent,
addKitsPage();
}
void QtQuickAppWizardDialog::initializePage(int id)
{
if (page(id) == kitsPage()) {
Core::FeatureSet features = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1);
QtQuickApp::ComponentSet components = componentSet();
switch (components) {
case QtQuickApp::QtQuick10Components:
features = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1);
break;
case QtQuickApp::QtQuick20Components:
features = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2);
break;
case QtQuickApp::QtQuickControls10:
features = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2)
| Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS);
break;
}
setRequiredFeatures(features);
updateKitsPage();
}
AbstractMobileAppWizardDialog::initializePage(id);
}
class QtQuickAppWizardPrivate
{
class QtQuickApp *app;
......
Markdown is supported
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