summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp8
-rw-r--r--noncore/tools/clock/setAlarm.cpp1
2 files changed, 5 insertions, 4 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 6f570c5..097ea90 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -1,476 +1,476 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "clock.h" 21#include "clock.h"
22#include "setAlarm.h" 22#include "setAlarm.h"
23 23
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#include <qpe/timestring.h> 27#include <qpe/timestring.h>
28#include <qpe/alarmserver.h> 28#include <qpe/alarmserver.h>
29#include <qpe/sound.h> 29#include <qpe/sound.h>
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qsound.h> 31#include <qsound.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qlcdnumber.h> 34#include <qlcdnumber.h>
35#include <qslider.h> 35#include <qslider.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qlayout.h> 37#include <qlayout.h>
38#include <qtimer.h> 38#include <qtimer.h>
39#include <qpushbutton.h> 39#include <qpushbutton.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qbuttongroup.h> 41#include <qbuttongroup.h>
42#include <qpainter.h> 42#include <qpainter.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qdatetime.h> 44#include <qdatetime.h>
45 45
46#include <math.h> 46#include <math.h>
47 47
48const double deg2rad = 0.017453292519943295769; // pi/180 48const double deg2rad = 0.017453292519943295769; // pi/180
49const int sw_prec = 2; 49const int sw_prec = 2;
50 50
51static void toggleScreenSaver( bool on ) 51static void toggleScreenSaver( bool on )
52{ 52{
53 QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" ); 53 QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" );
54 e << (on ? QPEApplication::Enable: QPEApplication::DisableSuspend ); 54 e << (on ? QPEApplication::Enable: QPEApplication::DisableSuspend );
55} 55}
56 56
57Clock::Clock( QWidget * parent, const char * name, WFlags f ) 57Clock::Clock( QWidget * parent, const char * name, WFlags f )
58 : QVBox( parent, name , f ) 58 : QVBox( parent, name , f )
59{ 59{
60 setSpacing( 4 ); 60 setSpacing( 4 );
61 setMargin( 1 ); 61 setMargin( 1 );
62 62
63 Config config( "qpe" ); 63 Config config( "qpe" );
64 config.setGroup("Time"); 64 config.setGroup("Time");
65 ampm = config.readBoolEntry( "AMPM", TRUE ); 65 ampm = config.readBoolEntry( "AMPM", TRUE );
66 66
67 snoozeBtn = new QPushButton ( this); 67 snoozeBtn = new QPushButton ( this);
68 snoozeBtn->setText( tr( "Snooze" ) ); 68 snoozeBtn->setText( tr( "Snooze" ) );
69 69
70 aclock = new AnalogClock( this ); 70 aclock = new AnalogClock( this );
71 aclock->display( QTime::currentTime() ); 71 aclock->display( QTime::currentTime() );
72 aclock->setLineWidth( 2 ); 72 aclock->setLineWidth( 2 );
73 73
74 QHBox *hb = new QHBox( this ); 74 QHBox *hb = new QHBox( this );
75 hb->setMargin( 0 ); 75 hb->setMargin( 0 );
76 QWidget *space = new QWidget( hb ); 76 QWidget *space = new QWidget( hb );
77 lcd = new QLCDNumber( hb ); 77 lcd = new QLCDNumber( hb );
78 lcd->setSegmentStyle( QLCDNumber::Flat ); 78 lcd->setSegmentStyle( QLCDNumber::Flat );
79 lcd->setFrameStyle( QFrame::NoFrame ); 79 lcd->setFrameStyle( QFrame::NoFrame );
80 lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); 80 lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
81 lcd->setFixedHeight( 23 ); 81 lcd->setFixedHeight( 23 );
82 82
83 ampmLabel = new QLabel( tr("PM"), hb ); 83 ampmLabel = new QLabel( tr("PM"), hb );
84 ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); 84 ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
85 ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); 85 ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) );
86 ampmLabel->setAlignment( AlignLeft | AlignBottom ); 86 ampmLabel->setAlignment( AlignLeft | AlignBottom );
87 space = new QWidget( hb ); 87 space = new QWidget( hb );
88 88
89 date = new QLabel( this ); 89 date = new QLabel( this );
90 date->setAlignment( AlignHCenter | AlignVCenter ); 90 date->setAlignment( AlignHCenter | AlignVCenter );
91 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); 91 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
92 date->setText( TimeString::longDateString( QDate::currentDate() ) ); 92 date->setText( TimeString::longDateString( QDate::currentDate() ) );
93 93
94 QWidget *controls = new QWidget( this ); 94 QWidget *controls = new QWidget( this );
95 QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 ); 95 QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 );
96 96
97 QButtonGroup *grp = new QButtonGroup( controls ); 97 QButtonGroup *grp = new QButtonGroup( controls );
98 grp->setRadioButtonExclusive( true ); 98 grp->setRadioButtonExclusive( true );
99 grp->hide(); 99 grp->hide();
100 100
101 clockRB = new QRadioButton ( tr( "Clock" ), controls ); 101 clockRB = new QRadioButton ( tr( "Clock" ), controls );
102 gl->addWidget( clockRB, 0, 0 ); 102 gl->addWidget( clockRB, 0, 0 );
103 grp->insert( clockRB ); 103 grp->insert( clockRB );
104 104
105 swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); 105 swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls );
106 gl->addWidget( swatchRB, 1, 0 ); 106 gl->addWidget( swatchRB, 1, 0 );
107 grp->insert( swatchRB ); 107 grp->insert( swatchRB );
108 108
109 connect( grp, SIGNAL(clicked(int)), this, SLOT(modeSelect(int)) ); 109 connect( grp, SIGNAL(clicked(int)), this, SLOT(modeSelect(int)) );
110 grp->setButton( 0 ); 110 grp->setButton( 0 );
111 111
112 set = new QPushButton ( controls ); 112 set = new QPushButton ( controls );
113 set->setMaximumSize(50,30); 113 set->setMaximumSize(50,30);
114 gl->addWidget( set, 0, 1 ); 114 gl->addWidget( set, 0, 1 );
115 set->setText( tr( "Start" ) ); 115 set->setText( tr( "Start" ) );
116 set->setEnabled( FALSE ); 116 set->setEnabled( FALSE );
117 grp->insert( set ); 117 grp->insert( set );
118 118
119 reset = new QPushButton ( controls ); 119 reset = new QPushButton ( controls );
120 gl->addWidget( reset, 1, 1 ); 120 gl->addWidget( reset, 1, 1 );
121 reset->setText( tr( "Reset" ) ); 121 reset->setText( tr( "Reset" ) );
122 reset->setEnabled( FALSE ); 122 reset->setEnabled( FALSE );
123 grp->insert( reset ); 123 grp->insert( reset );
124 124
125 alarmOffBtn = new QPushButton ( controls ); 125 alarmOffBtn = new QPushButton ( controls );
126 alarmOffBtn->setMaximumSize(60,30); 126 alarmOffBtn->setMaximumSize(60,30);
127 gl->addWidget( alarmOffBtn, 0, 2 ); 127 gl->addWidget( alarmOffBtn, 0, 2 );
128 128
129 alarmBtn = new QPushButton ( controls ); 129 alarmBtn = new QPushButton ( controls );
130 alarmBtn->setMaximumSize(60,30); 130 alarmBtn->setMaximumSize(60,30);
131 gl->addWidget( alarmBtn, 1, 2 ); 131 gl->addWidget( alarmBtn, 1, 2 );
132 alarmBtn->setText( tr( "Set Alarm" ) ); 132 alarmBtn->setText( tr( "Set Alarm" ) );
133 133
134 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) ); 134 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) );
135 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); 135 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
136 136
137 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); 137 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
138 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); 138 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
139 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); 139 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
140 140
141 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 141 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
142 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 142 this, SLOT(appMessage(const QCString&, const QByteArray&)) );
143 143
144 t = new QTimer( this ); 144 t = new QTimer( this );
145 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); 145 connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) );
146 t->start( 1000 ); 146 t->start( 1000 );
147 147
148 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); 148 connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) );
149 149
150 swatch_running = FALSE; 150 swatch_running = FALSE;
151 swatch_totalms = 0; 151 swatch_totalms = 0;
152 152
153 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 153 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
154 154
155 QString tmp = config.readEntry("clockAlarmHour", ""); 155 QString tmp = config.readEntry("clockAlarmHour", "");
156 bool ok; 156 bool ok;
157 hour = tmp.toInt(&ok,10); 157 hour = tmp.toInt(&ok,10);
158 tmp = config.readEntry("clockAlarmMinute",""); 158 tmp = config.readEntry("clockAlarmMinute","");
159 minute = tmp.toInt(&ok,10); 159 minute = tmp.toInt(&ok,10);
160 160
161 if( config.readEntry("clockAlarmSet","FALSE") == "TRUE") { 161 if( config.readEntry("clockAlarmSet","FALSE") == "TRUE") {
162 alarmOffBtn->setText( tr( "Alarm On" ) ); 162 alarmOffBtn->setText( tr( "Alarm Is On" ) );
163 alarmBool=TRUE; 163 alarmBool=TRUE;
164 snoozeBtn->show(); 164 snoozeBtn->show();
165 } else { 165 } else {
166 alarmOffBtn->setText( tr( "Alarm Off" ) ); 166 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
167 alarmBool=FALSE; 167 alarmBool=FALSE;
168 snoozeBtn->hide(); 168 snoozeBtn->hide();
169 } 169 }
170 170
171 QTimer::singleShot( 0, this, SLOT(updateClock()) ); 171 QTimer::singleShot( 0, this, SLOT(updateClock()) );
172 modeSelect(0); 172 modeSelect(0);
173} 173}
174 174
175Clock::~Clock() 175Clock::~Clock()
176{ 176{
177 toggleScreenSaver( true ); 177 toggleScreenSaver( true );
178} 178}
179 179
180void Clock::updateClock() 180void Clock::updateClock()
181{ 181{
182 if ( clockRB->isChecked() ) { 182 if ( clockRB->isChecked() ) {
183 QTime tm = QDateTime::currentDateTime().time(); 183 QTime tm = QDateTime::currentDateTime().time();
184 QString s; 184 QString s;
185 if ( ampm ) { 185 if ( ampm ) {
186 int hour = tm.hour(); 186 int hour = tm.hour();
187 if (hour == 0) 187 if (hour == 0)
188 hour = 12; 188 hour = 12;
189 if (hour > 12) 189 if (hour > 12)
190 hour -= 12; 190 hour -= 12;
191 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); 191 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() );
192 ampmLabel->setText( (tm.hour() >= 12) ? "PM" : "AM" ); 192 ampmLabel->setText( (tm.hour() >= 12) ? "PM" : "AM" );
193 ampmLabel->show(); 193 ampmLabel->show();
194 } else { 194 } else {
195 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); 195 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() );
196 ampmLabel->hide(); 196 ampmLabel->hide();
197 } 197 }
198 lcd->display( s ); 198 lcd->display( s );
199 lcd->repaint( FALSE ); 199 lcd->repaint( FALSE );
200 aclock->display( QTime::currentTime() ); 200 aclock->display( QTime::currentTime() );
201 date->setText( TimeString::longDateString( QDate::currentDate() ) ); 201 date->setText( TimeString::longDateString( QDate::currentDate() ) );
202 } else { 202 } else {
203 QTime swatch_time; 203 QTime swatch_time;
204 QString lcdtext; 204 QString lcdtext;
205 int totalms = swatch_totalms; 205 int totalms = swatch_totalms;
206 if ( swatch_running ) 206 if ( swatch_running )
207 totalms += swatch_start.elapsed(); 207 totalms += swatch_start.elapsed();
208 swatch_time = QTime(0,0,0).addMSecs(totalms); 208 swatch_time = QTime(0,0,0).addMSecs(totalms);
209 QString d = swatch_running ? QString(" ") 209 QString d = swatch_running ? QString(" ")
210 : QString::number(totalms%1000+1000); 210 : QString::number(totalms%1000+1000);
211 lcdtext = swatch_time.toString() + "." + d.right(3).left(sw_prec); 211 lcdtext = swatch_time.toString() + "." + d.right(3).left(sw_prec);
212 lcd->display( lcdtext ); 212 lcd->display( lcdtext );
213 lcd->repaint( FALSE ); 213 lcd->repaint( FALSE );
214 aclock->display( swatch_time ); 214 aclock->display( swatch_time );
215 date->setText( TimeString::longDateString( QDate::currentDate() ) ); 215 date->setText( TimeString::longDateString( QDate::currentDate() ) );
216 } 216 }
217} 217}
218 218
219void Clock::changeClock( bool a ) 219void Clock::changeClock( bool a )
220{ 220{
221 ampm = a; 221 ampm = a;
222 updateClock(); 222 updateClock();
223} 223}
224 224
225void Clock::clearClock( void ) 225void Clock::clearClock( void )
226{ 226{
227 lcd->display( QTime( 0,0,0 ).toString() ); 227 lcd->display( QTime( 0,0,0 ).toString() );
228 aclock->display( QTime( 0,0,0 ) ); 228 aclock->display( QTime( 0,0,0 ) );
229} 229}
230 230
231void Clock::slotSet() 231void Clock::slotSet()
232{ 232{
233 if ( t->isActive() ) { 233 if ( t->isActive() ) {
234 swatch_totalms += swatch_start.elapsed(); 234 swatch_totalms += swatch_start.elapsed();
235 set->setText( tr( "Start" ) ); 235 set->setText( tr( "Start" ) );
236 t->stop(); 236 t->stop();
237 swatch_running = FALSE; 237 swatch_running = FALSE;
238 toggleScreenSaver( TRUE ); 238 toggleScreenSaver( TRUE );
239 updateClock(); 239 updateClock();
240 } else { 240 } else {
241 swatch_start.start(); 241 swatch_start.start();
242 set->setText( tr( "Stop" ) ); 242 set->setText( tr( "Stop" ) );
243 t->start( 1000 ); 243 t->start( 1000 );
244 swatch_running = TRUE; 244 swatch_running = TRUE;
245 // disable screensaver while stop watch is running 245 // disable screensaver while stop watch is running
246 toggleScreenSaver( FALSE ); 246 toggleScreenSaver( FALSE );
247 } 247 }
248} 248}
249 249
250void Clock::slotReset() 250void Clock::slotReset()
251{ 251{
252 t->stop(); 252 t->stop();
253 swatch_start.start(); 253 swatch_start.start();
254 swatch_totalms = 0; 254 swatch_totalms = 0;
255 255
256 if (swatch_running ) 256 if (swatch_running )
257 t->start(1000); 257 t->start(1000);
258 258
259 updateClock(); 259 updateClock();
260} 260}
261 261
262void Clock::modeSelect( int m ) 262void Clock::modeSelect( int m )
263{ 263{
264 if ( m ) { 264 if ( m ) {
265 lcd->setNumDigits( 8+1+sw_prec ); 265 lcd->setNumDigits( 8+1+sw_prec );
266 lcd->setMinimumWidth( lcd->sizeHint().width() ); 266 lcd->setMinimumWidth( lcd->sizeHint().width() );
267 set->setEnabled( TRUE ); 267 set->setEnabled( TRUE );
268 reset->setEnabled( TRUE ); 268 reset->setEnabled( TRUE );
269 ampmLabel->hide(); 269 ampmLabel->hide();
270 270
271 if ( !swatch_running ) 271 if ( !swatch_running )
272 t->stop(); 272 t->stop();
273 } else { 273 } else {
274 lcd->setNumDigits( 5 ); 274 lcd->setNumDigits( 5 );
275 lcd->setMinimumWidth( lcd->sizeHint().width() ); 275 lcd->setMinimumWidth( lcd->sizeHint().width() );
276 set->setEnabled( FALSE ); 276 set->setEnabled( FALSE );
277 reset->setEnabled( FALSE ); 277 reset->setEnabled( FALSE );
278 t->start(1000); 278 t->start(1000);
279 } 279 }
280 updateClock(); 280 updateClock();
281} 281}
282 282
283//this sets the alarm time 283//this sets the alarm time
284void Clock::slotSetAlarm() 284void Clock::slotSetAlarm()
285{ 285{
286 if( !snoozeBtn->isHidden()) 286 if( !snoozeBtn->isHidden())
287 slotToggleAlarm(); 287 slotToggleAlarm();
288 Set_Alarm *setAlarmDlg; 288 Set_Alarm *setAlarmDlg;
289 setAlarmDlg = new Set_Alarm(this,"SetAlarm", TRUE); 289 setAlarmDlg = new Set_Alarm(this,"SetAlarm", TRUE);
290 int result = setAlarmDlg->exec(); 290 int result = setAlarmDlg->exec();
291 if(result == 1) { 291 if(result == 1) {
292 Config config( "qpe" ); 292 Config config( "qpe" );
293 config.setGroup("Time"); 293 config.setGroup("Time");
294 QString tmp; 294 QString tmp;
295 hour = setAlarmDlg->Hour_Slider->value(); 295 hour = setAlarmDlg->Hour_Slider->value();
296 minute = setAlarmDlg->Minute_Slider->value(); 296 minute = setAlarmDlg->Minute_Slider->value();
297 snoozeTime=setAlarmDlg->SnoozeSlider->value(); 297 snoozeTime=setAlarmDlg->SnoozeSlider->value();
298 if(ampm) { 298 if(ampm) {
299 if(setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 ) 299 if(setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 )
300 hour+=12; 300 hour+=12;
301 } 301 }
302 config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10); 302 config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10);
303 config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10); 303 config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10);
304 config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10); 304 config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10);
305 config.write(); 305 config.write();
306 } 306 }
307} 307}
308 308
309void Clock::slotSnooze() 309void Clock::slotSnooze()
310{ 310{
311 bSound=FALSE; 311 bSound=FALSE;
312 int warn; 312 int warn;
313 QTime t = QTime::currentTime(); 313 QTime t = QTime::currentTime();
314 QDateTime whenl( when.date(), t.addSecs( snoozeTime*60)); 314 QDateTime whenl( when.date(), t.addSecs( snoozeTime*60));
315 when=whenl; 315 when=whenl;
316 AlarmServer::addAlarm( when, 316 AlarmServer::addAlarm( when,
317 "QPE/Application/clock", 317 "QPE/Application/clock",
318 "alarm(QDateTime,int)", warn ); 318 "alarm(QDateTime,int)", warn );
319 319
320} 320}
321 321
322//toggles alarm on/off 322//toggles alarm on/off
323void Clock::slotToggleAlarm() 323void Clock::slotToggleAlarm()
324{ 324{
325 Config config( "qpe" ); 325 Config config( "qpe" );
326 config.setGroup("Time"); 326 config.setGroup("Time");
327 if(alarmBool) { 327 if(alarmBool) {
328 config.writeEntry("clockAlarmSet","FALSE"); 328 config.writeEntry("clockAlarmSet","FALSE");
329 alarmOffBtn->setText( tr( "Alarm Off" ) ); 329 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
330 snoozeBtn->hide(); 330 snoozeBtn->hide();
331 alarmBool=FALSE; 331 alarmBool=FALSE;
332 alarmOff(); 332 alarmOff();
333 } else { 333 } else {
334 config.writeEntry("clockAlarmSet","TRUE"); 334 config.writeEntry("clockAlarmSet","TRUE");
335 alarmOffBtn->setText( tr( "Alarm On" ) ); 335 alarmOffBtn->setText( tr( "Alarm Is On" ) );
336 snoozeBtn->show(); 336 snoozeBtn->show();
337 alarmBool=TRUE; 337 alarmBool=TRUE;
338 alarmOn(); 338 alarmOn();
339 } 339 }
340 config.write(); 340 config.write();
341} 341}
342 342
343void Clock::alarmOn() 343void Clock::alarmOn()
344{ 344{
345 QDate d = QDate::currentDate(); 345 QDate d = QDate::currentDate();
346 QTime tm((int)hour,(int)minute,0); 346 QTime tm((int)hour,(int)minute,0);
347 qDebug("Time set "+tm.toString()); 347 qDebug("Time set "+tm.toString());
348 QTime t = QTime::currentTime(); 348 QTime t = QTime::currentTime();
349 if( t > tm) 349 if( t > tm)
350 d = d.addDays(1); 350 d = d.addDays(1);
351 int warn; 351 int warn;
352 QDateTime whenl(d,tm); 352 QDateTime whenl(d,tm);
353 when=whenl; 353 when=whenl;
354 AlarmServer::addAlarm( when, 354 AlarmServer::addAlarm( when,
355 "QPE/Application/clock", 355 "QPE/Application/clock",
356 "alarm(QDateTime,int)", warn ); 356 "alarm(QDateTime,int)", warn );
357 QMessageBox::message("Note","Alarm is set for:\n"+ whenl.toString()); 357 QMessageBox::message("Note","Alarm is set for:\n"+ whenl.toString());
358} 358}
359 359
360void Clock::alarmOff() 360void Clock::alarmOff()
361{ 361{
362 int warn; 362 int warn;
363 bSound=FALSE; 363 bSound=FALSE;
364 AlarmServer::deleteAlarm( when, 364 AlarmServer::deleteAlarm( when,
365 "QPE/Application/clock", 365 "QPE/Application/clock",
366 "alarm(QDateTime,int)", warn ); 366 "alarm(QDateTime,int)", warn );
367 qDebug("Alarm Off "+ when.toString()); 367 qDebug("Alarm Off "+ when.toString());
368 368
369} 369}
370 370
371void Clock::appMessage(const QCString& msg, const QByteArray& data) 371void Clock::appMessage(const QCString& msg, const QByteArray& data)
372{ 372{
373 int stopTimer = 0; 373 int stopTimer = 0;
374 int timerStay = 5000; 374 int timerStay = 5000;
375 bSound=TRUE; 375 bSound=TRUE;
376 if ( msg == "alarm(QDateTime,int)" ) { 376 if ( msg == "alarm(QDateTime,int)" ) {
377 Sound::soundAlarm(); 377 Sound::soundAlarm();
378 stopTimer = startTimer( timerStay); 378 stopTimer = startTimer( timerStay);
379 } 379 }
380} 380}
381 381
382void Clock::timerEvent( QTimerEvent *e ) 382void Clock::timerEvent( QTimerEvent *e )
383{ 383{
384 static int stop = 0; 384 static int stop = 0;
385 if ( stop < 10 && bSound) { 385 if ( stop < 10 && bSound) {
386 Sound::soundAlarm(); 386 Sound::soundAlarm();
387 stop++; 387 stop++;
388 } else { 388 } else {
389 stop = 0; 389 stop = 0;
390 killTimer( e->timerId() ); 390 killTimer( e->timerId() );
391 } 391 }
392} 392}
393 393
394 394
395QSizePolicy AnalogClock::sizePolicy() const 395QSizePolicy AnalogClock::sizePolicy() const
396{ 396{
397 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); 397 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
398} 398}
399 399
400void AnalogClock::drawContents( QPainter *p ) 400void AnalogClock::drawContents( QPainter *p )
401{ 401{
402 QRect r = contentsRect(); 402 QRect r = contentsRect();
403 QPoint center( r.x() + r.width() / 2, r.y() + r.height() / 2 ); 403 QPoint center( r.x() + r.width() / 2, r.y() + r.height() / 2 );
404 404
405 QPoint l1( r.x() + r.width() / 2, r.y() + 2 ); 405 QPoint l1( r.x() + r.width() / 2, r.y() + 2 );
406 QPoint l2( r.x() + r.width() / 2, r.y() + 8 ); 406 QPoint l2( r.x() + r.width() / 2, r.y() + 8 );
407 407
408 QPoint h1( r.x() + r.width() / 2, r.y() + r.height() / 4 ); 408 QPoint h1( r.x() + r.width() / 2, r.y() + r.height() / 4 );
409 QPoint h2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); 409 QPoint h2( r.x() + r.width() / 2, r.y() + r.height() / 2 );
410 410
411 QPoint m1( r.x() + r.width() / 2, r.y() + r.height() / 8 ); 411 QPoint m1( r.x() + r.width() / 2, r.y() + r.height() / 8 );
412 QPoint m2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); 412 QPoint m2( r.x() + r.width() / 2, r.y() + r.height() / 2 );
413 413
414 QPoint s1( r.x() + r.width() / 2, r.y() + 8 ); 414 QPoint s1( r.x() + r.width() / 2, r.y() + 8 );
415 QPoint s2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); 415 QPoint s2( r.x() + r.width() / 2, r.y() + r.height() / 2 );
416 416
417 QColor color( clear ? backgroundColor() : black ); 417 QColor color( clear ? backgroundColor() : black );
418 QTime time = clear ? prevTime : currTime; 418 QTime time = clear ? prevTime : currTime;
419 419
420 if ( clear && prevTime.secsTo(currTime) > 1 ) { 420 if ( clear && prevTime.secsTo(currTime) > 1 ) {
421 p->eraseRect( rect() ); 421 p->eraseRect( rect() );
422 return; 422 return;
423 } 423 }
424 424
425 if ( !clear ) { 425 if ( !clear ) {
426 // draw ticks 426 // draw ticks
427 p->setPen( QPen( color, 1 ) ); 427 p->setPen( QPen( color, 1 ) );
428 for ( int i = 0; i < 12; i++ ) 428 for ( int i = 0; i < 12; i++ )
429 p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); 429 p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) );
430 } 430 }
431 431
432 if ( !clear || prevTime.minute() != currTime.minute() || 432 if ( !clear || prevTime.minute() != currTime.minute() ||
433 prevTime.hour() != currTime.hour() ) { 433 prevTime.hour() != currTime.hour() ) {
434 // draw hour pointer 434 // draw hour pointer
435 h1 = rotate( center, h1, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); 435 h1 = rotate( center, h1, 30 * ( time.hour() % 12 ) + time.minute() / 2 );
436 h2 = rotate( center, h2, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); 436 h2 = rotate( center, h2, 30 * ( time.hour() % 12 ) + time.minute() / 2 );
437 p->setPen( QPen( color, 3 ) ); 437 p->setPen( QPen( color, 3 ) );
438 p->drawLine( h1, h2 ); 438 p->drawLine( h1, h2 );
439 } 439 }
440 440
441 if ( !clear || prevTime.minute() != currTime.minute() ) { 441 if ( !clear || prevTime.minute() != currTime.minute() ) {
442 // draw minute pointer 442 // draw minute pointer
443 m1 = rotate( center, m1, time.minute() * 6 ); 443 m1 = rotate( center, m1, time.minute() * 6 );
444 m2 = rotate( center, m2, time.minute() * 6 ); 444 m2 = rotate( center, m2, time.minute() * 6 );
445 p->setPen( QPen( color, 2 ) ); 445 p->setPen( QPen( color, 2 ) );
446 p->drawLine( m1, m2 ); 446 p->drawLine( m1, m2 );
447 } 447 }
448 448
449 // draw second pointer 449 // draw second pointer
450 s1 = rotate( center, s1, time.second() * 6 ); 450 s1 = rotate( center, s1, time.second() * 6 );
451 s2 = rotate( center, s2, time.second() * 6 ); 451 s2 = rotate( center, s2, time.second() * 6 );
452 p->setPen( QPen( color, 1 ) ); 452 p->setPen( QPen( color, 1 ) );
453 p->drawLine( s1, s2 ); 453 p->drawLine( s1, s2 );
454 454
455 if ( !clear ) 455 if ( !clear )
456 prevTime = currTime; 456 prevTime = currTime;
457} 457}
458 458
459void AnalogClock::display( const QTime& t ) 459void AnalogClock::display( const QTime& t )
460{ 460{
461 currTime = t; 461 currTime = t;
462 clear = true; 462 clear = true;
463 repaint( false ); 463 repaint( false );
464 clear = false; 464 clear = false;
465 repaint( false ); 465 repaint( false );
466} 466}
467 467
468QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) 468QPoint AnalogClock::rotate( QPoint c, QPoint p, int a )
469{ 469{
470 double angle = deg2rad * ( - a + 180 ); 470 double angle = deg2rad * ( - a + 180 );
471 double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - 471 double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) -
472 ( p.y() - c.y() ) * sin( angle ); 472 ( p.y() - c.y() ) * sin( angle );
473 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + 473 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) +
474 ( p.x() - c.x() ) * sin( angle ); 474 ( p.x() - c.x() ) * sin( angle );
475 return QPoint( nx, ny ); 475 return QPoint( nx, ny );
476} 476}
diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp
index 01e52f6..6b95e6a 100644
--- a/noncore/tools/clock/setAlarm.cpp
+++ b/noncore/tools/clock/setAlarm.cpp
@@ -1,183 +1,184 @@
1 /*************************************************************************** 1 /***************************************************************************
2// setAlarm.cpp - description 2// setAlarm.cpp - description
3// ------------------- 3// -------------------
4// Created: Wed Mar 13 19:47:24 2002 4// Created: Wed Mar 13 19:47:24 2002
5// copyright : (C) 2002 by ljp 5// copyright : (C) 2002 by ljp
6// email : ljp@llornkcor.com 6// email : ljp@llornkcor.com
7// 7//
8*************************************************************************** 8***************************************************************************
9 * This program is free software; you can redistribute it and/or modify * 9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by * 10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or * 11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. * 12 * (at your option) any later version. *
13 ***************************************************************************/ 13 ***************************************************************************/
14 14
15#include "setAlarm.h" 15#include "setAlarm.h"
16 16
17#include <qpe/config.h> 17#include <qpe/config.h>
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qstring.h> 20#include <qstring.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qlcdnumber.h> 22#include <qlcdnumber.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qradiobutton.h> 24#include <qradiobutton.h>
25#include <qslider.h> 25#include <qslider.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvariant.h> 27#include <qvariant.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30#include <qbuttongroup.h> 30#include <qbuttongroup.h>
31 31
32Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) 32Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl )
33 : QDialog( parent, name, modal, fl ) 33 : QDialog( parent, name, modal, fl )
34{ 34{
35 if ( !name ) 35 if ( !name )
36 setName( "Set_Alarm" ); 36 setName( "Set_Alarm" );
37 resize( 240, 101 ); 37 resize( 240, 101 );
38 setMaximumSize( QSize( 240, 320 ) ); 38 setMaximumSize( QSize( 240, 320 ) );
39 setCaption( tr( "Set Alarm" ) ); 39 setCaption( tr( "Set Alarm" ) );
40 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 40 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
41 41
42 Set_AlarmLayout = new QGridLayout( this ); 42 Set_AlarmLayout = new QGridLayout( this );
43 Set_AlarmLayout->setSpacing( 6 ); 43 Set_AlarmLayout->setSpacing( 6 );
44 Set_AlarmLayout->setMargin( 11 ); 44 Set_AlarmLayout->setMargin( 11 );
45 45
46 TextLabel1 = new QLabel( this, "TextLabel1" ); 46 TextLabel1 = new QLabel( this, "TextLabel1" );
47 TextLabel1->setText( tr( "Hour" ) ); 47 TextLabel1->setText( tr( "Hour" ) );
48 48
49 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 ); 49 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 );
50 50
51 TextLabel2 = new QLabel( this, "TextLabel2" ); 51 TextLabel2 = new QLabel( this, "TextLabel2" );
52 TextLabel2->setText( tr( "Minute" ) ); 52 TextLabel2->setText( tr( "Minute" ) );
53 53
54 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 ); 54 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 );
55 55
56 Hour_Slider = new QSlider( this, "Hour_Slider" ); 56 Hour_Slider = new QSlider( this, "Hour_Slider" );
57 Hour_Slider->setPageStep( 1); 57 Hour_Slider->setPageStep( 1);
58 Hour_Slider->setOrientation( QSlider::Horizontal ); 58 Hour_Slider->setOrientation( QSlider::Horizontal );
59 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int))); 59 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int)));
60 60
61 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 ); 61 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 );
62 62
63 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" ); 63 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" );
64 Hour_LCDNumber->setFrameShape( QLCDNumber::Box ); 64 Hour_LCDNumber->setFrameShape( QLCDNumber::Box );
65 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 65 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain );
66 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 66 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
67 67
68 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 ); 68 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 );
69 69
70 Minute_Slider = new QSlider( this, "Minute_Slider" ); 70 Minute_Slider = new QSlider( this, "Minute_Slider" );
71 Minute_Slider->setMaxValue( 59); 71 Minute_Slider->setMaxValue( 59);
72 Minute_Slider->setPageStep( 1);
72 Minute_Slider->setOrientation( QSlider::Horizontal ); 73 Minute_Slider->setOrientation( QSlider::Horizontal );
73 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int))); 74 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int)));
74 75
75 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 ); 76 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 );
76 77
77 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" ); 78 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" );
78 Minute_LCDNumber->setFrameShape( QLCDNumber::Box ); 79 Minute_LCDNumber->setFrameShape( QLCDNumber::Box );
79 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 80 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain );
80 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 81 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
81 82
82 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 ); 83 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 );
83 84
84 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" ); 85 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" );
85 Am_RadioButton->setText( tr( "AM" ) ); 86 Am_RadioButton->setText( tr( "AM" ) );
86 Am_RadioButton->setChecked(TRUE); 87 Am_RadioButton->setChecked(TRUE);
87 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool))); 88 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool)));
88 89
89 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 ); 90 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 );
90 91
91 92
92 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" ); 93 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" );
93 Pm_RadioButton->setText( tr( "PM" ) ); 94 Pm_RadioButton->setText( tr( "PM" ) );
94 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool))); 95 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool)));
95 96
96 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); 97 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 );
97 98
98 TextLabel3 = new QLabel( this, "TextLabel3" ); 99 TextLabel3 = new QLabel( this, "TextLabel3" );
99 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); 100 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) );
100 101
101 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 ); 102 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 );
102 103
103 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" ); 104 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" );
104 Snooze_LCDNumber->setFrameShape( QLCDNumber::Box ); 105 Snooze_LCDNumber->setFrameShape( QLCDNumber::Box );
105 Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 106 Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain );
106 Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 107 Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
107 108
108 Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 ); 109 Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 );
109 110
110 SnoozeSlider = new QSlider( this, "SnoozeSlider" ); 111 SnoozeSlider = new QSlider( this, "SnoozeSlider" );
111 SnoozeSlider->setMaxValue( 60 ); 112 SnoozeSlider->setMaxValue( 60 );
112 SnoozeSlider->setOrientation( QSlider::Horizontal ); 113 SnoozeSlider->setOrientation( QSlider::Horizontal );
113 connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); 114 connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int)));
114 115
115 Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 ); 116 Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 );
116 117
117 Config config( "qpe" ); 118 Config config( "qpe" );
118 config.setGroup("Time"); 119 config.setGroup("Time");
119 120
120 bool ok; 121 bool ok;
121 bool ampm = config.readBoolEntry( "AMPM", TRUE ); 122 bool ampm = config.readBoolEntry( "AMPM", TRUE );
122 QString alarmHour=config.readEntry("clockAlarmHour","8"); 123 QString alarmHour=config.readEntry("clockAlarmHour","8");
123 int i_alarmHour = alarmHour.toInt(&ok,10); 124 int i_alarmHour = alarmHour.toInt(&ok,10);
124 QString alarmMinute=config.readEntry("clockAlarmMinute","0"); 125 QString alarmMinute=config.readEntry("clockAlarmMinute","0");
125 QString snoozeTime=config.readEntry("clockAlarmSnooze","0"); 126 QString snoozeTime=config.readEntry("clockAlarmSnooze","0");
126 if(ampm) { 127 if(ampm) {
127 Hour_Slider->setMaxValue( 12); 128 Hour_Slider->setMaxValue( 12);
128 Hour_Slider->setMinValue( 1); 129 Hour_Slider->setMinValue( 1);
129 130
130 if( i_alarmHour > 12) { 131 if( i_alarmHour > 12) {
131 i_alarmHour = i_alarmHour - 12; 132 i_alarmHour = i_alarmHour - 12;
132 Pm_RadioButton->setChecked(TRUE); 133 Pm_RadioButton->setChecked(TRUE);
133 } 134 }
134 Hour_Slider->setValue( i_alarmHour); 135 Hour_Slider->setValue( i_alarmHour);
135 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); 136 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
136 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); 137 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
137 } else { 138 } else {
138 Hour_Slider->setMaxValue( 23); 139 Hour_Slider->setMaxValue( 23);
139 Hour_Slider->setMinValue( 1); 140 Hour_Slider->setMinValue( 1);
140 Hour_Slider->setValue( i_alarmHour); 141 Hour_Slider->setValue( i_alarmHour);
141 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); 142 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
142 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); 143 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
143 Am_RadioButton->hide(); 144 Am_RadioButton->hide();
144 Pm_RadioButton->hide(); 145 Pm_RadioButton->hide();
145 } 146 }
146 // signals and slots connections 147 // signals and slots connections
147} 148}
148 149
149Set_Alarm::~Set_Alarm() 150Set_Alarm::~Set_Alarm()
150{ 151{
151 152
152} 153}
153 154
154void Set_Alarm::slotChangeHour(int hour) 155void Set_Alarm::slotChangeHour(int hour)
155{ 156{
156 Hour_LCDNumber->display(hour); 157 Hour_LCDNumber->display(hour);
157} 158}
158 159
159void Set_Alarm::slotChangeMinute(int minute) 160void Set_Alarm::slotChangeMinute(int minute)
160{ 161{
161 Minute_LCDNumber->display(minute); 162 Minute_LCDNumber->display(minute);
162} 163}
163 164
164void Set_Alarm::slotChangeSnooze(int minute) 165void Set_Alarm::slotChangeSnooze(int minute)
165{ 166{
166 Snooze_LCDNumber->display(minute); 167 Snooze_LCDNumber->display(minute);
167} 168}
168 169
169void Set_Alarm::amButtonToggled(bool b) 170void Set_Alarm::amButtonToggled(bool b)
170{ 171{
171 if ( b) 172 if ( b)
172 Pm_RadioButton->setChecked(FALSE); 173 Pm_RadioButton->setChecked(FALSE);
173} 174}
174 175
175void Set_Alarm::pmButtonToggled(bool b) 176void Set_Alarm::pmButtonToggled(bool b)
176{ 177{
177 if (b) 178 if (b)
178 Am_RadioButton->setChecked(FALSE); 179 Am_RadioButton->setChecked(FALSE);
179} 180}
180 181
181void Set_Alarm::cleanUp() 182void Set_Alarm::cleanUp()
182{ 183{
183} 184}