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
86fd4a29
Commit
86fd4a29
authored
Mar 04, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Completed Tool Bar settings in Preferences Dialog
parent
cef33ce0
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
452 additions
and
242 deletions
+452
-242
MainWindow.h
src/ui/MainWindow.h
+1
-0
SettingsDialog.cc
src/ui/SettingsDialog.cc
+46
-14
SettingsDialog.h
src/ui/SettingsDialog.h
+5
-0
SettingsDialog.ui
src/ui/SettingsDialog.ui
+332
-223
MainToolBar.cc
src/ui/toolbar/MainToolBar.cc
+40
-1
MainToolBar.h
src/ui/toolbar/MainToolBar.h
+24
-0
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+4
-4
No files found.
src/ui/MainWindow.h
View file @
86fd4a29
...
...
@@ -131,6 +131,7 @@ public:
MainToolBar
*
getMainToolBar
(
void
)
{
return
_mainToolBar
;
}
#endif
MainToolBar
*
getToolBar
()
{
return
_mainToolBar
;
}
public
slots
:
/** @brief Show the application settings */
...
...
src/ui/SettingsDialog.cc
View file @
86fd4a29
...
...
@@ -37,6 +37,7 @@
#include "QGCApplication.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "MainToolBar.h"
SettingsDialog
::
SettingsDialog
(
JoystickInput
*
joystick
,
QWidget
*
parent
,
int
showTab
,
Qt
::
WindowFlags
flags
)
:
QDialog
(
parent
,
flags
),
...
...
@@ -63,6 +64,14 @@ _ui(new Ui::SettingsDialog)
this
->
window
()
->
setWindowTitle
(
tr
(
"QGroundControl Settings"
));
// Tool Bar Preferences
QSettings
settings
;
settings
.
beginGroup
(
TOOL_BAR_SETTINGS_GROUP
);
_ui
->
showBattery
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_BATTERY
,
true
).
toBool
());
_ui
->
showGPS
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_GPS
,
true
).
toBool
());
_ui
->
showMav
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_MAV
,
true
).
toBool
());
_ui
->
showMessages
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_MESSAGES
,
true
).
toBool
());
settings
.
endGroup
();
// Audio preferences
_ui
->
audioMuteCheckBox
->
setChecked
(
GAudioOutput
::
instance
()
->
isMuted
());
connect
(
_ui
->
audioMuteCheckBox
,
SIGNAL
(
toggled
(
bool
)),
GAudioOutput
::
instance
(),
SLOT
(
mute
(
bool
)));
...
...
@@ -115,10 +124,11 @@ void SettingsDialog::styleChanged(int index)
void
SettingsDialog
::
_deleteSettingsToggled
(
bool
checked
)
{
if
(
checked
){
QGCMessageBox
::
StandardButton
answer
=
QGCMessageBox
::
question
(
tr
(
"Delete Settings"
),
tr
(
"All saved settings will be deleted the next time you start QGroundControl. Is this really what you want?"
),
QMessageBox
::
Yes
|
QMessageBox
::
No
,
QMessageBox
::
No
);
QGCMessageBox
::
StandardButton
answer
=
QGCMessageBox
::
question
(
tr
(
"Delete Settings"
),
tr
(
"All saved settings will be deleted the next time you start QGroundControl. Is this really what you want?"
),
QMessageBox
::
Yes
|
QMessageBox
::
No
,
QMessageBox
::
No
);
if
(
answer
==
QMessageBox
::
Yes
)
{
qgcApp
()
->
deleteAllSettingsNextBoot
();
}
else
{
...
...
@@ -133,21 +143,17 @@ void SettingsDialog::_deleteSettingsToggled(bool checked)
void
SettingsDialog
::
_validateBeforeClose
(
void
)
{
QGCApplication
*
app
=
qgcApp
();
// Validate the saved file location
QString
saveLocation
=
_ui
->
savedFilesLocation
->
text
();
if
(
!
app
->
validatePossibleSavedFilesLocation
(
saveLocation
))
{
QGCMessageBox
::
warning
(
tr
(
"Bad save location"
),
tr
(
"The location to save files to is invalid, or cannot be written to. Please provide a valid directory."
));
QGCMessageBox
::
warning
(
tr
(
"Invalid Save Location"
),
tr
(
"The location to save files is invalid, or cannot be written to. Please provide a valid directory."
));
return
;
}
// Locations is valid, save
app
->
setSavedFilesLocation
(
saveLocation
);
qgcApp
()
->
setPromptFlightDataSave
(
_ui
->
promptFlightDataSave
->
checkState
()
==
Qt
::
Checked
);
// Close dialog
accept
();
}
...
...
@@ -155,10 +161,36 @@ void SettingsDialog::_validateBeforeClose(void)
/// @brief Displays a directory picker dialog to allow the user to select a saved file location
void
SettingsDialog
::
_selectSavedFilesDirectory
(
void
)
{
QString
newLocation
=
QGCFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Select the directory where you want to save files to."
),
_ui
->
savedFilesLocation
->
text
());
QString
newLocation
=
QGCFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Select the directory where you want to save files to."
),
_ui
->
savedFilesLocation
->
text
());
if
(
!
newLocation
.
isEmpty
())
{
_ui
->
savedFilesLocation
->
setText
(
newLocation
);
}
// TODO:
// Once a directory is selected, we need to display the various subdirectories used underneath:
// * Flight data logs
// * Parameters
}
void
SettingsDialog
::
on_showGPS_clicked
(
bool
checked
)
{
_mainWindow
->
getToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_GPS
,
checked
);
}
void
SettingsDialog
::
on_showBattery_clicked
(
bool
checked
)
{
_mainWindow
->
getToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_BATTERY
,
checked
);
}
void
SettingsDialog
::
on_showMessages_clicked
(
bool
checked
)
{
_mainWindow
->
getToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_MESSAGES
,
checked
);
}
void
SettingsDialog
::
on_showMav_clicked
(
bool
checked
)
{
_mainWindow
->
getToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_MAV
,
checked
);
}
src/ui/SettingsDialog.h
View file @
86fd4a29
...
...
@@ -56,6 +56,11 @@ private slots:
void
_selectSavedFilesDirectory
(
void
);
void
_validateBeforeClose
(
void
);
void
on_showGPS_clicked
(
bool
checked
);
void
on_showBattery_clicked
(
bool
checked
);
void
on_showMessages_clicked
(
bool
checked
);
void
on_showMav_clicked
(
bool
checked
);
private:
MainWindow
*
_mainWindow
;
Ui
::
SettingsDialog
*
_ui
;
...
...
src/ui/SettingsDialog.ui
View file @
86fd4a29
This diff is collapsed.
Click to expand it.
src/ui/toolbar/MainToolBar.cc
View file @
86fd4a29
...
...
@@ -57,6 +57,10 @@ MainToolBar::MainToolBar(QWidget* parent)
,
_satelliteCount
(
-
1
)
,
_dotsPerInch
(
96.0
)
// Default to Windows as it's more likely not to report below
,
_satelliteLock
(
0
)
,
_showGPS
(
true
)
,
_showMav
(
true
)
,
_showMessages
(
true
)
,
_showBattery
(
true
)
,
_rollDownMessages
(
0
)
{
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
...
...
@@ -76,7 +80,16 @@ MainToolBar::MainToolBar(QWidget* parent)
}
else
{
qWarning
()
<<
"System not reporting logical DPI, which is used to compute the appropriate font size. The default being used is 96dpi. If the text within buttons and UI elements are too big or too small, that's the reason."
;
}
// Give the QML code a way to reach us
// Tool Bar Preferences
QSettings
settings
;
settings
.
beginGroup
(
TOOL_BAR_SETTINGS_GROUP
);
_showBattery
=
settings
.
value
(
TOOL_BAR_SHOW_BATTERY
,
true
).
toBool
();
_showGPS
=
settings
.
value
(
TOOL_BAR_SHOW_GPS
,
true
).
toBool
();
_showMav
=
settings
.
value
(
TOOL_BAR_SHOW_MAV
,
true
).
toBool
();
_showMessages
=
settings
.
value
(
TOOL_BAR_SHOW_MESSAGES
,
true
).
toBool
();
settings
.
endGroup
();
setContextPropertyObject
(
"mainToolBar"
,
this
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/MainToolBar.qml"
));
setVisible
(
true
);
...
...
@@ -97,6 +110,32 @@ MainToolBar::~MainToolBar()
}
void
MainToolBar
::
_setToolBarState
(
const
QString
&
key
,
bool
value
)
{
QSettings
settings
;
settings
.
beginGroup
(
TOOL_BAR_SETTINGS_GROUP
);
settings
.
setValue
(
key
,
value
);
settings
.
endGroup
();
if
(
key
==
TOOL_BAR_SHOW_GPS
)
{
_showGPS
=
value
;
emit
showGPSChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_MAV
)
{
_showMav
=
value
;
emit
showMavChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_BATTERY
)
{
_showBattery
=
value
;
emit
showBatteryChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_MESSAGES
)
{
_showMessages
=
value
;
emit
showMessagesChanged
(
value
);
}
}
void
MainToolBar
::
viewStateChanged
(
const
QString
&
key
,
bool
value
)
{
_setToolBarState
(
key
,
value
);
}
void
MainToolBar
::
onSetupView
()
{
setCurrentView
(
ViewSetup
);
...
...
src/ui/toolbar/MainToolBar.h
View file @
86fd4a29
...
...
@@ -32,6 +32,12 @@ This file is part of the QGROUNDCONTROL project
#include "QGCQmlWidgetHolder.h"
#define TOOL_BAR_SETTINGS_GROUP "TOOLBAR_SETTINGS_GROUP"
#define TOOL_BAR_SHOW_BATTERY "ShowBattery"
#define TOOL_BAR_SHOW_GPS "ShowGPS"
#define TOOL_BAR_SHOW_MAV "ShowMav"
#define TOOL_BAR_SHOW_MESSAGES "ShowMessages"
class
UASInterface
;
class
UASMessage
;
class
UASMessageViewRollDown
;
...
...
@@ -88,6 +94,10 @@ public:
Q_PROPERTY
(
QString
currentState
READ
currentState
NOTIFY
currentStateChanged
)
Q_PROPERTY
(
double
dotsPerInch
READ
dotsPerInch
NOTIFY
dotsPerInchChanged
)
Q_PROPERTY
(
int
satelliteLock
READ
satelliteLock
NOTIFY
satelliteLockChanged
)
Q_PROPERTY
(
bool
showGPS
READ
showGPS
NOTIFY
showGPSChanged
)
Q_PROPERTY
(
bool
showMav
READ
showMav
NOTIFY
showMavChanged
)
Q_PROPERTY
(
bool
showMessages
READ
showMessages
NOTIFY
showMessagesChanged
)
Q_PROPERTY
(
bool
showBattery
READ
showBattery
NOTIFY
showBatteryChanged
)
int
connectionCount
()
{
return
_connectionCount
;
}
double
batteryVoltage
()
{
return
_batteryVoltage
;
}
...
...
@@ -108,8 +118,13 @@ public:
QString
currentState
()
{
return
_currentState
;
}
double
dotsPerInch
()
{
return
_dotsPerInch
;
}
int
satelliteLock
()
{
return
_satelliteLock
;
}
bool
showGPS
()
{
return
_showGPS
;
}
bool
showMav
()
{
return
_showMav
;
}
bool
showMessages
()
{
return
_showMessages
;
}
bool
showBattery
()
{
return
_showBattery
;
}
void
setCurrentView
(
int
currentView
);
void
viewStateChanged
(
const
QString
&
key
,
bool
value
);
signals:
void
connectionCountChanged
(
int
count
);
...
...
@@ -131,6 +146,10 @@ signals:
void
currentStateChanged
(
QString
state
);
void
dotsPerInchChanged
();
void
satelliteLockChanged
(
int
lock
);
void
showGPSChanged
(
bool
value
);
void
showMavChanged
(
bool
value
);
void
showMessagesChanged
(
bool
value
);
void
showBatteryChanged
(
bool
value
);
private
slots
:
void
_setActiveUAS
(
UASInterface
*
active
);
...
...
@@ -154,6 +173,7 @@ private slots:
private:
void
_updateConnection
(
LinkInterface
*
disconnectedLink
=
NULL
);
void
_setToolBarState
(
const
QString
&
key
,
bool
value
);
private:
UASInterface
*
_mav
;
...
...
@@ -183,6 +203,10 @@ private:
QStringList
_connectedList
;
qreal
_dotsPerInch
;
int
_satelliteLock
;
bool
_showGPS
;
bool
_showMav
;
bool
_showMessages
;
bool
_showBattery
;
UASMessageViewRollDown
*
_rollDownMessages
;
};
...
...
src/ui/toolbar/MainToolBar.qml
View file @
86fd4a29
...
...
@@ -190,7 +190,7 @@ Rectangle {
id
:
messages
width
:
(
mainToolBar
.
newMessageCount
>
99
)
?
70
:
60
height
:
cellHeight
visible
:
(
mainToolBar
.
connectionCount
>
0
)
visible
:
(
mainToolBar
.
connectionCount
>
0
)
&&
(
mainToolBar
.
showMessages
)
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getMessageColor
()
radius
:
cellRadius
...
...
@@ -266,7 +266,7 @@ Rectangle {
id
:
mavIcon
width
:
cellHeight
height
:
cellHeight
visible
:
showMavStatus
()
visible
:
showMavStatus
()
&&
(
mainToolBar
.
showMav
)
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
colorBlue
radius
:
cellRadius
...
...
@@ -285,7 +285,7 @@ Rectangle {
id
:
satelitte
width
:
60
height
:
cellHeight
visible
:
showMavStatus
()
;
visible
:
showMavStatus
()
&&
(
mainToolBar
.
showGPS
)
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getSatelliteColor
();
radius
:
cellRadius
...
...
@@ -320,7 +320,7 @@ Rectangle {
id
:
battery
width
:
80
height
:
cellHeight
visible
:
showMavStatus
()
visible
:
showMavStatus
()
&&
(
mainToolBar
.
showBattery
)
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
(
mainToolBar
.
batteryPercent
>
40.0
||
mainToolBar
.
batteryPercent
<
0.01
)
?
colorGreen
:
colorRed
radius
:
cellRadius
...
...
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