diff options
author | Luiz Agostini <luiz.agostini@openbossa.org> | 2009-11-10 20:43:38 -0300 |
---|---|---|
committer | Luiz Agostini <luiz.agostini@openbossa.org> | 2009-11-10 22:00:57 -0200 |
commit | a4e5af0fa9823b20650ef58fa31eae0a9ce65407 (patch) | |
tree | 620eb625da76914c7609e6430c342d288ffc045a | |
parent | 2d21ac1cbaf1c1d8be6e47bce8011e4911854ba5 (diff) |
Weather: demo mode.
Signed-off-by: Luiz Agostini <luiz.agostini@openbossa.org>
-rw-r--r-- | weather/bootmanager.cpp | 4 | ||||
-rw-r--r-- | weather/bootmanager.h | 2 | ||||
-rw-r--r-- | weather/demoforecastsource.cpp | 4 | ||||
-rw-r--r-- | weather/fake_content.xml | 647 | ||||
-rw-r--r-- | weather/fakecontentscreen.cpp | 104 | ||||
-rw-r--r-- | weather/fakecontentscreen.h | 30 | ||||
-rw-r--r-- | weather/images/weather_elements/button_softkey_left.png | bin | 0 -> 7344 bytes | |||
-rw-r--r-- | weather/images/weather_elements/button_softkey_right.png | bin | 0 -> 7059 bytes | |||
-rw-r--r-- | weather/main.cpp | 18 | ||||
-rw-r--r-- | weather/mainview.cpp | 32 | ||||
-rw-r--r-- | weather/mainview.h | 6 | ||||
-rw-r--r-- | weather/resources.qrc | 2 | ||||
-rw-r--r-- | weather/settings.cpp | 12 | ||||
-rw-r--r-- | weather/settings.h | 3 | ||||
-rw-r--r-- | weather/weather.ini | 41 | ||||
-rw-r--r-- | weather/weather.pro | 6 |
16 files changed, 884 insertions, 27 deletions
diff --git a/weather/bootmanager.cpp b/weather/bootmanager.cpp index 08a3738..ac41a8f 100644 --- a/weather/bootmanager.cpp +++ b/weather/bootmanager.cpp @@ -21,9 +21,9 @@ BootManager::BootManager(QObject *parent) { } -void BootManager::run() +void BootManager::run(const QStringList &locations) { - m_keys = Settings::getCurrentCities(); + m_keys = locations; ForecastProvider::connectToResponseSignal(this, SLOT(forecastResponse(int, ForecastData))); foreach (const QString & city, m_keys) { m_requests.append(ForecastProvider::getForecast(city, true)); diff --git a/weather/bootmanager.h b/weather/bootmanager.h index b061547..4fc4969 100644 --- a/weather/bootmanager.h +++ b/weather/bootmanager.h @@ -11,7 +11,7 @@ class BootManager : public QObject Q_OBJECT public: BootManager(QObject *parent = 0); - void run(); + void run(const QStringList &locations); QList<ForecastData> data() const { return m_data; } signals: diff --git a/weather/demoforecastsource.cpp b/weather/demoforecastsource.cpp index db6f5cc..292b6ea 100644 --- a/weather/demoforecastsource.cpp +++ b/weather/demoforecastsource.cpp @@ -132,8 +132,10 @@ void DemoForecastSource::sendResponse() if (!m_requests.isEmpty()) { Request request = m_requests.takeFirst(); for (int i = 0; i < m_list.count(); ++i) { - if (m_list[i].key() == request.m_locId) + if (m_list[i].key() == request.m_locId) { emit forecastReceived(request.m_reqId, m_list[i]); + return; + } } emit forecastReceived(request.m_reqId, ForecastData(0)); } diff --git a/weather/fake_content.xml b/weather/fake_content.xml index 2bff5f0..24d4639 100644 --- a/weather/fake_content.xml +++ b/weather/fake_content.xml @@ -20,7 +20,654 @@ <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> </item> <yweather:location city="Mostly Cloudy" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0002"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Storm" code="1" temp="8" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-18" high="21" text="Storm" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Storm" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Storm" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0003"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Thunderstorm" code="2" temp="3" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-8" high="3" text="Thunderstorm" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Thunderstorm" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Thunderstorm" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0004"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Sleet" code="5" temp="5" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="3" high="15" text="Sleet" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Sleet" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Sleet" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0005"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Rain" code="6" temp="12" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-8" high="25" text="Sleet" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Sleet" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Rain" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0006"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Mist" code="8" temp="22" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="21" high="25" text="Mist" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Mist" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Mist" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0007"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Flurries" code="13" temp="8" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-1" high="10" text="Flurries" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Flurries" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Flurries" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0008"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + <yweather:condition text="Snow" code="15" temp="0" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-5" high="10" text="Snow" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Snow" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Snow" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0009"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Haze" code="19" temp="0" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-5" high="10" text="Snow" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Snow" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Haze" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0010"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Fog" code="22" temp="30" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="28" high="35" text="Fog" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Fog" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Fog" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0011"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Cloudy" code="22" temp="27" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="25" high="28" text="Cloudy" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Cloudy" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Cloudy" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0012"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Sunny" code="31" temp="37" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="35" high="40" text="Sunny" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Sunny" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Sunny" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0013"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="MostlySunny" code="34" temp="37" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="35" high="40" text="MostlySunny" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="MostlySunny" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="MostlySunny" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0014"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="PartlyCloudy" code="44" temp="27" date="Mon, 09 Nov 2009 7:56 am PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="24" high="30" text="PartlyCloudy" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="PartlyCloudy" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="PartlyCloudy" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0015"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Mostly Cloudy" code="27" temp="22" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="18" high="31" text="Mostly Cloudy" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Mostly Cloudy" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Mostly Cloudy" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0016"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Storm" code="1" temp="8" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-18" high="21" text="Storm" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Storm" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Storm" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0017"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Thunderstorm" code="2" temp="3" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-8" high="3" text="Thunderstorm" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Thunderstorm" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Thunderstorm" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0018"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Sleet" code="5" temp="5" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="3" high="15" text="Sleet" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Sleet" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Sleet" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0019"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Rain" code="6" temp="12" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-8" high="25" text="Sleet" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Sleet" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Rain" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0020"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Mist" code="8" temp="22" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="21" high="25" text="Mist" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Mist" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Mist" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0021"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Flurries" code="13" temp="8" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-1" high="10" text="Flurries" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Flurries" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Flurries" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0022"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Snow" code="15" temp="0" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-5" high="10" text="Snow" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Snow" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Snow" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0023"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Haze" code="19" temp="0" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="-5" high="10" text="Snow" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Snow" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Haze" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0024"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Fog" code="22" temp="30" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="28" high="35" text="Fog" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Fog" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Fog" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0025"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Cloudy" code="22" temp="27" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="25" high="28" text="Cloudy" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Cloudy" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Cloudy" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0026"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="Sunny" code="31" temp="37" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="35" high="40" text="Sunny" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="Sunny" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="Sunny" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0027"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="MostlySunny" code="34" temp="37" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="35" high="40" text="MostlySunny" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="MostlySunny" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="MostlySunny" region="" country=""/> + </channel> + </rss> + </item> + <item locId="INDT0028"> + <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> + <channel> + <lastBuildDate>Mon, 09 Nov 2009 7:56 am PST</lastBuildDate> + <ttl>1440</ttl> + + <yweather:units temperature="C" distance="mi" pressure="in" speed="mph"/> + <yweather:wind chill="46" direction="0" speed="0" /> + <yweather:atmosphere humidity="76" visibility="10" pressure="30.11" rising="1" /> + <yweather:astronomy sunrise="5:41 am" sunset="6:02 pm"/> + <item> + <geo:lat>37.39</geo:lat> + <geo:long>-122.03</geo:long> + <pubDate>Mon, 09 Nov 2009 7:56 am PST</pubDate> + + <yweather:condition text="PartlyCloudy" code="44" temp="27" date="Mon, 09 Nov 2009 8:56 pm PST" /> + <yweather:forecast day="Mon" date="9 Nov 2009" low="24" high="30" text="PartlyCloudy" code="30" /> + <yweather:forecast day="Tue" date="10 Nov 2009" low="49" high="68" text="PartlyCloudy" code="28" /> + <guid isPermaLink="false">USCA1116_2009_11_09_7_56_PST</guid> + </item> + <yweather:location city="PartlyCloudy" region="" country=""/> </channel> </rss> </item> diff --git a/weather/fakecontentscreen.cpp b/weather/fakecontentscreen.cpp new file mode 100644 index 0000000..493df9c --- /dev/null +++ b/weather/fakecontentscreen.cpp @@ -0,0 +1,104 @@ +#include "fakecontentscreen.h" +#include "pixmaploader.h" +#include "settings.h" +#include "painttextitem.h" + +#include <QPainter> +#include <QDebug> +#include <QCoreApplication> +#include <QGraphicsSceneMouseEvent> + +#define SCREEN_FONT_SIZE (Settings::scaleHeight(30.0)) +#define BUTTON_FONT_SIZE (Settings::scaleHeight(40.0)) + +#define LEFT_BUTTON_NAME "button_softkey_right" +#define RIGHT_BUTTON_NAME "button_softkey_left" + +#define LEFT_PIXMAP (PixmapLoader::getPic(LEFT_BUTTON_NAME)) +#define RIGHT_PIXMAP (PixmapLoader::getPic(RIGHT_BUTTON_NAME)) + +FakeContentScreen::FakeContentScreen(QGraphicsItem *parent) + : QGraphicsItem(parent) + , m_boundingRect(QPointF(0.0, 0.0), Settings::windowSize()) + , m_left(LEFT_PIXMAP) + , m_right(RIGHT_PIXMAP) +{ +} + +QRectF FakeContentScreen::boundingRect() const +{ + return m_boundingRect; +} + +void FakeContentScreen::paint(QPainter *painter, + const QStyleOptionGraphicsItem *opt, QWidget *widget) +{ + Q_UNUSED(opt); + Q_UNUSED(widget); + + static TextPainter text1(SCREEN_FONT_SIZE, QColor(255, 255, 255, 255), "You have no internet"); + static TextPainter text2(SCREEN_FONT_SIZE, QColor(255, 255, 255, 255), + "connection. Do you want to"); + static TextPainter text3(SCREEN_FONT_SIZE, QColor(255, 255, 255, 255), + "continue to the off-line"); + static TextPainter text4(SCREEN_FONT_SIZE, QColor(255, 255, 255, 255), "weather demo?"); + + static TextPainter left(BUTTON_FONT_SIZE, QColor(255, 255, 255, 255), "YES"); + static TextPainter right(BUTTON_FONT_SIZE, QColor(255, 255, 255, 255), "EXIT"); + + static const int buttonTop = boundingRect().height() - m_left.height(); + static const int buttonLeft = boundingRect().width() - m_right.width(); + + static bool firstTime = true; + + if (firstTime) { + firstTime = false; + const qreal top = (boundingRect().height() - 4 * text1.height() - m_left.height()) / 2; + TextPainter::locateAtCenter(&text1, 0.0, top, boundingRect().width()); + TextPainter::locateAtCenter(&text2, 0.0, top + 1 * text1.height(), boundingRect().width()); + TextPainter::locateAtCenter(&text3, 0.0, top + 2 * text1.height(), boundingRect().width()); + TextPainter::locateAtCenter(&text4, 0.0, top + 3 * text1.height(), boundingRect().width()); + + const qreal buttonTextTop = (m_left.height() - left.height()) / 2 + buttonTop; + left.setPos(30, buttonTextTop); + right.setPos(boundingRect().width() - right.width() - 30, buttonTextTop); + + } + + painter->fillRect(boundingRect(), QColor(7, 18, 23, 255)); + + text1.paint(painter); + text2.paint(painter); + text3.paint(painter); + text4.paint(painter); + + painter->drawPixmap(0, buttonTop, m_left); + painter->drawPixmap(buttonLeft, buttonTop, m_right); + + left.paint(painter); + right.paint(painter); + +} + +int FakeContentScreen::loadImages() +{ + PixmapLoader::load(LEFT_BUTTON_NAME); + PixmapLoader::load(RIGHT_BUTTON_NAME); + return 2; +} + +void FakeContentScreen::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + static QRectF left(0.0, boundingRect().height() - m_left.height(), + m_left.width(), m_left.height()); + static QRectF right(boundingRect().width() - m_right.width(), + boundingRect().height() - m_left.height(), + m_right.width(), m_right.height()); + + + if (left.contains(event->pos())) + emit userAccepted(); + else + QCoreApplication::instance()->quit(); + +} diff --git a/weather/fakecontentscreen.h b/weather/fakecontentscreen.h new file mode 100644 index 0000000..09c788a --- /dev/null +++ b/weather/fakecontentscreen.h @@ -0,0 +1,30 @@ +#ifndef FAKECONTENTSCREEN_H +#define FAKECONTENTSCREEN_H + +#include <QObject> +#include <QGraphicsItem> + +class FakeContentScreen : public QObject, public QGraphicsItem +{ + Q_OBJECT + Q_INTERFACES(QGraphicsItem) +public: + FakeContentScreen(QGraphicsItem *parent = 0); + static int loadImages(); + + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event); + +private: + const QRectF m_boundingRect; + QPixmap m_left; + QPixmap m_right; + +signals: + void userAccepted(); +}; + +#endif // FAKECONTENTSCREEN_H diff --git a/weather/images/weather_elements/button_softkey_left.png b/weather/images/weather_elements/button_softkey_left.png Binary files differnew file mode 100644 index 0000000..56f1d26 --- /dev/null +++ b/weather/images/weather_elements/button_softkey_left.png diff --git a/weather/images/weather_elements/button_softkey_right.png b/weather/images/weather_elements/button_softkey_right.png Binary files differnew file mode 100644 index 0000000..c6cb619 --- /dev/null +++ b/weather/images/weather_elements/button_softkey_right.png diff --git a/weather/main.cpp b/weather/main.cpp index 8f63a7a..3925fda 100644 --- a/weather/main.cpp +++ b/weather/main.cpp @@ -63,15 +63,17 @@ int main(int argc, char **argv) #else const bool connected = true; #endif - - if (connected) { - MainView mainView; - ForecastProvider::setForecastSource(new NetworkForecastSource()); + + if (connected) + ForecastProvider::setForecastSource(new NetworkForecastSource()); + else + ForecastProvider::setForecastSource(new DemoForecastSource(1500)); + + MainView mainView(connected); #ifdef Q_OS_SYMBIAN - mainView.showFullScreen(); + mainView.showFullScreen(); #else - mainView.show(); + mainView.show(); #endif - return app.exec(); - } + return app.exec(); } diff --git a/weather/mainview.cpp b/weather/mainview.cpp index b3bb3b4..6ee73ae 100644 --- a/weather/mainview.cpp +++ b/weather/mainview.cpp @@ -36,12 +36,14 @@ // MainView -MainView::MainView(QWidget *parent) +MainView::MainView(bool connected, QWidget *parent) : QGraphicsView(parent) , m_carroussel(0) , m_loading(0) , m_bootManager(0) , m_manager(0) + , m_fakeContentScreen(0) + , m_connected(connected) { setScene(&m_scene); setFrameShape(QFrame::NoFrame); @@ -56,6 +58,8 @@ MainView::MainView(QWidget *parent) PixmapLoader::connectToOnIdleSignal(this, SLOT(pixmapLoaderIsIdle())); Loading::loadImages(); + if (!m_connected) + FakeContentScreen::loadImages(); } MainView::~MainView() @@ -65,6 +69,20 @@ MainView::~MainView() void MainView::pixmapLoaderIsIdle() { PixmapLoader::disconnectReceiver(this); + if (m_connected) + startBoot(); + else { + m_fakeContentScreen = new FakeContentScreen(); + connect(m_fakeContentScreen, SIGNAL(userAccepted()), this, SLOT(startBoot())); + m_fakeContentScreen->setPos(0.0, 0.0); + m_scene.addItem(m_fakeContentScreen); + } +} + +void MainView::startBoot() +{ + delete m_fakeContentScreen; + m_fakeContentScreen = 0; m_loading = new Loading(); m_loading->setPos((geometry().width() - m_loading->boundingRect().width()) / 2, (geometry().height() - m_loading->boundingRect().height()) / 2); @@ -72,7 +90,7 @@ void MainView::pixmapLoaderIsIdle() m_loading->start(); m_bootManager = new BootManager(this); connect(m_bootManager, SIGNAL(ready()), this, SLOT(bootEnd())); - m_bootManager->run(); + m_bootManager->run(m_connected ? Settings::getCurrentCities() : Settings::getDemoCities()); } void MainView::bootEnd() @@ -134,10 +152,12 @@ void MainView::closeCityManager() void MainView::saveManagerList() { - QStringList list; - foreach(const ForecastData &data, m_manager->forecastList()) - list.append(data.key()); - Settings::setCurrentCities(list); + if (m_connected) { + QStringList list; + foreach(const ForecastData &data, m_manager->forecastList()) + list.append(data.key()); + Settings::setCurrentCities(list); + } } void MainView::keyPressEvent(QKeyEvent* event) diff --git a/weather/mainview.h b/weather/mainview.h index 2663b0e..fc54837 100644 --- a/weather/mainview.h +++ b/weather/mainview.h @@ -42,13 +42,14 @@ #include "bootmanager.h" #include "loading.h" #include "citymanager.h" +#include "fakecontentscreen.h" class MainView: public QGraphicsView { Q_OBJECT public: - MainView(QWidget *parent = 0); + MainView(bool connected, QWidget *parent = 0); ~MainView(); protected: @@ -64,6 +65,7 @@ private slots: void pixmapLoaderIsIdle(); void bootEnd(); + void startBoot(); private: QGraphicsScene m_scene; @@ -71,6 +73,8 @@ private: Loading *m_loading; BootManager *m_bootManager; CityManager *m_manager; + FakeContentScreen *m_fakeContentScreen; + const bool m_connected; void showCarroussel(); void createCityManager(); diff --git a/weather/resources.qrc b/weather/resources.qrc index 94386d5..ae73c5d 100644 --- a/weather/resources.qrc +++ b/weather/resources.qrc @@ -97,5 +97,7 @@ <file>images/weather_elements/scroll_knob.png</file> <file>images/weather_elements/city_name_background_bigger.png</file> <file>fake_content.xml</file> + <file>images/weather_elements/button_softkey_left.png</file> + <file>images/weather_elements/button_softkey_right.png</file> </qresource> </RCC> diff --git a/weather/settings.cpp b/weather/settings.cpp index 3c926dc..4122fdf 100644 --- a/weather/settings.cpp +++ b/weather/settings.cpp @@ -87,9 +87,19 @@ private: QStringList Settings::getCurrentCities() { + return getCities("Cities"); +} + +QStringList Settings::getDemoCities() +{ + return getCities("Demo"); +} + +QStringList Settings::getCities(const QString &type) +{ Settings *obj = instance(); - obj->m_settings.beginGroup("Cities"); + obj->m_settings.beginGroup(type); QStringList result = obj->m_settings.allKeys(); QMap<QString, int> map; diff --git a/weather/settings.h b/weather/settings.h index 5e4bdde..a54ea64 100644 --- a/weather/settings.h +++ b/weather/settings.h @@ -60,6 +60,7 @@ public: static qreal scaleWidth(qreal width) { return width * widthFactor(); } static qreal scaleHeight(qreal height) { return height * heightFactor(); } + static QStringList getDemoCities(); static QStringList getCurrentCities(); static void setCurrentCities(QStringList cities); @@ -70,6 +71,8 @@ private: QSettings m_settings; static Settings *instance(); + static QStringList getCities(const QString &type); + }; #endif // SETTINGS_H diff --git a/weather/weather.ini b/weather/weather.ini index bfce791..51bb0a0 100644 --- a/weather/weather.ini +++ b/weather/weather.ini @@ -4,9 +4,40 @@ windowSize=@Size(360 640) [Cities] NOXX0029=0 ASXX0112=1 -USND0343=2 -UKXX0085=3 -BRXX0309=4 -IDXX0022=5 -CHXX0049=6 +UKXX0085=2 +BRXX0309=3 +IDXX0022=4 +CHXX0049=5 +JAXX0085=6 INXX0012=7 +USNY0996=8 + +[Demo] +INDT0001=1 +INDT0002=2 +INDT0003=3 +INDT0004=4 +INDT0005=5 +INDT0006=6 +INDT0007=7 +INDT0008=8 +INDT0009=9 +INDT0010=10 +INDT0011=11 +INDT0012=12 +INDT0013=13 +INDT0014=14 +INDT0015=15 +INDT0016=16 +INDT0017=17 +INDT0018=18 +INDT0019=19 +INDT0020=20 +INDT0021=21 +INDT0022=22 +INDT0023=23 +INDT0024=24 +INDT0025=25 +INDT0026=26 +INDT0027=27 +INDT0028=28 diff --git a/weather/weather.pro b/weather/weather.pro index 50d2c0b..da0a38a 100644 --- a/weather/weather.pro +++ b/weather/weather.pro @@ -57,7 +57,8 @@ HEADERS += mainview.h \ networkforecastsource.h \ yahooweatherresponse.h \ xoapweatherresponse.h \ - sym_iap_util.h + symbiannetwork.h \ + fakecontentscreen.h SOURCES += mainview.cpp \ main.cpp \ settings.cpp \ @@ -85,4 +86,5 @@ SOURCES += mainview.cpp \ networkforecastsource.cpp \ yahooweatherresponse.cpp \ xoapweatherresponse.cpp \ - forecastdata.cpp + forecastdata.cpp \ + fakecontentscreen.cpp |