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 <QtCore/QTime>
00025 #include <QtCore/QDate>
00026
00027 #include <Plasma/Applet>
00028 #include <Plasma/DataEngine>
00029 #include <Plasma/Dialog>
00030
00031 #include "ui_clockConfig.h"
00032 #include <plasmaclock/clockapplet.h>
00033
00034 class Clock : public ClockApplet
00035 {
00036 Q_OBJECT
00037 public:
00038 Clock(QObject *parent, const QVariantList &args);
00039 ~Clock();
00040
00041 void init();
00042 void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
00043
00044 public slots:
00045 void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
00046 void updateColors();
00047
00048 protected slots:
00049 void clockConfigAccepted();
00050 void constraintsEvent(Plasma::Constraints constraints);
00051
00052 protected:
00053 void createClockConfigurationInterface(KConfigDialog *parent);
00054 void changeEngineTimezone(const QString &oldTimezone, const QString &newTimezone);
00055
00056 private:
00057 void updateSize();
00058 bool showTimezone() const;
00059 QRect preparePainter(QPainter *p, const QRect &rect, const QFont &font, const QString &text, bool singleline = false);
00060 QRectF normalLayout (int subtitleWidth, int subtitleHeight, const QRect &contentsRect);
00061 QRectF sideBySideLayout (int subtitleWidth, int subtitleHeight, const QRect &contentsRect);
00062
00063 QFont m_plainClockFont;
00064 bool m_useCustomColor;
00065 QColor m_plainClockColor;
00066 QRect m_timeRect;
00067 QRect m_dateRect;
00068
00069 bool m_showDate;
00070 bool m_showYear;
00071 bool m_showDay;
00072 bool m_showSeconds;
00073 bool m_showTimezone;
00074 bool m_dateTimezoneBesides;
00075
00076 int updateInterval() const;
00077 Plasma::IntervalAlignment intervalAlignment() const;
00078
00079 QTime m_time;
00080 QDate m_date;
00081 QString m_dateString;
00082 QVBoxLayout *m_layout;
00083 QTime m_lastTimeSeen;
00084 QPixmap m_toolTipIcon;
00086 Ui::clockConfig ui;
00087 };
00088
00089 K_EXPORT_PLASMA_APPLET(dig_clock, Clock)
00090
00091 #endif