forked from qt-creator/qt-creator
QmlDesigner: Enable 'automatic cmake generation' by wizard
Task-number: QDS-13344 Change-Id: Ie3e5baf42e31375df8d2d00cb5bf916b2b8bd2ad Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -391,6 +391,21 @@ Item {
|
|||||||
visible: BackendApi.haveVirtualKeyboard
|
visible: BackendApi.haveVirtualKeyboard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StudioControls.CheckBox {
|
||||||
|
id: enableCMakeGeneration
|
||||||
|
actionIndicatorVisible: false
|
||||||
|
text: qsTr("Enable Cmake Generation")
|
||||||
|
font.pixelSize: DialogValues.defaultPixelSize
|
||||||
|
checked: BackendApi.enableCMakeGeneration
|
||||||
|
visible: BackendApi.hasCMakeGeneration
|
||||||
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
target: BackendApi
|
||||||
|
property: "enableCMakeGeneration"
|
||||||
|
value: enableCMakeGeneration.checked
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout { // Target Qt Version
|
RowLayout { // Target Qt Version
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: BackendApi.haveTargetQtVersion
|
visible: BackendApi.haveTargetQtVersion
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
{ "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" },
|
{ "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" },
|
||||||
{ "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" },
|
{ "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" },
|
||||||
{ "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" },
|
{ "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" },
|
||||||
|
{ "key": "EnableCMakeGenerationDefault", "value": "%{JS: true}" },
|
||||||
{ "key": "QtQuick3DVersion", "value": "%{JS: %{TargetQtVersion}.TargetQuick3DVersion}" }
|
{ "key": "QtQuick3DVersion", "value": "%{JS: %{TargetQtVersion}.TargetQuick3DVersion}" }
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -208,6 +209,15 @@
|
|||||||
"checked": "%{UseVirtualKeyboardDefault}"
|
"checked": "%{UseVirtualKeyboardDefault}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "EnableCMakeGeneration",
|
||||||
|
"trDisplayName": "Enable CMake Genertion",
|
||||||
|
"type": "CheckBox",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"checked": "%{EnableCMakeGenerationDefault}"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "CustomScreenWidth",
|
"name": "CustomScreenWidth",
|
||||||
"trDisplayName": "Custom screen width:",
|
"trDisplayName": "Custom screen width:",
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
{ "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" },
|
{ "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" },
|
||||||
{ "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" },
|
{ "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" },
|
||||||
{ "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" },
|
{ "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" },
|
||||||
|
{ "key": "EnableCMakeGenerationDefault", "value": "%{JS: true}" },
|
||||||
{ "key": "QtQuick3DVersion", "value": "%{JS: %{TargetQtVersion}.TargetQuick3DVersion}" }
|
{ "key": "QtQuick3DVersion", "value": "%{JS: %{TargetQtVersion}.TargetQuick3DVersion}" }
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -208,6 +209,15 @@
|
|||||||
"checked": "%{UseVirtualKeyboardDefault}"
|
"checked": "%{UseVirtualKeyboardDefault}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "EnableCMakeGeneration",
|
||||||
|
"trDisplayName": "Enable CMake Genertion",
|
||||||
|
"type": "CheckBox",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"checked": "%{EnableCMakeGenerationDefault}"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "CustomScreenWidth",
|
"name": "CustomScreenWidth",
|
||||||
"trDisplayName": "Custom screen width:",
|
"trDisplayName": "Custom screen width:",
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
{ "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" },
|
{ "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" },
|
||||||
{ "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" },
|
{ "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" },
|
||||||
{ "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" },
|
{ "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" },
|
||||||
|
{ "key": "EnableCMakeGenerationDefault", "value": "%{JS: true}" },
|
||||||
{ "key": "DefaultStyle", "value": "Basic" }
|
{ "key": "DefaultStyle", "value": "Basic" }
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -207,6 +208,15 @@
|
|||||||
"checked": "%{UseVirtualKeyboardDefault}"
|
"checked": "%{UseVirtualKeyboardDefault}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "EnableCMakeGeneration",
|
||||||
|
"trDisplayName": "Enable CMake Genertion",
|
||||||
|
"type": "CheckBox",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"checked": "%{EnableCMakeGenerationDefault}"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "CustomScreenWidth",
|
"name": "CustomScreenWidth",
|
||||||
"trDisplayName": "Custom screen width:",
|
"trDisplayName": "Custom screen width:",
|
||||||
|
@@ -103,6 +103,10 @@ Project {
|
|||||||
/* Required for deployment */
|
/* Required for deployment */
|
||||||
targetDirectory: "/opt/%{ProjectName}"
|
targetDirectory: "/opt/%{ProjectName}"
|
||||||
|
|
||||||
|
@if %{EnableCMakeGeneration}
|
||||||
|
enableCMakeGeneration: true
|
||||||
|
@endif
|
||||||
|
|
||||||
qdsVersion: "4.6"
|
qdsVersion: "4.6"
|
||||||
|
|
||||||
quickVersion: "%{QtQuickVersion}"
|
quickVersion: "%{QtQuickVersion}"
|
||||||
|
@@ -4,6 +4,7 @@ add_qtc_plugin(StudioWelcome
|
|||||||
PLUGIN_DEPENDS Core ProjectExplorer QtSupport QmlDesigner
|
PLUGIN_DEPENDS Core ProjectExplorer QtSupport QmlDesigner
|
||||||
DEFINES STUDIO_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/qml/"
|
DEFINES STUDIO_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/qml/"
|
||||||
SOURCES
|
SOURCES
|
||||||
|
fieldhelper.cpp fieldhelper.h
|
||||||
studiowelcomeplugin.cpp studiowelcomeplugin.h
|
studiowelcomeplugin.cpp studiowelcomeplugin.h
|
||||||
newprojectdialogimageprovider.cpp newprojectdialogimageprovider.h
|
newprojectdialogimageprovider.cpp newprojectdialogimageprovider.h
|
||||||
presetmodel.cpp presetmodel.h
|
presetmodel.cpp presetmodel.h
|
||||||
|
@@ -43,6 +43,9 @@ void CreateProject::processFieldPage(ProjectExplorer::JsonFieldPage *page)
|
|||||||
if (page->jsonField("UseVirtualKeyboard"))
|
if (page->jsonField("UseVirtualKeyboard"))
|
||||||
m_wizard.setUseVirtualKeyboard(m_useVirtualKeyboard);
|
m_wizard.setUseVirtualKeyboard(m_useVirtualKeyboard);
|
||||||
|
|
||||||
|
if (page->jsonField("EnableCMakeGeneration"))
|
||||||
|
m_wizard.enableCMakeGeneration(m_enableCMakeGeneration);
|
||||||
|
|
||||||
auto widthField = dynamic_cast<ProjectExplorer::LineEditField *>(page->jsonField("CustomScreenWidth"));
|
auto widthField = dynamic_cast<ProjectExplorer::LineEditField *>(page->jsonField("CustomScreenWidth"));
|
||||||
auto heightField = dynamic_cast<ProjectExplorer::LineEditField *>(page->jsonField("CustomScreenHeight"));
|
auto heightField = dynamic_cast<ProjectExplorer::LineEditField *>(page->jsonField("CustomScreenHeight"));
|
||||||
|
|
||||||
|
@@ -28,6 +28,11 @@ public:
|
|||||||
|
|
||||||
CreateProject &withStyle(int styleIndex) { m_styleIndex = styleIndex; return *this; }
|
CreateProject &withStyle(int styleIndex) { m_styleIndex = styleIndex; return *this; }
|
||||||
CreateProject &useQtVirtualKeyboard(bool value) { m_useVirtualKeyboard = value; return *this; }
|
CreateProject &useQtVirtualKeyboard(bool value) { m_useVirtualKeyboard = value; return *this; }
|
||||||
|
CreateProject &enableCMakeGeneration(bool value)
|
||||||
|
{
|
||||||
|
m_enableCMakeGeneration = value;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
CreateProject &saveAsDefaultLocation(bool value) { m_saveAsDefaultLocation = value; return *this; }
|
CreateProject &saveAsDefaultLocation(bool value) { m_saveAsDefaultLocation = value; return *this; }
|
||||||
CreateProject &withTargetQtVersion(int targetQtVersionIndex)
|
CreateProject &withTargetQtVersion(int targetQtVersionIndex)
|
||||||
{ m_targetQtVersionIndex = targetQtVersionIndex; return *this; }
|
{ m_targetQtVersionIndex = targetQtVersionIndex; return *this; }
|
||||||
@@ -48,6 +53,7 @@ private:
|
|||||||
QString m_customHeight;
|
QString m_customHeight;
|
||||||
int m_styleIndex = -1;
|
int m_styleIndex = -1;
|
||||||
bool m_useVirtualKeyboard = false;
|
bool m_useVirtualKeyboard = false;
|
||||||
|
bool m_enableCMakeGeneration = false;
|
||||||
bool m_saveAsDefaultLocation = false;
|
bool m_saveAsDefaultLocation = false;
|
||||||
int m_targetQtVersionIndex = -1;
|
int m_targetQtVersionIndex = -1;
|
||||||
};
|
};
|
||||||
|
89
src/plugins/studiowelcome/fieldhelper.cpp
Normal file
89
src/plugins/studiowelcome/fieldhelper.cpp
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
// Copyright (C) 2024 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include "fieldhelper.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/jsonwizard/jsonfieldpage.h>
|
||||||
|
#include <projectexplorer/jsonwizard/jsonfieldpage_p.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
using namespace StudioWelcome::FieldHelper;
|
||||||
|
|
||||||
|
CheckBoxHelper::CheckBoxHelper(ProjectExplorer::JsonFieldPage *detailsPage, const QString &fieldName)
|
||||||
|
: m_field(dynamic_cast<ProjectExplorer::CheckBoxField *>(detailsPage->jsonField(fieldName)))
|
||||||
|
{}
|
||||||
|
|
||||||
|
void CheckBoxHelper::setChecked(bool value)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return);
|
||||||
|
|
||||||
|
m_field->setChecked(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBoxHelper::ComboBoxHelper(ProjectExplorer::JsonFieldPage *detailsPage, const QString &fieldName)
|
||||||
|
: m_field(dynamic_cast<ProjectExplorer::ComboBoxField *>(detailsPage->jsonField(fieldName)))
|
||||||
|
{}
|
||||||
|
|
||||||
|
void ComboBoxHelper::selectIndex(int index)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return);
|
||||||
|
|
||||||
|
m_field->selectRow(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ComboBoxHelper::text(int index) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return {});
|
||||||
|
|
||||||
|
QStandardItemModel *model = m_field->model();
|
||||||
|
if (index < 0 || index >= model->rowCount())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return model->item(index)->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ComboBoxHelper::indexOf(const QString &text) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return -1);
|
||||||
|
|
||||||
|
const QStandardItemModel *model = m_field->model();
|
||||||
|
for (int i = 0; i < model->rowCount(); ++i) {
|
||||||
|
const QStandardItem *item = model->item(i, 0);
|
||||||
|
const QString text = item->text();
|
||||||
|
|
||||||
|
if (text == text)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ComboBoxHelper::selectedIndex() const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return -1);
|
||||||
|
|
||||||
|
return m_field->selectedRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStandardItemModel *ComboBoxHelper::model() const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return {});
|
||||||
|
|
||||||
|
return m_field->model();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList ComboBoxHelper::allTexts() const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_field, return {});
|
||||||
|
|
||||||
|
QStandardItemModel *model = m_field->model();
|
||||||
|
const int rows = model->rowCount();
|
||||||
|
QStringList result;
|
||||||
|
result.reserve(rows);
|
||||||
|
|
||||||
|
for (int i = 0; i < rows; ++i)
|
||||||
|
result.append(model->item(i)->text());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
46
src/plugins/studiowelcome/fieldhelper.h
Normal file
46
src/plugins/studiowelcome/fieldhelper.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (C) 2024 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QStandardItemModel)
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
class JsonFieldPage;
|
||||||
|
class CheckBoxField;
|
||||||
|
class ComboBoxField;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace StudioWelcome::FieldHelper {
|
||||||
|
|
||||||
|
class CheckBoxHelper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CheckBoxHelper(ProjectExplorer::JsonFieldPage *detailsPage, const QString &fieldName);
|
||||||
|
|
||||||
|
void setChecked(bool value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ProjectExplorer::CheckBoxField *m_field = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ComboBoxHelper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ComboBoxHelper(ProjectExplorer::JsonFieldPage *detailsPage, const QString &fieldName);
|
||||||
|
|
||||||
|
void selectIndex(int index);
|
||||||
|
|
||||||
|
QString text(int index) const;
|
||||||
|
int indexOf(const QString &text) const;
|
||||||
|
int selectedIndex() const;
|
||||||
|
QStandardItemModel *model() const;
|
||||||
|
QStringList allTexts() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ProjectExplorer::ComboBoxField *m_field = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace StudioWelcome::FieldHelper
|
@@ -93,6 +93,7 @@ PresetItems PresetData::makeUserPresets(const PresetItems &wizardPresets,
|
|||||||
presetItem->qtVersion = userPresetData.qtVersion;
|
presetItem->qtVersion = userPresetData.qtVersion;
|
||||||
presetItem->styleName = userPresetData.styleName;
|
presetItem->styleName = userPresetData.styleName;
|
||||||
presetItem->useQtVirtualKeyboard = userPresetData.useQtVirtualKeyboard;
|
presetItem->useQtVirtualKeyboard = userPresetData.useQtVirtualKeyboard;
|
||||||
|
presetItem->enableCMakeGeneration = userPresetData.enableCMakeGeneration;
|
||||||
|
|
||||||
presetItem->create = foundPreset->create;
|
presetItem->create = foundPreset->create;
|
||||||
presetItem->description = foundPreset->description;
|
presetItem->description = foundPreset->description;
|
||||||
|
@@ -80,6 +80,7 @@ struct UserPresetItem : public PresetItem
|
|||||||
public:
|
public:
|
||||||
QString userName;
|
QString userName;
|
||||||
bool useQtVirtualKeyboard;
|
bool useQtVirtualKeyboard;
|
||||||
|
bool enableCMakeGeneration;
|
||||||
QString qtVersion;
|
QString qtVersion;
|
||||||
QString styleName;
|
QString styleName;
|
||||||
};
|
};
|
||||||
|
@@ -133,6 +133,15 @@ void QdsNewDialog::setProjectLocation(const QString &location)
|
|||||||
m_wizard.setProjectLocation(m_qmlProjectLocation);
|
m_wizard.setProjectLocation(m_qmlProjectLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QdsNewDialog::setHasCMakeGeneration(bool haveCmakeGen)
|
||||||
|
{
|
||||||
|
if (m_qmlHasCMakeGeneration == haveCmakeGen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_qmlHasCMakeGeneration = haveCmakeGen;
|
||||||
|
emit hasCMakeGenerationChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void QdsNewDialog::onStatusMessageChanged(Utils::InfoLabel::InfoType type, const QString &message)
|
void QdsNewDialog::onStatusMessageChanged(Utils::InfoLabel::InfoType type, const QString &message)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -192,9 +201,16 @@ void QdsNewDialog::onWizardCreated(QStandardItemModel *screenSizeModel, QStandar
|
|||||||
auto userPreset = m_currentPreset->asUserPreset();
|
auto userPreset = m_currentPreset->asUserPreset();
|
||||||
|
|
||||||
if (m_qmlDetailsLoaded) {
|
if (m_qmlDetailsLoaded) {
|
||||||
m_targetQtVersions.clear();
|
setHasCMakeGeneration(m_wizard.hasCMakeGeneration());
|
||||||
if (m_currentPreset->isUserPreset() && m_wizard.haveVirtualKeyboard())
|
|
||||||
|
if (m_currentPreset->isUserPreset()) {
|
||||||
|
if (getHaveVirtualKeyboard())
|
||||||
setUseVirtualKeyboard(userPreset->useQtVirtualKeyboard);
|
setUseVirtualKeyboard(userPreset->useQtVirtualKeyboard);
|
||||||
|
if (hasCMakeGeneration())
|
||||||
|
setEnableCMakeGeneration(userPreset->enableCMakeGeneration);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_targetQtVersions.clear();
|
||||||
if (m_wizard.haveTargetQtVersion()) {
|
if (m_wizard.haveTargetQtVersion()) {
|
||||||
m_targetQtVersions = m_wizard.targetQtVersionNames();
|
m_targetQtVersions = m_wizard.targetQtVersionNames();
|
||||||
int index = m_currentPreset->isUserPreset() ? m_wizard.targetQtVersionIndex(userPreset->qtVersion)
|
int index = m_currentPreset->isUserPreset() ? m_wizard.targetQtVersionIndex(userPreset->qtVersion)
|
||||||
@@ -227,6 +243,15 @@ void QdsNewDialog::onWizardCreated(QStandardItemModel *screenSizeModel, QStandar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QdsNewDialog::setEnableCMakeGeneration(bool newQmlEnableCMakeGeneration)
|
||||||
|
{
|
||||||
|
if (m_qmlEnableCMakeGeneration == newQmlEnableCMakeGeneration)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_qmlEnableCMakeGeneration = newQmlEnableCMakeGeneration;
|
||||||
|
emit enableCMakeGenerationChanged();
|
||||||
|
}
|
||||||
|
|
||||||
QString QdsNewDialog::currentPresetQmlPath() const
|
QString QdsNewDialog::currentPresetQmlPath() const
|
||||||
{
|
{
|
||||||
if (!m_currentPreset || m_currentPreset->qmlPath.isEmpty())
|
if (!m_currentPreset || m_currentPreset->qmlPath.isEmpty())
|
||||||
@@ -385,6 +410,11 @@ bool QdsNewDialog::getHaveTargetQtVersion() const
|
|||||||
return m_wizard.haveTargetQtVersion();
|
return m_wizard.haveTargetQtVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QdsNewDialog::hasCMakeGeneration() const
|
||||||
|
{
|
||||||
|
return m_qmlHasCMakeGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
void QdsNewDialog::accept()
|
void QdsNewDialog::accept()
|
||||||
{
|
{
|
||||||
CreateProject create{m_wizard};
|
CreateProject create{m_wizard};
|
||||||
@@ -395,6 +425,7 @@ void QdsNewDialog::accept()
|
|||||||
.withScreenSizes(m_qmlScreenSizeIndex, m_qmlCustomWidth, m_qmlCustomHeight)
|
.withScreenSizes(m_qmlScreenSizeIndex, m_qmlCustomWidth, m_qmlCustomHeight)
|
||||||
.withStyle(getStyleIndex())
|
.withStyle(getStyleIndex())
|
||||||
.useQtVirtualKeyboard(m_qmlUseVirtualKeyboard)
|
.useQtVirtualKeyboard(m_qmlUseVirtualKeyboard)
|
||||||
|
.enableCMakeGeneration(m_qmlEnableCMakeGeneration)
|
||||||
.saveAsDefaultLocation(m_qmlSaveAsDefaultLocation)
|
.saveAsDefaultLocation(m_qmlSaveAsDefaultLocation)
|
||||||
.withTargetQtVersion(m_qmlTargetQtVersionIndex)
|
.withTargetQtVersion(m_qmlTargetQtVersionIndex)
|
||||||
.execute();
|
.execute();
|
||||||
@@ -446,6 +477,7 @@ UserPresetData QdsNewDialog::currentUserPresetData(const QString &displayName) c
|
|||||||
QString targetQtVersion = "";
|
QString targetQtVersion = "";
|
||||||
QString styleName = "";
|
QString styleName = "";
|
||||||
bool useVirtualKeyboard = false;
|
bool useVirtualKeyboard = false;
|
||||||
|
bool enableCMakeGeneration = false;
|
||||||
|
|
||||||
if (m_wizard.haveTargetQtVersion())
|
if (m_wizard.haveTargetQtVersion())
|
||||||
targetQtVersion = m_wizard.targetQtVersionName(m_qmlTargetQtVersionIndex);
|
targetQtVersion = m_wizard.targetQtVersionName(m_qmlTargetQtVersionIndex);
|
||||||
@@ -456,11 +488,16 @@ UserPresetData QdsNewDialog::currentUserPresetData(const QString &displayName) c
|
|||||||
if (m_wizard.haveVirtualKeyboard())
|
if (m_wizard.haveVirtualKeyboard())
|
||||||
useVirtualKeyboard = m_qmlUseVirtualKeyboard;
|
useVirtualKeyboard = m_qmlUseVirtualKeyboard;
|
||||||
|
|
||||||
UserPresetData preset = {m_currentPreset->categoryId,
|
if (m_wizard.hasCMakeGeneration())
|
||||||
|
enableCMakeGeneration = m_qmlEnableCMakeGeneration;
|
||||||
|
|
||||||
|
UserPresetData preset{
|
||||||
|
m_currentPreset->categoryId,
|
||||||
m_currentPreset->wizardName,
|
m_currentPreset->wizardName,
|
||||||
displayName,
|
displayName,
|
||||||
screenSize,
|
screenSize,
|
||||||
useVirtualKeyboard,
|
useVirtualKeyboard,
|
||||||
|
enableCMakeGeneration,
|
||||||
targetQtVersion,
|
targetQtVersion,
|
||||||
styleName};
|
styleName};
|
||||||
|
|
||||||
|
@@ -34,7 +34,13 @@ public:
|
|||||||
Q_PROPERTY(QString customHeight MEMBER m_qmlCustomHeight)
|
Q_PROPERTY(QString customHeight MEMBER m_qmlCustomHeight)
|
||||||
Q_PROPERTY(int styleIndex MEMBER m_qmlStyleIndex READ getStyleIndex WRITE setStyleIndex)
|
Q_PROPERTY(int styleIndex MEMBER m_qmlStyleIndex READ getStyleIndex WRITE setStyleIndex)
|
||||||
Q_PROPERTY(bool useVirtualKeyboard MEMBER m_qmlUseVirtualKeyboard READ getUseVirtualKeyboard WRITE setUseVirtualKeyboard NOTIFY useVirtualKeyboardChanged)
|
Q_PROPERTY(bool useVirtualKeyboard MEMBER m_qmlUseVirtualKeyboard READ getUseVirtualKeyboard WRITE setUseVirtualKeyboard NOTIFY useVirtualKeyboardChanged)
|
||||||
|
Q_PROPERTY(
|
||||||
|
bool enableCMakeGeneration
|
||||||
|
MEMBER m_qmlEnableCMakeGeneration
|
||||||
|
WRITE setEnableCMakeGeneration
|
||||||
|
NOTIFY enableCMakeGenerationChanged)
|
||||||
Q_PROPERTY(bool haveVirtualKeyboard MEMBER m_qmlHaveVirtualKeyboard READ getHaveVirtualKeyboard NOTIFY haveVirtualKeyboardChanged)
|
Q_PROPERTY(bool haveVirtualKeyboard MEMBER m_qmlHaveVirtualKeyboard READ getHaveVirtualKeyboard NOTIFY haveVirtualKeyboardChanged)
|
||||||
|
Q_PROPERTY(bool hasCMakeGeneration READ hasCMakeGeneration NOTIFY hasCMakeGenerationChanged)
|
||||||
Q_PROPERTY(bool haveTargetQtVersion MEMBER m_qmlHaveTargetQtVersion READ getHaveTargetQtVersion NOTIFY haveTargetQtVersionChanged)
|
Q_PROPERTY(bool haveTargetQtVersion MEMBER m_qmlHaveTargetQtVersion READ getHaveTargetQtVersion NOTIFY haveTargetQtVersionChanged)
|
||||||
Q_PROPERTY(int targetQtVersionIndex MEMBER m_qmlTargetQtVersionIndex READ getTargetQtVersionIndex WRITE setTargetQtVersionIndex NOTIFY targetQtVersionIndexChanged)
|
Q_PROPERTY(int targetQtVersionIndex MEMBER m_qmlTargetQtVersionIndex READ getTargetQtVersionIndex WRITE setTargetQtVersionIndex NOTIFY targetQtVersionIndexChanged)
|
||||||
Q_PROPERTY(bool saveAsDefaultLocation MEMBER m_qmlSaveAsDefaultLocation WRITE setSaveAsDefaultLocation)
|
Q_PROPERTY(bool saveAsDefaultLocation MEMBER m_qmlSaveAsDefaultLocation WRITE setSaveAsDefaultLocation)
|
||||||
@@ -85,12 +91,15 @@ public:
|
|||||||
bool getFieldsValid() const { return m_qmlFieldsValid; }
|
bool getFieldsValid() const { return m_qmlFieldsValid; }
|
||||||
bool getHaveVirtualKeyboard() const;
|
bool getHaveVirtualKeyboard() const;
|
||||||
bool getHaveTargetQtVersion() const;
|
bool getHaveTargetQtVersion() const;
|
||||||
|
bool hasCMakeGeneration() const;
|
||||||
|
|
||||||
void setSaveAsDefaultLocation(bool value) { m_qmlSaveAsDefaultLocation = value; }
|
void setSaveAsDefaultLocation(bool value) { m_qmlSaveAsDefaultLocation = value; }
|
||||||
|
|
||||||
QString getStatusMessage() const { return m_qmlStatusMessage; }
|
QString getStatusMessage() const { return m_qmlStatusMessage; }
|
||||||
QString getStatusType() const { return m_qmlStatusType; }
|
QString getStatusType() const { return m_qmlStatusType; }
|
||||||
|
|
||||||
|
void setEnableCMakeGeneration(bool newQmlEnableCMakeGeneration);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
void reject();
|
void reject();
|
||||||
@@ -102,7 +111,9 @@ signals:
|
|||||||
void projectLocationChanged();
|
void projectLocationChanged();
|
||||||
void projectDescriptionChanged();
|
void projectDescriptionChanged();
|
||||||
void useVirtualKeyboardChanged();
|
void useVirtualKeyboardChanged();
|
||||||
|
void enableCMakeGenerationChanged();
|
||||||
void haveVirtualKeyboardChanged();
|
void haveVirtualKeyboardChanged();
|
||||||
|
void hasCMakeGenerationChanged();
|
||||||
void haveTargetQtVersionChanged();
|
void haveTargetQtVersionChanged();
|
||||||
void statusMessageChanged();
|
void statusMessageChanged();
|
||||||
void statusTypeChanged();
|
void statusTypeChanged();
|
||||||
@@ -129,6 +140,8 @@ private:
|
|||||||
emit projectDescriptionChanged();
|
emit projectDescriptionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setHasCMakeGeneration(bool haveCmakeGen);
|
||||||
|
|
||||||
QString projectDescription() const { return m_qmlProjectDescription; }
|
QString projectDescription() const { return m_qmlProjectDescription; }
|
||||||
|
|
||||||
void updateScreenSizes();
|
void updateScreenSizes();
|
||||||
@@ -156,7 +169,9 @@ private:
|
|||||||
// m_qmlStyleIndex is like a cache, so it needs to be updated on get()
|
// m_qmlStyleIndex is like a cache, so it needs to be updated on get()
|
||||||
mutable int m_qmlStyleIndex = -1;
|
mutable int m_qmlStyleIndex = -1;
|
||||||
bool m_qmlUseVirtualKeyboard = false;
|
bool m_qmlUseVirtualKeyboard = false;
|
||||||
|
bool m_qmlEnableCMakeGeneration = false;
|
||||||
bool m_qmlHaveVirtualKeyboard = false;
|
bool m_qmlHaveVirtualKeyboard = false;
|
||||||
|
bool m_qmlHasCMakeGeneration = false;
|
||||||
bool m_qmlHaveTargetQtVersion = false;
|
bool m_qmlHaveTargetQtVersion = false;
|
||||||
bool m_qmlSaveAsDefaultLocation = false;
|
bool m_qmlSaveAsDefaultLocation = false;
|
||||||
bool m_qmlFieldsValid = false;
|
bool m_qmlFieldsValid = false;
|
||||||
|
@@ -67,13 +67,16 @@ void UserPresetsStore::savePresets(const std::vector<UserPresetData> &presetItem
|
|||||||
QJsonArray jsonArray;
|
QJsonArray jsonArray;
|
||||||
|
|
||||||
for (const auto &preset : presetItems) {
|
for (const auto &preset : presetItems) {
|
||||||
QJsonObject obj({{"categoryId", preset.categoryId},
|
QJsonObject obj{
|
||||||
|
{"categoryId", preset.categoryId},
|
||||||
{"wizardName", preset.wizardName},
|
{"wizardName", preset.wizardName},
|
||||||
{"name", preset.name},
|
{"name", preset.name},
|
||||||
{"screenSize", preset.screenSize},
|
{"screenSize", preset.screenSize},
|
||||||
{"useQtVirtualKeyboard", preset.useQtVirtualKeyboard},
|
{"useQtVirtualKeyboard", preset.useQtVirtualKeyboard},
|
||||||
|
{"enableCMakeGeneration", preset.enableCMakeGeneration},
|
||||||
{"qtVersion", preset.qtVersion},
|
{"qtVersion", preset.qtVersion},
|
||||||
{"styleName", preset.styleName}});
|
{"styleName", preset.styleName},
|
||||||
|
};
|
||||||
|
|
||||||
jsonArray.append(QJsonValue{obj});
|
jsonArray.append(QJsonValue{obj});
|
||||||
}
|
}
|
||||||
@@ -164,6 +167,7 @@ std::vector<UserPresetData> UserPresetsStore::fetchAll() const
|
|||||||
preset.name = obj["name"].toString();
|
preset.name = obj["name"].toString();
|
||||||
preset.screenSize = obj["screenSize"].toString();
|
preset.screenSize = obj["screenSize"].toString();
|
||||||
preset.useQtVirtualKeyboard = obj["useQtVirtualKeyboard"].toBool();
|
preset.useQtVirtualKeyboard = obj["useQtVirtualKeyboard"].toBool();
|
||||||
|
preset.enableCMakeGeneration = obj["enableCMakeGeneration"].toBool();
|
||||||
preset.qtVersion = obj["qtVersion"].toString();
|
preset.qtVersion = obj["qtVersion"].toString();
|
||||||
preset.styleName = obj["styleName"].toString();
|
preset.styleName = obj["styleName"].toString();
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ struct UserPresetData
|
|||||||
QString screenSize;
|
QString screenSize;
|
||||||
|
|
||||||
bool useQtVirtualKeyboard;
|
bool useQtVirtualKeyboard;
|
||||||
|
bool enableCMakeGeneration;
|
||||||
QString qtVersion;
|
QString qtVersion;
|
||||||
QString styleName;
|
QString styleName;
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ inline QDebug &operator<<(QDebug &d, const UserPresetData &preset)
|
|||||||
d << "UserPreset{category = " << preset.categoryId;
|
d << "UserPreset{category = " << preset.categoryId;
|
||||||
d << "; wizardName = " << preset.wizardName;
|
d << "; wizardName = " << preset.wizardName;
|
||||||
d << "; name = " << preset.name;
|
d << "; name = " << preset.name;
|
||||||
|
d << "; cmakeGeneration = " << preset.enableCMakeGeneration;
|
||||||
d << "; screenSize = " << preset.screenSize;
|
d << "; screenSize = " << preset.screenSize;
|
||||||
d << "; keyboard = " << preset.useQtVirtualKeyboard;
|
d << "; keyboard = " << preset.useQtVirtualKeyboard;
|
||||||
d << "; qt = " << preset.qtVersion;
|
d << "; qt = " << preset.qtVersion;
|
||||||
@@ -48,9 +50,10 @@ inline QDebug &operator<<(QDebug &d, const UserPresetData &preset)
|
|||||||
inline bool operator==(const UserPresetData &lhs, const UserPresetData &rhs)
|
inline bool operator==(const UserPresetData &lhs, const UserPresetData &rhs)
|
||||||
{
|
{
|
||||||
return lhs.categoryId == rhs.categoryId && lhs.wizardName == rhs.wizardName
|
return lhs.categoryId == rhs.categoryId && lhs.wizardName == rhs.wizardName
|
||||||
&& lhs.name == rhs.name && lhs.screenSize == rhs.screenSize
|
&& lhs.enableCMakeGeneration == rhs.enableCMakeGeneration && lhs.name == rhs.name
|
||||||
|
&& lhs.screenSize == rhs.screenSize
|
||||||
&& lhs.useQtVirtualKeyboard == rhs.useQtVirtualKeyboard && lhs.qtVersion == rhs.qtVersion
|
&& lhs.useQtVirtualKeyboard == rhs.useQtVirtualKeyboard && lhs.qtVersion == rhs.qtVersion
|
||||||
&& lhs.styleName == rhs.styleName;;
|
&& lhs.styleName == rhs.styleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class StorePolicy {UniqueNames, UniqueValues};
|
enum class StorePolicy {UniqueNames, UniqueValues};
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
// Copyright (C) 2021 The Qt Company Ltd.
|
// Copyright (C) 2021 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include <QWizardPage>
|
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
#include "wizardhandler.h"
|
#include "wizardhandler.h"
|
||||||
|
#include "fieldhelper.h"
|
||||||
|
|
||||||
#include <projectexplorer/jsonwizard/jsonfieldpage.h>
|
#include <projectexplorer/jsonwizard/jsonfieldpage.h>
|
||||||
#include <projectexplorer/jsonwizard/jsonfieldpage_p.h>
|
#include <projectexplorer/jsonwizard/jsonfieldpage_p.h>
|
||||||
|
|
||||||
#include <projectexplorer/jsonwizard/jsonprojectpage.h>
|
#include <projectexplorer/jsonwizard/jsonprojectpage.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QWizardPage>
|
||||||
|
|
||||||
using namespace StudioWelcome;
|
using namespace StudioWelcome;
|
||||||
|
using namespace StudioWelcome::FieldHelper;
|
||||||
|
|
||||||
void WizardHandler::reset(const std::shared_ptr<PresetItem> &presetInfo, int presetSelection)
|
void WizardHandler::reset(const std::shared_ptr<PresetItem> &presetInfo, int presetSelection)
|
||||||
{
|
{
|
||||||
@@ -57,8 +58,8 @@ void WizardHandler::setupWizard()
|
|||||||
emit wizardCreationFailed();
|
emit wizardCreationFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto *screenFactorModel = getScreenFactorModel(m_detailsPage);
|
auto *screenFactorModel = getScreenFactorModel();
|
||||||
auto *styleModel = getStyleModel(m_detailsPage);
|
auto *styleModel = getStyleModel();
|
||||||
|
|
||||||
emit wizardCreated(screenFactorModel, styleModel);
|
emit wizardCreated(screenFactorModel, styleModel);
|
||||||
}
|
}
|
||||||
@@ -105,16 +106,9 @@ void WizardHandler::initializeFieldsPage(QWizardPage *page)
|
|||||||
fieldsPage->initializePage();
|
fieldsPage->initializePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItemModel *WizardHandler::getScreenFactorModel(ProjectExplorer::JsonFieldPage *page)
|
QStandardItemModel *WizardHandler::getScreenFactorModel()
|
||||||
{
|
{
|
||||||
auto *field = page->jsonField("ScreenFactor");
|
return ComboBoxHelper(m_detailsPage, "ScreenFactor").model();
|
||||||
if (!field)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return nullptr);
|
|
||||||
|
|
||||||
return cbfield->model();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WizardHandler::haveStyleModel() const
|
bool WizardHandler::haveStyleModel() const
|
||||||
@@ -122,16 +116,9 @@ bool WizardHandler::haveStyleModel() const
|
|||||||
return m_wizard->hasField("ControlsStyle");
|
return m_wizard->hasField("ControlsStyle");
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItemModel *WizardHandler::getStyleModel(ProjectExplorer::JsonFieldPage *page)
|
QStandardItemModel *WizardHandler::getStyleModel()
|
||||||
{
|
{
|
||||||
auto *field = page->jsonField("ControlsStyle");
|
return ComboBoxHelper(m_detailsPage, "ControlsStyle").model();
|
||||||
if (!field)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField*>(field);
|
|
||||||
QTC_ASSERT(cbfield, return nullptr);
|
|
||||||
|
|
||||||
return cbfield->model();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WizardHandler::onWizardResetting()
|
void WizardHandler::onWizardResetting()
|
||||||
@@ -147,61 +134,27 @@ void WizardHandler::onWizardResetting()
|
|||||||
|
|
||||||
void WizardHandler::setScreenSizeIndex(int index)
|
void WizardHandler::setScreenSizeIndex(int index)
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ScreenFactor");
|
ComboBoxHelper(m_detailsPage, "ScreenFactor").selectIndex(index);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return);
|
|
||||||
|
|
||||||
cbfield->selectRow(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WizardHandler::screenSizeName(int index) const
|
QString WizardHandler::screenSizeName(int index) const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ScreenFactor");
|
return ComboBoxHelper(m_detailsPage, "ScreenFactor").text(index);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return "");
|
|
||||||
|
|
||||||
QStandardItemModel *model = cbfield->model();
|
|
||||||
if (index < 0 || index >= model->rowCount())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
QString text = model->item(index)->text();
|
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WizardHandler::screenSizeIndex() const
|
int WizardHandler::screenSizeIndex() const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ScreenFactor");
|
return ComboBoxHelper(m_detailsPage, "ScreenFactor").selectedIndex();
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return -1);
|
|
||||||
|
|
||||||
return cbfield->selectedRow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WizardHandler::screenSizeIndex(const QString &sizeName) const
|
int WizardHandler::screenSizeIndex(const QString &sizeName) const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ScreenFactor");
|
return ComboBoxHelper(m_detailsPage, "ScreenFactor").indexOf(sizeName);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return false);
|
|
||||||
|
|
||||||
const QStandardItemModel *model = cbfield->model();
|
|
||||||
for (int i = 0; i < model->rowCount(); ++i) {
|
|
||||||
const QStandardItem *item = model->item(i, 0);
|
|
||||||
const QString text = item->text();
|
|
||||||
|
|
||||||
if (text == sizeName)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WizardHandler::setTargetQtVersionIndex(int index)
|
void WizardHandler::setTargetQtVersionIndex(int index)
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("TargetQtVersion");
|
ComboBoxHelper(m_detailsPage, "TargetQtVersion").selectIndex(index);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return);
|
|
||||||
|
|
||||||
cbfield->selectRow(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WizardHandler::haveTargetQtVersion() const
|
bool WizardHandler::haveTargetQtVersion() const
|
||||||
@@ -211,117 +164,47 @@ bool WizardHandler::haveTargetQtVersion() const
|
|||||||
|
|
||||||
QString WizardHandler::targetQtVersionName(int index) const
|
QString WizardHandler::targetQtVersionName(int index) const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("TargetQtVersion");
|
return ComboBoxHelper(m_detailsPage, "TargetQtVersion").text(index);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return "");
|
|
||||||
|
|
||||||
QStandardItemModel *model = cbfield->model();
|
|
||||||
if (index < 0 || index >= model->rowCount())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
QString text = model->item(index)->text();
|
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList WizardHandler::targetQtVersionNames() const
|
QStringList WizardHandler::targetQtVersionNames() const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("TargetQtVersion");
|
return ComboBoxHelper(m_detailsPage, "TargetQtVersion").allTexts();
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return {});
|
|
||||||
|
|
||||||
QStandardItemModel *model = cbfield->model();
|
|
||||||
QStringList targetVersions;
|
|
||||||
|
|
||||||
for (int i = 0; i < model->rowCount(); ++i)
|
|
||||||
targetVersions.append(model->item(i)->text());
|
|
||||||
|
|
||||||
return targetVersions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WizardHandler::targetQtVersionIndex(const QString &qtVersionName) const
|
int WizardHandler::targetQtVersionIndex(const QString &qtVersionName) const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("TargetQtVersion");
|
return ComboBoxHelper(m_detailsPage, "TargetQtVersion").indexOf(qtVersionName);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return -1);
|
|
||||||
|
|
||||||
const QStandardItemModel *model = cbfield->model();
|
|
||||||
for (int i = 0; i < model->rowCount(); ++i) {
|
|
||||||
const QStandardItem *item = model->item(i, 0);
|
|
||||||
const QString text = item->text();
|
|
||||||
|
|
||||||
if (text == qtVersionName)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WizardHandler::targetQtVersionIndex() const
|
int WizardHandler::targetQtVersionIndex() const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("TargetQtVersion");
|
return ComboBoxHelper(m_detailsPage, "TargetQtVersion").selectedIndex();
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return -1);
|
|
||||||
|
|
||||||
return cbfield->selectedRow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WizardHandler::setStyleIndex(int index)
|
void WizardHandler::setStyleIndex(int index)
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ControlsStyle");
|
ComboBoxHelper(m_detailsPage, "ControlsStyle").selectIndex(index);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return);
|
|
||||||
|
|
||||||
cbfield->selectRow(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WizardHandler::styleIndex() const
|
int WizardHandler::styleIndex() const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ControlsStyle");
|
return ComboBoxHelper(m_detailsPage, "ControlsStyle").selectedIndex();
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return -1);
|
|
||||||
|
|
||||||
return cbfield->selectedRow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int WizardHandler::styleIndex(const QString &styleName) const
|
int WizardHandler::styleIndex(const QString &styleName) const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ControlsStyle");
|
return ComboBoxHelper(m_detailsPage, "ControlsStyle").indexOf(styleName);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return -1);
|
|
||||||
|
|
||||||
const QStandardItemModel *model = cbfield->model();
|
|
||||||
for (int i = 0; i < model->rowCount(); ++i) {
|
|
||||||
const QStandardItem *item = model->item(i, 0);
|
|
||||||
const QString text = item->text();
|
|
||||||
|
|
||||||
if (text == styleName)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WizardHandler::styleName(int index) const
|
QString WizardHandler::styleName(int index) const
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("ControlsStyle");
|
return ComboBoxHelper(m_detailsPage, "ControlsStyle").text(index);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::ComboBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return "");
|
|
||||||
|
|
||||||
QStandardItemModel *model = cbfield->model();
|
|
||||||
if (index < 0 || index >= model->rowCount())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
QString text = model->item(index)->text();
|
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WizardHandler::setUseVirtualKeyboard(bool value)
|
void WizardHandler::setUseVirtualKeyboard(bool value)
|
||||||
{
|
{
|
||||||
auto *field = m_detailsPage->jsonField("UseVirtualKeyboard");
|
CheckBoxHelper(m_detailsPage, "UseVirtualKeyboard").setChecked(value);
|
||||||
auto *cbfield = dynamic_cast<ProjectExplorer::CheckBoxField *>(field);
|
|
||||||
QTC_ASSERT(cbfield, return);
|
|
||||||
|
|
||||||
cbfield->setChecked(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WizardHandler::haveVirtualKeyboard() const
|
bool WizardHandler::haveVirtualKeyboard() const
|
||||||
@@ -329,6 +212,16 @@ bool WizardHandler::haveVirtualKeyboard() const
|
|||||||
return m_wizard->hasField("UseVirtualKeyboard");
|
return m_wizard->hasField("UseVirtualKeyboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WizardHandler::enableCMakeGeneration(bool value)
|
||||||
|
{
|
||||||
|
CheckBoxHelper(m_detailsPage, "EnableCMakeGeneration").setChecked(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WizardHandler::hasCMakeGeneration() const
|
||||||
|
{
|
||||||
|
return m_wizard->hasField("EnableCMakeGeneration");
|
||||||
|
}
|
||||||
|
|
||||||
void WizardHandler::run(const std::function<void(QWizardPage *)> &processPage)
|
void WizardHandler::run(const std::function<void(QWizardPage *)> &processPage)
|
||||||
{
|
{
|
||||||
m_wizard->restart();
|
m_wizard->restart();
|
||||||
|
@@ -48,6 +48,9 @@ public:
|
|||||||
void setUseVirtualKeyboard(bool value);
|
void setUseVirtualKeyboard(bool value);
|
||||||
bool haveVirtualKeyboard() const;
|
bool haveVirtualKeyboard() const;
|
||||||
|
|
||||||
|
void enableCMakeGeneration(bool value);
|
||||||
|
bool hasCMakeGeneration() const;
|
||||||
|
|
||||||
void setProjectName(const QString &name);
|
void setProjectName(const QString &name);
|
||||||
void setProjectLocation(const Utils::FilePath &location);
|
void setProjectLocation(const Utils::FilePath &location);
|
||||||
|
|
||||||
@@ -67,8 +70,8 @@ private:
|
|||||||
void initializeProjectPage(QWizardPage *page);
|
void initializeProjectPage(QWizardPage *page);
|
||||||
void initializeFieldsPage(QWizardPage *page);
|
void initializeFieldsPage(QWizardPage *page);
|
||||||
|
|
||||||
QStandardItemModel *getScreenFactorModel(ProjectExplorer::JsonFieldPage *page);
|
QStandardItemModel *getScreenFactorModel();
|
||||||
QStandardItemModel *getStyleModel(ProjectExplorer::JsonFieldPage *page);
|
QStandardItemModel *getStyleModel();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onWizardResetting();
|
void onWizardResetting();
|
||||||
|
Reference in New Issue
Block a user