-
-
Notifications
You must be signed in to change notification settings - Fork 829
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
Refactoring TZ support #3202
base: master
Are you sure you want to change the base?
Refactoring TZ support #3202
Conversation
Great PR! Please pay attention to the following items before merging: Files matching
This is an automatically generated QA checklist based on modified files. |
Ok, it’s ready |
The time zone support in Qt is not very good (esp. in Windows) and if we want to get the better support then we need use 3rd-party library and IANA data. |
Actually Qt uses OS resources, but TZ support on Windows is limited. I have seen interesting results in Linux (like TZ rule details applied in previous years) which were different in Windows. However, when we have a TZ entry for a city, and city changes the actual timezone at some point, this may also not help. It may be more important to find some TZ lookup per geographic coordinates, i.e. clicking on the map. Or replacing (or just extending when online) the map with Qt6.5 by the new map QML interface (with zoom etc.). However, as I am struggling with #3180, this may also need some more extensive redesign. |
From a user perspective: what should the user see when pressing "Update time zones"? IMHO this should happen behind the screen. I have not looked into the relevant code, but what about, at startup:
The local TZ file might include an optional timestamp in line 1 to avoid online lookup at every restart. (Don't lookup again on the same date.) It should also contain a warning in the header that discourages users from editing:
|
IANA TZDB has all changes in timezones. I don't like the latest changes in TZ data (removing TZ data from main file, renaming locations, using fictional TZ for locations by political reasons instead of factical data), but this is a comprehensive timezones database.
Mixing Widgets and QML is a bad idea - we've already had this mix and it was removed due problems. |
Where and when did we have QML? It's just new, and mixing should work. Likely not in an embedded dialog but separate window, though. If there was a better Map widget with nice built-in features (e.g. geodata/tz lookup), of course it would be the clearer way to go. |
Progress bar for downloading the data.
I can implement it, but this is bad idea:
Of course we can add the code for updating the data by some frequency (every month or something else) like in pluigns, but this is will not resolve point 1 from the list above.
How? With standard Qt's classes for network management this is impossible, because Qt doesn't support partially loading the data. We may use HEAD request and GET request later if filesize is changed, but this is not give us guarantee for following a real changing the data.
OK |
I mean, when and how should John Simple (who never reads the logfile) ever want to press this button? Just because it's "There is a button, let's see what happens!"? Pressing this button appears useful if there is a complaint about missing timezone in the logfile. But this condition can trigger the update automatically.
AMENDED:
Why? The LocationMgr is the central authority for location-specific stuff.
Only if missing timezones are detected shall there be any attempt at downloading. And of course, not at every start!
Not even regular frequency. Update attempt shall be done on demand. (Usually after update of tzdata OS package...)
Then use some other mechanism, like a datestamp in config.ini. "Don't attempt to download on the same day" (or +1 week? This gives us a few days to fix such missing timezone). The pseudo-function lastUpdateLongEnoughAgo() would test this. |
See db64b13 |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Ah, interesting, 2014... This was QML1. Whatever this was used for, it looked like some testing environment. |
Obviously that John Simple also never updating OS and, of course, time zones. I don't see a big problem if users will be press the button.
Because this is C++. Adding
Seriously? Do you think John Simple above will report about missing time zone? :) Of course, no. So, we don't have data about new missing time zone and we don't add the data into file and result is obvious - attempt to downloading the fixes at every start.
So, you expected that user will see the log and press the button. But John Simple... |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
TZ updates are done by the operating system. Typically this is automated today. If there are no OS updates, timezones don't change, and there will be no need for updates.
Ah, header inclusion. You can probably declare "class QNetworkReply" in the header file (if at all needed), and only include the header in the cpp file.
Not John Simple, but those few who have reported will hopefully continue to do so. And no, with a timestamp "last-attempted-to-update" stored, there can be a few days of updating silence. I have somehow forgotten what actually happens if tz is not found. Invalid time for those locations? Other strange behaviour?
The current situation is IMHO just not good. The test for unknown timezones can simply trigger an update action (... or just the visibility of this button! But one must open the location panel to see that in the first place.), but only if the latest update attempt was already some time ago, preventing update attempts at every start. Usually there will then be no unknown timezones, therefore no network activity. If needed, another config entry could even inhibit this lookup attempt, e.g. on offline installations or when network activity must be inhibited. Those offline sites will also not get tzdata updates from their OS services, so, no problems. |
I did not intend you to kill this at 80%. We had planned such auto-update "in the future" of ~2017/18 when we see how the missing timezones issue develops. Just that I think this update should run without user interaction. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Description
The fixator for missing and wrong time zones is refactored in this pull request - the old code are splitted into code and data now.
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: