• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • plasmoid
worldclock.h
Go to the documentation of this file.
1 // Copyright 2008 Henry de Valence <hdevalence@gmail.com>
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this program. If not, see <http://www.gnu.org/licenses/>.
15 
16 
17 #ifndef WORLDCLOCK_H
18 #define WORLDCLOCK_H
19 
20 
21 #include <Plasma/Applet>
22 #include <Plasma/DataEngine>
23 #include "ui_worldclockConfig.h"
24 
25 
26 class QGraphicsSceneHoverEvent;
27 class QStyleOptionGraphicsItem;
28 class QFont;
29 class QRect;
30 class QString;
31 class QPainter;
32 class QDateTime;
33 class QPointF;
34 
35 class KTimeZone;
36 
37 namespace Marble
38 {
39 
40 class MarbleMap;
41 
42 class WorldClock : public Plasma::Applet
43 {
44  Q_OBJECT
45  public:
46  WorldClock(QObject *parent, const QVariantList &args);
47  ~WorldClock();
48  void init();
49  void paintInterface(QPainter *painter,
50  const QStyleOptionGraphicsItem *option,
51  const QRect& contentsRect);
52  public slots:
53  void dataUpdated(const QString &source,
54  const Plasma::DataEngine::Data &data);
55  void createConfigurationInterface(KConfigDialog *parent);
56  void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
57  void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
58  void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
59  protected slots:
60  void configAccepted();
61  private slots:
62  //connected to geometryChanged()
63  void resizeMap(bool changeAspect = false);
64  void slotRepaint();
65  private:
66  void connectToEngine();
67 
68  //these are used for sizing & positioning text
69  void recalculatePoints();
70  void recalculateFonts();
71  QFont calculateFont(const QString &text, const QRect &boundingBox) const;
72  void recalculateTranslation();
73 
74  //for changing zones based on mouse position
75  void setTz( QString newtz );
76  QString getZone();
77 
78  //time in our selected timezone
79  QDateTime m_time;
80  //time in user's local zone
81  QDateTime m_localtime;
82  bool m_showDate;
83  //use custom zone list?
84  bool m_customTz;
85 
86  //the translation
87  QPoint m_t;
88 
89  //the map
90  MarbleMap *m_map;
91 
92  //hover stuff
93  bool m_isHovered;
94  QPointF m_hover;
95 
96  //map of locations and key for accessing it.
97  QString m_locationkey;
98  QMap<QString, KTimeZone> m_locations;
99 
100  //so we can check if the size has changed
101  QRect m_lastRect;
102 
103  //Font sizing & positioning
104  QFont m_timeFont;
105  QFont m_locationFont;
106  QHash<QString, QPoint> m_points;
107 
108  //engine
109  Plasma::DataEngine *m_timeEngine;
110 
111  //config gui
112  Ui::worldclockConfig ui;
113 };
114 
115 } //ns Marble
116 
117 K_EXPORT_PLASMA_APPLET(worldclock, Marble::WorldClock)
118 #endif
119 
120 
QPainter
Marble::WorldClock::WorldClock
WorldClock(QObject *parent, const QVariantList &args)
Definition: worldclock.cpp:58
Marble::WorldClock::init
void init()
Definition: worldclock.cpp:72
QObject
Marble::WorldClock::paintInterface
void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
Definition: worldclock.cpp:335
Marble::WorldClock::hoverEnterEvent
void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Definition: worldclock.cpp:214
Marble::WorldClock::hoverLeaveEvent
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Definition: worldclock.cpp:208
Marble::WorldClock::configAccepted
void configAccepted()
Definition: worldclock.cpp:439
Marble::MarbleMap
A class that can paint a view of the earth.
Definition: MarbleMap.h:90
Marble::WorldClock::createConfigurationInterface
void createConfigurationInterface(KConfigDialog *parent)
Definition: worldclock.cpp:405
Marble::WorldClock::hoverMoveEvent
void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Definition: worldclock.cpp:222
Marble::WorldClock::dataUpdated
void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data)
Definition: worldclock.cpp:196
Marble::WorldClock
Definition: worldclock.h:42
Marble::WorldClock::~WorldClock
~WorldClock()
Definition: worldclock.cpp:142
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal