summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-08 23:08:11 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-08 23:08:11 (GMT)
commit858d80c6f62dbf38c10fa0d4d29679d9122d4065 (patch)
tree551cf654c815a9830e1a5ed0e948b7734627ac76
parentf4ae0754dead3039f4663b664dda64301faad0ec (diff)
Remove sources of old plasma4 worldclock plasmoid
-rw-r--r--src/plasmoid/CMakeLists.txt44
-rw-r--r--src/plasmoid/plasma-applet-kworldclock.desktop115
-rw-r--r--src/plasmoid/worldclock.cpp506
-rw-r--r--src/plasmoid/worldclock.h120
-rw-r--r--src/plasmoid/worldclockConfig.ui273
5 files changed, 0 insertions, 1058 deletions
diff --git a/src/plasmoid/CMakeLists.txt b/src/plasmoid/CMakeLists.txt
deleted file mode 100644
index d8709c4..0000000
--- a/src/plasmoid/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-set(KDE_SKIP_UNINSTALL_TARGET ON CACHE BOOL "KDE uninstall target must be disabled")
-find_package(ECM QUIET)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
-if(ECM_FOUND)
- include(KDEInstallDirs)
-endif()
-macro_optional_find_package(KF5 QUIET COMPONENTS Config Plasma Service)
-
-if (NOT KF5_FOUND)
- return()
-endif()
-
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/../lib
- ${CMAKE_CURRENT_SOURCE_DIR}/../lib/projections
- ${CMAKE_CURRENT_SOURCE_DIR}/../lib/geodata
- ${CMAKE_CURRENT_SOURCE_DIR}/../lib/geodata/data
- ${CMAKE_CURRENT_SOURCE_DIR}/../lib/geodata/parser
- ${CMAKE_CURRENT_SOURCE_DIR}/../lib/geodata/scene
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_BINARY_DIR}
- ${KDE4_INCLUDES}
- )
-
-set(worldclock_SRCS worldclock.cpp )
-
-qt_add_resources(worldclock_SRCS ../apps/marble-ui/marble.qrc)
-
-qt_wrap_ui( worldclock_SRCS worldclockConfig.ui )
-
-add_library(plasma_applet_worldclock MODULE ${worldclock_SRCS})
-target_link_libraries(plasma_applet_worldclock
- KF5::ConfigCore
- KF5::Plasma
- KF5::Service
- ${MARBLEWIDGET} )
-
-install(TARGETS plasma_applet_worldclock
- DESTINATION ${PLUGIN_INSTALL_DIR})
-
-install(FILES plasma-applet-kworldclock.desktop
- DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/src/plasmoid/plasma-applet-kworldclock.desktop b/src/plasmoid/plasma-applet-kworldclock.desktop
deleted file mode 100644
index 98b980e..0000000
--- a/src/plasmoid/plasma-applet-kworldclock.desktop
+++ /dev/null
@@ -1,115 +0,0 @@
-[Desktop Entry]
-Name=World Clock
-Name[ast]=Reló mundial
-Name[bg]=Световен часовник
-Name[bs]=Svijetski Sat
-Name[ca]=Rellotge mundial
-Name[ca@valencia]=Rellotge mundial
-Name[cs]=Světové hodiny
-Name[da]=Verdensur
-Name[de]=Weltzeituhr
-Name[el]=Παγκόσμιο ρολόι
-Name[en_GB]=World Clock
-Name[eo]=Monda Horloĝo
-Name[es]=Reloj mundial
-Name[et]=Maailmakell
-Name[eu]=Munduko ordularia
-Name[fi]=Maailmankello
-Name[fr]=Horloge mondiale
-Name[ga]=Clog an Domhain
-Name[gl]=Reloxo mundial
-Name[gu]=વિશ્વ ઘડિયાળ
-Name[he]=שעון עולמי
-Name[hne]=संसार घड़ी
-Name[hu]=Világóra
-Name[is]=Heimsklukka
-Name[it]=Orologio del mondo
-Name[ja]=世界時計
-Name[kk]=Дүниежүзлік сағат
-Name[km]=នាឡិកា​ពិភពលោក
-Name[ko]=세계 시각
-Name[lt]=Pasaulio laikrodis
-Name[lv]=Pasaules pulkstenis
-Name[ml]=ലോകഘടികാരം
-Name[mr]=जागतिक घड्याळ
-Name[nb]=Verdensur
-Name[nds]=Weltklock
-Name[nl]=Wereldklok
-Name[nn]=Verdsklokke
-Name[pa]=ਸੰਸਾਰ ਘੜੀ
-Name[pl]=Zegar światowy
-Name[pt]=Relógio Mundial
-Name[pt_BR]=Relógio mundial
-Name[ru]=Мировые часы
-Name[sk]=Svetový čas
-Name[sl]=Svetovna ura
-Name[sv]=Världsklocka
-Name[tr]=World Clock
-Name[ug]=دۇنيا سائىتى
-Name[uk]=Світовий годинник
-Name[x-test]=xxWorld Clockxx
-Name[zh_CN]=世界时钟
-Name[zh_TW]=世界時鐘
-Comment=Shows the time in different parts of the world
-Comment[ast]=Amuesa la hora en diferentes partes del mundu
-Comment[bg]=Показва времето в различни краища на света
-Comment[bs]=Prikazuje vrijeme u različitim dijelovima svijeta
-Comment[ca]=Mostra l'hora en diverses parts del món
-Comment[ca@valencia]=Mostra l'hora en diverses parts del món
-Comment[cs]=Ukazuje čas v různých částech světa
-Comment[da]=Viser tiden i forskellige dele af verden
-Comment[de]=Zeigt die Zeit in verschiedenen Erdteilen
-Comment[el]=Εμφάνιση της ώρας σε διάφορα μέρη του κόσμου
-Comment[en_GB]=Shows the time in different parts of the world
-Comment[eo]=Montri la horojn en diversaj lokoj de la mondo
-Comment[es]=Muestra la hora en las diferentes partes del mundo
-Comment[et]=Kellaaja näitamine maailma eri kohtades
-Comment[eu]=Erakutsi munduko zati desberdinetako orduak
-Comment[fi]=Näyttää kellonajan eri puolilla maailmaa
-Comment[fr]=Affiche l'heure à travers le monde
-Comment[ga]=Taispeáin an t-am in áiteanna ar fud an domhain
-Comment[gl]=Mostra a hora en diferentes partes do mundo
-Comment[gu]=દુનિયાનાં જુદા જુદા ભાગોનો સમય બતાવે છે
-Comment[hr]=Prikazuje vrijeme u različitim dijelovima svijeta
-Comment[hu]=Megmutatja, mennyi a pontos idő a világ nagyvárosaiban
-Comment[is]=Sýnir tímann á mismunandi stöðum um allan heim
-Comment[it]=Mostra il tempo in diverse parti del mondo
-Comment[ja]=世界各地の時刻を表示します
-Comment[kk]=Дүние түбкір-түбкіріндеғі уақытты көрсету
-Comment[km]=បង្ហាញ​ពេល​វេលា​នៅ​ក្នុង​ផ្នែក​ផ្សេង​ទៀត​នៃ​ពិភព​លោក
-Comment[ko]=세계의 다른 지역의 시간을 보여 주는 Plasmoid
-Comment[lt]=Rodo laiką skirtingose pasaulio dalyse
-Comment[lv]=Rāda laiku dažādās pasaules vietās
-Comment[mr]=जगातील वेगवेगळ्या भागांची वेळ दर्शवितो
-Comment[nb]=Viser tiden i forskjellige deler av verden
-Comment[nds]=Wiest de Tiet in verscheden Rebeden vun de Eer
-Comment[nl]=Tijdklok voor de hele wereld
-Comment[nn]=Vis kva klokka er ulike stader i verda
-Comment[pa]=ਸੰਸਾਰ ਦੇ ਵੱਖ ਵੱਖ ਭਾਗਾਂ ਵਿੱਚ ਟਾਈਮ ਵੇਖੋ
-Comment[pl]=Pokazuje czas w różnych miejscach na świecie
-Comment[pt]=Mostra a hora em diferentes partes do mundo
-Comment[pt_BR]=Exibe a hora em diferentes partes do mundo
-Comment[ru]=Виджет, показывающий время в различных частях планеты
-Comment[sk]=Ukazuje čas v rôznych častiach sveta
-Comment[sl]=Pokaže uro v različnih delih sveta
-Comment[sv]=Visar tiden i olika delar av världen
-Comment[tr]=Dünyanın değişik bölgelerindeki saati gösterir
-Comment[ug]=دۇنيادىكى ئوخشىمىغان جايلارنىڭ ۋاقتىنى كۆرسىتىدۇ
-Comment[uk]=Показує вам час у різних частинах світу
-Comment[x-test]=xxShows the time in different parts of the worldxx
-Comment[zh_CN]=显示世界各地时间
-Comment[zh_TW]=顯示世界上不同地區的時間
-Icon=marble
-Type=Service
-ServiceTypes=Plasma/Applet
-
-X-KDE-Library=plasma_applet_worldclock
-X-KDE-PluginInfo-Author=Henry de Valence
-X-KDE-PluginInfo-Email=hdevalence@gmail.com
-X-KDE-PluginInfo-Name=worldclock
-X-KDE-PluginInfo-Version=0.1
-X-KDE-PluginInfo-Website=http://edu.kde.org/marble/
-X-KDE-PluginInfo-Category=Date and Time
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=LGPL
-X-KDE-PluginInfo-EnabledByDefault=true
diff --git a/src/plasmoid/worldclock.cpp b/src/plasmoid/worldclock.cpp
deleted file mode 100644
index 96de33c..0000000
--- a/src/plasmoid/worldclock.cpp
+++ /dev/null
@@ -1,506 +0,0 @@
-// Copyright 2008 Henry de Valence <hdevalence@gmail.com>
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library 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
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see <http://www.gnu.org/licenses/>.
-
-
-//Mine
-#include "worldclock.h"
-
-//Qt
-#include <QPainter>
-#include <QRadialGradient>
-#include <QBrush>
-#include <QGraphicsSceneHoverEvent>
-#include <QList>
-#include <QSize>
-#include <QRect>
-#include <QTime>
-#include <QDate>
-#include <QDateTime>
-
-//KDE
-#include <KDebug>
-#include <KLocale>
-#include <KConfigDialog>
-#include <KConfigGroup>
-#include <KTimeZone>
-#include <KTimeZoneWidget>
-#include <KSystemTimeZone>
-
-//Plasma
-#include <Plasma/Applet>
-#include <Plasma/DataEngine>
-
-//Marble
-#include "MarbleGlobal.h"
-#include "MarbleMap.h"
-#include "MarbleModel.h"
-#include "AbstractFloatItem.h"
-#include "SunLocator.h"
-#include "GeoPainter.h"
-#include "LatLonEdit.h"
-#include "ViewportParams.h"
-
-namespace Marble
-{
-
-WorldClock::WorldClock(QObject *parent, const QVariantList &args)
- : Plasma::Applet(parent, args),
- m_showDate( false ),
- m_customTz( false ),
- m_map(0),
- m_isHovered( false ),
- m_timeEngine( 0 )
-{
- KGlobal::locale()->insertCatalog("marble");
- KGlobal::locale()->insertCatalog("marble_qt");
- KGlobal::locale()->insertCatalog("timezones4");
- setHasConfigurationInterface(true);
- setAcceptHoverEvents(true);
- //The applet needs a 2:1 ratio
- //so that the map fits properly
- resize(QSize(400, 200));
-}
-
-void WorldClock::init()
-{
- KConfigGroup cg = config();
- m_map = new MarbleMap();
-
- //Set how we want the map to look
- m_map->centerOn( cg.readEntry("rotation", -20), 0 );
- m_map->setMapThemeId( "earth/bluemarble/bluemarble.dgml" );
- m_map->setShowCompass ( false );
- m_map->setShowClouds ( false );
- m_map->setShowScaleBar ( false );
- m_map->setShowGrid ( false );
- m_map->setShowPlaces ( false );
- m_map->setShowCities ( false );
- m_map->setShowTerrain ( false );
- m_map->setShowOtherPlaces( false );
- // set the date time of the marble model otherwise the sun will not show up correctly
- m_map->model()->setClockDateTime(QDateTime::currentDateTimeUtc());
-
- if(cg.readEntry("projection", static_cast<int>(Equirectangular)) == Mercator)
- m_map->setProjection(Mercator);
- else
- m_map->setProjection(Equirectangular);
-
- foreach( RenderPlugin* item, m_map->renderPlugins() )
- item->setVisible( false );
-
- //Set up the Sun to draw night/day shadow
- m_map->setShowSunShading(true);
- m_map->setShowCityLights(true);
- m_map->setLockToSubSolarPoint(cg.readEntry("centersun", false ));
- m_map->setSubSolarPointIconVisible(true);
-
- m_customTz = cg.readEntry("customtz", false );
- m_locationkey = KSystemTimeZones::local().name();
- if(m_customTz) {
- QStringList tzlist = cg.readEntry("tzlist", QStringList());
- m_locations = QMap<QString, KTimeZone>();
- foreach( const QString& tzname, tzlist ) {
- m_locations.insert(tzname, KSystemTimeZones::zone(tzname));
- }
- if(!m_locations.contains(m_locationkey))
- m_locationkey = m_locations.keys().first();
- } else {
- m_locations = KSystemTimeZones::zones();
- QList<QString> zones = m_locations.keys();
- for (int i = 0; i < zones.size(); ++i ) {
- KTimeZone curzone = m_locations.value( zones.at( i ) );
- if ( curzone.latitude() == KTimeZone::UNKNOWN ||
- curzone.longitude() == KTimeZone::UNKNOWN ) {
- m_locations.remove( zones.at(i) );
- }
- }
- }
-
- //Font sizes will change before painting
- m_timeFont = QFont( QStringLiteral( "Helvetica" ), 12, QFont::Bold);
- m_locationFont = QFont( QStringLiteral( "Helvetica" ), 12, QFont::Bold);
- m_points = QHash<QString, QPoint>();
- m_lastRect = QRect(0,0,0,0);
- m_showDate = cg.readEntry("showdate", false);
-
- setTz( getZone() );
-
- Plasma::DataEngine *m_timeEngine = dataEngine("time");
- m_timeEngine->connectSource( "Local", this, 6000, Plasma::AlignToMinute);
-
- connect(m_map, SIGNAL(repaintNeeded(QRegion)), this, SLOT(slotRepaint()));
-}
-
-WorldClock::~WorldClock()
-{
- delete m_map;
-}
-
-void WorldClock::resizeMap(bool changeAspect)
-{
- int width = 0;
- int height = 0;
- int radius = 0;
- double ratio = static_cast<double>(m_lastRect.width()) /
- static_cast<double>(m_lastRect.height());
- if( m_map->projection() == Equirectangular ) {
- qDebug() << "equirectangular with rect" << m_lastRect;
- qDebug() << "w/h ratio:" << ratio;
- if( ratio > 2 ) {
- height = m_lastRect.height();
- width = height*2;
- radius = static_cast<int>(height/2);
- } else {
- width = m_lastRect.width();
- height = static_cast<int>(width/2);
- radius = static_cast<int>(width/4);
- }
- } else if( m_map->projection() == Mercator ) {
- qDebug() << "mercator with rect" << m_lastRect;
- qDebug() << "w/h ratio:" << ratio;
- if( ratio > 1 ) {
- height = m_lastRect.height();
- width = height;
- radius = static_cast<int>(width/4);
- } else {
- width = m_lastRect.width();
- height = width;
- radius = static_cast<int>(width/4);
- }
- }
- qDebug() << "width, height, radius:" << width << height << radius;
-
- m_map->setSize(width, height);
- m_map->setRadius( radius );
- update();
- if(changeAspect) {
- QRectF curGeo = geometry();
- setGeometry( curGeo.x(), curGeo.y(), static_cast<double>(width),
- static_cast<double>(height) );
- }
-}
-
-void WorldClock::slotRepaint()
-{
- update();
-}
-
-void WorldClock::dataUpdated(const QString &source,
- const Plasma::DataEngine::Data &data)
-{
- Q_UNUSED(source)
- //qDebug() << "Time = " << data["Time"].toTime();
- m_localtime = QDateTime( QDate::currentDate(), data["Time"].toTime() );
- m_time = KSystemTimeZones::local().convert(m_locations.value(m_locationkey),
- m_localtime );
- //qDebug() << "Adjusted Time = " << m_time;
- update();
-}
-
-void WorldClock::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- m_isHovered = false;
- Applet::hoverLeaveEvent(event);
- update();
-}
-void WorldClock::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- m_isHovered = true;
- m_hover = event->pos() - m_t;
- Applet::hoverEnterEvent(event);
- setTz( getZone() );
- update();
-}
-void WorldClock::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
-{
- m_hover = event->pos() - m_t;
- Applet::hoverMoveEvent(event);
- setTz( getZone() );
- update();
-}
-
-QString WorldClock::getZone()
-{
- qreal lat, lon;
- // get the hover zone only if the hove point exists
- bool ok = !m_hover.isNull() &&
- m_map->viewport()->geoCoordinates( m_hover.x(), m_hover.y(), lon, lat );
-
- if( !ok ) {
- return KSystemTimeZones::local().name();
- }
- QList<QString> zones = m_locations.keys();
-
- QString closest;
- qreal mindist = 99999999999999999.9;
-
- for (int i = 0; i < zones.size(); ++i ) {
- KTimeZone cz = m_locations.value( zones.at( i ) );
- qreal dist = sqrt( pow(lat-cz.latitude(), 2) + pow(lon-cz.longitude(), 2) );
- if ( dist < mindist ) {
- mindist = dist;
- closest = zones.at( i );
- }
- }
- return m_locations.value( closest ).name();
-}
-
-void WorldClock::setTz( QString newtz )
-{
- if ( newtz == m_locationkey ) { return; }
- m_locationkey = newtz;
- m_time = KSystemTimeZones::local().convert(m_locations.value(m_locationkey),
- m_localtime );
- recalculateFonts();
-}
-
-void WorldClock::recalculatePoints()
-{
- int x = m_map->width();
- int y = m_map->height();
- m_points.insert( "topright", QPoint( ( x*0.666 ), ( y*0.25 ) ) );
- m_points.insert( "topleft", QPoint( ( x*0.333 ), ( y*0.25 ) ) );
- m_points.insert( "middleright", QPoint( ( x*0.666 ), ( y*0.58333 ) ) );
- m_points.insert( "middleleft", QPoint( ( x*0.333 ), ( y*0.58333 ) ) );
- m_points.insert( "bottomright", QPoint( ( x*0.666 ), ( y*0.75 ) ) );
- m_points.insert( "bottomleft", QPoint( ( x*0.333 ), ( y*0.75 ) ) );
- return;
-
-}
-
-void WorldClock::recalculateFonts( )
-{
- QString timestr;
- if(m_showDate)
- timestr = KGlobal::locale()->formatDateTime( m_time );
- else
- timestr = KGlobal::locale()->formatTime( m_time.time() );
-
- QString locstr = i18n( m_locationkey.toUtf8().data() );
- locstr.remove( 0, locstr.lastIndexOf( '/' ) + 1 ).replace( '_', ' ' );
- QRect timeRect( m_points.value( "topleft" ), m_points.value( "middleright" ) );
- QRect locationRect( m_points.value( "middleleft" ), m_points.value( "bottomright" ) );
-
- m_locationFont = calculateFont(locstr, locationRect);
- m_timeFont = calculateFont(timestr, timeRect);
-}
-
-QFont WorldClock::calculateFont(const QString &text, const QRect &boundingBox)
-{
- QFont resultFont( QStringLiteral( "Helvetica" ), 3, QFont::Bold);
-
- int unscaled = 0; // Avoid infinite loops, bug 189633
- QRect lastBox;
-
- //we set very small defaults and then increase them
- for ( int curSize = resultFont.pointSize()+1; unscaled<100; ++curSize ) {
- resultFont.setPointSize(curSize);
- QFontMetrics metrics( resultFont );
- QRect rect = metrics.boundingRect( text );
- if ( rect.width() > boundingBox.width() ||
- rect.height() > boundingBox.height() ) {
- break;
- }
-
- if ( rect.width() > lastBox.width() ||
- rect.height() > lastBox.height() ) {
- unscaled = 0;
- }
- else {
- ++unscaled;
- }
-
- lastBox = rect;
- }
-
- resultFont.setPointSize(resultFont.pointSize()-1);
- return resultFont;
-}
-
-void WorldClock::recalculateTranslation()
-{
- m_t = QPoint(static_cast<int>( (m_lastRect.width()/2) - (m_map->width()/2) ),
- static_cast<int>( (m_lastRect.height()/2) - (m_map->height()/2) ));
- m_t += m_lastRect.topLeft();
-}
-
-void WorldClock::paintInterface(QPainter *p,
- const QStyleOptionGraphicsItem *option,
- const QRect &contentsRect)
-{
- Q_UNUSED(option)
- if ( contentsRect != m_lastRect ) {
- m_lastRect = contentsRect;
- resizeMap();
- recalculateTranslation();
- recalculatePoints();
- recalculateFonts();
- }
- p->setRenderHint( QPainter::TextAntialiasing , true );
- p->setRenderHint( QPainter::Antialiasing , true );
- p->setPen( Qt::NoPen );
- //p->setBrush( QBrush( QColor( 0x00, 0x00, 0x00, 0xFF ) ) );
- //p->drawRect( m_lastRect );
- QPixmap pixmap( m_map->width(), m_map->height() );
- pixmap.fill( Qt::transparent );
- GeoPainter gp( &pixmap, m_map->viewport(),
- Marble::NormalQuality );
- QRect mapRect( 0, 0, m_map->width(), m_map->height() );
- m_map->paint(gp, mapRect );
- p->drawPixmap( m_t, pixmap );
-
- if ( !m_isHovered ) {
- setTz( KSystemTimeZones::local().name() );
- }
-
- //Show the location on the map
- qreal tzx = 0;
- qreal tzy = 0;
- qreal lon = m_locations.value(m_locationkey).longitude() * DEG2RAD;
- qreal lat = m_locations.value(m_locationkey).latitude() * DEG2RAD;
- bool ok = m_map->viewport()->screenCoordinates(lon, lat, tzx, tzy);
- if ( ok /*&& m_isHovered*/ ) {
- QPoint tz( tzx, tzy );
- tz += m_t;
- int radius = m_lastRect.width() / 40;
- QRadialGradient grad( tz, radius );
- grad.setColorAt( 0, QColor( 0xFF, 0xFF, 0x00, 0xFF ) );
- grad.setColorAt( 0.33, QColor( 0xFF, 0xFF, 0x00, 0x46 ) );
- grad.setColorAt( 0.66, QColor( 0xFF, 0xFF, 0x00, 0x14 ) );
- grad.setColorAt( 1, QColor( 0xFF, 0xFF, 0x00, 0x00 ) );
- p->setBrush( QBrush( grad ) );
- p->drawEllipse( tz, radius, radius );
- }
-
- p->setPen( QColor( 0xFF, 0xFF, 0xFF ) );
-
- QString locstr = i18n( m_locationkey.toUtf8().data() );
- locstr.remove( 0, locstr.lastIndexOf( '/' ) + 1 ).replace( '_', ' ' );
-
- QString timestr;
- if(m_showDate)
- timestr = KGlobal::locale()->formatDateTime( m_time );
- else
- timestr = KGlobal::locale()->formatTime( m_time.time() );
-
- p->setFont( m_timeFont );
- p->drawText( QRect( m_points.value( "topleft" ) + m_t,
- m_points.value( "middleright" ) + m_t ),
- Qt::AlignCenter, timestr );
-
- p->setFont( m_locationFont );
- p->drawText( QRect( m_points.value( "middleleft" ) + m_t,
- m_points.value( "bottomright" ) + m_t ),
- Qt::AlignCenter, locstr );
-}
-
-void WorldClock::createConfigurationInterface(KConfigDialog *parent)
-{
- QWidget *widget = new QWidget();
- ui.setupUi(widget);
- parent->setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
-
- KConfigGroup cg = config();
-
- ui.longitudeEdit->setValue(cg.readEntry("rotation", -20));
-
- if(cg.readEntry("projection", static_cast<int>(Equirectangular)) == Mercator)
- ui.projection->setCurrentIndex(1);
- else //Equirectangular is the default projection
- ui.projection->setCurrentIndex(0);
-
- if(cg.readEntry("daylight", false ))
- ui.daylightButton->setChecked(true);
-
- if(cg.readEntry("showdate", false ))
- ui.showdate->setChecked(true);
-
- if(cg.readEntry("customtz", false ))
- ui.customTz->setChecked(true);
-
- ui.tzWidget->setSelectionMode( QTreeView::MultiSelection );
- foreach(const QString& tz, cg.readEntry("tzlist")) {
- ui.tzWidget->setSelected(tz,true);
- }
-
- connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
- connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
- parent->addPage(widget, parent->windowTitle(), icon());
-}
-
-void WorldClock::configAccepted()
-{
- KConfigGroup cg = config();
-
- if( ui.daylightButton->isChecked() )
- m_map->setSubSolarPointIconVisible(true);
- else {
- m_map->centerOn(ui.longitudeEdit->value(), 0);
- update();
- }
-
- m_showDate = ui.showdate->isChecked();
- m_customTz = ui.customTz->isChecked();
-
- if(m_customTz) {
- QStringList tzlist = ui.tzWidget->selection();
- qDebug() << "\tSetting TZLIST";
- qDebug() << tzlist;
- QMap<QString, KTimeZone> selectedZones;
- selectedZones.insert(KSystemTimeZones::local().name(),
- KSystemTimeZones::local());
- foreach( const QString& tzname, tzlist ) {
- selectedZones.insert(tzname, KSystemTimeZones::zone(tzname));
- }
- cg.writeEntry("tzlist",tzlist);
- m_locations = selectedZones;
- if(!m_locations.contains(m_locationkey))
- m_locationkey = m_locations.keys().first();
- }
-
- // What projection? note: +1 because the spherical projection is 0
- if((ui.projection->currentIndex() + 1) != cg.readEntry("projection",
- static_cast<int>(Equirectangular)) )
- {
- switch ( ui.projection->currentIndex() ) {
- case 1:
- //qDebug() << "case 1, setting proj to mercator";
- m_map->setProjection(Mercator);
- update();
- resizeMap(true);
- cg.writeEntry("projection", static_cast<int>(Mercator));
- break;
- //case 0 (and anything else that pops up)
- default:
- //qDebug() << "case default, setting proj to Equirectangular";
- m_map->setProjection(Equirectangular);
- update();
- resizeMap(true);
- cg.writeEntry("projection", static_cast<int>(Equirectangular));
- break;
- }
- }
-
- cg.writeEntry("rotation", ui.longitudeEdit->value());
- cg.writeEntry("centersun", ui.daylightButton->isChecked());
- cg.writeEntry("showdate", ui.showdate->isChecked());
- cg.writeEntry("customtz", ui.customTz->isChecked());
-
- emit configNeedsSaving();
-}
-
-} //ns Marble
-
-#include "moc_worldclock.cpp"
diff --git a/src/plasmoid/worldclock.h b/src/plasmoid/worldclock.h
deleted file mode 100644
index 5e434a5..0000000
--- a/src/plasmoid/worldclock.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2008 Henry de Valence <hdevalence@gmail.com>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 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
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-#ifndef WORLDCLOCK_H
-#define WORLDCLOCK_H
-
-
-#include <Applet>
-#include <DataEngine>
-#include "ui_worldclockConfig.h"
-
-
-class QGraphicsSceneHoverEvent;
-class QStyleOptionGraphicsItem;
-class QFont;
-class QRect;
-class QString;
-class QPainter;
-class QDateTime;
-class QPointF;
-
-class KTimeZone;
-
-namespace Marble
-{
-
-class MarbleMap;
-
-class WorldClock : public Plasma::Applet
-{
- Q_OBJECT
- public:
- WorldClock(QObject *parent, const QVariantList &args);
- ~WorldClock();
- void init();
- void paintInterface(QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- const QRect& contentsRect);
- public Q_SLOTS:
- void dataUpdated(const QString &source,
- const Plasma::DataEngine::Data &data);
- void createConfigurationInterface(KConfigDialog *parent);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
- protected Q_SLOTS:
- void configAccepted();
- private Q_SLOTS:
- //connected to geometryChanged()
- void resizeMap(bool changeAspect = false);
- void slotRepaint();
- private:
- void connectToEngine();
-
- //these are used for sizing & positioning text
- void recalculatePoints();
- void recalculateFonts();
- static QFont calculateFont(const QString &text, const QRect &boundingBox);
- void recalculateTranslation();
-
- //for changing zones based on mouse position
- void setTz( QString newtz );
- QString getZone();
-
- //time in our selected timezone
- QDateTime m_time;
- //time in user's local zone
- QDateTime m_localtime;
- bool m_showDate;
- //use custom zone list?
- bool m_customTz;
-
- //the translation
- QPoint m_t;
-
- //the map
- MarbleMap *m_map;
-
- //hover stuff
- bool m_isHovered;
- QPointF m_hover;
-
- //map of locations and key for accessing it.
- QString m_locationkey;
- QMap<QString, KTimeZone> m_locations;
-
- //so we can check if the size has changed
- QRect m_lastRect;
-
- //Font sizing & positioning
- QFont m_timeFont;
- QFont m_locationFont;
- QHash<QString, QPoint> m_points;
-
- //engine
- Plasma::DataEngine *m_timeEngine;
-
- //config gui
- Ui::worldclockConfig ui;
-};
-
-} //ns Marble
-
-K_EXPORT_PLASMA_APPLET(worldclock, Marble::WorldClock)
-#endif
-
-
diff --git a/src/plasmoid/worldclockConfig.ui b/src/plasmoid/worldclockConfig.ui
deleted file mode 100644
index 0f58f86..0000000
--- a/src/plasmoid/worldclockConfig.ui
+++ /dev/null
@@ -1,273 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>worldclockConfig</class>
- <widget class="QWidget" name="worldclockConfig">
- <property name="windowModality">
- <enum>Qt::NonModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>495</width>
- <height>275</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Worldclock Applet Configuration</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="tabPosition">
- <enum>QTabWidget::North</enum>
- </property>
- <property name="tabShape">
- <enum>QTabWidget::Rounded</enum>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Map Display</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Projection:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="projection">
- <item>
- <property name="text">
- <string>Equirectangular</string>
- </property>
- <property name="icon">
- <iconset resource="../marble.qrc">
- <normaloff>:/icons/map-flat.png</normaloff>:/icons/map-flat.png</iconset>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Mercator</string>
- </property>
- <property name="icon">
- <iconset resource="../marble.qrc">
- <normaloff>:/icons/map-mercator.png</normaloff>:/icons/map-mercator.png</iconset>
- </property>
- </item>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QRadioButton" name="longitudeButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Center map on longitude:</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="Marble::LatLonEdit" name="longitudeEdit" native="true"/>
- </item>
- <item row="3" column="0">
- <widget class="QRadioButton" name="daylightButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Center map on daylight</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="5" column="0">
- <widget class="QCheckBox" name="showdate">
- <property name="text">
- <string>Show date</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>8</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>8</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>Time Zones</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="customTz">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Use custom timezone selection</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KTimeZoneWidget" name="tzWidget">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <column>
- <property name="text">
- <string>Area</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Region</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Comment</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KTimeZoneWidget</class>
- <extends>QTreeWidget</extends>
- <header>ktimezonewidget.h</header>
- </customwidget>
- <customwidget>
- <class>Marble::LatLonEdit</class>
- <extends>QWidget</extends>
- <header>LatLonEdit.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>tabWidget</tabstop>
- <tabstop>projection</tabstop>
- <tabstop>longitudeButton</tabstop>
- <tabstop>daylightButton</tabstop>
- <tabstop>customTz</tabstop>
- <tabstop>tzWidget</tabstop>
- </tabstops>
- <resources>
- <include location="../marble.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>longitudeButton</sender>
- <signal>toggled(bool)</signal>
- <receiver>longitudeEdit</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>144</x>
- <y>89</y>
- </hint>
- <hint type="destinationlabel">
- <x>283</x>
- <y>86</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>customTz</sender>
- <signal>toggled(bool)</signal>
- <receiver>tzWidget</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>147</x>
- <y>47</y>
- </hint>
- <hint type="destinationlabel">
- <x>147</x>
- <y>79</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>