Commit fa12589e authored by Don Gagne's avatar Don Gagne

Add toolbar message support

Also restructured some toolbar positioning QML to handle resizing.
parent af46dc40
...@@ -91,6 +91,8 @@ public: ...@@ -91,6 +91,8 @@ public:
int telemetryLRSSI () { return _telemetryLRSSI; } int telemetryLRSSI () { return _telemetryLRSSI; }
int connectionCount () { return _connectionCount; } int connectionCount () { return _connectionCount; }
void showToolBarMessage(const QString& message) { emit showMessage(message); }
signals: signals:
void connectionCountChanged (int count); void connectionCountChanged (int count);
void currentViewChanged (); void currentViewChanged ();
......
...@@ -45,7 +45,10 @@ Rectangle { ...@@ -45,7 +45,10 @@ Rectangle {
readonly property real toolBarHeight: ScreenTools.defaultFontPixelHeight * 3 readonly property real toolBarHeight: ScreenTools.defaultFontPixelHeight * 3
property int cellSpacerSize: ScreenTools.isMobile ? getProportionalDimmension(6) : getProportionalDimmension(4) property int cellSpacerSize: ScreenTools.isMobile ? getProportionalDimmension(6) : getProportionalDimmension(4)
readonly property int cellHeight: getProportionalDimmension(30) readonly property int cellHeight: toolBarHeight * 0.75
readonly property real horizontalMargins: ScreenTools.defaultFontPixelWidth / 2
readonly property real verticalMargins: ScreenTools.defaultFontPixelHeight / 4
readonly property var colorBlue: "#1a6eaa" readonly property var colorBlue: "#1a6eaa"
readonly property var colorGreen: "#329147" readonly property var colorGreen: "#329147"
...@@ -62,7 +65,12 @@ Rectangle { ...@@ -62,7 +65,12 @@ Rectangle {
Connections { Connections {
target: mainToolBar target: mainToolBar
onShowMessage: mainToolBar.height = 100
onShowMessage: {
toolBarMessage.text = message
mainToolBar.height = toolBarHeight + toolBarMessage.contentHeight + verticalMargins
toolBarMessageArea.visible = true
}
} }
function getProportionalDimmension(val) { function getProportionalDimmension(val) {
...@@ -183,24 +191,24 @@ Rectangle { ...@@ -183,24 +191,24 @@ Rectangle {
mainToolBar.onFlyViewMenu(); mainToolBar.onFlyViewMenu();
} }
} }
} } // Menu
Row { Row {
id: row1 id: toolRow
height: cellHeight x: horizontalMargins
anchors.left: parent.left y: (toolBarHeight - cellHeight) / 2
spacing: getProportionalDimmension(4) height: cellHeight
anchors.verticalCenter: parent.verticalCenter spacing: getProportionalDimmension(4)
anchors.leftMargin: getProportionalDimmension(10)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//-- Main menu for Non Mobile Devices (Chevron Buttons) //-- Main menu for Non Mobile Devices (Chevron Buttons)
Row { Row {
id: row11 id: row11
height: cellHeight height: cellHeight
spacing: -getProportionalDimmension(12) spacing: -getProportionalDimmension(12)
anchors.verticalCenter: parent.verticalCenter anchors.top: parent.top
visible: !ScreenTools.isMobile visible: !ScreenTools.isMobile
Connections { Connections {
target: ScreenTools target: ScreenTools
onRepaintRequested: { onRepaintRequested: {
...@@ -219,7 +227,6 @@ Rectangle { ...@@ -219,7 +227,6 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Setup") text: qsTr("Setup")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewSetup) checked: (mainToolBar.currentView === MainToolBar.ViewSetup)
onClicked: { onClicked: {
mainToolBar.onSetupView(); mainToolBar.onSetupView();
...@@ -233,7 +240,6 @@ Rectangle { ...@@ -233,7 +240,6 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Plan") text: qsTr("Plan")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewPlan) checked: (mainToolBar.currentView === MainToolBar.ViewPlan)
onClicked: { onClicked: {
mainToolBar.onPlanView(); mainToolBar.onPlanView();
...@@ -247,7 +253,6 @@ Rectangle { ...@@ -247,7 +253,6 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Fly") text: qsTr("Fly")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewFly) checked: (mainToolBar.currentView === MainToolBar.ViewFly)
onClicked: { onClicked: {
mainToolBar.onFlyView(); mainToolBar.onFlyView();
...@@ -261,15 +266,13 @@ Rectangle { ...@@ -261,15 +266,13 @@ Rectangle {
height: cellHeight height: cellHeight
exclusiveGroup: mainActionGroup exclusiveGroup: mainActionGroup
text: qsTr("Analyze") text: qsTr("Analyze")
anchors.verticalCenter: parent.verticalCenter
checked: (mainToolBar.currentView === MainToolBar.ViewAnalyze) checked: (mainToolBar.currentView === MainToolBar.ViewAnalyze)
onClicked: { onClicked: {
mainToolBar.onAnalyzeView(); mainToolBar.onAnalyzeView();
} }
z: 700 z: 700
} }
} // Row
}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//-- Indicators //-- Indicators
...@@ -673,17 +676,17 @@ Rectangle { ...@@ -673,17 +676,17 @@ Rectangle {
color: colorRedText color: colorRedText
} }
} }
} } // Row
} } // Row
Row { Row {
id: row2 id: connectRow
height: cellHeight anchors.rightMargin: verticalMargins
spacing: cellSpacerSize anchors.right: parent.right
anchors.right: parent.right anchors.top: toolRow.top
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: toolRow.verticalCenter
anchors.leftMargin: getProportionalDimmension(10) height: toolRow.height
anchors.rightMargin: getProportionalDimmension(10) spacing: cellSpacerSize
Menu { Menu {
id: connectMenu id: connectMenu
...@@ -718,7 +721,6 @@ Rectangle { ...@@ -718,7 +721,6 @@ Rectangle {
visible: mainToolBar.connectionCount === 0 visible: mainToolBar.connectionCount === 0
text: qsTr("Connect") text: qsTr("Connect")
menu: connectMenu menu: connectMenu
anchors.verticalCenter: parent.verticalCenter
} }
QGCButton { QGCButton {
...@@ -726,7 +728,6 @@ Rectangle { ...@@ -726,7 +728,6 @@ Rectangle {
width: getProportionalDimmension(100) width: getProportionalDimmension(100)
visible: mainToolBar.connectionCount === 1 visible: mainToolBar.connectionCount === 1
text: qsTr("Disconnect") text: qsTr("Disconnect")
anchors.verticalCenter: parent.verticalCenter
onClicked: { onClicked: {
mainToolBar.onDisconnect(""); mainToolBar.onDisconnect("");
} }
...@@ -756,18 +757,47 @@ Rectangle { ...@@ -756,18 +757,47 @@ Rectangle {
text: "Disconnect" text: "Disconnect"
visible: mainToolBar.connectionCount > 1 visible: mainToolBar.connectionCount > 1
menu: disconnectMenu menu: disconnectMenu
anchors.verticalCenter: parent.verticalCenter
} }
} // Row
}
// Progress bar // Progress bar
Rectangle { Rectangle {
readonly property int progressBarHeight: getProportionalDimmension(3) id: progressBar
y: parent.height - progressBarHeight anchors.top: toolRow.bottom
height: progressBarHeight height: getProportionalDimmension(3)
width: parent.width * mainToolBar.progressBarValue width: parent.width * mainToolBar.progressBarValue
color: qgcPal.text color: qgcPal.text
} }
}
// Toolbar message area
Rectangle {
id: toolBarMessageArea
anchors.margins: horizontalMargins
anchors.top: progressBar.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
color: qgcPal.windowShadeDark
visible: false
QGCLabel {
id: toolBarMessage
anchors.fill: parent
wrapMode: Text.WordWrap
}
QGCButton {
id: toolBarMessageCloseButton
anchors.rightMargin: horizontalMargins
anchors.topMargin: verticalMargins
anchors.top: parent.top
anchors.right: parent.right
text: "Close Message"
onClicked: {
parent.visible = false
mainToolBar.height = toolBarHeight
}
}
}
} // Rectangle
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment