summaryrefslogtreecommitdiff
path: root/noncore/tools
authorllornkcor <llornkcor>2002-05-31 12:12:02 (UTC)
committer llornkcor <llornkcor>2002-05-31 12:12:02 (UTC)
commitdd08e7fa2ccbcc0489c17ed305b20a9a7d187161 (patch) (unidiff)
tree59399ddb7c89ad178c85e576018db9471d292b52 /noncore/tools
parent40eac37ff82dd4499a95adb786eb063fd0b81584 (diff)
downloadopie-dd08e7fa2ccbcc0489c17ed305b20a9a7d187161.zip
opie-dd08e7fa2ccbcc0489c17ed305b20a9a7d187161.tar.gz
opie-dd08e7fa2ccbcc0489c17ed305b20a9a7d187161.tar.bz2
add zeckes change in again *DOH*, and initialize some silly int's to get rid of silly compiler warnings
Diffstat (limited to 'noncore/tools') (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp21
-rw-r--r--noncore/tools/clock/clock.h2
2 files changed, 17 insertions, 6 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index a85cc19..0a21146 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -14,13 +14,12 @@
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// code added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002
21 20
22#include "clock.h" 21#include "clock.h"
23#include "setAlarm.h" 22#include "setAlarm.h"
24 23
25#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
26#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
@@ -29,12 +28,14 @@
29#include <qpe/alarmserver.h> 28#include <qpe/alarmserver.h>
30#include <qpe/sound.h> 29#include <qpe/sound.h>
31#include <qpe/resource.h> 30#include <qpe/resource.h>
32#include <qsound.h> 31#include <qsound.h>
33#include <qtimer.h> 32#include <qtimer.h>
34 33
34#include <opie/oclickablelabel.h>
35
35#include <qlcdnumber.h> 36#include <qlcdnumber.h>
36#include <qslider.h> 37#include <qslider.h>
37#include <qlabel.h> 38#include <qlabel.h>
38#include <qlayout.h> 39#include <qlayout.h>
39#include <qtimer.h> 40#include <qtimer.h>
40#include <qpushbutton.h> 41#include <qpushbutton.h>
@@ -90,13 +91,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
90 date = new QLabel( this ); 91 date = new QLabel( this );
91 date->setAlignment( AlignHCenter | AlignVCenter ); 92 date->setAlignment( AlignHCenter | AlignVCenter );
92 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); 93 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
93 date->setText( TimeString::longDateString( QDate::currentDate() ) ); 94 date->setText( TimeString::longDateString( QDate::currentDate() ) );
94 95
95 QWidget *controls = new QWidget( this ); 96 QWidget *controls = new QWidget( this );
96 QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 ); 97 QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 );
97 98
98 QButtonGroup *grp = new QButtonGroup( controls ); 99 QButtonGroup *grp = new QButtonGroup( controls );
99 grp->setRadioButtonExclusive( true ); 100 grp->setRadioButtonExclusive( true );
100 grp->hide(); 101 grp->hide();
101 102
102 clockRB = new QRadioButton ( tr( "Clock" ), controls ); 103 clockRB = new QRadioButton ( tr( "Clock" ), controls );
@@ -129,12 +130,17 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
129 130
130 alarmBtn = new QPushButton ( controls ); 131 alarmBtn = new QPushButton ( controls );
131 // alarmBtn->setMaximumSize(60,30); 132 // alarmBtn->setMaximumSize(60,30);
132 gl->addWidget( alarmBtn, 1, 2 ); 133 gl->addWidget( alarmBtn, 1, 2 );
133 alarmBtn->setText( tr( "Set Alarm" ) ); 134 alarmBtn->setText( tr( "Set Alarm" ) );
134 135
136 OClickableLabel *click = new OClickableLabel(controls, "label" );
137 click->setText(tr("Set date and time." ) );
138 gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter);
139 connect( click, SIGNAL(clicked() ), this, SLOT(slotAdjustTime() ) );
140
135 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) ); 141 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) );
136 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); 142 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
137 143
138 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); 144 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
139 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); 145 connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
140 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); 146 connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
@@ -307,13 +313,13 @@ void Clock::slotSetAlarm()
307 } 313 }
308} 314}
309 315
310void Clock::slotSnooze() 316void Clock::slotSnooze()
311{ 317{
312 bSound=FALSE; 318 bSound=FALSE;
313 int warn; 319 int warn = 0;
314 QTime t = QTime::currentTime(); 320 QTime t = QTime::currentTime();
315 QDateTime whenl( when.date(), t.addSecs( snoozeTime*60)); 321 QDateTime whenl( when.date(), t.addSecs( snoozeTime*60));
316 when=whenl; 322 when=whenl;
317 AlarmServer::addAlarm( when, 323 AlarmServer::addAlarm( when,
318 "QPE/Application/clock", 324 "QPE/Application/clock",
319 "alarm(QDateTime,int)", warn ); 325 "alarm(QDateTime,int)", warn );
@@ -346,24 +352,24 @@ void Clock::alarmOn()
346 QDate d = QDate::currentDate(); 352 QDate d = QDate::currentDate();
347 QTime tm((int)hour,(int)minute,0); 353 QTime tm((int)hour,(int)minute,0);
348 qDebug("Time set "+tm.toString()); 354 qDebug("Time set "+tm.toString());
349 QTime t = QTime::currentTime(); 355 QTime t = QTime::currentTime();
350 if( t > tm) 356 if( t > tm)
351 d = d.addDays(1); 357 d = d.addDays(1);
352 int warn; 358 int warn = 0;
353 QDateTime whenl(d,tm); 359 QDateTime whenl(d,tm);
354 when=whenl; 360 when=whenl;
355 AlarmServer::addAlarm( when, 361 AlarmServer::addAlarm( when,
356 "QPE/Application/clock", 362 "QPE/Application/clock",
357 "alarm(QDateTime,int)", warn ); 363 "alarm(QDateTime,int)", warn );
358 setCaption("Alarm set: "+ whenl.toString()); 364 setCaption("Alarm set: "+ whenl.toString());
359} 365}
360 366
361void Clock::alarmOff() 367void Clock::alarmOff()
362{ 368{
363 int warn; 369 int warn = 0;
364 bSound=FALSE; 370 bSound=FALSE;
365 AlarmServer::deleteAlarm( when, 371 AlarmServer::deleteAlarm( when,
366 "QPE/Application/clock", 372 "QPE/Application/clock",
367 "alarm(QDateTime,int)", warn ); 373 "alarm(QDateTime,int)", warn );
368 qDebug("Alarm Off "+ when.toString()); 374 qDebug("Alarm Off "+ when.toString());
369 setCaption("Clock"); 375 setCaption("Clock");
@@ -476,6 +482,11 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a )
476 double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - 482 double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) -
477 ( p.y() - c.y() ) * sin( angle ); 483 ( p.y() - c.y() ) * sin( angle );
478 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + 484 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) +
479 ( p.x() - c.x() ) * sin( angle ); 485 ( p.x() - c.x() ) * sin( angle );
480 return QPoint( nx, ny ); 486 return QPoint( nx, ny );
481} 487}
488void Clock::slotAdjustTime()
489{
490 QCopEnvelope e("QPE/System", "execute(QString)");
491 e << QString("systemtime");
492}
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h
index e5ed13c..024dd28 100644
--- a/noncore/tools/clock/clock.h
+++ b/noncore/tools/clock/clock.h
@@ -73,13 +73,13 @@ private slots:
73 void slotSnooze(); 73 void slotSnooze();
74 void slotToggleAlarm(); 74 void slotToggleAlarm();
75 void alarmOn(); 75 void alarmOn();
76 void alarmOff(); 76 void alarmOff();
77 void appMessage(const QCString& msg, const QByteArray& data); 77 void appMessage(const QCString& msg, const QByteArray& data);
78 void timerEvent( QTimerEvent *e ); 78 void timerEvent( QTimerEvent *e );
79// void slotAdjustTime(); 79 void slotAdjustTime();
80 80
81private: 81private:
82 void clearClock(); 82 void clearClock();
83 83
84 bool alarmBool; 84 bool alarmBool;
85 QTimer *t; 85 QTimer *t;