forked from qt-creator/qt-creator
add hideProjectUi property to summary page
Change-Id: Ibd46848e2d91d5183b7eb77b910a7be59fed3b91 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -93,6 +93,11 @@ JsonSummaryPage::JsonSummaryPage(QWidget *parent) :
|
||||
this, &JsonSummaryPage::summarySettingsHaveChanged);
|
||||
}
|
||||
|
||||
void JsonSummaryPage::setHideProjectUiValue(const QVariant &hideProjectUiValue)
|
||||
{
|
||||
m_hideProjectUiValue = hideProjectUiValue;
|
||||
}
|
||||
|
||||
void JsonSummaryPage::initializePage()
|
||||
{
|
||||
m_wizard = qobject_cast<JsonWizard *>(wizard());
|
||||
@@ -129,6 +134,9 @@ void JsonSummaryPage::initializePage()
|
||||
initializeProjectTree(contextNode, files, kind,
|
||||
isProject ? AddSubProject : AddNewFile);
|
||||
|
||||
bool hideProjectUi = JsonWizard::boolFromVariant(m_hideProjectUiValue, m_wizard->expander());
|
||||
setProjectUiVisible(!hideProjectUi);
|
||||
|
||||
initializeVersionControls();
|
||||
|
||||
// Do a new try at initialization, now that we have real values set up:
|
||||
|
||||
@@ -47,6 +47,7 @@ class JsonSummaryPage : public Internal::ProjectWizardPage
|
||||
|
||||
public:
|
||||
JsonSummaryPage(QWidget *parent = 0);
|
||||
void setHideProjectUiValue(const QVariant &hideProjectUiValue);
|
||||
|
||||
void initializePage();
|
||||
bool validatePage();
|
||||
@@ -63,6 +64,7 @@ private:
|
||||
|
||||
JsonWizard *m_wizard;
|
||||
JsonWizard::GeneratorFiles m_fileList;
|
||||
QVariant m_hideProjectUiValue;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -228,6 +228,8 @@ bool ProjectPageFactory::validateData(Core::Id typeId, const QVariant &data, QSt
|
||||
// SummaryPageFactory:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static const char KEY_HIDE_PROJECT_UI[] = "hideProjectUi";
|
||||
|
||||
SummaryPageFactory::SummaryPageFactory()
|
||||
{
|
||||
setTypeIdsSuffix(QLatin1String("Summary"));
|
||||
@@ -239,15 +241,18 @@ Utils::WizardPage *SummaryPageFactory::create(JsonWizard *wizard, Core::Id typeI
|
||||
Q_UNUSED(data);
|
||||
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)
|
||||
{
|
||||
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",
|
||||
"\"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;
|
||||
}
|
||||
|
||||
|
||||
@@ -604,5 +604,11 @@ void ProjectWizardPage::hideVersionControlUiElements()
|
||||
m_ui->addToVersionControlComboBox->hide();
|
||||
}
|
||||
|
||||
void ProjectWizardPage::setProjectUiVisible(bool visible)
|
||||
{
|
||||
m_ui->projectLabel->setVisible(visible);
|
||||
m_ui->projectComboBox->setVisible(visible);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -85,6 +85,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void initializeVersionControls();
|
||||
void setProjectUiVisible(bool visible);
|
||||
|
||||
private slots:
|
||||
void projectChanged(int);
|
||||
|
||||
Reference in New Issue
Block a user