Improve launcher feedback when location is disabled
Also improve warning text about conflicting args
This commit is contained in:
parent
92ab8549bd
commit
5ada6d46d9
4 changed files with 103 additions and 4 deletions
|
@ -8,7 +8,13 @@ Item {
|
||||||
id: pagesModel
|
id: pagesModel
|
||||||
ListElement { title: qsTr("Summary"); pageSource: "qrc:///qml/Summary.qml"; iconPath: "qrc:///toolbox-summary"; state:"loader" }
|
ListElement { title: qsTr("Summary"); pageSource: "qrc:///qml/Summary.qml"; iconPath: "qrc:///toolbox-summary"; state:"loader" }
|
||||||
ListElement { title: qsTr("Aircraft"); pageSource: "qrc:///qml/AircraftList.qml"; iconPath: "qrc:///toolbox-aircraft"; state:"loader" }
|
ListElement { title: qsTr("Aircraft"); pageSource: "qrc:///qml/AircraftList.qml"; iconPath: "qrc:///toolbox-aircraft"; state:"loader" }
|
||||||
ListElement { title: qsTr("Location"); pageSource: "qrc:///qml/Location.qml"; iconPath: "qrc:///toolbox-location"; state:"loader" }
|
|
||||||
|
ListElement {
|
||||||
|
title: qsTr("Location"); pageSource: "qrc:///qml/Location.qml";
|
||||||
|
iconPath: "qrc:///toolbox-location"; state:"loader"
|
||||||
|
buttonDisabled: false
|
||||||
|
disabledText: qsTr("Location page disabled due to conflicting user arguments (in Settings)");
|
||||||
|
}
|
||||||
|
|
||||||
// due to some design stupidity by James, we can't use the Loader mechanism for these pages; they need to exist
|
// due to some design stupidity by James, we can't use the Loader mechanism for these pages; they need to exist
|
||||||
// permanently so that collecting args works. So we instantiate them down below, and toggle the visiblity
|
// permanently so that collecting args works. So we instantiate them down below, and toggle the visiblity
|
||||||
|
@ -21,6 +27,11 @@ Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: _location
|
||||||
|
onSkipFromArgsChanged: pagesModel.setProperty(2, "buttonDisabled", _location.skipFromArgs)
|
||||||
|
}
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "loader"
|
name: "loader"
|
||||||
|
|
|
@ -22,7 +22,20 @@ SettingControl {
|
||||||
enabled: root.enabled
|
enabled: root.enabled
|
||||||
text: qsTr("Enter additional command-line arguments if any are required. " +
|
text: qsTr("Enter additional command-line arguments if any are required. " +
|
||||||
"See <a href=\"http://flightgear.sourceforge.net/getstart-en/getstart-enpa2.html#x5-450004.5\">here</a> " +
|
"See <a href=\"http://flightgear.sourceforge.net/getstart-en/getstart-enpa2.html#x5-450004.5\">here</a> " +
|
||||||
"for documentation on possible arguments.");
|
"for documentation on possible arguments. " +
|
||||||
|
"<br>" +
|
||||||
|
"<b>Warning:</b> values entered here always override other settings; <a href=\"#view-command-line\">click here</a> " +
|
||||||
|
"to view the final set of arguments that will be used"
|
||||||
|
);
|
||||||
|
|
||||||
|
onLinkActivated: {
|
||||||
|
if (link == "#view-command-line") {
|
||||||
|
_launcher.viewCommandLine();
|
||||||
|
} else {
|
||||||
|
Qt.openUrlExternally(link)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ Rectangle {
|
||||||
root.selectPage(model.pageSource);
|
root.selectPage(model.pageSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enabled: !model.buttonDisabled
|
||||||
|
disabledText: model.hasOwnProperty("disabledText") ? model.disabledText : ""
|
||||||
selected: (model.index === root.selectedPage)
|
selected: (model.index === root.selectedPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +46,7 @@ Rectangle {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: Style.margin
|
anchors.bottomMargin: Style.margin
|
||||||
enabled: _launcher.canFly
|
enabled: _launcher.canFly
|
||||||
|
disabledText: qsTr("The selected aircraft is not installed")
|
||||||
icon: "qrc:///toolbox-fly"
|
icon: "qrc:///toolbox-fly"
|
||||||
onClicked: _launcher.fly();
|
onClicked: _launcher.fly();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,10 @@ Item {
|
||||||
property bool selected: false
|
property bool selected: false
|
||||||
property bool enabled: true
|
property bool enabled: true
|
||||||
|
|
||||||
|
property string disabledText: ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: baseRect
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: root.enabled & (root.selected | mouse.containsMouse)
|
visible: root.enabled & (root.selected | mouse.containsMouse)
|
||||||
color: Style.activeColor
|
color: Style.activeColor
|
||||||
|
@ -42,9 +45,78 @@ Item {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouse
|
id: mouse
|
||||||
enabled: root.enabled
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: root.clicked();
|
onClicked: if (root.enabled) root.clicked();
|
||||||
|
|
||||||
|
onEntered: {
|
||||||
|
// disabled tooltip
|
||||||
|
if (!root.enabled) tooltipTimer.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
onExited: {
|
||||||
|
tooltipTimer.stop()
|
||||||
|
disabledTextBox.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: tooltipTimer
|
||||||
|
onTriggered: {
|
||||||
|
disabledTextBox.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: disabledTextBox
|
||||||
|
height:disabledTextContent.implicitHeight + Style.margin * 2
|
||||||
|
width: disabledTextContent.implicitWidth + Style.margin * 2
|
||||||
|
color: Style.themeColor
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
anchors.left: baseRect.right
|
||||||
|
anchors.verticalCenter: baseRect.verticalCenter
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
hideDisabledAnimation.stop();
|
||||||
|
showDisabledAnimation.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
if (!visible)
|
||||||
|
return;
|
||||||
|
showDisabledAnimation.stop();
|
||||||
|
hideDisabledAnimation.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: disabledTextContent
|
||||||
|
x: Style.margin
|
||||||
|
y: Style.margin
|
||||||
|
color: "white"
|
||||||
|
font.pixelSize: Style.subHeadingFontPixelSize
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: root.disabledText
|
||||||
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: showDisabledAnimation
|
||||||
|
PropertyAction { target:disabledTextBox; property:"visible"; value: true }
|
||||||
|
NumberAnimation {
|
||||||
|
target:disabledTextBox; property:"opacity"
|
||||||
|
from: 0.0; to: 1.0
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: hideDisabledAnimation
|
||||||
|
NumberAnimation {
|
||||||
|
target:disabledTextBox; property:"opacity"
|
||||||
|
from: 1.0; to: 0.0
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
PropertyAction { target:disabledTextBox; property:"visible"; value: false }
|
||||||
|
}
|
||||||
|
} // of disabled text box
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue