Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
2f7fe9dd
Commit
2f7fe9dd
authored
Apr 28, 2015
by
Don Gagne
Browse files
Merge pull request #1517 from dogmaphobic/mobileMenubar
Mobile Menu Bar
parents
9ad975bd
bcb6a113
Changes
9
Hide whitespace changes
Inline
Side-by-side
QGCCommon.pri
View file @
2f7fe9dd
...
...
@@ -32,7 +32,9 @@ linux {
CONFIG += LinuxBuild
} else : android-g++ {
message("Android build")
CONFIG += AndroidBuild
CONFIG += AndroidBuild
DEFINES += __mobile__
DEFINES += __android__
warning("Android build is experimental and not fully functional")
} else {
error("Unsuported Linux toolchain, only GCC 32- or 64-bit is supported")
...
...
@@ -116,7 +118,6 @@ DEFINES += _TTY_NOWARN_
#
AndroidBuild {
DEFINES += __android__
DEFINES += __STDC_LIMIT_MACROS
}
...
...
src/QGCFileDialog.cc
View file @
2f7fe9dd
...
...
@@ -217,7 +217,9 @@ void QGCFileDialog::_validate(Options& options)
Q_ASSERT
(
qgcApp
());
Q_ASSERT_X
(
QThread
::
currentThread
()
==
qgcApp
()
->
thread
(),
"Threading issue"
,
"QGCFileDialog can only be called from main thread"
);
#ifndef __android__
#ifdef __android__
Q_UNUSED
(
options
)
#else
// On OSX native dialog can hang so we always use Qt dialogs
options
|=
DontUseNativeDialog
;
#endif
...
...
src/ui/MainWindow.cc
View file @
2f7fe9dd
...
...
@@ -181,12 +181,16 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// Qt 4 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar.
// TODO: Check that this is still necessary on Qt5 on Ubuntu
#ifdef Q_OS_LINUX
#ifndef __android__
menuBar
()
->
setNativeMenuBar
(
false
);
#endif
// On Mobile devices, we don't want any main menus at all.
#ifdef __mobile__
menuBar
()
->
setNativeMenuBar
(
false
);
#endif
#ifdef UNITTEST_BUILD
QAction
*
qmlTestAction
=
new
QAction
(
"Test QML palette and controls"
,
NULL
);
connect
(
qmlTestAction
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
_showQmlTestWidget
);
...
...
src/ui/MainWindow.h
View file @
2f7fe9dd
...
...
@@ -62,6 +62,7 @@ This file is part of the QGROUNDCONTROL project
#include
"MainToolBar.h"
#include
"LogCompressor.h"
#include
"QGCFlightDisplay.h"
#include
"QGCMAVLinkInspector.h"
#include
"QGCMAVLinkLogPlayer.h"
#include
"MAVLinkDecoder.h"
...
...
@@ -76,6 +77,7 @@ class QGCStatusBar;
class
Linecharts
;
class
QGCDataPlot2D
;
class
QGCUASFileViewMulti
;
class
QGCFlightDisplay
;
/**
* @brief Main Application Window
...
...
@@ -125,6 +127,9 @@ public:
/// @brief Gets a pointer to the Main Tool Bar
MainToolBar
*
getMainToolBar
(
void
)
{
return
_mainToolBar
;
}
/// @brief Gets a pointer to the Main Flight Display
QGCFlightDisplay
*
getFlightDisplay
()
{
return
dynamic_cast
<
QGCFlightDisplay
*>
(
_flightView
.
data
());
}
QWidget
*
getCurrentViewWidget
(
void
)
{
return
_currentViewWidget
;
}
...
...
src/ui/flightdisplay/FlightDisplay.qml
View file @
2f7fe9dd
...
...
@@ -58,6 +58,13 @@ Item {
return
value
?
"
1
"
:
"
0
"
;
}
Connections
{
target
:
flightDisplay
onShowOptionsMenuChanged
:
{
contextMenu
.
popup
();
}
}
Component.onCompleted
:
{
mapBackground
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showMapBackground
"
,
"
0
"
));
...
...
@@ -609,39 +616,15 @@ Item {
z
:
70
}
// Button at upper left corner
Item
{
id
:
optionsButton
x
:
__screenTools
.
pixelSizeFactor
*
(
5
)
y
:
__screenTools
.
pixelSizeFactor
*
(
5
)
width
:
__screenTools
.
pixelSizeFactor
*
(
30
)
height
:
__screenTools
.
pixelSizeFactor
*
(
30
)
opacity
:
0.85
z
:
1000
Image
{
id
:
buttomImg
anchors.fill
:
parent
source
:
"
/qml/buttonMore.svg
"
mipmap
:
true
smooth
:
true
antialiasing
:
true
fillMode
:
Image
.
PreserveAspectFit
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
|
Qt
.
RightButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
LeftButton
)
{
contextMenu
.
popup
();
}
// Experimental
if
(
mouse
.
button
==
Qt
.
RightButton
)
{
optionsDialog
.
open
();
}
//- Context Menu
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
RightButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
RightButton
)
{
contextMenu
.
popup
();
}
}
}
}
src/ui/flightdisplay/QGCFlightDisplay.h
View file @
2f7fe9dd
...
...
@@ -53,6 +53,9 @@ public:
ALTITUDEAMSL_CHANGED
};
/// @brief Invokes the Flight Display Options menu
void
showOptionsMenu
()
{
emit
showOptionsMenuChanged
();
}
Q_PROPERTY
(
float
roll
READ
roll
NOTIFY
rollChanged
)
Q_PROPERTY
(
float
pitch
READ
pitch
NOTIFY
pitchChanged
)
Q_PROPERTY
(
float
heading
READ
heading
NOTIFY
headingChanged
)
...
...
@@ -103,6 +106,7 @@ signals:
void
latitudeChanged
();
void
longitudeChanged
();
void
mavPresentChanged
();
void
showOptionsMenuChanged
();
private
slots
:
/** @brief Attitude from main autopilot / system state */
...
...
src/ui/toolbar/MainToolBar.cc
View file @
2f7fe9dd
...
...
@@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project
#include
"MainWindow.h"
#include
"UASMessageHandler.h"
#include
"UASMessageView.h"
#include
"QGCFlightDisplay.h"
MainToolBar
::
MainToolBar
(
QWidget
*
parent
)
:
QGCQmlWidgetHolder
(
parent
)
...
...
@@ -156,6 +157,14 @@ void MainToolBar::onFlyView()
MainWindow
::
instance
()
->
loadFlightView
();
}
void
MainToolBar
::
onFlyViewMenu
()
{
QGCFlightDisplay
*
fdsp
=
MainWindow
::
instance
()
->
getFlightDisplay
();
if
(
fdsp
)
{
fdsp
->
showOptionsMenu
();
}
}
void
MainToolBar
::
onAnalyzeView
()
{
setCurrentView
(
MainWindow
::
VIEW_ANALYZE
);
...
...
src/ui/toolbar/MainToolBar.h
View file @
2f7fe9dd
...
...
@@ -70,6 +70,7 @@ public:
Q_INVOKABLE
void
onSetupView
();
Q_INVOKABLE
void
onPlanView
();
Q_INVOKABLE
void
onFlyView
();
Q_INVOKABLE
void
onFlyViewMenu
();
Q_INVOKABLE
void
onAnalyzeView
();
Q_INVOKABLE
void
onConnect
(
QString
conf
);
Q_INVOKABLE
void
onDisconnect
(
QString
conf
);
...
...
@@ -102,6 +103,9 @@ public:
Q_PROPERTY
(
int
remoteRSSI
READ
remoteRSSI
NOTIFY
remoteRSSIChanged
)
Q_PROPERTY
(
int
telemetryRRSSI
READ
telemetryRRSSI
NOTIFY
telemetryRRSSIChanged
)
Q_PROPERTY
(
int
telemetryLRSSI
READ
telemetryLRSSI
NOTIFY
telemetryLRSSIChanged
)
Q_PROPERTY
(
bool
isAndroid
READ
isAndroid
CONSTANT
)
Q_PROPERTY
(
bool
isiOS
READ
isiOS
CONSTANT
)
Q_PROPERTY
(
bool
isMobile
READ
isMobile
CONSTANT
)
bool
mavPresent
()
{
return
_mav
!=
NULL
;
}
int
satelliteCount
()
{
return
_satelliteCount
;
}
...
...
@@ -109,6 +113,16 @@ public:
int
telemetryRRSSI
()
{
return
_telemetryRRSSI
;
}
int
telemetryLRSSI
()
{
return
_telemetryLRSSI
;
}
#if defined (__android__)
bool
isAndroid
()
{
return
true
;
}
bool
isiOS
()
{
return
false
;
}
bool
isMobile
()
{
return
true
;
}
#else
bool
isAndroid
()
{
return
false
;
}
bool
isiOS
()
{
return
false
;
}
bool
isMobile
()
{
return
false
;
}
#endif
void
setCurrentView
(
int
currentView
);
void
viewStateChanged
(
const
QString
&
key
,
bool
value
);
...
...
src/ui/toolbar/MainToolBar.qml
View file @
2f7fe9dd
...
...
@@ -43,7 +43,7 @@ Rectangle {
property
var
qgcPal
:
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
property
ScreenTools
__screenTools
:
ScreenTools
{
}
property
int
cellSpacerSize
:
getProportionalDimmension
(
4
)
property
int
cellSpacerSize
:
mainToolBar
.
isMobile
?
getProportionalDimmension
(
6
)
:
getProportionalDimmension
(
4
)
property
int
cellHeight
:
getProportionalDimmension
(
30
)
property
var
colorBlue
:
"
#1a6eaa
"
...
...
@@ -133,6 +133,52 @@ Rectangle {
return
(
mainToolBar
.
mavPresent
&&
mainToolBar
.
heartbeatTimeout
===
0
&&
mainToolBar
.
connectionCount
>
0
);
}
//-------------------------------------------------------------------------
//-- Main menu for Mobile Devices
Menu
{
id
:
maintMenu
ExclusiveGroup
{
id
:
mainMenuGroup
}
MenuItem
{
text
:
"
Vehicle Setup
"
checkable
:
true
exclusiveGroup
:
mainMenuGroup
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewSetup
)
onTriggered
:
{
mainToolBar
.
onSetupView
();
}
}
MenuItem
{
text
:
"
Plan View
"
checkable
:
true
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewPlan
)
exclusiveGroup
:
mainMenuGroup
onTriggered
:
{
mainToolBar
.
onPlanView
();
}
}
MenuItem
{
text
:
"
Flight View
"
checkable
:
true
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewFly
)
exclusiveGroup
:
mainMenuGroup
onTriggered
:
{
mainToolBar
.
onFlyView
();
}
}
//-- Flight View Context Menu
MenuItem
{
text
:
"
Flight View Options...
"
visible
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewFly
)
onTriggered
:
{
mainToolBar
.
onFlyViewMenu
();
}
}
}
Row
{
id
:
row1
height
:
cellHeight
...
...
@@ -141,11 +187,14 @@ Rectangle {
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.leftMargin
:
getProportionalDimmension
(
10
)
//---------------------------------------------------------------------
//-- Main menu for Non Mobile Devices (Chevron Buttons)
Row
{
id
:
row11
height
:
cellHeight
spacing
:
-
getProportionalDimmension
(
12
)
anchors.verticalCenter
:
parent
.
verticalCenter
visible
:
!
mainToolBar
.
isMobile
Connections
{
target
:
__screenTools
onRepaintRequestedChanged
:
{
...
...
@@ -216,12 +265,50 @@ Rectangle {
}
//---------------------------------------------------------------------
//-- Indicators
Row
{
id
:
row12
height
:
cellHeight
spacing
:
cellSpacerSize
anchors.verticalCenter
:
parent
.
verticalCenter
//-- "Hamburger" menu for Mobile Devices
Item
{
id
:
actionButton
visible
:
mainToolBar
.
isMobile
height
:
cellHeight
width
:
cellHeight
Image
{
id
:
buttomImg
anchors.fill
:
parent
source
:
"
/qml/buttonMore.svg
"
mipmap
:
true
smooth
:
true
antialiasing
:
true
fillMode
:
Image
.
PreserveAspectFit
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
LeftButton
)
{
maintMenu
.
popup
();
}
}
}
}
//-- Separator if Hamburger menu is visible
Rectangle
{
visible
:
actionButton
.
visible
height
:
cellHeight
width
:
cellHeight
color
:
"
#00000000
"
anchors.verticalCenter
:
parent
.
verticalCenter
}
Rectangle
{
id
:
messages
width
:
(
mainToolBar
.
messageCount
>
99
)
?
getProportionalDimmension
(
65
)
:
getProportionalDimmension
(
60
)
...
...
@@ -462,7 +549,7 @@ Rectangle {
QGCLabel
{
id
:
batteryText
text
:
mainToolBar
.
batteryVoltage
.
toFixed
(
1
)
+
'
V
'
;
font.pointSize
:
__screenTools
.
fontPointFactor
*
(
1
2
);
font.pointSize
:
__screenTools
.
fontPointFactor
*
(
1
1
);
font.weight
:
Font
.
DemiBold
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.right
:
parent
.
right
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment