add hideProjectUi property to summary page

Change-Id: Ibd46848e2d91d5183b7eb77b910a7be59fed3b91
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Tim Jenssen
2015-07-02 16:15:10 +02:00
parent 78057f0910
commit e46ae661bc
5 changed files with 25 additions and 3 deletions

View File

@@ -93,6 +93,11 @@ JsonSummaryPage::JsonSummaryPage(QWidget *parent) :
this, &JsonSummaryPage::summarySettingsHaveChanged); this, &JsonSummaryPage::summarySettingsHaveChanged);
} }
void JsonSummaryPage::setHideProjectUiValue(const QVariant &hideProjectUiValue)
{
m_hideProjectUiValue = hideProjectUiValue;
}
void JsonSummaryPage::initializePage() void JsonSummaryPage::initializePage()
{ {
m_wizard = qobject_cast<JsonWizard *>(wizard()); m_wizard = qobject_cast<JsonWizard *>(wizard());
@@ -129,6 +134,9 @@ void JsonSummaryPage::initializePage()
initializeProjectTree(contextNode, files, kind, initializeProjectTree(contextNode, files, kind,
isProject ? AddSubProject : AddNewFile); isProject ? AddSubProject : AddNewFile);
bool hideProjectUi = JsonWizard::boolFromVariant(m_hideProjectUiValue, m_wizard->expander());
setProjectUiVisible(!hideProjectUi);
initializeVersionControls(); initializeVersionControls();
// Do a new try at initialization, now that we have real values set up: // Do a new try at initialization, now that we have real values set up:

View File

@@ -47,6 +47,7 @@ class JsonSummaryPage : public Internal::ProjectWizardPage
public: public:
JsonSummaryPage(QWidget *parent = 0); JsonSummaryPage(QWidget *parent = 0);
void setHideProjectUiValue(const QVariant &hideProjectUiValue);
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
@@ -63,6 +64,7 @@ private:
JsonWizard *m_wizard; JsonWizard *m_wizard;
JsonWizard::GeneratorFiles m_fileList; JsonWizard::GeneratorFiles m_fileList;
QVariant m_hideProjectUiValue;
}; };
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -228,6 +228,8 @@ bool ProjectPageFactory::validateData(Core::Id typeId, const QVariant &data, QSt
// SummaryPageFactory: // SummaryPageFactory:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
static const char KEY_HIDE_PROJECT_UI[] = "hideProjectUi";
SummaryPageFactory::SummaryPageFactory() SummaryPageFactory::SummaryPageFactory()
{ {
setTypeIdsSuffix(QLatin1String("Summary")); setTypeIdsSuffix(QLatin1String("Summary"));
@@ -239,15 +241,18 @@ Utils::WizardPage *SummaryPageFactory::create(JsonWizard *wizard, Core::Id typeI
Q_UNUSED(data); Q_UNUSED(data);
QTC_ASSERT(canCreate(typeId), return 0); QTC_ASSERT(canCreate(typeId), return 0);
return new JsonSummaryPage; JsonSummaryPage *page = new JsonSummaryPage;
QVariant hideProjectUi = data.toMap().value(QLatin1String(KEY_HIDE_PROJECT_UI));
page->setHideProjectUiValue(hideProjectUi);
return page;
} }
bool SummaryPageFactory::validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) bool SummaryPageFactory::validateData(Core::Id typeId, const QVariant &data, QString *errorMessage)
{ {
QTC_ASSERT(canCreate(typeId), return false); QTC_ASSERT(canCreate(typeId), return false);
if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) { if (!data.isNull() && (data.type() != QVariant::Map)) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
"\"data\" for a \"Summary\" page needs to be unset or an empty object."); "\"data\" for a \"Summary\" page can be unset or needs to be an object.");
return false; return false;
} }

View File

@@ -604,5 +604,11 @@ void ProjectWizardPage::hideVersionControlUiElements()
m_ui->addToVersionControlComboBox->hide(); m_ui->addToVersionControlComboBox->hide();
} }
void ProjectWizardPage::setProjectUiVisible(bool visible)
{
m_ui->projectLabel->setVisible(visible);
m_ui->projectComboBox->setVisible(visible);
}
} // namespace Internal } // namespace Internal
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -85,6 +85,7 @@ signals:
public slots: public slots:
void initializeVersionControls(); void initializeVersionControls();
void setProjectUiVisible(bool visible);
private slots: private slots:
void projectChanged(int); void projectChanged(int);