[localeq] Offer a Config setting to set location from region/zone
- already had methods for various kinds of broken-up data, but not one for plain "region/zone" strings; having this makes it easier for QML to report a zone. - use the region/zone method from QML, so that clicking on the world map updates the actual TZ in Config.
This commit is contained in:
parent
e78cde7ccb
commit
a4ed160060
@ -218,6 +218,15 @@ Config::setCurrentLocation()
|
||||
}
|
||||
}
|
||||
|
||||
void Config::setCurrentLocation(const QString& regionzone)
|
||||
{
|
||||
auto r = CalamaresUtils::GeoIP::splitTZString( regionzone );
|
||||
if ( r.isValid() )
|
||||
{
|
||||
setCurrentLocation( r.first, r.second );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Config::setCurrentLocation( const QString& regionName, const QString& zoneName )
|
||||
{
|
||||
|
@ -92,7 +92,14 @@ public Q_SLOTS:
|
||||
/// Set LC (formats) by user-choice, overriding future location changes
|
||||
void setLCLocaleExplicitly( const QString& locale );
|
||||
|
||||
/** @brief Sets a location by name
|
||||
/** @brief Sets a location by full name
|
||||
*
|
||||
* @p regionzone should be an identifier from zone.tab, e.g. "Africa/Abidjan",
|
||||
* which is split into regon and zone. Invalid names will **not**
|
||||
* change the actual location.
|
||||
*/
|
||||
void setCurrentLocation( const QString& regionzone );
|
||||
/** @brief Sets a location by split name
|
||||
*
|
||||
* @p region should be "America" or the like, while @p zone
|
||||
* names a zone within that region.
|
||||
|
@ -74,6 +74,7 @@ Column {
|
||||
var tz2 = responseJSON.timezoneId
|
||||
|
||||
tzText.text = "Timezone: " + tz2
|
||||
config.setCurrentLocation(tz2)
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ Column {
|
||||
anchorPoint.x: image.width/4
|
||||
anchorPoint.y: image.height
|
||||
coordinate: QtPositioning.coordinate(
|
||||
map.center.latitude,
|
||||
map.center.latitude,
|
||||
map.center.longitude)
|
||||
//coordinate: QtPositioning.coordinate(40.730610, -73.935242) // New York
|
||||
|
||||
@ -156,7 +157,7 @@ Column {
|
||||
map.center.longitude = coordinate.longitude
|
||||
|
||||
getTz();
|
||||
|
||||
|
||||
console.log(coordinate.latitude, coordinate.longitude)
|
||||
}
|
||||
}
|
||||
@ -199,7 +200,7 @@ Column {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
width: parent.width
|
||||
height: 100
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user