diff options
author | louis <louis.braun@gmx.de> | 2015-01-15 13:12:47 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-01-15 13:12:47 +0100 |
commit | c7f71f3f2b580714bd9e5a5c773bc2179c0e8567 (patch) | |
tree | a39d3efd5494b60964152e559eaead76c7897af5 /setup.c | |
download | vdr-plugin-weatherforecast-0.0.1.tar.gz vdr-plugin-weatherforecast-0.0.1.tar.bz2 |
Initial commit0.0.1
Diffstat (limited to 'setup.c')
-rw-r--r-- | setup.c | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -0,0 +1,47 @@ +#include "setup.h" +#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(lat, strLat.c_str(), sizeof(lat)); + strn0cpy(lon, strLon.c_str(), sizeof(lon)); + Setup(); +} + +cWeatherforecastSetup::~cWeatherforecastSetup() { +} + + +void cWeatherforecastSetup::Setup(void) { + int current = Current(); + Clear(); + + 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))); + + SetCurrent(Get(current)); + Display(); +} + +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); + + weatherConfig.city = city; + weatherConfig.lat = atod(lat); + weatherConfig.lon = atod(lon); +}
\ No newline at end of file |