-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map management #185
Map management #185
Conversation
… map-management
It seems that this manager contains some bug that cause segfault when QNetworkAccessManager is deleted on "bad" phase. It is possible that I use it by some wrong way, but documentation don't contains any note or warning about that... Anyway, keep one instance in MapManager makes it happy.
Is it possible that some builds break because you did not extend the autoconf based Makefiles with the new source files? |
Build should be ok now. I have to add one |
@@ -276,8 +280,8 @@ public slots: | |||
void SearchForLocations(const QString searchPattern, int limit); | |||
|
|||
protected: | |||
QStringList databaseLookupDirs; | |||
|
|||
MapManager *mapManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would nowadays always use shared_ptr or unique_ptr for memory management.
} | ||
databases.clear(); | ||
delete mapManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above. This code could be dropped then.
{ | ||
double num = size; | ||
QStringList list; | ||
list << "KiB" << "MiB" << "GiB" << "TiB"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have an libosmscout function for this. See String.h ByteSizeToString().
@@ -1,6 +1,7 @@ | |||
[ | |||
{ | |||
"uri": "https://osmscout.karry.cz", | |||
"listUri": "https://osmscout.karry.cz/latest.php?fromVersion=%1&toVersion=%2&locale=%3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should place a README into the OSMScout2 directory, with a hint where to change this and what directory structure is to be expected.
Just some minor comments, see inline comments to code changes. |
Thank you for comments. I will update this branch tomorrow. |
Hi Tim. I updated code and OSMScout2 readme: https://github.com/karry-space-with-my-second-forks/libosmscout/blob/635bc2d8cfd8af7174c6f16d8554ffc867325345/OSMScout2/README.md Btw, |
Hi Tim, sorry for this huge MR (again), but single class don't give complete picture...
Short story: These changes adds ability to view available maps on server and download it to local computer. Picture better thousand words:
Long story:
new main classes:
AvailableMapsModel
Tree model with maps available by configured providers (see Settings::GetMapProviders).
Every map provider have to expose list of maps by json.
FileDownloadJob
Simple utility class for download single file over http. It don't support downloading restart when connection is interrupted.
MapDownloadJob
Utility class for downloading map database described by AvailableMapsModelMap over http. When connection is interrupted, downloading will be retried after some backoff period.
MapManager
Manager of map databases. It provide database lookup (in databaseDirectories) and simple scheduler for downloading maps.
MapDownloadsModel
QML list model with currently downloaded maps. It provide methods (invocable from QML) for starting new map download.