Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
bcb6a113
Commit
bcb6a113
authored
Apr 28, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mobile Menu Bar
parent
29e114fd
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
39 deletions
+148
-39
QGCCommon.pri
QGCCommon.pri
+3
-2
QGCFileDialog.cc
src/QGCFileDialog.cc
+3
-1
MainWindow.cc
src/ui/MainWindow.cc
+6
-2
MainWindow.h
src/ui/MainWindow.h
+5
-0
FlightDisplay.qml
src/ui/flightdisplay/FlightDisplay.qml
+15
-32
QGCFlightDisplay.h
src/ui/flightdisplay/QGCFlightDisplay.h
+4
-0
MainToolBar.cc
src/ui/toolbar/MainToolBar.cc
+9
-0
MainToolBar.h
src/ui/toolbar/MainToolBar.h
+14
-0
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+89
-2
No files found.
QGCCommon.pri
View file @
bcb6a113
...
...
@@ -33,6 +33,8 @@ linux {
} else : android-g++ {
message("Android build")
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 @
bcb6a113
...
...
@@ -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 @
bcb6a113
...
...
@@ -181,10 +181,14 @@ 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
...
...
src/ui/MainWindow.h
View file @
bcb6a113
...
...
@@ -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
...
...
@@ -126,6 +128,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
;
}
//! Returns the font point size factor
...
...
src/ui/flightdisplay/FlightDisplay.qml
View file @
bcb6a113
...
...
@@ -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
}
//- Context Menu
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
|
Qt
.
RightButton
acceptedButtons
:
Qt
.
RightButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
LeftButton
)
{
contextMenu
.
popup
();
}
// Experimental
if
(
mouse
.
button
==
Qt
.
RightButton
)
{
optionsDialog
.
open
();
}
contextMenu
.
popup
();
}
}
}
}
src/ui/flightdisplay/QGCFlightDisplay.h
View file @
bcb6a113
...
...
@@ -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 @
bcb6a113
...
...
@@ -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 @
bcb6a113
...
...
@@ -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 @
bcb6a113
...
...
@@ -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
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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