summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-04-11 10:04:06 (UTC)
committer harlekin <harlekin>2003-04-11 10:04:06 (UTC)
commitebf5bb083d47179918d47f083a3cc98a5ed5d2e0 (patch) (unidiff)
treeda68f67dc45ea495edefef9842b6d2124f6a53c4
parent0cce344730fbdcc131254bf04a2d40f665e1bd86 (diff)
downloadopie-ebf5bb083d47179918d47f083a3cc98a5ed5d2e0.zip
opie-ebf5bb083d47179918d47f083a3cc98a5ed5d2e0.tar.gz
opie-ebf5bb083d47179918d47f083a3cc98a5ed5d2e0.tar.bz2
use default font
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clockapplet/clock.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
index 19d3f6c..bcecab4 100644
--- a/core/applets/clockapplet/clock.cpp
+++ b/core/applets/clockapplet/clock.cpp
@@ -19,49 +19,49 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "clock.h" 21#include "clock.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27 27
28#include <qmainwindow.h> 28#include <qmainwindow.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38 38
39LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) 39LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
40{ 40{
41 // If you want a sunken border around the clock do this: 41 // If you want a sunken border around the clock do this:
42 // setFrameStyle( QFrame::Panel | QFrame::Sunken ); 42 // setFrameStyle( QFrame::Panel | QFrame::Sunken );
43 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 43 //setFont( QFont( "Helvetica", , QFont::Normal ) );
44 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); 44 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) );
45 connect( qApp, SIGNAL( clockChanged( bool ) ), 45 connect( qApp, SIGNAL( clockChanged( bool ) ),
46 this, SLOT( slotClockChanged( bool ) ) ); 46 this, SLOT( slotClockChanged( bool ) ) );
47 readConfig(); 47 readConfig();
48 timerId = 0; 48 timerId = 0;
49 timerEvent( 0 ); 49 timerEvent( 0 );
50 show(); 50 show();
51} 51}
52 52
53void LauncherClock::readConfig() { 53void LauncherClock::readConfig() {
54 Config config( "qpe" ); 54 Config config( "qpe" );
55 config.setGroup( "Time" ); 55 config.setGroup( "Time" );
56 ampmFormat = config.readBoolEntry( "AMPM", TRUE ); 56 ampmFormat = config.readBoolEntry( "AMPM", TRUE );
57 config.setGroup( "Date" ); 57 config.setGroup( "Date" );
58 format = config.readNumEntry("ClockApplet",0); 58 format = config.readNumEntry("ClockApplet",0);
59} 59}
60 60
61void LauncherClock::mouseReleaseEvent( QMouseEvent * ) 61void LauncherClock::mouseReleaseEvent( QMouseEvent * )
62{ 62{
63 QCString setTimeApp; 63 QCString setTimeApp;
64 setTimeApp="systemtime"; 64 setTimeApp="systemtime";
65 QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)"); 65 QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)");
66 QString lf = QString::null; 66 QString lf = QString::null;
67 67
@@ -71,54 +71,54 @@ void LauncherClock::mouseReleaseEvent( QMouseEvent * )
71 71
72void LauncherClock::timerEvent( QTimerEvent *e ) 72void LauncherClock::timerEvent( QTimerEvent *e )
73{ 73{
74 if ( !e || e->timerId() == timerId ) { 74 if ( !e || e->timerId() == timerId ) {
75 killTimer( timerId ); 75 killTimer( timerId );
76 changeTime(); 76 changeTime();
77 QTime t = QTime::currentTime(); 77 QTime t = QTime::currentTime();
78 int ms = (60 - t.second())*1000 - t.msec(); 78 int ms = (60 - t.second())*1000 - t.msec();
79 timerId = startTimer( ms ); 79 timerId = startTimer( ms );
80 } else { 80 } else {
81 QLabel::timerEvent( e ); 81 QLabel::timerEvent( e );
82 } 82 }
83} 83}
84 84
85void LauncherClock::updateTime( void ) 85void LauncherClock::updateTime( void )
86{ 86{
87 changeTime(); 87 changeTime();
88} 88}
89 89
90void LauncherClock::changeTime( void ) 90void LauncherClock::changeTime( void )
91{ 91{
92 QTime tm = QDateTime::currentDateTime().time(); 92 QTime tm = QDateTime::currentDateTime().time();
93 QString s; 93 QString s;
94 if( ampmFormat ) { 94 if( ampmFormat ) {
95 int hour = tm.hour(); 95 int hour = tm.hour();
96 if (hour == 0) 96 if (hour == 0)
97 hour = 12; 97 hour = 12;
98 if (hour > 12) 98 if (hour > 12)
99 hour -= 12; 99 hour -= 12;
100 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 100 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
101 (tm.hour() >= 12) ? "PM" : "AM" ); 101 (tm.hour() >= 12) ? "PM" : "AM" );
102 } else 102 } else
103 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 103 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
104 104
105 if (format==1) { 105 if (format==1) {
106 QDate dm = QDate::currentDate(); 106 QDate dm = QDate::currentDate();
107 QString d; 107 QString d;
108 d.sprintf("%d/%d ", dm.day(), dm.month()); 108 d.sprintf("%d/%d ", dm.day(), dm.month());
109 setText( d+s ); 109 setText( d+s );
110 } else if (format==2) { 110 } else if (format==2) {
111 QDate dm = QDate::currentDate(); 111 QDate dm = QDate::currentDate();
112 QString d; 112 QString d;
113 d.sprintf("%d/%d ", dm.month(), dm.day()); 113 d.sprintf("%d/%d ", dm.month(), dm.day());
114 setText( d+s ); 114 setText( d+s );
115 } else { 115 } else {
116 setText( s ); 116 setText( s );
117 } 117 }
118} 118}
119 119
120void LauncherClock::slotClockChanged( bool pm ) 120void LauncherClock::slotClockChanged( bool pm )
121{ 121{
122 readConfig(); 122 readConfig();
123 updateTime(); 123 updateTime();
124} 124}