summaryrefslogtreecommitdiff
path: root/noncore/tools/clock/clock.cpp
Unidiff
Diffstat (limited to 'noncore/tools/clock/clock.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index b780675..485354b 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -35,48 +35,49 @@
35#include <opie2/oclickablelabel.h> 35#include <opie2/oclickablelabel.h>
36 36
37#include <qlcdnumber.h> 37#include <qlcdnumber.h>
38#include <qslider.h> 38#include <qslider.h>
39#include <qlabel.h> 39#include <qlabel.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qtimer.h> 41#include <qtimer.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43#include <qradiobutton.h> 43#include <qradiobutton.h>
44#include <qbuttongroup.h> 44#include <qbuttongroup.h>
45#include <qpainter.h> 45#include <qpainter.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47#include <qdatetime.h> 47#include <qdatetime.h>
48 48
49#include <math.h> 49#include <math.h>
50#include <unistd.h> 50#include <unistd.h>
51#include <sys/types.h> 51#include <sys/types.h>
52 52
53#include <pthread.h> 53#include <pthread.h>
54 54
55 55
56const double deg2rad = 0.017453292519943295769; // pi/180 56const double deg2rad = 0.017453292519943295769; // pi/180
57const int sw_prec = 2; 57const int sw_prec = 2;
58 58
59using namespace Opie::Ui;
59void startPlayer() 60void startPlayer()
60{ 61{
61 Config config( "qpe" ); 62 Config config( "qpe" );
62 config.setGroup( "Time" ); 63 config.setGroup( "Time" );
63 sleep(15); 64 sleep(15);
64 QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); 65 QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" );
65 e << config.readEntry( "mp3File", "" ); 66 e << config.readEntry( "mp3File", "" );
66} 67}
67 68
68 69
69static void toggleScreenSaver( bool on ) 70static void toggleScreenSaver( bool on )
70{ 71{
71 QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); 72 QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" );
72 e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); 73 e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend );
73} 74}
74 75
75Clock::Clock( QWidget * parent, const char * name, WFlags f ) 76Clock::Clock( QWidget * parent, const char * name, WFlags f )
76 : QVBox( parent, name , f ) 77 : QVBox( parent, name , f )
77{ 78{
78 setSpacing( 4 ); 79 setSpacing( 4 );
79 setMargin( 1 ); 80 setMargin( 1 );
80 81
81 82
82 snoozeBtn = new QPushButton ( this ); 83 snoozeBtn = new QPushButton ( this );
@@ -124,49 +125,49 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
124 connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) ); 125 connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) );
125 grp->setButton( 0 ); 126 grp->setButton( 0 );
126 127
127 set = new QPushButton ( controls ); 128 set = new QPushButton ( controls );
128 set->setMaximumSize( 50, 30 ); 129 set->setMaximumSize( 50, 30 );
129 gl->addWidget( set , 0, 1 ); 130 gl->addWidget( set , 0, 1 );
130 set->setText( tr( "Start" ) ); 131 set->setText( tr( "Start" ) );
131 set->setEnabled( FALSE ); 132 set->setEnabled( FALSE );
132 grp->insert( set ); 133 grp->insert( set );
133 134
134 reset = new QPushButton ( controls ); 135 reset = new QPushButton ( controls );
135 gl->addWidget( reset, 1, 1 ); 136 gl->addWidget( reset, 1, 1 );
136 reset->setText( tr( "Reset" ) ); 137 reset->setText( tr( "Reset" ) );
137 reset->setEnabled( FALSE ); 138 reset->setEnabled( FALSE );
138 grp->insert( reset ); 139 grp->insert( reset );
139 140
140 alarmOffBtn = new QPushButton ( controls ); 141 alarmOffBtn = new QPushButton ( controls );
141 gl->addWidget( alarmOffBtn, 0, 2 ); 142 gl->addWidget( alarmOffBtn, 0, 2 );
142 143
143 alarmBtn = new QPushButton ( controls ); 144 alarmBtn = new QPushButton ( controls );
144 gl->addWidget( alarmBtn, 1, 2 ); 145 gl->addWidget( alarmBtn, 1, 2 );
145 146
146 alarmBtn->setText( tr( "Set Alarm" ) ); 147 alarmBtn->setText( tr( "Set Alarm" ) );
147 148
148 Opie::OClickableLabel *click = new Opie::OClickableLabel( controls, "label" ); 149 OClickableLabel *click = new Opie::Ui::OClickableLabel( controls, "label" );
149 click->setText( tr( "Set date and time." ) ); 150 click->setText( tr( "Set date and time." ) );
150 gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); 151 gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter );
151 connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); 152 connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) );
152 153
153 connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); 154 connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) );
154 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); 155 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
155 156
156 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); 157 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
157 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); 158 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
158 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); 159 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
159 160
160 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 161 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
161 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 162 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
162 163
163 t = new QTimer( this ); 164 t = new QTimer( this );
164 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); 165 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) );
165 t->start( 1000 ); 166 t->start( 1000 );
166 167
167 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); 168 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) );
168 169
169 swatch_running = FALSE; 170 swatch_running = FALSE;
170 swatch_totalms = 0; 171 swatch_totalms = 0;
171 172
172 connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); 173 connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) );