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
c6cd2cc0
Commit
c6cd2cc0
authored
May 28, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added save/load settings to UASQuickView, and commented header file
parent
93b786aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
39 deletions
+49
-39
UASQuickView.cc
src/ui/uas/UASQuickView.cc
+33
-39
UASQuickView.h
src/ui/uas/UASQuickView.h
+16
-0
No files found.
src/ui/uas/UASQuickView.cc
View file @
c6cd2cc0
...
...
@@ -75,21 +75,8 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent)
ui.verticalLayout->addWidget(item);
uasPropertyToLabelMap["distToWaypoint"] = item;
}*/
QSettings
settings
;
int
size
=
settings
.
beginReadArray
(
"UAS_QUICK_VIEW_ITEMS"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
settings
.
setArrayIndex
(
i
);
QString
nameval
=
settings
.
value
(
"name"
).
toString
();
QString
typeval
=
settings
.
value
(
"type"
).
toString
();
if
(
typeval
==
"text"
&&
!
uasPropertyToLabelMap
.
contains
(
nameval
))
{
valueEnabled
(
nameval
);
}
//QString name = settings.value("name").toString();
//QString var = settings.value("variable").toString();
}
loadSettings
();
//If we don't have any predefined settings, set some defaults.
if
(
uasPropertyValueMap
.
size
()
==
0
)
{
...
...
@@ -127,17 +114,8 @@ void UASQuickView::actionTriggered()
}
quickViewSelectDialog
->
show
();
}
void
UASQuickView
::
valueEnabled
(
QString
value
)
void
UASQuickView
::
saveSettings
(
)
{
UASQuickViewItem
*
item
=
new
UASQuickViewItem
(
this
);
item
->
setTitle
(
value
);
ui
.
verticalLayout
->
addWidget
(
item
);
uasPropertyToLabelMap
[
value
]
=
item
;
uasEnabledPropertyList
.
append
(
value
);
if
(
!
uasPropertyValueMap
.
contains
(
value
))
{
uasPropertyValueMap
[
value
]
=
0
;
}
QSettings
settings
;
settings
.
beginWriteArray
(
"UAS_QUICK_VIEW_ITEMS"
);
int
count
=
0
;
...
...
@@ -146,12 +124,40 @@ void UASQuickView::valueEnabled(QString value)
settings
.
setArrayIndex
(
count
++
);
settings
.
setValue
(
"name"
,
i
.
key
());
settings
.
setValue
(
"type"
,
"text"
);
//QString name = settings.value("name").toString();
//QString var = settings.value("variable").toString();
}
settings
.
endArray
();
settings
.
sync
();
}
void
UASQuickView
::
loadSettings
()
{
QSettings
settings
;
int
size
=
settings
.
beginReadArray
(
"UAS_QUICK_VIEW_ITEMS"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
settings
.
setArrayIndex
(
i
);
QString
nameval
=
settings
.
value
(
"name"
).
toString
();
QString
typeval
=
settings
.
value
(
"type"
).
toString
();
if
(
typeval
==
"text"
&&
!
uasPropertyToLabelMap
.
contains
(
nameval
))
{
valueEnabled
(
nameval
);
}
}
}
void
UASQuickView
::
valueEnabled
(
QString
value
)
{
UASQuickViewItem
*
item
=
new
UASQuickViewItem
(
this
);
item
->
setTitle
(
value
);
ui
.
verticalLayout
->
addWidget
(
item
);
uasPropertyToLabelMap
[
value
]
=
item
;
uasEnabledPropertyList
.
append
(
value
);
if
(
!
uasPropertyValueMap
.
contains
(
value
))
{
uasPropertyValueMap
[
value
]
=
0
;
}
saveSettings
();
}
void
UASQuickView
::
valueDisabled
(
QString
value
)
{
...
...
@@ -163,19 +169,7 @@ void UASQuickView::valueDisabled(QString value)
ui
.
verticalLayout
->
removeWidget
(
item
);
item
->
deleteLater
();
uasEnabledPropertyList
.
removeOne
(
value
);
QSettings
settings
;
settings
.
beginWriteArray
(
"UAS_QUICK_VIEW_ITEMS"
);
int
count
=
0
;
for
(
QMap
<
QString
,
UASQuickViewItem
*>::
const_iterator
i
=
uasPropertyToLabelMap
.
constBegin
();
i
!=
uasPropertyToLabelMap
.
constEnd
();
i
++
)
{
settings
.
setArrayIndex
(
count
++
);
settings
.
setValue
(
"name"
,
i
.
key
());
settings
.
setValue
(
"type"
,
"text"
);
//QString name = settings.value("name").toString();
//QString var = settings.value("variable").toString();
}
settings
.
endArray
();
settings
.
sync
();
saveSettings
();
}
}
...
...
src/ui/uas/UASQuickView.h
View file @
c6cd2cc0
...
...
@@ -18,11 +18,27 @@ public:
void
addSource
(
MAVLinkDecoder
*
decoder
);
private:
UASInterface
*
uas
;
/** List of enabled properties */
QList
<
QString
>
uasEnabledPropertyList
;
/** Maps from the property name to the current value */
QMap
<
QString
,
double
>
uasPropertyValueMap
;
/** Maps from property name to the display item */
QMap
<
QString
,
UASQuickViewItem
*>
uasPropertyToLabelMap
;
/** Timer for updating the UI */
QTimer
*
updateTimer
;
/** Selection dialog for selectin/deselecting gauge items */
UASQuickViewItemSelect
*
quickViewSelectDialog
;
/** Saves gauge layout to settings file */
void
saveSettings
();
/** Loads gauge layout from settings file */
void
loadSettings
();
protected:
Ui
::
Form
ui
;
signals:
...
...
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