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
Hide 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)
...
@@ -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 @
76984650
...
@@ -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 @
76984650
...
@@ -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
)
{
...
@@ -163,7 +157,13 @@ QVariantList& QGCCorePlugin::toolBarIndicators()
...
@@ -163,7 +157,13 @@ QVariantList& QGCCorePlugin::toolBarIndicators()
bool
QGCCorePlugin
::
overrideSettingsGroupVisibility
(
QString
name
)
bool
QGCCorePlugin
::
overrideSettingsGroupVisibility
(
QString
name
)
{
{
Q_UNUSED
(
name
);
Q_UNUSED
(
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 @
76984650
...
@@ -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 @
76984650
...
@@ -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
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
Repeater
{
QGCLabel
{
id
:
unitsRepeater
width
:
_labelWidth
model
:
[
QGroundControl
.
settingsManager
.
unitsSettings
.
distanceUnits
,
QGroundControl
.
settingsManager
.
unitsSettings
.
areaUnits
,
QGroundControl
.
settingsManager
.
unitsSettings
.
speedUnits
]
anchors.baseline
:
distanceUnitsCombo
.
baseline
text
:
qsTr
(
"
Distance:
"
)
property
var
names
:
[
qsTr
(
"
Distance:
"
),
qsTr
(
"
Area:
"
),
qsTr
(
"
Speed:
"
)
]
}
FactComboBox
{
Row
{
id
:
distanceUnitsCombo
spacing
:
ScreenTools
.
defaultFontPixelWidth
width
:
_editFieldWidth
visible
:
modelData
.
visible
fact
:
QGroundControl
.
settingsManager
.
unitsSettings
.
distanceUnits
indexModel
:
false
QGCLabel
{
}
width
:
_labelWidth
}
anchors.baseline
:
factCombo
.
baseline
Row
{
text
:
unitsRepeater
.
names
[
index
]
spacing
:
ScreenTools
.
defaultFontPixelWidth
}
QGCLabel
{
FactComboBox
{
width
:
_labelWidth
id
:
factCombo
anchors.baseline
:
areaUnitsCombo
.
baseline
width
:
_editFieldWidth
text
:
qsTr
(
"
Area:
"
)
fact
:
modelData
}
indexModel
:
false
FactComboBox
{
}
id
:
areaUnitsCombo
width
:
_editFieldWidth
fact
:
QGroundControl
.
settingsManager
.
unitsSettings
.
areaUnits
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
FactCheckBox
{
text
:
qsTr
(
"
Pixhawk
"
)
Repeater
{
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPixhawk
id
:
autoConnectRepeater
visible
:
!
ScreenTools
.
isiOS
model
:
[
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPixhawk
,
}
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectSiKRadio
,
FactCheckBox
{
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPX4Flow
,
text
:
qsTr
(
"
SiK Radio
"
)
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectLibrePilot
,
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectSiKRadio
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectUDP
,
visible
:
!
ScreenTools
.
isiOS
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectRTKGPS
}
]
FactCheckBox
{
text
:
qsTr
(
"
PX4 Flow
"
)
property
var
names
:
[
qsTr
(
"
Pixhawk
"
),
qsTr
(
"
SiK Radio
"
),
qsTr
(
"
PX4 Flow
"
),
qsTr
(
"
LibrePilot
"
),
qsTr
(
"
UDP
"
),
qsTr
(
"
RTK GPS
"
)
]
fact
:
QGroundControl
.
settingsManager
.
autoConnectSettings
.
autoConnectPX4Flow
visible
:
!
ScreenTools
.
isiOS
FactCheckBox
{
}
text
:
autoConnectRepeater
.
names
[
index
]
FactCheckBox
{
fact
:
modelData
text
:
qsTr
(
"
LibrePilot
"
)
visible
:
!
ScreenTools
.
isiOS
&&
modelData
.
visible
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