Applets
clock.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef CLOCK_H
00022 #define CLOCK_H
00023
00024 #include <QImage>
00025 #include <QPaintDevice>
00026 #include <QLabel>
00027 #include <QPixmap>
00028 #include <QTimer>
00029 #include <QPaintEvent>
00030 #include <QPainter>
00031 #include <QTime>
00032 #include <QGraphicsItem>
00033 #include <QColor>
00034
00035 #include <Plasma/Containment>
00036 #include <Plasma/DataEngine>
00037
00038 #include <plasmaclock/clockapplet.h>
00039 #include "ui_clockConfig.h"
00040
00041 class QTimer;
00042
00043 namespace Plasma
00044 {
00045 class Svg;
00046 class Dialog;
00047 }
00048
00049 class Clock : public ClockApplet
00050 {
00051 Q_OBJECT
00052 public:
00053 Clock(QObject *parent, const QVariantList &args);
00054 ~Clock();
00055
00056 void init();
00057 void constraintsEvent(Plasma::Constraints constraints);
00058 QPainterPath shape() const;
00059 void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
00060
00061 public slots:
00062 void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
00063
00064 protected:
00065 void createClockConfigurationInterface(KConfigDialog *parent);
00066 void changeEngineTimezone(const QString &oldTimezone, const QString &newTimezone);
00067
00068 protected slots:
00069 void clockConfigAccepted();
00070 void repaintNeeded();
00071 void moveSecondHand();
00072
00073 private:
00074 void connectToEngine();
00075 void drawHand(QPainter *p, const QRect &rect, const qreal verticalTranslation, const qreal rotation, const QString &handName);
00076
00077 bool m_showSecondHand;
00078 bool m_fancyHands;
00079 bool m_showTimezoneString;
00080 Plasma::Svg* m_theme;
00081 QTime m_time;
00082 QTime m_lastTimeSeen;
00083 enum RepaintCache {
00084 RepaintNone,
00085 RepaintAll,
00086 RepaintHands
00087 };
00088 RepaintCache m_repaintCache;
00089 QPixmap m_faceCache;
00090 QPixmap m_handsCache;
00091 QPixmap m_glassCache;
00092 qreal m_verticalTranslation;
00093 QTimer *m_secondHandUpdateTimer;
00094 int m_animationStart;
00096 Ui::clockConfig ui;
00097 };
00098
00099 K_EXPORT_PLASMA_APPLET(clock, Clock)
00100
00101 #endif