diff --git a/src/GUI/qml/Launcher.qml b/src/GUI/qml/Launcher.qml index f33316bc8..496ba2605 100644 --- a/src/GUI/qml/Launcher.qml +++ b/src/GUI/qml/Launcher.qml @@ -8,7 +8,13 @@ Item { id: pagesModel 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("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 // 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: [ State { name: "loader" diff --git a/src/GUI/qml/SettingExtraArguments.qml b/src/GUI/qml/SettingExtraArguments.qml index 273287714..32c8b8474 100644 --- a/src/GUI/qml/SettingExtraArguments.qml +++ b/src/GUI/qml/SettingExtraArguments.qml @@ -22,7 +22,20 @@ SettingControl { enabled: root.enabled text: qsTr("Enter additional command-line arguments if any are required. " + "See here " + - "for documentation on possible arguments."); + "for documentation on possible arguments. " + + "
" + + "Warning: values entered here always override other settings; click here " + + "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 } diff --git a/src/GUI/qml/Sidebar.qml b/src/GUI/qml/Sidebar.qml index 80245fa48..a027814d6 100644 --- a/src/GUI/qml/Sidebar.qml +++ b/src/GUI/qml/Sidebar.qml @@ -33,6 +33,8 @@ Rectangle { root.selectPage(model.pageSource); } + enabled: !model.buttonDisabled + disabledText: model.hasOwnProperty("disabledText") ? model.disabledText : "" selected: (model.index === root.selectedPage) } } @@ -44,6 +46,7 @@ Rectangle { anchors.bottom: parent.bottom anchors.bottomMargin: Style.margin enabled: _launcher.canFly + disabledText: qsTr("The selected aircraft is not installed") icon: "qrc:///toolbox-fly" onClicked: _launcher.fly(); } diff --git a/src/GUI/qml/SidebarButton.qml b/src/GUI/qml/SidebarButton.qml index a5bd93730..00dda4eca 100644 --- a/src/GUI/qml/SidebarButton.qml +++ b/src/GUI/qml/SidebarButton.qml @@ -16,7 +16,10 @@ Item { property bool selected: false property bool enabled: true + property string disabledText: "" + Rectangle { + id: baseRect anchors.fill: parent visible: root.enabled & (root.selected | mouse.containsMouse) color: Style.activeColor @@ -42,9 +45,78 @@ Item { MouseArea { id: mouse - enabled: root.enabled anchors.fill: parent 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 }