-rw-r--r-- | noncore/tools/clock/clock.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 118cf1f..b780675 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp | |||
@@ -3,65 +3,65 @@ | |||
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 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 | 20 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 |
21 | 21 | ||
22 | #include "clock.h" | 22 | #include "clock.h" |
23 | #include "setAlarm.h" | 23 | #include "setAlarm.h" |
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
29 | #include <qpe/alarmserver.h> | 29 | #include <qpe/alarmserver.h> |
30 | #include <qpe/sound.h> | 30 | #include <qpe/sound.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #include <qsound.h> | 32 | #include <qsound.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | 34 | ||
35 | #include <opie/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 | ||
56 | const double deg2rad = 0.017453292519943295769; // pi/180 | 56 | const double deg2rad = 0.017453292519943295769; // pi/180 |
57 | const int sw_prec = 2; | 57 | const int sw_prec = 2; |
58 | 58 | ||
59 | void startPlayer() | 59 | void startPlayer() |
60 | { | 60 | { |
61 | Config config( "qpe" ); | 61 | Config config( "qpe" ); |
62 | config.setGroup( "Time" ); | 62 | config.setGroup( "Time" ); |
63 | sleep(15); | 63 | sleep(15); |
64 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | 64 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); |
65 | e << config.readEntry( "mp3File", "" ); | 65 | e << config.readEntry( "mp3File", "" ); |
66 | } | 66 | } |
67 | 67 | ||
@@ -116,65 +116,65 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) | |||
116 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); | 116 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); |
117 | gl->addWidget( clockRB, 0, 0 ); | 117 | gl->addWidget( clockRB, 0, 0 ); |
118 | grp->insert( clockRB ); | 118 | grp->insert( clockRB ); |
119 | 119 | ||
120 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); | 120 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); |
121 | gl->addWidget( swatchRB, 1, 0 ); | 121 | gl->addWidget( swatchRB, 1, 0 ); |
122 | grp->insert( swatchRB ); | 122 | grp->insert( swatchRB ); |
123 | 123 | ||
124 | connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) ); | 124 | connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) ); |
125 | grp->setButton( 0 ); | 125 | grp->setButton( 0 ); |
126 | 126 | ||
127 | set = new QPushButton ( controls ); | 127 | set = new QPushButton ( controls ); |
128 | set->setMaximumSize( 50, 30 ); | 128 | set->setMaximumSize( 50, 30 ); |
129 | gl->addWidget( set , 0, 1 ); | 129 | gl->addWidget( set , 0, 1 ); |
130 | set->setText( tr( "Start" ) ); | 130 | set->setText( tr( "Start" ) ); |
131 | set->setEnabled( FALSE ); | 131 | set->setEnabled( FALSE ); |
132 | grp->insert( set ); | 132 | grp->insert( set ); |
133 | 133 | ||
134 | reset = new QPushButton ( controls ); | 134 | reset = new QPushButton ( controls ); |
135 | gl->addWidget( reset, 1, 1 ); | 135 | gl->addWidget( reset, 1, 1 ); |
136 | reset->setText( tr( "Reset" ) ); | 136 | reset->setText( tr( "Reset" ) ); |
137 | reset->setEnabled( FALSE ); | 137 | reset->setEnabled( FALSE ); |
138 | grp->insert( reset ); | 138 | grp->insert( reset ); |
139 | 139 | ||
140 | alarmOffBtn = new QPushButton ( controls ); | 140 | alarmOffBtn = new QPushButton ( controls ); |
141 | gl->addWidget( alarmOffBtn, 0, 2 ); | 141 | gl->addWidget( alarmOffBtn, 0, 2 ); |
142 | 142 | ||
143 | alarmBtn = new QPushButton ( controls ); | 143 | alarmBtn = new QPushButton ( controls ); |
144 | gl->addWidget( alarmBtn, 1, 2 ); | 144 | gl->addWidget( alarmBtn, 1, 2 ); |
145 | 145 | ||
146 | alarmBtn->setText( tr( "Set Alarm" ) ); | 146 | alarmBtn->setText( tr( "Set Alarm" ) ); |
147 | 147 | ||
148 | OClickableLabel *click = new OClickableLabel( controls, "label" ); | 148 | Opie::OClickableLabel *click = new Opie::OClickableLabel( controls, "label" ); |
149 | click->setText( tr( "Set date and time." ) ); | 149 | click->setText( tr( "Set date and time." ) ); |
150 | gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); | 150 | gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); |
151 | connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); | 151 | connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); |
152 | 152 | ||
153 | connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); | 153 | connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); |
154 | connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); | 154 | connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); |
155 | 155 | ||
156 | connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); | 156 | connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); |
157 | connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); | 157 | connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); |
158 | connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); | 158 | connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); |
159 | 159 | ||
160 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 160 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
161 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 161 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
162 | 162 | ||
163 | t = new QTimer( this ); | 163 | t = new QTimer( this ); |
164 | connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); | 164 | connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); |
165 | t->start( 1000 ); | 165 | t->start( 1000 ); |
166 | 166 | ||
167 | connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); | 167 | connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); |
168 | 168 | ||
169 | swatch_running = FALSE; | 169 | swatch_running = FALSE; |
170 | swatch_totalms = 0; | 170 | swatch_totalms = 0; |
171 | 171 | ||
172 | connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); | 172 | connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); |
173 | 173 | ||
174 | 174 | ||
175 | Config config( "qpe" ); | 175 | Config config( "qpe" ); |
176 | config.setGroup( "Time" ); | 176 | config.setGroup( "Time" ); |
177 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 177 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
178 | 178 | ||
179 | QString tmp = config.readEntry( "clockAlarmHour", "" ); | 179 | QString tmp = config.readEntry( "clockAlarmHour", "" ); |
180 | bool ok; | 180 | bool ok; |