From da63cf6851791b7bf374255572bb236103a0d498 Mon Sep 17 00:00:00 2001
From: Joachim Langenbach <joachim.langenbach@engsas.de>
Date: Wed, 25 Jan 2012 20:46:57 +0100
Subject: [PATCH 1/2] Added new screen world weather map. Since it is really different from other screen behaviour, it has it's own class WorldWeatherScreen. This screen displays one of the maps within the
 bluemarble folder and displays weather icons for the associated locations.

The class Location is used to store this data during fetching process of geo coordinates.

The world map uses QtMobility Location API to map weather locations into geo coordinates.
---
 .../bluemarble/land_ocean_ice_lights_8192.png      |  Bin 0 -> 9615852 bytes
 .../bluemarble/land_shallow_topo_8192.png          |  Bin 0 -> 22458804 bytes
 mythplugins/mythweather/mythweather/location.cpp   |  140 +++++++++++++
 mythplugins/mythweather/mythweather/location.h     |   63 ++++++
 .../mythweather/mythweather/worldweatherscreen.cpp |  213 ++++++++++++++++++++
 .../mythweather/mythweather/worldweatherscreen.h   |  101 +++++++++
 6 files changed, 517 insertions(+), 0 deletions(-)
 create mode 100644 mythplugins/mythweather/mythweather/bluemarble/land_ocean_ice_lights_8192.png
 create mode 100644 mythplugins/mythweather/mythweather/bluemarble/land_shallow_topo_8192.png
 create mode 100644 mythplugins/mythweather/mythweather/location.cpp
 create mode 100644 mythplugins/mythweather/mythweather/location.h
 create mode 100644 mythplugins/mythweather/mythweather/worldweatherscreen.cpp
 create mode 100644 mythplugins/mythweather/mythweather/worldweatherscreen.h

diff --git a/mythplugins/mythweather/mythweather/bluemarble/land_ocean_ice_lights_8192.png b/mythplugins/mythweather/mythweather/bluemarble/land_ocean_ice_lights_8192.png
new file mode 100644
index 0000000..4f51b60
Binary files /dev/null and b/mythplugins/mythweather/mythweather/bluemarble/land_ocean_ice_lights_8192.png differ
diff --git a/mythplugins/mythweather/mythweather/bluemarble/land_shallow_topo_8192.png b/mythplugins/mythweather/mythweather/bluemarble/land_shallow_topo_8192.png
new file mode 100644
index 0000000..75bda59
Binary files /dev/null and b/mythplugins/mythweather/mythweather/bluemarble/land_shallow_topo_8192.png differ
diff --git a/mythplugins/mythweather/mythweather/location.cpp b/mythplugins/mythweather/mythweather/location.cpp
new file mode 100644
index 0000000..25a374f
--- /dev/null
+++ b/mythplugins/mythweather/mythweather/location.cpp
@@ -0,0 +1,140 @@
+/*
+    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "location.h"
+
+#include <mythimage.h>
+#include <mythmainwindow.h>
+
+#include <QStringList>
+#include <QPainter>
+#include <QPixmap>
+#include <QFont>
+#include <QFontMetrics>
+
+// Location::Location(qreal latitude, qreal longitude, QString station, QString name)
+// {
+// 	init();
+// // 	myCoordinates = QtMobility::QGeoCoordinate(latitude, longitude);
+// 	myStation = station;
+// 	myName = name;
+// }
+
+void Location::setName(QString name)
+{
+	myName = name;
+}
+
+QString Location::name() const
+{
+	return myName;
+}
+
+// void Location::setCoordinate(QtMobility::QGeoCoordinate coordinates)
+// {
+// 	myCoordinates = coordinates;
+// }
+
+// QString Location::latitude() const
+// {
+// 	// Format: 27° 28' 3.2" S, 153° 1' 40.4" E, 28.1m
+// 	QString myValues = myCoordinates.toString(QtMobility::QGeoCoordinate::DegreesMinutesSecondsWithHemisphere);
+// 	return myValues.split(", ")[0];
+// }
+// 
+// QString Location::longitude() const
+// {
+// // Format: 27° 28' 3.2" S, 153° 1' 40.4" E, 28.1m
+// 	QString myValues = myCoordinates.toString(QtMobility::QGeoCoordinate::DegreesMinutesSecondsWithHemisphere);
+// 	return myValues.split(", ")[1];
+// }
+
+void Location::setCurrentTemperatur(QString temperature)
+{
+	myCurrentTemperature = temperature;
+}
+
+QString Location::currentTemperature() const
+{
+	return myCurrentTemperature;
+}
+
+void Location::setCurrentWeatherIcon(QString icon)
+{
+	if(!icon.startsWith(":/weathermap/") && !icon.startsWith(":"))
+		icon = ":/weathermap/"+ icon;
+	myCurrentWeatherIcon = icon;
+}
+
+QString Location::currentWeatherIcon() const
+{
+	return myCurrentWeatherIcon;
+}
+
+// QtMobility::QGeoCoordinate Location::toCoordinate() const
+// {
+// 	return myCoordinates;
+// }
+
+bool Location::addToMap(MythImage* map, QPoint position)
+{
+	if(!map)
+		return false;
+	
+	// load weather icon
+	MythImage *weatherIcon = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage();
+	weatherIcon->Load(currentWeatherIcon());
+	if(weatherIcon->isNull())
+		weatherIcon->Load("unknown.png");
+	
+	// add the temperature value
+	QFont iconFont;
+	iconFont.setPixelSize(40);
+	QFontMetrics metrics(iconFont);
+	QString text = QObject::tr("%1: %2 C").arg(name()).arg(currentTemperature());
+	int iconWidth = weatherIcon->size().width();
+	if(iconWidth < metrics.width(text))
+		iconWidth = metrics.width(text);
+	
+	QPixmap icon(iconWidth, weatherIcon->size().height() + 1.2 * float(metrics.height()));
+	icon.fill(Qt::transparent);
+	QPainter painter;
+	painter.begin(&icon);
+	painter.setFont(iconFont);
+	painter.setPen(Qt::white);
+	// remember: iconWidth = weatherIcon.width()
+	painter.drawImage((icon.width() - iconWidth)/2, 0, *weatherIcon);
+	painter.drawText(float(icon.width() - metrics.width(text)) / 2.0, weatherIcon->height() + painter.fontMetrics().height(), text);
+	painter.end();
+	
+	icon = icon.scaled(iconWidth, 80, Qt::KeepAspectRatio);
+	// set offset
+	position.setX(position.x() - icon.width()/2);
+	position.setY(position.y() - 40);
+	painter.begin(map);
+	painter.drawPixmap(position.x(), position.y(), icon);
+	painter.end();
+	
+	return true;
+}
+
+void Location::init()
+{
+	myCurrentWeatherIcon = "unknown.png";
+}
diff --git a/mythplugins/mythweather/mythweather/location.h b/mythplugins/mythweather/mythweather/location.h
new file mode 100644
index 0000000..52b1fd8
--- /dev/null
+++ b/mythplugins/mythweather/mythweather/location.h
@@ -0,0 +1,63 @@
+/*
+    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef LOCATION_H
+#define LOCATION_H
+
+// #include <QGeoCoordinate>
+
+class MythImage;
+
+#include <QMetaType>
+
+/**
+	* @brief Represents a location with its coordinates and weather.
+	*/
+class Location
+{
+	public:
+		inline Location(){ init(); }
+// 		Location(qreal latitude, qreal longitude, QString station, QString name);
+		
+		void setName(QString name);
+		QString name() const;
+// 		void setCoordinate(QtMobility::QGeoCoordinate coordinates);
+// 		QString latitude() const;
+// 		QString longitude() const;
+		void setCurrentTemperatur(QString temperature);
+		QString currentTemperature() const;
+		void setCurrentWeatherIcon(QString icon);
+		QString currentWeatherIcon() const;
+// 		QtMobility::QGeoCoordinate toCoordinate() const;
+		bool addToMap(MythImage *map, QPoint position);
+		
+
+	private:
+		void init();
+		
+// 		QtMobility::QGeoCoordinate myCoordinates;
+		QString myName, myStation, myCurrentWeatherIcon;
+		QString myCurrentTemperature;
+};
+
+typedef QList<Location*> Locations;
+
+Q_DECLARE_METATYPE(Location)
+
+#endif // LOCATION_H
diff --git a/mythplugins/mythweather/mythweather/worldweatherscreen.cpp b/mythplugins/mythweather/mythweather/worldweatherscreen.cpp
new file mode 100644
index 0000000..10e1fc5
--- /dev/null
+++ b/mythplugins/mythweather/mythweather/worldweatherscreen.cpp
@@ -0,0 +1,213 @@
+/*
+    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "worldweatherscreen.h"
+
+#include "location.h"
+
+#include <QGeoSearchManager>
+#include <QGeoServiceProvider>
+#include <QGeoCoordinate>
+#include <QGeoAddress>
+
+#include <mythimage.h>
+#include <mythuiimage.h>
+#include <mythmainwindow.h>
+#include <mythdirs.h>
+
+#include <cmath>
+
+using namespace QtMobility;
+
+#include <QDebug>
+
+WorldWeatherScreen::WorldWeatherScreen(MythScreenStack* parent, ScreenListInfo* screenDefn, int id)
+	: WeatherScreen(parent, screenDefn, id)
+{
+	map = NULL;
+	geoProvider = NULL;
+	geoSearch = NULL;
+// 	manager = NULL;
+}
+
+WorldWeatherScreen::~WorldWeatherScreen()
+{
+	if(geoProvider)
+		delete geoProvider;
+}
+
+ScreenListInfo WorldWeatherScreen::info()
+{
+    ScreenListInfo info;
+    info.name = "World Weather";
+    info.title = tr("World Weather");
+    info.hasUnits = false;
+    // seems to be ignored right now
+    info.multiLoc = true;
+		info.dataTypes << "cclocation" << "c1location" << "temp" << "weather" << "weather_icon" << "copyright";
+    return info;
+}
+
+bool WorldWeatherScreen::Create(void )
+{
+    bool foundtheme = false;
+
+    // Load the theme for this screen
+    foundtheme = LoadWindowFromXML("weather-ui.xml", "World Weather", this);
+
+    if (!foundtheme)
+        return false;
+		
+		bool err = false;
+
+    UIUtilE::Assign(this, m_mapImage, "map_image", &err);
+
+		if (err)
+    {
+        VERBOSE(VB_IMPORTANT, "Window World Weather is missing required elements.");
+        return false;
+    }
+
+    if (!prepareScreen(true))
+        return false;
+
+    return true;
+}
+
+void WorldWeatherScreen::newData(QString loc, units_t units, DataMap data)
+{
+	Location *location = new Location();
+	QGeoAddress address;
+	foreach(QString key, data.uniqueKeys()){
+		qDebug() << "WorldWeather::newData: "+ key +": "+ data.value(key);
+		if(key.endsWith("location")){
+			QStringList names = data.value(key).split(", ");
+			if(names.size() < 2)
+				return;
+			location->setName(names[0]);
+			address.setCity(names[0]);
+			address.setCountry(names[1]);
+		}
+		if(key == "temp")
+			location->setCurrentTemperatur(data.value(key));
+		if(key == "weather_icon")
+			location->setCurrentWeatherIcon(data.value(key));
+	}
+	if(address.isEmpty())
+		return;
+	locations << location;
+	QGeoSearchReply *reply = geoSearch->geocode(address);
+	connect(reply, SIGNAL(finished()), this, SLOT(geocodingFinished()));
+}
+
+bool WorldWeatherScreen::prepareScreen(bool checkOnly)
+{
+	// setup provider and scene
+	if(!geoProvider)
+		geoProvider = new QGeoServiceProvider("nokia");
+	if(!geoProvider)
+		return false;
+	if(!geoSearch)
+		geoSearch = geoProvider->searchManager();
+	if(!geoSearch)
+		return false;
+	
+	if(!map || map->isNull())
+		if(!loadMap(SatelliteMapDay))
+			return false;
+
+	// draw empty map
+  m_mapImage->SetImage(map);
+	
+	return true;
+}
+
+void WorldWeatherScreen::geocodingFinished()
+{
+	qDebug() << "geocoding finished";
+	QGeoSearchReply *reply = qobject_cast<QGeoSearchReply*>(sender());
+	if(!reply)
+		return;
+	if(!reply->error() != QGeoSearchReply::NoError){
+		qDebug() << "Network error";
+// 		return;
+	}
+	if(locations.size() < 1)
+		return;
+	
+	Location *location = locations.first();
+	foreach(QGeoPlace place, reply->places()){
+		qDebug() << "trying "+ place.address().city() +" --> "+ location->name();
+		if(place.address().city() == location->name()){
+			qDebug() << "add "+ place.address().city() +" to the map";
+			if(!location->addToMap(map, coordinateToWorldReferencePosition(place.coordinate())))
+				qDebug() << "drawing weathericon has failed";
+			locations.removeFirst();
+			delete location;
+			if(locations.size() < 1)
+				break;
+			location = locations.first();
+		}
+	}
+	
+	emit screenReady(this);
+}
+
+bool WorldWeatherScreen::loadMap(MapType type)
+{
+	if(!map)
+		map = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage();
+	
+	if(type == SatelliteMapNight)
+		map->Load(QString("%1/mythweather/bluemarble/land_ocean_ice_lights_8192.png").arg(GetShareDir()));
+	else
+		map->Load(QString("%1/mythweather/bluemarble/land_shallow_topo_8192.png").arg(GetShareDir()));
+	return !map->isNull();
+}
+
+QPoint WorldWeatherScreen::coordinateToWorldReferencePosition(const QGeoCoordinate& coordinate) const
+{
+	double longitude = coordinate.longitude();
+	double latitude = coordinate.latitude();
+	
+	int x = floor(longitude * mLongitude() + nLongitude());
+	int y = floor(latitude * mLatitude() + nLatitude());
+	
+	return QPoint(x, y);
+}
+
+qreal WorldWeatherScreen::mLongitude() const
+{
+	return qreal(map->size().width())/360.0;
+}
+
+qreal WorldWeatherScreen::mLatitude() const
+{
+	return qreal(map->size().height())/-180.0;
+}
+
+qreal WorldWeatherScreen::nLongitude() const
+{
+	return qreal(map->size().width())/2.0;
+}
+
+qreal WorldWeatherScreen::nLatitude() const
+{
+	return qreal(map->size().height()) + mLatitude() * 90.0;
+}
diff --git a/mythplugins/mythweather/mythweather/worldweatherscreen.h b/mythplugins/mythweather/mythweather/worldweatherscreen.h
new file mode 100644
index 0000000..99e4929
--- /dev/null
+++ b/mythplugins/mythweather/mythweather/worldweatherscreen.h
@@ -0,0 +1,101 @@
+/*
+    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef WORLDWEATHERSCREEN_H
+#define WORLDWEATHERSCREEN_H
+
+#include "weatherScreen.h"
+#include "weatherUtils.h"
+
+class Location;
+
+#include <QGeoCoordinate>
+
+namespace QtMobility{
+	class QGeoServiceProvider;
+	class QGeoSearchManager;
+};
+
+class MythImage;
+
+class WorldWeatherScreen : public WeatherScreen
+{
+    Q_OBJECT
+    public:
+				/**
+					* @brief List of supported maps.
+					*/
+				enum MapType{
+					SatelliteMapDay,		/**< Day map */
+					SatelliteMapNight  	/**< Night map */ 
+				};
+			
+        WorldWeatherScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id);
+        ~WorldWeatherScreen();
+		
+        static ScreenListInfo info();
+		
+        bool Create(void);
+				
+    public slots:
+        void newData(QString loc, units_t units, DataMap data);
+				
+    protected:
+        bool prepareScreen(bool checkOnly = false);
+				
+		private slots:
+			void geocodingFinished();
+				
+    private:
+				/**
+					* @brief Loads the map of @p type type.
+					*/
+				bool loadMap(MapType type);
+				/**
+					* @brief Converts the coordinate \a coordinate to a pixel position on the entire map at the maximum zoom level.
+					* 
+					* @note Do not check for longitude between -180 and 180 and latitude between
+					*       -90 and 90, because the map starts over after 180 and -180 and so on.
+					*/
+				QPoint coordinateToWorldReferencePosition(const QtMobility::QGeoCoordinate &coordinate) const;
+				/**
+					* @brief pixel/Deg for longitude.
+					*/
+				qreal mLongitude() const;
+				/**
+					* @brief pixel/deg for latitude.
+					*/
+				qreal mLatitude() const;
+				/**
+					* @brief pixel of greenwich meridian.
+					*/
+				qreal nLongitude() const;
+				/**
+					* @brief pixel of equator.
+					*/
+				qreal nLatitude() const;
+			
+				MythImage *map;
+        MythUIImage *m_mapImage;
+				QtMobility::QGeoServiceProvider *geoProvider;
+				QtMobility::QGeoSearchManager *geoSearch;
+				QList<Location*> locations;
+};
+
+#endif // WORLDWEATHERSCREEN_H
-- 
1.7.3.4


From ae2f2d8773630c576f0398d639e6a19067e9717d Mon Sep 17 00:00:00 2001
From: Joachim Langenbach <joachim.langenbach@engsas.de>
Date: Thu, 26 Jan 2012 22:17:49 +0100
Subject: [PATCH 2/2] Forgotten some changes for WorldWeatherMap

---
 .../mythweather/mythweather/weatherScreen.cpp      |   15 ++++----
 .../mythweather/mythweather/weatherUtils.cpp       |   32 +++++++++++-------
 mythplugins/mythweather/mythweather/weatherUtils.h |   35 ++++++++------------
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/mythplugins/mythweather/mythweather/weatherScreen.cpp b/mythplugins/mythweather/mythweather/weatherScreen.cpp
index f34cc09..0f25c20 100644
--- a/mythplugins/mythweather/mythweather/weatherScreen.cpp
+++ b/mythplugins/mythweather/mythweather/weatherScreen.cpp
@@ -8,24 +8,25 @@ using namespace std;
 // MythWeather headers
 #include "weather.h"
 #include "weatherScreen.h"
+#include "worldweatherscreen.h"
 
 WeatherScreen *WeatherScreen::loadScreen(MythScreenStack *parent,
                                          ScreenListInfo *screenDefn, int id)
 {
+    if(screenDefn->name == "World Weather")
+        return new WorldWeatherScreen(parent, screenDefn, id);
     return new WeatherScreen(parent, screenDefn, id);
 }
 
 WeatherScreen::WeatherScreen(MythScreenStack *parent,
                              ScreenListInfo *screenDefn, int id) :
                MythScreenType (parent, screenDefn->title),
-    m_units(SI_UNITS),
     m_screenDefn(screenDefn),
     m_name(m_screenDefn->name),
     m_inuse(false),
     m_prepared(false),
     m_id(id)
 {
-
     QStringList types = m_screenDefn->dataTypes;
 
     for (int i = 0; i < types.size(); ++i)
@@ -66,7 +67,7 @@ bool WeatherScreen::canShowScreen()
         i.next();
         if (i.key().isEmpty())
         {
-            LOG(VB_GENERAL, LOG_DEBUG, i.key());
+            VERBOSE(VB_GENERAL, i.key());
             ok = false;
         }
     }
@@ -96,7 +97,7 @@ void WeatherScreen::newData(QString loc, units_t units, DataMap data)
     // This may seem like overkill, but it is necessary to actually update the
     // static and animated maps when they are redownloaded on an update
     if (!prepareScreen())
-        LOG(VB_GENERAL, LOG_ERR, "Theme is missing a required widget!");
+        VERBOSE(VB_IMPORTANT, "Theme is missing a required widget!");
 
     emit screenReady(this);
 }
@@ -119,13 +120,13 @@ bool WeatherScreen::prepareScreen(bool checkOnly)
 
         if (!widget)
         {
-            LOG(VB_GENERAL, LOG_ERR, "Widget not found " + itr.key());
+            VERBOSE(VB_GENERAL, "Widget not found " + itr.key());
 
             if (name == "copyright")
             {
-                LOG(VB_GENERAL, LOG_WARNING,
+                VERBOSE(VB_IMPORTANT, 
                     QString("No copyright widget found, skipping screen %1.")
-                        .arg(m_name));
+                    .arg(m_name));
                 return false;
             }
         }
diff --git a/mythplugins/mythweather/mythweather/weatherUtils.cpp b/mythplugins/mythweather/mythweather/weatherUtils.cpp
index 4284d64..f3e4b64 100644
--- a/mythplugins/mythweather/mythweather/weatherUtils.cpp
+++ b/mythplugins/mythweather/mythweather/weatherUtils.cpp
@@ -8,6 +8,7 @@
 
 // MythWeather headers
 #include "weatherUtils.h"
+#include "worldweatherscreen.h"
 
 static QString getScreenTitle(const QString &screenName)
 {
@@ -32,31 +33,36 @@ static QString getScreenTitle(const QString &screenName)
 ScreenListMap loadScreens()
 {
     ScreenListMap screens;
-    QStringList searchpath = GetMythUI()->GetThemeSearchPath();
-
+    QList<QString> searchpath = GetMythUI()->GetThemeSearchPath();
+		
+		ScreenListInfo info = WorldWeatherScreen::info();
+		screens[info.name].multiLoc = false;
+		screens[info.name].name = info.name;
+		screens[info.name].title = info.title;
+		screens[info.name].hasUnits = true;
+		screens[info.name].dataTypes = info.dataTypes;
+    
     // Check the theme first if it has its own weather-screens.xml
-
-    QStringList::iterator it;
-    for (it = searchpath.begin(); it != searchpath.end(); ++it)
+    
+    QList<QString>::iterator i;
+    for (i = searchpath.begin(); i != searchpath.end(); i++)
     {
-        QString filename = (*it) + "weather-screens.xml";
+        QString filename = *i + "weather-screens.xml";
         if (doLoadScreens(filename, screens))
         {
-            LOG(VB_GENERAL, LOG_INFO,
-                QString("Loading from: %1").arg(filename));
+            VERBOSE(VB_GENERAL, QString("Loading from: %1").arg(filename));
             break;
         }
     }
 
     //  Also load from the default file in case the theme file doesn't
     //  exist or the theme file doesn't define all the screens
-
+    
     QString filename = GetShareDir() + "mythweather/weather-screens.xml";
-
+    
     if (!doLoadScreens(filename, screens))
     {
-        LOG(VB_GENERAL, LOG_ERR,
-            QString("Unable to parse weather-screens.xml"));
+        VERBOSE(VB_IMPORTANT, QString("Unable to parse weather-screens.xml"));
     }
 
     return screens;
@@ -66,7 +72,7 @@ bool doLoadScreens(const QString &filename, ScreenListMap &screens)
 {
     QFile f(filename);
     QDomDocument doc;
-
+        
     if (!f.open(QIODevice::ReadOnly))
     {
         return false;
diff --git a/mythplugins/mythweather/mythweather/weatherUtils.h b/mythplugins/mythweather/mythweather/weatherUtils.h
index d39d5da..2b392b5 100644
--- a/mythplugins/mythweather/mythweather/weatherUtils.h
+++ b/mythplugins/mythweather/mythweather/weatherUtils.h
@@ -15,7 +15,7 @@
 #define SI_UNITS 0
 #define ENG_UNITS 1
 #define DEFAULT_UPDATE_TIMEOUT (5*60*1000)
-#define DEFAULT_SCRIPT_TIMEOUT (60)
+#define DEFAULT_SCRIPT_TIMEOUT (60*1000)
 
 typedef unsigned char units_t;
 typedef QMap<QString, QString> DataMap;
@@ -23,14 +23,14 @@ typedef QMap<QString, QString> DataMap;
 class TypeListInfo
 {
   public:
-
+  
     TypeListInfo(const TypeListInfo& info)
         : name(info.name), location(info.location), src(info.src)
     {
         name.detach();
         location.detach();
     }
-
+  
     TypeListInfo(const QString &_name)
         : name(_name), location(QString::null), src(NULL)
     {
@@ -60,25 +60,18 @@ typedef QMultiHash<QString, TypeListInfo> TypeListMap;
 class ScreenListInfo
 {
   public:
-    ScreenListInfo() :
-        units(SI_UNITS),
-        hasUnits(false),
-        multiLoc(false)
-    {
-        updating = false;
-    }
+    ScreenListInfo() {updating = false;}
 
     ScreenListInfo(const ScreenListInfo& info) :
-        name(info.name),
-        title(info.title),
-        types(info.types),
-        dataTypes(info.dataTypes),
-        helptxt(info.helptxt),
-        sources(info.sources),
-        units(info.units),
-        hasUnits(info.hasUnits),
-        multiLoc(info.multiLoc),
-        updating(info.updating)
+    name(info.name),
+    title(info.title),
+    types(info.types),
+    helptxt(info.helptxt),
+    sources(info.sources),
+    units(info.units),
+    hasUnits(info.hasUnits),
+    multiLoc(info.multiLoc),
+    updating(info.updating)
     {
       types.detach();
     }
@@ -98,7 +91,7 @@ class ScreenListInfo
     bool updating;
 };
 
-Q_DECLARE_METATYPE(ScreenListInfo *);
+Q_DECLARE_METATYPE(ScreenListInfo *); 
 
 typedef QMap<QString, ScreenListInfo> ScreenListMap;
 
-- 
1.7.3.4

