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
eacffcd0
Commit
eacffcd0
authored
Jun 22, 2017
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow renaming a tile set.
parent
54c92f75
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
2 deletions
+83
-2
QGCMapEngineData.h
src/QtLocationPlugin/QGCMapEngineData.h
+20
-0
QGCMapTileSet.h
src/QtLocationPlugin/QGCMapTileSet.h
+2
-1
QGCTileCacheWorker.cpp
src/QtLocationPlugin/QGCTileCacheWorker.cpp
+19
-0
QGCTileCacheWorker.h
src/QtLocationPlugin/QGCTileCacheWorker.h
+1
-0
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+22
-1
QGCMapEngineManager.cc
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
+18
-0
QGCMapEngineManager.h
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
+1
-0
No files found.
src/QtLocationPlugin/QGCMapEngineData.h
View file @
eacffcd0
...
...
@@ -118,6 +118,7 @@ public:
taskGetTileDownloadList
,
taskUpdateTileDownloadState
,
taskDeleteTileSet
,
taskRenameTileSet
,
taskPruneCache
,
taskReset
,
taskExport
,
...
...
@@ -325,6 +326,25 @@ private:
qulonglong
_setID
;
};
//-----------------------------------------------------------------------------
class
QGCRenameTileSetTask
:
public
QGCMapTask
{
Q_OBJECT
public:
QGCRenameTileSetTask
(
qulonglong
setID
,
QString
newName
)
:
QGCMapTask
(
QGCMapTask
::
taskRenameTileSet
)
,
_setID
(
setID
)
,
_newName
(
newName
)
{}
qulonglong
setID
()
{
return
_setID
;
}
QString
newName
()
{
return
_newName
;
}
private:
qulonglong
_setID
;
QString
_newName
;
};
//-----------------------------------------------------------------------------
class
QGCPruneCacheTask
:
public
QGCMapTask
{
...
...
src/QtLocationPlugin/QGCMapTileSet.h
View file @
eacffcd0
...
...
@@ -42,7 +42,7 @@ public:
QGCCachedTileSet
(
const
QString
&
name
);
~
QGCCachedTileSet
();
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QString
name
READ
name
NOTIFY
nameChanged
)
Q_PROPERTY
(
QString
mapTypeStr
READ
mapTypeStr
CONSTANT
)
Q_PROPERTY
(
double
topleftLon
READ
topleftLon
CONSTANT
)
Q_PROPERTY
(
double
topleftLat
READ
topleftLat
CONSTANT
)
...
...
@@ -147,6 +147,7 @@ signals:
void
completeChanged
();
void
errorCountChanged
();
void
selectedChanged
();
void
nameChanged
();
private
slots
:
void
_tileListFetched
(
QList
<
QGCTile
*>
tiles
);
...
...
src/QtLocationPlugin/QGCTileCacheWorker.cpp
View file @
eacffcd0
...
...
@@ -148,6 +148,9 @@ QGCCacheWorker::run()
case
QGCMapTask
:
:
taskDeleteTileSet
:
_deleteTileSet
(
task
);
break
;
case
QGCMapTask
:
:
taskRenameTileSet
:
_renameTileSet
(
task
);
break
;
case
QGCMapTask
:
:
taskPruneCache
:
_pruneCache
(
task
);
break
;
...
...
@@ -615,6 +618,22 @@ QGCCacheWorker::_deleteTileSet(QGCMapTask* mtask)
task
->
setTileSetDeleted
();
}
//-----------------------------------------------------------------------------
void
QGCCacheWorker
::
_renameTileSet
(
QGCMapTask
*
mtask
)
{
if
(
!
_testTask
(
mtask
))
{
return
;
}
QGCRenameTileSetTask
*
task
=
static_cast
<
QGCRenameTileSetTask
*>
(
mtask
);
QSqlQuery
query
(
*
_db
);
QString
s
;
s
=
QString
(
"UPDATE TileSets SET name =
\"
%1
\"
WHERE setID = %2"
).
arg
(
task
->
newName
()).
arg
(
task
->
setID
());
if
(
!
query
.
exec
(
s
))
{
task
->
setError
(
"Error renaming tile set"
);
}
}
//-----------------------------------------------------------------------------
void
QGCCacheWorker
::
_resetCacheDatabase
(
QGCMapTask
*
mtask
)
...
...
src/QtLocationPlugin/QGCTileCacheWorker.h
View file @
eacffcd0
...
...
@@ -57,6 +57,7 @@ private:
void
_getTileDownloadList
(
QGCMapTask
*
mtask
);
void
_updateTileDownloadState
(
QGCMapTask
*
mtask
);
void
_deleteTileSet
(
QGCMapTask
*
mtask
);
void
_renameTileSet
(
QGCMapTask
*
mtask
);
void
_resetCacheDatabase
(
QGCMapTask
*
mtask
);
void
_pruneCache
(
QGCMapTask
*
mtask
);
void
_exportSets
(
QGCMapTask
*
mtask
);
...
...
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
eacffcd0
...
...
@@ -405,6 +405,14 @@ QGCView {
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
name
:
""
font.pointSize
:
_saveRealEstate
?
ScreenTools
.
defaultFontPointSize
:
ScreenTools
.
mediumFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
visible
:
_defaultSet
}
QGCTextField
{
id
:
editSetName
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
visible
:
!
_defaultSet
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
name
:
""
}
QGCLabel
{
anchors.left
:
parent
.
left
...
...
@@ -500,7 +508,20 @@ QGCView {
onClicked
:
showDialog
(
deleteConfirmationDialogComponent
,
qsTr
(
"
Confirm Delete
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
No
)
}
QGCButton
{
text
:
qsTr
(
"
Close
"
)
text
:
qsTr
(
"
Ok
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
(
infoView
.
_extraButton
?
6
:
10
)
visible
:
!
_defaultSet
enabled
:
editSetName
.
text
!==
""
onClicked
:
{
if
(
editSetName
.
text
!==
_currentSelection
.
name
)
{
QGroundControl
.
mapEngineManager
.
renameTileSet
(
_currentSelection
,
editSetName
.
text
)
}
leaveInfoView
()
showList
()
}
}
QGCButton
{
text
:
_defaultSet
?
qsTr
(
"
Close
"
)
:
qsTr
(
"
Cancel
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
(
infoView
.
_extraButton
?
6
:
10
)
onClicked
:
{
leaveInfoView
()
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
View file @
eacffcd0
...
...
@@ -249,6 +249,24 @@ QGCMapEngineManager::deleteTileSet(QGCCachedTileSet* tileSet)
}
}
//-----------------------------------------------------------------------------
void
QGCMapEngineManager
::
renameTileSet
(
QGCCachedTileSet
*
tileSet
,
QString
newName
)
{
//-- Name must be unique
int
idx
=
1
;
QString
name
=
newName
;
while
(
findName
(
name
))
{
name
=
QString
(
"%1 (%2)"
).
arg
(
newName
).
arg
(
idx
++
);
}
qCDebug
(
QGCMapEngineManagerLog
)
<<
"Renaming tile set "
<<
tileSet
->
name
()
<<
"to"
<<
name
;
tileSet
->
setName
(
name
);
QGCRenameTileSetTask
*
task
=
new
QGCRenameTileSetTask
(
tileSet
->
setID
(),
name
);
connect
(
task
,
&
QGCMapTask
::
error
,
this
,
&
QGCMapEngineManager
::
taskError
);
getQGCMapEngine
()
->
addTask
(
task
);
emit
tileSet
->
nameChanged
();
}
//-----------------------------------------------------------------------------
void
QGCMapEngineManager
::
_resetCompleted
()
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
View file @
eacffcd0
...
...
@@ -66,6 +66,7 @@ public:
Q_INVOKABLE
void
saveSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
Q_INVOKABLE
void
deleteTileSet
(
QGCCachedTileSet
*
tileSet
);
Q_INVOKABLE
void
renameTileSet
(
QGCCachedTileSet
*
tileSet
,
QString
newName
);
Q_INVOKABLE
QString
getUniqueName
();
Q_INVOKABLE
bool
findName
(
const
QString
&
name
);
Q_INVOKABLE
void
selectAll
();
...
...
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