Ticket #10286: mythweather-worldweathermap.3.patch

File mythweather-worldweathermap.3.patch, 24.2 KB (added by joachim@…, 17 months ago)

Complete patch without binary files

  • mythplugins//configure

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//configure mythtv/mythplugins//configure
    old new sdl 
    118118exif 
    119119newexif 
    120120dcraw 
     121worldweather 
    121122" 
    122123 
    123124enable $PLUGIN_LIST $CONFIG_LIST 
    MythVideo related options: 
    183184 
    184185MythWeather related options: 
    185186  --enable-mythweather     build the mythweather plugin [$weather] 
     187  --enable-worldweather    build the world weather map screen [$worldweather] 
    186188 
    187189MythZoneMinder related options: 
    188190  --enable-mythzoneminder  build the mythzoneminder plugin [$zoneminder] 
    for opt do 
    254256  ;; 
    255257  --disable-dcraw) dcraw="no" 
    256258  ;; 
     259  --enable-worldweather) worldweather="yes" 
     260  ;; 
     261  --disable-worldweather) worldweather="no" 
     262  ;; 
    257263  --icc-profile=*) icc=`echo $opt | cut -d '=' -f 2` 
    258264  ;; 
    259265  --enable-all) 
    if ! disabled weather; then 
    462468        disable_weather "DateTime::Format::ISO8601" 
    463469    check_pl_lib "SOAP::Lite"  || disable_weather "SOAP::Lite" 
    464470    check_pl_lib "JSON"  || disable_weather "JSON" 
     471 
     472    if test "$worldweather" != "no" ; then 
     473        worldweather="no" 
     474        if has_library libQtLocation ; then 
     475            if has_header qt4/QtLocation/QGeoCoordinate ; then 
     476                worldweather="yes" 
     477            fi 
     478        fi 
     479    fi 
    465480fi 
    466481 
    467482if test "$dcraw" != "no" ; then 
    else 
    658673  echo "        MythVideo      plugin will not be built" 
    659674fi 
    660675 
     676########################################################### 
     677#                                                         # 
     678#   MythWeather related configuration options             # 
     679#                                                         # 
     680########################################################### 
     681 
    661682if test "$weather" = "yes" ; then 
    662683  echo "        MythWeather    plugin will be built" 
    663684  echo "SUBDIRS += mythweather" >> ./config.pro 
     685  echo "/*" >  ./mythweather/mythweather/config.h 
     686  echo "    Automatically generated by configure - do not modify" >> ./mythweather/mythweather/config.h 
     687  echo "*/" >> ./mythweather/mythweather/config.h 
     688 
     689  echo "#" > ./mythweather/config.pro 
     690  echo "#    Automatically generated by configure - modify only under penalty of death" >> ./mythweather/config.pro 
     691  echo "#" >> ./mythweather/config.pro 
     692 
     693  echo "#" > ./mythweather/mythweather/config.pro 
     694  echo "#    Automatically generated by configure - modify only under penalty of death" >> ./mythweather/mythweather/config.pro 
     695  echo "#" >> ./mythweather/mythweather/config.pro 
     696  if test "$worldweather" = "yes" ; then 
     697    echo "        World weather map screen         will be included in MythWeather" 
     698    echo "#define USE_WORLDWEATHERMAP 1" >> ./mythweather/mythweather/config.h 
     699    echo "CONFIG += mobility" >> ./mythweather/mythweather/config.pro 
     700    echo "MOBILITY += location" >> ./mythweather/mythweather/config.pro 
     701    echo "HEADERS += worldweatherscreen.h location.h" >> ./mythweather/mythweather/config.pro 
     702    echo "SOURCES += worldweatherscreen.cpp location.cpp" >> ./mythweather/mythweather/config.pro 
     703    echo "installmaps.path = $${PREFIX}/share/mythtv/mythweather/bluemarble" >> ./mythweather/mythweather/config.pro 
     704    echo "installmaps.files = bluemarble/*.png" >> ./mythweather/mythweather/config.pro 
     705    echo "INSTALLS += datafiles installscripts installmaps" >> ./mythweather/mythweather/config.pro 
     706  fi 
     707  if test "$worldweather" = "no" ; then 
     708          echo "        World weather map screen         will not be included in MythWeather" 
     709  fi 
    664710else 
    665711  echo "        MythWeather    plugin will not be built" 
    666712fi 
  • mythplugins//mythweather/mythweather/location.cpp

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/location.cpp mythtv/mythplugins//mythweather/mythweather/location.cpp
    old new  
     1/* 
     2    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved. 
     3 
     4    This program is free software: you can redistribute it and/or modify 
     5    it under the terms of the GNU General Public License as published by 
     6    the Free Software Foundation, either version 3 of the License, or 
     7    (at your option) any later version. 
     8 
     9    This program is distributed in the hope that it will be useful, 
     10    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     12    GNU General Public License for more details. 
     13 
     14    You should have received a copy of the GNU General Public License 
     15    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16 
     17*/ 
     18 
     19 
     20#include "location.h" 
     21 
     22#include <mythimage.h> 
     23#include <mythmainwindow.h> 
     24 
     25#include <QStringList> 
     26#include <QPainter> 
     27#include <QPixmap> 
     28#include <QFont> 
     29#include <QFontMetrics> 
     30 
     31void Location::setName(QString name) 
     32{ 
     33    m_name = name; 
     34} 
     35 
     36QString Location::name() const 
     37{ 
     38    return m_name; 
     39} 
     40 
     41void Location::setCurrentTemperature(QString temperature) 
     42{ 
     43    m_currentTemperature = temperature; 
     44} 
     45 
     46QString Location::currentTemperature() const 
     47{ 
     48    return m_currentTemperature; 
     49} 
     50 
     51void Location::setCurrentWeatherIcon(QString icon) 
     52{ 
     53    if(!icon.startsWith(":/weathermap/") && !icon.startsWith(":")) 
     54        icon = ":/weathermap/"+ icon; 
     55    m_currentWeatherIcon = icon; 
     56} 
     57 
     58QString Location::currentWeatherIcon() const 
     59{ 
     60    return m_currentWeatherIcon; 
     61} 
     62 
     63bool Location::addToMap(MythImage* map, QPoint position) 
     64{ 
     65    if(!map) 
     66        return false; 
     67 
     68    // load weather icon 
     69    MythImage *weatherIcon = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); 
     70    weatherIcon->UpRef(); 
     71    weatherIcon->Load(currentWeatherIcon()); 
     72    if(weatherIcon->isNull()) 
     73        weatherIcon->Load("unknown.png"); 
     74 
     75    // add the temperature value 
     76    QFont iconFont; 
     77    iconFont.setPixelSize(40); 
     78    QFontMetrics metrics(iconFont); 
     79    QString text = QObject::tr("%1: %2 C").arg(name()).arg(currentTemperature()); 
     80    int iconWidth = weatherIcon->size().width(); 
     81    if(iconWidth < metrics.width(text)) 
     82        iconWidth = metrics.width(text); 
     83 
     84    QPixmap icon(iconWidth, 
     85                 weatherIcon->size().height() + 1.2 * float(metrics.height())); 
     86    icon.fill(Qt::transparent); 
     87    QPainter painter; 
     88    painter.begin(&icon); 
     89    painter.setFont(iconFont); 
     90    painter.setPen(Qt::white); 
     91    // remember: iconWidth = weatherIcon.width() 
     92    painter.drawImage((icon.width() - iconWidth)/2, 0, *weatherIcon); 
     93    painter.drawText(float(icon.width() - metrics.width(text)) / 2.0, 
     94                     weatherIcon->height(), 
     95                     text 
     96    ); 
     97    painter.end(); 
     98 
     99    icon = icon.scaled(iconWidth, 60, Qt::KeepAspectRatio); 
     100    // set offset 
     101    position.setX(position.x() - icon.width()/2); 
     102    position.setY(position.y() - 40); 
     103    painter.begin(map); 
     104    painter.drawPixmap(position.x(), position.y(), icon); 
     105    painter.end(); 
     106                 
     107                weatherIcon->DownRef(); 
     108 
     109    return true; 
     110} 
  • mythplugins//mythweather/mythweather/location.h

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/location.h mythtv/mythplugins//mythweather/mythweather/location.h
    old new  
     1/* 
     2    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved. 
     3 
     4    This program is free software: you can redistribute it and/or modify 
     5    it under the terms of the GNU General Public License as published by 
     6    the Free Software Foundation, either version 3 of the License, or 
     7    (at your option) any later version. 
     8 
     9    This program is distributed in the hope that it will be useful, 
     10    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     12    GNU General Public License for more details. 
     13 
     14    You should have received a copy of the GNU General Public License 
     15    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16 
     17*/ 
     18 
     19 
     20#ifndef LOCATION_H 
     21#define LOCATION_H 
     22 
     23// #include <QGeoCoordinate> 
     24 
     25class MythImage; 
     26 
     27#include <QMetaType> 
     28 
     29/** 
     30    * @brief Represents a location with its coordinates and weather. 
     31    */ 
     32class Location 
     33{ 
     34    public: 
     35        inline Location(){ m_currentWeatherIcon = "unknown.png"; } 
     36 
     37        void setName(QString name); 
     38        QString name() const; 
     39        void setCurrentTemperature(QString temperature); 
     40        QString currentTemperature() const; 
     41        void setCurrentWeatherIcon(QString icon); 
     42        QString currentWeatherIcon() const; 
     43        bool addToMap(MythImage *map, QPoint position); 
     44 
     45    private: 
     46        QString m_name, m_station, m_currentWeatherIcon; 
     47        QString m_currentTemperature; 
     48}; 
     49 
     50typedef QList<Location*> Locations; 
     51 
     52Q_DECLARE_METATYPE(Location) 
     53 
     54#endif // LOCATION_H 
  • mythplugins//mythweather/mythweather/mythweather.pro

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/mythweather.pro mythtv/mythplugins//mythweather/mythweather/mythweather.pro
    old new INSTALLS += datafiles installscripts 
    2525# Input 
    2626 
    2727HEADERS += weather.h weatherSource.h sourceManager.h weatherScreen.h dbcheck.h 
    28 HEADERS += weatherSetup.h weatherUtils.h 
     28HEADERS += weatherSetup.h weatherUtils.h config.h 
    2929SOURCES += main.cpp weather.cpp weatherSource.cpp sourceManager.cpp weatherScreen.cpp 
    3030SOURCES += dbcheck.cpp weatherSetup.cpp weatherUtils.cpp 
    3131 
    3232include ( ../../libs-targetfix.pro ) 
     33 
     34include (config.pro) 
     35 
     36!exists( config.pro ) { 
     37   error(Missing config.pro: please run the configure script) 
     38} 
  • mythplugins//mythweather/mythweather/weatherScreen.cpp

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/weatherScreen.cpp mythtv/mythplugins//mythweather/mythweather/weatherScreen.cpp
    old new using namespace std; 
    88// MythWeather headers 
    99#include "weather.h" 
    1010#include "weatherScreen.h" 
     11#include "config.h" 
     12#ifdef USE_WORLDWEATHERMAP 
     13    #include "worldweatherscreen.h" 
     14#endif 
    1115 
    1216WeatherScreen *WeatherScreen::loadScreen(MythScreenStack *parent, 
    1317                                         ScreenListInfo *screenDefn, int id) 
    1418{ 
     19#ifdef USE_WORLDWEATHERMAP 
     20    if(screenDefn->name == "World Weather") 
     21        return new WorldWeatherScreen(parent, screenDefn, id); 
     22#endif 
    1523    return new WeatherScreen(parent, screenDefn, id); 
    1624} 
    1725 
    WeatherScreen::WeatherScreen(MythScreenS 
    2432    m_prepared(false), 
    2533    m_id(id) 
    2634{ 
    27  
    2835    QStringList types = m_screenDefn->dataTypes; 
    2936 
    3037    for (int i = 0; i < types.size(); ++i) 
  • mythplugins//mythweather/mythweather/weatherUtils.cpp

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/weatherUtils.cpp mythtv/mythplugins//mythweather/mythweather/weatherUtils.cpp
    old new  
    88 
    99// MythWeather headers 
    1010#include "weatherUtils.h" 
     11#include "config.h" 
     12#ifdef USE_WORLDWEATHERMAP 
     13    #include "worldweatherscreen.h" 
     14#endif 
    1115 
    1216static QString getScreenTitle(const QString &screenName) 
    1317{ 
    ScreenListMap loadScreens() 
    3337{ 
    3438    ScreenListMap screens; 
    3539    QList<QString> searchpath = GetMythUI()->GetThemeSearchPath(); 
     40 
     41#ifdef USE_WORLDWEATHERMAP 
     42    ScreenListInfo info = WorldWeatherScreen::info(); 
     43    screens[info.name].multiLoc = false; 
     44    screens[info.name].name = info.name; 
     45    screens[info.name].title = info.title; 
     46    screens[info.name].hasUnits = true; 
     47    screens[info.name].dataTypes = info.dataTypes; 
     48#endif 
    3649     
    3750    // Check the theme first if it has its own weather-screens.xml 
    3851     
  • mythplugins//mythweather/mythweather/worldweatherscreen.cpp

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/worldweatherscreen.cpp mythtv/mythplugins//mythweather/mythweather/worldweatherscreen.cpp
    old new  
     1/* 
     2    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved. 
     3 
     4    This program is free software: you can redistribute it and/or modify 
     5    it under the terms of the GNU General Public License as published by 
     6    the Free Software Foundation, either version 3 of the License, or 
     7    (at your option) any later version. 
     8 
     9    This program is distributed in the hope that it will be useful, 
     10    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     12    GNU General Public License for more details. 
     13 
     14    You should have received a copy of the GNU General Public License 
     15    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16 
     17*/ 
     18 
     19 
     20#include "worldweatherscreen.h" 
     21 
     22#include "location.h" 
     23 
     24#include <QGeoSearchManager> 
     25#include <QGeoServiceProvider> 
     26#include <QGeoCoordinate> 
     27#include <QGeoAddress> 
     28 
     29#include <mythimage.h> 
     30#include <mythuiimage.h> 
     31#include <mythmainwindow.h> 
     32#include <mythdirs.h> 
     33 
     34#include <cmath> 
     35 
     36using namespace QtMobility; 
     37 
     38#include <QDebug> 
     39 
     40WorldWeatherScreen::WorldWeatherScreen(MythScreenStack* parent, 
     41                                       ScreenListInfo* screenDefn, int id) 
     42    : WeatherScreen(parent, screenDefn, id) 
     43{ 
     44    m_map = NULL; 
     45    m_geoProvider = NULL; 
     46    m_geoSearch = NULL; 
     47//      manager = NULL; 
     48} 
     49 
     50WorldWeatherScreen::~WorldWeatherScreen() 
     51{ 
     52    if(m_geoProvider) 
     53        delete m_geoProvider; 
     54    m_map->DownRef(); 
     55} 
     56 
     57ScreenListInfo WorldWeatherScreen::info() 
     58{ 
     59    ScreenListInfo info; 
     60    info.name = "World Weather"; 
     61    info.title = tr("World Weather"); 
     62    info.hasUnits = false; 
     63    // seems to be ignored right now 
     64    info.multiLoc = true; 
     65    info.dataTypes << "cclocation" << "c1location" << "temp"; 
     66    info.dataTypes << "weather" << "weather_icon" << "copyright"; 
     67    return info; 
     68} 
     69 
     70bool WorldWeatherScreen::Create(void ) 
     71{ 
     72    bool foundtheme = false; 
     73 
     74    // Load the theme for this screen 
     75    foundtheme = LoadWindowFromXML("weather-ui.xml", "World Weather", this); 
     76 
     77    if (!foundtheme) 
     78        return false; 
     79 
     80    bool err = false; 
     81 
     82    UIUtilE::Assign(this, m_mapImage, "map_image", &err); 
     83 
     84    if (err) 
     85    { 
     86        VERBOSE(VB_IMPORTANT, "Window World Weather is missing required elements."); 
     87        return false; 
     88    } 
     89 
     90    if (!prepareScreen(true)) 
     91        return false; 
     92 
     93    return true; 
     94} 
     95 
     96void WorldWeatherScreen::newData(QString loc, units_t units, DataMap data) 
     97{ 
     98    Location *location = new Location(); 
     99    QGeoAddress address; 
     100    foreach(QString key, data.uniqueKeys()){ 
     101        qDebug() << "WorldWeather::newData: "+ key +": "+ data.value(key); 
     102        if(key.endsWith("location")){ 
     103            QStringList names = data.value(key).split(", "); 
     104            if(names.size() < 2) 
     105                return; 
     106            location->setName(names[0]); 
     107            address.setCity(names[0]); 
     108            address.setCountry(names[1]); 
     109        } 
     110        if(key == "temp") 
     111            location->setCurrentTemperature(data.value(key)); 
     112        if(key == "weather_icon") 
     113            location->setCurrentWeatherIcon(data.value(key)); 
     114    } 
     115    if(address.isEmpty()) 
     116        return; 
     117    m_locations << location; 
     118    QGeoSearchReply *reply = m_geoSearch->geocode(address); 
     119    connect(reply, SIGNAL(finished()), this, SLOT(geocodingFinished())); 
     120} 
     121 
     122bool WorldWeatherScreen::prepareScreen(bool checkOnly) 
     123{ 
     124    // setup provider and scene 
     125    if(!m_geoProvider) 
     126        m_geoProvider = new QGeoServiceProvider("nokia"); 
     127    if(!m_geoProvider) 
     128        return false; 
     129    if(!m_geoSearch) 
     130        m_geoSearch = m_geoProvider->searchManager(); 
     131    if(!m_geoSearch) 
     132        return false; 
     133 
     134    if(!m_map || m_map->isNull()) 
     135        if(!loadMap(SatelliteMapDay)) 
     136            return false; 
     137 
     138    // draw empty map 
     139    m_map->UpRef(); 
     140    setMap(); 
     141 
     142    return true; 
     143} 
     144 
     145void WorldWeatherScreen::geocodingFinished() 
     146{ 
     147    qDebug() << "geocoding finished"; 
     148    QGeoSearchReply *reply = qobject_cast<QGeoSearchReply*>(sender()); 
     149    if(!reply) 
     150        return; 
     151    if(!reply->error() != QGeoSearchReply::NoError){ 
     152        qDebug() << "Network error"; 
     153//              return; 
     154    } 
     155    if(m_locations.size() < 1) 
     156        return; 
     157 
     158    Location *location = m_locations.first(); 
     159    foreach(QGeoPlace place, reply->places()){ 
     160        qDebug() << "trying "+ place.address().city() +" --> "+ location->name(); 
     161        if(place.address().city() == location->name()){ 
     162            qDebug() << "add "+ place.address().city() +" to the map"; 
     163            if(!location->addToMap(m_map, coordinateToWorldReferencePosition(place.coordinate()))) 
     164                qDebug() << "drawing weathericon has failed"; 
     165            m_locations.removeFirst(); 
     166            delete location; 
     167            if(m_locations.size() < 1) 
     168                break; 
     169            location = m_locations.first(); 
     170        } 
     171    } 
     172 
     173    setMap(); 
     174    emit screenReady(this); 
     175} 
     176 
     177bool WorldWeatherScreen::loadMap(MapType type) 
     178{ 
     179    if(!m_map) 
     180        m_map = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); 
     181 
     182    if(type == SatelliteMapNight) 
     183        m_map->Load( 
     184            QString("%1/mythweather/bluemarble/land_ocean_ice_lights_8192.png") 
     185            .arg(GetShareDir()) 
     186        ); 
     187    else 
     188        m_map->Load( 
     189            QString("%1/mythweather/bluemarble/land_shallow_topo_8192.png") 
     190            .arg(GetShareDir()) 
     191        ); 
     192    if(m_map->isNull()) 
     193        return false; 
     194    m_map->Resize(GetMythMainWindow()->size(), true); 
     195    return !m_map->isNull(); 
     196} 
     197 
     198void WorldWeatherScreen::setMap() 
     199{ 
     200    if(!m_map || !m_mapImage) 
     201        return; 
     202 
     203    MythImage *image = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); 
     204    image->UpRef(); 
     205    image->Assign(m_map->copy()); 
     206    m_mapImage->SetImage(image); 
     207} 
     208 
     209QPoint WorldWeatherScreen::coordinateToWorldReferencePosition( 
     210        const QGeoCoordinate& coordinate) const 
     211{ 
     212    double longitude = coordinate.longitude(); 
     213    double latitude = coordinate.latitude(); 
     214 
     215    int x = floor(longitude * mLongitude() + nLongitude()); 
     216    int y = floor(latitude * mLatitude() + nLatitude()); 
     217 
     218    return QPoint(x, y); 
     219} 
     220 
     221qreal WorldWeatherScreen::mLongitude() const 
     222{ 
     223    return qreal(m_map->size().width())/360.0; 
     224} 
     225 
     226qreal WorldWeatherScreen::mLatitude() const 
     227{ 
     228    return qreal(m_map->size().height())/-180.0; 
     229} 
     230 
     231qreal WorldWeatherScreen::nLongitude() const 
     232{ 
     233    return qreal(m_map->size().width())/2.0; 
     234} 
     235 
     236qreal WorldWeatherScreen::nLatitude() const 
     237{ 
     238    return qreal(m_map->size().height()) + mLatitude() * 90.0; 
     239} 
  • mythplugins//mythweather/mythweather/worldweatherscreen.h

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/mythweather/worldweatherscreen.h mythtv/mythplugins//mythweather/mythweather/worldweatherscreen.h
    old new  
     1/* 
     2    Copyright (C) 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved. 
     3 
     4    This program is free software: you can redistribute it and/or modify 
     5    it under the terms of the GNU General Public License as published by 
     6    the Free Software Foundation, either version 3 of the License, or 
     7    (at your option) any later version. 
     8 
     9    This program is distributed in the hope that it will be useful, 
     10    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     12    GNU General Public License for more details. 
     13 
     14    You should have received a copy of the GNU General Public License 
     15    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16 
     17*/ 
     18 
     19 
     20#ifndef WORLDWEATHERSCREEN_H 
     21#define WORLDWEATHERSCREEN_H 
     22 
     23#include "weatherScreen.h" 
     24#include "weatherUtils.h" 
     25 
     26class Location; 
     27 
     28#include <QGeoCoordinate> 
     29 
     30namespace QtMobility{ 
     31    class QGeoServiceProvider; 
     32    class QGeoSearchManager; 
     33}; 
     34 
     35class MythImage; 
     36 
     37class WorldWeatherScreen : public WeatherScreen 
     38{ 
     39    Q_OBJECT 
     40    public: 
     41        /** 
     42          * @brief List of supported maps. 
     43          */ 
     44        enum MapType{ 
     45            SatelliteMapDay,            /**< Day map */ 
     46            SatelliteMapNight   /**< Night map */  
     47        }; 
     48 
     49        WorldWeatherScreen(MythScreenStack *parent, 
     50                           ScreenListInfo *screenDefn, int id); 
     51        ~WorldWeatherScreen(); 
     52 
     53        static ScreenListInfo info(); 
     54 
     55        bool Create(void); 
     56 
     57    public slots: 
     58        void newData(QString loc, units_t units, DataMap data); 
     59 
     60    protected: 
     61        bool prepareScreen(bool checkOnly = false); 
     62 
     63    private slots: 
     64        void geocodingFinished(); 
     65 
     66    private: 
     67        /** 
     68          * @brief Loads the map of @p type type from file. 
     69          */ 
     70        bool loadMap(MapType type); 
     71        /** 
     72          * @brief Set a copy of m_map into m_mapImage. 
     73          */ 
     74        void setMap(); 
     75        /** 
     76          * @brief Converts the coordinate \a coordinate to a pixel position 
     77          *        on the entire map at the maximum zoom level. 
     78          *  
     79          * @note Do not check for longitude between -180 and 180 and latitude  
     80          *       between -90 and 90, because the map starts over after 180 and 
     81          *       -180 and so on. 
     82          */ 
     83        QPoint coordinateToWorldReferencePosition( 
     84          const QtMobility::QGeoCoordinate &coordinate) const; 
     85        /** 
     86          * @brief pixel/Deg for longitude. 
     87          */ 
     88        qreal mLongitude() const; 
     89        /** 
     90          * @brief pixel/deg for latitude. 
     91          */ 
     92        qreal mLatitude() const; 
     93        /** 
     94          * @brief pixel of greenwich meridian. 
     95          */ 
     96        qreal nLongitude() const; 
     97        /** 
     98          * @brief pixel of equator. 
     99          */ 
     100        qreal nLatitude() const; 
     101 
     102        MythImage *m_map; 
     103        MythUIImage *m_mapImage; 
     104        QtMobility::QGeoServiceProvider *m_geoProvider; 
     105        QtMobility::QGeoSearchManager *m_geoSearch; 
     106        QList<Location*> m_locations; 
     107}; 
     108 
     109#endif // WORLDWEATHERSCREEN_H 
  • mythplugins//mythweather/theme/default/weather-ui.xml

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/theme/default/weather-ui.xml mythtv/mythplugins//mythweather/theme/default/weather-ui.xml
    old new  
    4545        </textarea> 
    4646    </window> 
    4747 
     48    <window name="World Weather"> 
     49        <imagetype name="map_image"> 
     50            <area>30,80,760,380</area> 
     51        </imagetype> 
     52    </window> 
     53     
    4854    <window name="Current Conditions"> 
    4955 
    5056        <shape name="background1"> 
  • mythplugins//mythweather/theme/default-wide/weather-ui.xml

    diff -rupN -x '*~' -x '*.mak' -x config.ep -x config.log -x cleanup mythtv.orig/mythplugins//mythweather/theme/default-wide/weather-ui.xml mythtv/mythplugins//mythweather/theme/default-wide/weather-ui.xml
    old new  
    4545        </textarea> 
    4646    </window> 
    4747 
     48    <window name="World Weather"> 
     49        <imagetype name="map_image"> 
     50            <area>0,65,1280,640</area> 
     51        </imagetype> 
     52    </window> 
     53 
    4854    <window name="Current Conditions"> 
    4955 
    5056        <shape name="background1">