diff options
author | louis <louis.braun@gmx.de> | 2015-01-17 10:23:39 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-01-17 10:23:39 +0100 |
commit | a5aa281e337f148e27b17c287e04d8a023856667 (patch) | |
tree | 6ff69709bfd9815ece9b29a31ae8397653ff8848 /setup.c | |
parent | c7f71f3f2b580714bd9e5a5c773bc2179c0e8567 (diff) | |
download | vdr-plugin-weatherforecast-0.0.2.tar.gz vdr-plugin-weatherforecast-0.0.2.tar.bz2 |
added possibility to use own api key0.0.2
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -2,12 +2,13 @@ #include "tools/jsonhelpers.h" cWeatherforecastSetup::cWeatherforecastSetup() { - data = weatherConfig; - strn0cpy(city, data.city.c_str(), sizeof(city)); - string strLat = FloatToString(data.lat); - string strLon = FloatToString(data.lon); + strn0cpy(city, weatherConfig.city.c_str(), sizeof(city)); + string strLat = FloatToString(weatherConfig.lat); + string strLon = FloatToString(weatherConfig.lon); strn0cpy(lat, strLat.c_str(), sizeof(lat)); strn0cpy(lon, strLon.c_str(), sizeof(lon)); + strn0cpy(userApiKey, weatherConfig.userApiKey.c_str(), sizeof(userApiKey)); + userHoursToUpdate = weatherConfig.userHoursToUpdate; Setup(); } @@ -22,6 +23,11 @@ void cWeatherforecastSetup::Setup(void) { Add(new cMenuEditStrItem(tr("City"), city, sizeof(city), trVDR(FileNameChars))); Add(new cMenuEditStrItem(tr("Latitude"), lat, sizeof(lat), trVDR(FileNameChars))); Add(new cMenuEditStrItem(tr("Longitude"), lon, sizeof(lon), trVDR(FileNameChars))); + Add(new cMenuEditStrItem(tr("API Key"), userApiKey, sizeof(userApiKey), trVDR(FileNameChars))); + + if (strlen(userApiKey) > 0) { + Add(new cMenuEditIntItem(tr("Update Frequency in hours"), &userHoursToUpdate, 1, 24)); + } SetCurrent(Get(current)); Display(); @@ -29,19 +35,19 @@ void cWeatherforecastSetup::Setup(void) { eOSState cWeatherforecastSetup::ProcessKey(eKeys Key) { eOSState state = cMenuSetupPage::ProcessKey(Key); - switch (state) { - default: break; - } return state; } void cWeatherforecastSetup::Store(void) { - weatherConfig = data; SetupStore("city", city); SetupStore("lat", lat); SetupStore("lon", lon); + SetupStore("userapikey", userApiKey); + SetupStore("updatefreq", userHoursToUpdate); weatherConfig.city = city; weatherConfig.lat = atod(lat); weatherConfig.lon = atod(lon); + weatherConfig.userApiKey = userApiKey; + weatherConfig.userHoursToUpdate = userHoursToUpdate; }
\ No newline at end of file |