• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

clock.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright 2007 by Aaron Seigo <aseigo@kde.org>                        *
00003  *   Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org>               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
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

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal