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
3387a14d
Commit
3387a14d
authored
Feb 22, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for SettingsFact::visible
parent
a56a153d
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 @
3387a14d
...
@@ -23,6 +23,7 @@ SettingsFact::SettingsFact(QObject* parent)
...
@@ -23,6 +23,7 @@ SettingsFact::SettingsFact(QObject* parent)
SettingsFact
::
SettingsFact
(
QString
settingGroup
,
FactMetaData
*
metaData
,
QObject
*
parent
)
SettingsFact
::
SettingsFact
(
QString
settingGroup
,
FactMetaData
*
metaData
,
QObject
*
parent
)
:
Fact
(
0
,
metaData
->
name
(),
metaData
->
type
(),
parent
)
:
Fact
(
0
,
metaData
->
name
(),
metaData
->
type
(),
parent
)
,
_settingGroup
(
settingGroup
)
,
_settingGroup
(
settingGroup
)
,
_visible
(
true
)
{
{
QSettings
settings
;
QSettings
settings
;
...
@@ -31,7 +32,7 @@ SettingsFact::SettingsFact(QString settingGroup, FactMetaData* metaData, QObject
...
@@ -31,7 +32,7 @@ SettingsFact::SettingsFact(QString settingGroup, FactMetaData* metaData, QObject
}
}
// Allow core plugin a chance to override the default value
// 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
);
setMetaData
(
metaData
);
QVariant
typedValue
;
QVariant
typedValue
;
...
...
src/FactSystem/SettingsFact.h
View file @
3387a14d
...
@@ -28,11 +28,14 @@ public:
...
@@ -28,11 +28,14 @@ public:
const
SettingsFact
&
operator
=
(
const
SettingsFact
&
other
);
const
SettingsFact
&
operator
=
(
const
SettingsFact
&
other
);
Q_PROPERTY
(
bool
visible
MEMBER
_visible
CONSTANT
)
private
slots
:
private
slots
:
void
_rawValueChanged
(
QVariant
value
);
void
_rawValueChanged
(
QVariant
value
);
private:
private:
QString
_settingGroup
;
QString
_settingGroup
;
bool
_visible
;
};
};
#endif
#endif
src/api/QGCCorePlugin.cc
View file @
3387a14d
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include "QGCCorePlugin.h"
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
#include "QGCOptions.h"
#include "QGCSettings.h"
#include "QGCSettings.h"
#include "FactMetaData.h"
#include <QtQml>
#include <QtQml>
#include <QQmlEngine>
#include <QQmlEngine>
...
@@ -140,13 +141,6 @@ QGCOptions* QGCCorePlugin::options()
...
@@ -140,13 +141,6 @@ QGCOptions* QGCCorePlugin::options()
return
_p
->
defaultOptions
;
return
_p
->
defaultOptions
;
}
}
QVariant
QGCCorePlugin
::
overrideSettingsDefault
(
QString
name
,
QVariant
defaultValue
)
{
Q_UNUSED
(
name
);
// No overrides for base plugin
return
defaultValue
;
}
QVariantList
&
QGCCorePlugin
::
toolBarIndicators
()
QVariantList
&
QGCCorePlugin
::
toolBarIndicators
()
{
{
if
(
_p
->
toolBarIndicatorList
.
size
()
==
0
)
{
if
(
_p
->
toolBarIndicatorList
.
size
()
==
0
)
{
...
@@ -167,3 +161,9 @@ bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
...
@@ -167,3 +161,9 @@ bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
// Always show all
// Always show all
return
true
;
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 @
3387a14d
...
@@ -24,6 +24,7 @@ class QGCApplication;
...
@@ -24,6 +24,7 @@ class QGCApplication;
class
QGCOptions
;
class
QGCOptions
;
class
QGCSettings
;
class
QGCSettings
;
class
QGCCorePlugin_p
;
class
QGCCorePlugin_p
;
class
FactMetaData
;
class
QGCCorePlugin
:
public
QGCTool
class
QGCCorePlugin
:
public
QGCTool
{
{
...
@@ -58,11 +59,10 @@ public:
...
@@ -58,11 +59,10 @@ public:
/// @return true: Show settings ui, false: Hide settings ui
/// @return true: Show settings ui, false: Hide settings ui
virtual
bool
overrideSettingsGroupVisibility
(
QString
name
);
virtual
bool
overrideSettingsGroupVisibility
(
QString
name
);
/// Allows the core plugin to override the default value for the specified setting
/// Allows the core plugin to override the setting meta data before the setting fact is created.
/// @param name - Setting name
/// @param metaData - MetaData for setting fact
/// @param defaultValue - Standard default value for setting
/// @return true: Setting should be visible in ui, false: Setting should not be shown in ui
/// @return New default value for setting, if no override just return passed in defaultValue
virtual
bool
adjustSettingMetaData
(
FactMetaData
&
metaData
);
virtual
QVariant
overrideSettingsDefault
(
QString
name
,
QVariant
defaultValue
);
// Override from QGCTool
// Override from QGCTool
void
setToolbox
(
QGCToolbox
*
toolbox
);
void
setToolbox
(
QGCToolbox
*
toolbox
);
...
...
src/ui/preferences/GeneralSettings.qml
View file @
3387a14d
...
@@ -54,6 +54,7 @@ QGCView {
...
@@ -54,6 +54,7 @@ QGCView {
width
:
qgcView
.
width
width
:
qgcView
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- Units
//-- Units
Item
{
Item
{
...
@@ -79,50 +80,33 @@ QGCView {
...
@@ -79,50 +80,33 @@ QGCView {
id
:
unitsCol
id
:
unitsCol
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.centerIn
:
parent
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
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
modelData
.
visible
QGCLabel
{
QGCLabel
{
width
:
_labelWidth
width
:
_labelWidth
anchors.baseline
:
distanceUnitsCombo
.
baseline
anchors.baseline
:
factCombo
.
baseline
text
:
qsTr
(
"
Distance:
"
)
text
:
unitsRepeater
.
names
[
index
]
}
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:
"
)
}
}
FactComboBox
{
FactComboBox
{
id
:
areaUnits
Combo
id
:
fact
Combo
width
:
_editFieldWidth
width
:
_editFieldWidth
fact
:
QGroundControl
.
settingsManager
.
unitsSettings
.
areaUnits
fact
:
modelData
indexModel
:
false
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
//-- Miscellanous
Item
{
Item
{
...
@@ -395,6 +379,7 @@ QGCView {
...
@@ -395,6 +379,7 @@ QGCView {
}
}
}
}
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- Autoconnect settings
//-- Autoconnect settings
Item
{
Item
{
...
@@ -416,44 +401,37 @@ QGCView {
...
@@ -416,44 +401,37 @@ QGCView {
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
visible
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
visible
visible
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
visible
Column
{
Column
{
id
:
autoConnectCol
id
:
autoConnectCol
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.centerIn
:
parent
anchors.centerIn
:
parent
//-----------------------------------------------------------------
//-- Autoconnect settings
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
2
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
{
FactCheckBox
{
text
:
qsTr
(
"
Pixhawk
"
)
text
:
autoConnectRepeater
.
names
[
index
]
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPixhawk
fact
:
modelData
visible
:
!
ScreenTools
.
isiOS
visible
:
!
ScreenTools
.
isiOS
&&
modelData
.
visible
}
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
}
}
FactCheckBox
{
text
:
qsTr
(
"
RTK GPS
"
)
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectRTKGPS
}
}
}
}
}
}
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- Video Source
//-- Video Source
Item
{
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