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
5b943e88
Commit
5b943e88
authored
Apr 17, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for settings not persisting, a bug introduced with the new configuration windows
parent
995422bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
QGCVehicleConfig.cc
src/ui/QGCVehicleConfig.cc
+1
-1
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+25
-6
QGCToolWidget.h
src/ui/designer/QGCToolWidget.h
+2
-0
No files found.
src/ui/QGCVehicleConfig.cc
View file @
5b943e88
...
...
@@ -461,7 +461,7 @@ void QGCVehicleConfig::loadConfig()
QList
<
QString
>
paramlist
=
tool
->
getParamList
();
for
(
int
i
=
0
;
i
<
paramlist
.
size
();
i
++
)
{
qDebug
()
<<
"Adding:"
<<
paramlist
[
i
]
<<
parametersname
;
//
qDebug() << "Adding:" << paramlist[i] << parametersname;
if
(
parametersname
==
"ArduPlane"
)
//MAV_TYPE_FIXED_WING FIXED_WING
{
systemTypeToParamMap
[
"FIXED_WING"
]
->
insert
(
paramlist
[
i
],
tool
);
...
...
src/ui/designer/QGCToolWidget.cc
View file @
5b943e88
...
...
@@ -22,6 +22,7 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent, QSettings* s
widgetTitle
(
title
),
ui
(
new
Ui
::
QGCToolWidget
)
{
isFromMetaData
=
false
;
ui
->
setupUi
(
this
);
if
(
settings
)
loadSettings
(
*
settings
);
...
...
@@ -109,6 +110,7 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
}
QList
<
QGCToolWidget
*>
newWidgets
;
settings
->
beginGroup
(
"Custom_Tool_Widgets"
);
int
size
=
settings
->
beginReadArray
(
"QGC_TOOL_WIDGET_NAMES"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
...
...
@@ -140,6 +142,8 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
{
newWidgets
.
at
(
i
)
->
loadSettings
(
*
settings
);
}
settings
->
endGroup
();
settings
->
sync
();
delete
settings
;
return
instances
()
->
values
();
...
...
@@ -171,6 +175,7 @@ bool QGCToolWidget::loadSettings(const QString& settings, bool singleinstance)
}
void
QGCToolWidget
::
setSettings
(
QVariantMap
&
settings
)
{
isFromMetaData
=
true
;
settingsMap
=
settings
;
QString
widgetName
=
getTitle
();
int
size
=
settingsMap
[
"count"
].
toInt
();
...
...
@@ -365,18 +370,23 @@ void QGCToolWidget::storeWidgetsToSettings(QString settingsFile)
//qDebug() << "STORING SETTINGS TO DEFAULT" << settings->fileName();
}
settings
->
beginGroup
(
"Custom_Tool_Widgets"
);
int
preArraySize
=
settings
->
beginReadArray
(
"QGC_TOOL_WIDGET_NAMES"
);
settings
->
endArray
();
settings
->
beginWriteArray
(
"QGC_TOOL_WIDGET_NAMES"
);
int
num
=
0
;
for
(
int
i
=
0
;
i
<
qMax
(
preArraySize
,
instances
()
->
size
());
++
i
)
{
settings
->
setArrayIndex
(
i
);
if
(
i
<
instances
()
->
size
())
{
// Updating value
settings
->
setValue
(
"TITLE"
,
instances
()
->
values
().
at
(
i
)
->
getTitle
());
//qDebug() << "WRITING TITLE" << instances()->values().at(i)->getTitle();
if
(
!
instances
()
->
values
().
at
(
i
)
->
fromMetaData
())
{
settings
->
setArrayIndex
(
num
++
);
settings
->
setValue
(
"TITLE"
,
instances
()
->
values
().
at
(
i
)
->
getTitle
());
//qDebug() << "WRITING TITLE" << instances()->values().at(i)->getTitle();
}
}
else
{
...
...
@@ -391,6 +401,8 @@ void QGCToolWidget::storeWidgetsToSettings(QString settingsFile)
{
instances
()
->
values
().
at
(
i
)
->
storeSettings
(
*
settings
);
}
settings
->
endGroup
();
settings
->
sync
();
delete
settings
;
}
...
...
@@ -408,6 +420,11 @@ void QGCToolWidget::storeSettings(const QString& settingsFile)
void
QGCToolWidget
::
storeSettings
(
QSettings
&
settings
)
{
if
(
isFromMetaData
)
{
//Refuse to store if this is loaded from metadata or dynamically generated.
return
;
}
//qDebug() << "WRITING WIDGET" << widgetTitle << "TO SETTINGS";
settings
.
beginGroup
(
widgetTitle
);
settings
.
beginWriteArray
(
"QGC_TOOL_WIDGET_ITEMS"
);
...
...
@@ -511,6 +528,7 @@ QList<QGCToolWidgetItem*>* QGCToolWidget::itemList()
}
void
QGCToolWidget
::
addParam
(
int
uas
,
int
component
,
QString
paramname
,
QVariant
value
)
{
isFromMetaData
=
true
;
QGCParamSlider
*
slider
=
new
QGCParamSlider
(
this
);
connect
(
slider
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
storeSettings
()));
if
(
ui
->
hintLabel
)
...
...
@@ -611,11 +629,11 @@ void QGCToolWidget::setWindowTitle(const QString& title)
void
QGCToolWidget
::
setTitle
(
QString
title
)
{
// Remove references to old title
QSettings
settings
;
/*
QSettings settings;
settings.beginGroup(widgetTitle);
settings.remove("");
settings.endGroup();
settings
.
sync
();
settings.sync();
*/
if
(
instances
()
->
contains
(
widgetTitle
))
instances
()
->
remove
(
widgetTitle
);
...
...
@@ -645,10 +663,11 @@ void QGCToolWidget::deleteWidget()
// Hide
this
->
hide
();
instances
()
->
remove
(
getTitle
());
QSettings
settings
;
/*
QSettings settings;
settings.beginGroup(getTitle());
settings.remove("");
settings.endGroup();
storeWidgetsToSettings();*/
storeWidgetsToSettings
();
// Delete
...
...
src/ui/designer/QGCToolWidget.h
View file @
5b943e88
...
...
@@ -61,10 +61,12 @@ public slots:
void
setSettings
(
QVariantMap
&
settings
);
QList
<
QString
>
getParamList
();
void
setParameterValue
(
int
uas
,
int
component
,
QString
parameterName
,
const
QVariant
value
);
bool
fromMetaData
()
{
return
isFromMetaData
;
}
signals:
void
titleChanged
(
QString
);
protected:
bool
isFromMetaData
;
QMap
<
QString
,
QGCToolWidgetItem
*>
paramToItemMap
;
QList
<
QString
>
paramList
;
QVariantMap
settingsMap
;
...
...
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