14 changed files with 302 additions and 5 deletions
@ -0,0 +1,10 @@ |
|||||||
|
import QtQuick 2.12 |
||||||
|
|
||||||
|
Item { |
||||||
|
// `null` for default which makes the wizzard display one of the buttons: "Next" if more pages or "Done" if the last |
||||||
|
property string doneText: null |
||||||
|
// Blocks user from closing the wizard or going to the next page until this becomes true |
||||||
|
property bool forceConfirmation: false |
||||||
|
|
||||||
|
signal closeView() |
||||||
|
} |
@ -0,0 +1,87 @@ |
|||||||
|
import QtQuick 2.11 |
||||||
|
import QtQuick.Layouts 1.11 |
||||||
|
|
||||||
|
import QGroundControl.ScreenTools 1.0 |
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
import QGroundControl 1.0 |
||||||
|
import QGroundControl.Specific 1.0 |
||||||
|
|
||||||
|
|
||||||
|
Item { |
||||||
|
id: _root |
||||||
|
|
||||||
|
implicitWidth: contentColumn.implicitWidth + contentColumn.anchors.margins * 2.5 |
||||||
|
implicitHeight: contentColumn.implicitHeight + contentColumn.anchors.margins * 2 + contentColumn.spacing * 3 |
||||||
|
|
||||||
|
property bool forceKeepingOpen: _pageReady && pageLoader.item.forceConfirmation && !_armed |
||||||
|
|
||||||
|
signal closeView() |
||||||
|
|
||||||
|
property bool _pageReady: pageLoader.status === Loader.Ready |
||||||
|
property int _currentIndex: 0 |
||||||
|
property int _pagesCount: QGroundControl.corePlugin.startupPages.length |
||||||
|
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle |
||||||
|
property bool _armed: _activeVehicle && _activeVehicle.armed |
||||||
|
|
||||||
|
function doneOrJumpToNext() { |
||||||
|
if(_currentIndex < _pagesCount - 1) |
||||||
|
_currentIndex += 1 |
||||||
|
else { |
||||||
|
_root.closeView() |
||||||
|
QGroundControl.settingsManager.appSettings.firstTimeStart.value = false |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Connections { |
||||||
|
target: _pageReady ? pageLoader.item : null |
||||||
|
onCloseView: doneOrJumpToNext() |
||||||
|
} |
||||||
|
|
||||||
|
ColumnLayout { |
||||||
|
id: contentColumn |
||||||
|
anchors.fill: parent |
||||||
|
anchors.margins: ScreenTools.defaultFontPixelHeight |
||||||
|
spacing: ScreenTools.defaultFontPixelHeight * 0.5 |
||||||
|
|
||||||
|
QGCLabel { |
||||||
|
id: titleLabel |
||||||
|
text: qsTr("Welcome to " + QGroundControl.appName) |
||||||
|
color: qgcPal.text |
||||||
|
font.family: ScreenTools.demiboldFontFamily |
||||||
|
font.pointSize: ScreenTools.mediumFontPointSize |
||||||
|
} |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
id: separatorRect |
||||||
|
height: 1 |
||||||
|
color: qgcPal.windowShade |
||||||
|
Layout.fillWidth: true |
||||||
|
} |
||||||
|
|
||||||
|
Flickable { |
||||||
|
id: flickablePage |
||||||
|
clip: true |
||||||
|
|
||||||
|
contentWidth: pageLoader.item ? pageLoader.item.width : 0 |
||||||
|
contentHeight: pageLoader.item ? pageLoader.item.height : 0 |
||||||
|
|
||||||
|
Layout.fillHeight: true |
||||||
|
Layout.preferredWidth: contentWidth |
||||||
|
Layout.preferredHeight: contentHeight |
||||||
|
|
||||||
|
Loader { |
||||||
|
id: pageLoader |
||||||
|
source: QGroundControl.corePlugin.startupPages[_currentIndex] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
QGCButton { |
||||||
|
id: confirmButton |
||||||
|
property string _acknowledgeText: _pagesCount <= 1 ? qsTr("Next") : qsTr("Done") |
||||||
|
|
||||||
|
text: (_pageReady && pageLoader.item && pageLoader.item.doneText) ? pageLoader.item.doneText : _acknowledgeText |
||||||
|
onClicked: doneOrJumpToNext() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
import QtQuick 2.12 |
||||||
|
import QtQuick.Layouts 1.12 |
||||||
|
|
||||||
|
import QGroundControl 1.0 |
||||||
|
import QGroundControl.FactSystem 1.0 |
||||||
|
import QGroundControl.FactControls 1.0 |
||||||
|
import QGroundControl.ScreenTools 1.0 |
||||||
|
import QGroundControl.SettingsManager 1.0 |
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
import QGroundControl.Specific 1.0 |
||||||
|
|
||||||
|
BaseStartupWizardPage { |
||||||
|
width: settingsColumn.width |
||||||
|
height: settingsColumn.height |
||||||
|
|
||||||
|
property real _margins: ScreenTools.defaultFontPixelWidth |
||||||
|
property real _comboFieldWidth: ScreenTools.defaultFontPixelWidth * 20 |
||||||
|
|
||||||
|
doneText: qsTr("Confirm") |
||||||
|
|
||||||
|
ColumnLayout { |
||||||
|
id: settingsColumn |
||||||
|
anchors.horizontalCenter: parent.horizontalCenter |
||||||
|
spacing: ScreenTools.defaultFontPixelHeight |
||||||
|
|
||||||
|
QGCLabel { |
||||||
|
id: unitsSectionLabel |
||||||
|
text: qsTr("Choose the measurement units you want to use in the application. You can change it later on in General Settings.") |
||||||
|
|
||||||
|
Layout.preferredWidth: unitsGrid.width |
||||||
|
wrapMode: Text.WordWrap |
||||||
|
} |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
Layout.preferredHeight: unitsGrid.height + (_margins * 2) |
||||||
|
Layout.preferredWidth: unitsGrid.width + (_margins * 2) |
||||||
|
color: qgcPal.windowShade |
||||||
|
Layout.fillWidth: true |
||||||
|
|
||||||
|
GridLayout { |
||||||
|
id: unitsGrid |
||||||
|
anchors.topMargin: _margins |
||||||
|
anchors.top: parent.top |
||||||
|
Layout.fillWidth: false |
||||||
|
anchors.horizontalCenter: parent.horizontalCenter |
||||||
|
flow: GridLayout.TopToBottom |
||||||
|
rows: 5 |
||||||
|
|
||||||
|
QGCLabel { text: qsTr("System of units") } |
||||||
|
|
||||||
|
Repeater { |
||||||
|
model: [ qsTr("Distance"), qsTr("Area"), qsTr("Speed"), qsTr("Temperature") ] |
||||||
|
QGCLabel { text: modelData } |
||||||
|
} |
||||||
|
|
||||||
|
QGCComboBox { |
||||||
|
model: [qsTr("Metric System"), qsTr("Imperial System")] |
||||||
|
Layout.preferredWidth: _comboFieldWidth |
||||||
|
|
||||||
|
currentIndex: QGroundControl.settingsManager.unitsSettings.distanceUnits.value === UnitsSettings.DistanceUnitsMeters ? 0 : 1 |
||||||
|
|
||||||
|
onActivated: { |
||||||
|
var metric = (currentIndex === 0); |
||||||
|
QGroundControl.settingsManager.unitsSettings.distanceUnits.value = metric ? UnitsSettings.DistanceUnitsMeters : UnitsSettings.DistanceUnitsFeet |
||||||
|
QGroundControl.settingsManager.unitsSettings.areaUnits.value = metric ? UnitsSettings.AreaUnitsSquareMeters : UnitsSettings.AreaUnitsSquareFeet |
||||||
|
QGroundControl.settingsManager.unitsSettings.speedUnits.value = metric ? UnitsSettings.SpeedUnitsMetersPerSecond : UnitsSettings.SpeedUnitsFeetPerSecond |
||||||
|
QGroundControl.settingsManager.unitsSettings.temperatureUnits.value = metric ? UnitsSettings.TemperatureUnitsCelsius : UnitsSettings.TemperatureUnitsFarenheit |
||||||
|
} |
||||||
|
} |
||||||
|
Repeater { |
||||||
|
model: [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ] |
||||||
|
FactComboBox { |
||||||
|
Layout.preferredWidth: _comboFieldWidth |
||||||
|
fact: modelData |
||||||
|
indexModel: false |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
module QGroundControl.Specific |
||||||
|
|
||||||
|
BaseStartupWizardPage 1.0 BaseStartupWizardPage.qml |
||||||
|
StartupWizard 1.0 StartupWizard.qml |
||||||
|
UnitsWizardPage 1.0 UnitsWizardPage.qml |
Loading…
Reference in new issue