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
76984650
Commit
76984650
authored
Feb 23, 2017
by
Don Gagne
Committed by
GitHub
Feb 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4602 from DonLakeFlyer/SettingsVisibility
Add support for SettingsFact::visible
parents
354eeb8f
3387a14d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
82 deletions
+64
-82
SettingsFact.cc
src/FactSystem/SettingsFact.cc
+2
-1
SettingsFact.h
src/FactSystem/SettingsFact.h
+3
-0
QGCCorePlugin.cc
src/api/QGCCorePlugin.cc
+8
-8
QGCCorePlugin.h
src/api/QGCCorePlugin.h
+5
-5
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+46
-68
No files found.
src/FactSystem/SettingsFact.cc
View file @
76984650
...
...
@@ -23,6 +23,7 @@ SettingsFact::SettingsFact(QObject* parent)
SettingsFact
::
SettingsFact
(
QString
settingGroup
,
FactMetaData
*
metaData
,
QObject
*
parent
)
:
Fact
(
0
,
metaData
->
name
(),
metaData
->
type
(),
parent
)
,
_settingGroup
(
settingGroup
)
,
_visible
(
true
)
{
QSettings
settings
;
...
...
@@ -31,7 +32,7 @@ SettingsFact::SettingsFact(QString settingGroup, FactMetaData* metaData, QObject
}
// Allow core plugin a chance to override the default value
metaData
->
setRawDefaultValue
(
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
overrideSettingsDefault
(
metaData
->
name
(),
metaData
->
rawDefaultValue
())
);
_visible
=
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
adjustSettingMetaData
(
*
metaData
);
setMetaData
(
metaData
);
QVariant
typedValue
;
...
...
src/FactSystem/SettingsFact.h
View file @
76984650
...
...
@@ -28,11 +28,14 @@ public:
const
SettingsFact
&
operator
=
(
const
SettingsFact
&
other
);
Q_PROPERTY
(
bool
visible
MEMBER
_visible
CONSTANT
)
private
slots
:
void
_rawValueChanged
(
QVariant
value
);
private:
QString
_settingGroup
;
bool
_visible
;
};
#endif
src/api/QGCCorePlugin.cc
View file @
76984650
...
...
@@ -10,6 +10,7 @@
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
#include "QGCSettings.h"
#include "FactMetaData.h"
#include <QtQml>
#include <QQmlEngine>
...
...
@@ -140,13 +141,6 @@ QGCOptions* QGCCorePlugin::options()
return
_p
->
defaultOptions
;
}
QVariant
QGCCorePlugin
::
overrideSettingsDefault
(
QString
name
,
QVariant
defaultValue
)
{
Q_UNUSED
(
name
);
// No overrides for base plugin
return
defaultValue
;
}
QVariantList
&
QGCCorePlugin
::
toolBarIndicators
()
{
if
(
_p
->
toolBarIndicatorList
.
size
()
==
0
)
{
...
...
@@ -167,3 +161,9 @@ bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
// Always show all
return
true
;
}
bool
QGCCorePlugin
::
adjustSettingMetaData
(
FactMetaData
&
metaData
)
{
Q_UNUSED
(
metaData
);
// No mods to standard meta data
return
true
;
// Show setting in ui
}
src/api/QGCCorePlugin.h
View file @
76984650
...
...
@@ -24,6 +24,7 @@ class QGCApplication;
class
QGCOptions
;
class
QGCSettings
;
class
QGCCorePlugin_p
;
class
FactMetaData
;
class
QGCCorePlugin
:
public
QGCTool
{
...
...
@@ -58,11 +59,10 @@ public:
/// @return true: Show settings ui, false: Hide settings ui
virtual
bool
overrideSettingsGroupVisibility
(
QString
name
);
/// Allows the core plugin to override the default value for the specified setting
/// @param name - Setting name
/// @param defaultValue - Standard default value for setting
/// @return New default value for setting, if no override just return passed in defaultValue
virtual
QVariant
overrideSettingsDefault
(
QString
name
,
QVariant
defaultValue
);
/// Allows the core plugin to override the setting meta data before the setting fact is created.
/// @param metaData - MetaData for setting fact
/// @return true: Setting should be visible in ui, false: Setting should not be shown in ui
virtual
bool
adjustSettingMetaData
(
FactMetaData
&
metaData
);
// Override from QGCTool
void
setToolbox
(
QGCToolbox
*
toolbox
);
...
...
src/ui/preferences/GeneralSettings.qml
View file @
76984650
...
...
@@ -54,6 +54,7 @@ QGCView {
width
:
qgcView
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
//-----------------------------------------------------------------
//-- Units
Item
{
...
...
@@ -79,50 +80,33 @@ QGCView {
id
:
unitsCol
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.centerIn
:
parent
Repeater
{
id
:
unitsRepeater
model
:
[
QGroundControl
.
settingsManager
.
unitsSettings
.
distanceUnits
,
QGroundControl
.
settingsManager
.
unitsSettings
.
areaUnits
,
QGroundControl
.
settingsManager
.
unitsSettings
.
speedUnits
]
property
var
names
:
[
qsTr
(
"
Distance:
"
),
qsTr
(
"
Area:
"
),
qsTr
(
"
Speed:
"
)
]
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
modelData
.
visible
QGCLabel
{
width
:
_labelWidth
anchors.baseline
:
distanceUnitsCombo
.
baseline
text
:
qsTr
(
"
Distance:
"
)
}
FactComboBox
{
id
:
distanceUnitsCombo
width
:
_editFieldWidth
fact
:
QGroundControl
.
settingsManager
.
unitsSettings
.
distanceUnits
indexModel
:
false
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
width
:
_labelWidth
anchors.baseline
:
areaUnitsCombo
.
baseline
text
:
qsTr
(
"
Area:
"
)
anchors.baseline
:
factCombo
.
baseline
text
:
unitsRepeater
.
names
[
index
]
}
FactComboBox
{
id
:
areaUnits
Combo
id
:
fact
Combo
width
:
_editFieldWidth
fact
:
QGroundControl
.
settingsManager
.
unitsSettings
.
areaUnits
fact
:
modelData
indexModel
:
false
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
width
:
_labelWidth
anchors.baseline
:
speedUnitsCombo
.
baseline
text
:
qsTr
(
"
Speed:
"
)
}
FactComboBox
{
id
:
speedUnitsCombo
width
:
_editFieldWidth
fact
:
QGroundControl
.
settingsManager
.
unitsSettings
.
speedUnits
indexModel
:
false
}
}
}
}
//-----------------------------------------------------------------
//-- Miscellanous
Item
{
...
...
@@ -395,6 +379,7 @@ QGCView {
}
}
}
//-----------------------------------------------------------------
//-- Autoconnect settings
Item
{
...
...
@@ -416,44 +401,37 @@ QGCView {
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
visible
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
visible
Column
{
id
:
autoConnectCol
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.centerIn
:
parent
//-----------------------------------------------------------------
//-- Autoconnect settings
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
2
Repeater
{
id
:
autoConnectRepeater
model
:
[
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPixhawk
,
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectSiKRadio
,
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPX4Flow
,
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectLibrePilot
,
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectUDP
,
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectRTKGPS
]
property
var
names
:
[
qsTr
(
"
Pixhawk
"
),
qsTr
(
"
SiK Radio
"
),
qsTr
(
"
PX4 Flow
"
),
qsTr
(
"
LibrePilot
"
),
qsTr
(
"
UDP
"
),
qsTr
(
"
RTK GPS
"
)
]
FactCheckBox
{
text
:
qsTr
(
"
Pixhawk
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPixhawk
visible
:
!
ScreenTools
.
isiOS
}
FactCheckBox
{
text
:
qsTr
(
"
SiK Radio
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectSiKRadio
visible
:
!
ScreenTools
.
isiOS
}
FactCheckBox
{
text
:
qsTr
(
"
PX4 Flow
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPX4Flow
visible
:
!
ScreenTools
.
isiOS
}
FactCheckBox
{
text
:
qsTr
(
"
LibrePilot
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectLibrePilot
}
FactCheckBox
{
text
:
qsTr
(
"
UDP
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectUDP
text
:
autoConnectRepeater
.
names
[
index
]
fact
:
modelData
visible
:
!
ScreenTools
.
isiOS
&&
modelData
.
visible
}
FactCheckBox
{
text
:
qsTr
(
"
RTK GPS
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectRTKGPS
}
}
}
}
//-----------------------------------------------------------------
//-- Video Source
Item
{
...
...
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