author | alwin <alwin> | 2004-03-02 23:51:24 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 23:51:24 (UTC) |
commit | e59c700bba3fe4f7e7b4504cf5f69267886936f5 (patch) (unidiff) | |
tree | fbef0d120c6a654fc5d8c532e138e30e28ea3ba8 | |
parent | 7588efaff9fcf2079b5f2a4429862bfa4fb7281d (diff) | |
download | opie-e59c700bba3fe4f7e7b4504cf5f69267886936f5.zip opie-e59c700bba3fe4f7e7b4504cf5f69267886936f5.tar.gz opie-e59c700bba3fe4f7e7b4504cf5f69267886936f5.tar.bz2 |
fixed include and namespace (sic!) usage.
-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 | |||
@@ -1,212 +1,212 @@ | |||
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 | // 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 | ||
68 | 68 | ||
69 | static void toggleScreenSaver( bool on ) | 69 | static void toggleScreenSaver( bool on ) |
70 | { | 70 | { |
71 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); | 71 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); |
72 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); | 72 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); |
73 | } | 73 | } |
74 | 74 | ||
75 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) | 75 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) |
76 | : QVBox( parent, name , f ) | 76 | : QVBox( parent, name , f ) |
77 | { | 77 | { |
78 | setSpacing( 4 ); | 78 | setSpacing( 4 ); |
79 | setMargin( 1 ); | 79 | setMargin( 1 ); |
80 | 80 | ||
81 | 81 | ||
82 | snoozeBtn = new QPushButton ( this ); | 82 | snoozeBtn = new QPushButton ( this ); |
83 | snoozeBtn->setText( tr( "Snooze" ) ); | 83 | snoozeBtn->setText( tr( "Snooze" ) ); |
84 | 84 | ||
85 | aclock = new AnalogClock( this ); | 85 | aclock = new AnalogClock( this ); |
86 | aclock->display( QTime::currentTime() ); | 86 | aclock->display( QTime::currentTime() ); |
87 | aclock->setLineWidth( 2 ); | 87 | aclock->setLineWidth( 2 ); |
88 | 88 | ||
89 | QHBox *hb = new QHBox( this ); | 89 | QHBox *hb = new QHBox( this ); |
90 | hb->setMargin( 0 ); | 90 | hb->setMargin( 0 ); |
91 | QWidget *space = new QWidget( hb ); | 91 | QWidget *space = new QWidget( hb ); |
92 | lcd = new QLCDNumber( hb ); | 92 | lcd = new QLCDNumber( hb ); |
93 | lcd->setSegmentStyle( QLCDNumber::Flat ); | 93 | lcd->setSegmentStyle( QLCDNumber::Flat ); |
94 | lcd->setFrameStyle( QFrame::NoFrame ); | 94 | lcd->setFrameStyle( QFrame::NoFrame ); |
95 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 95 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
96 | lcd->setFixedHeight( 23 ); | 96 | lcd->setFixedHeight( 23 ); |
97 | 97 | ||
98 | ampmLabel = new QLabel( tr( "PM" ), hb ); | 98 | ampmLabel = new QLabel( tr( "PM" ), hb ); |
99 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | 99 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); |
100 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); | 100 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); |
101 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); | 101 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); |
102 | space = new QWidget( hb ); | 102 | space = new QWidget( hb ); |
103 | 103 | ||
104 | date = new QLabel( this ); | 104 | date = new QLabel( this ); |
105 | date->setAlignment( AlignHCenter | AlignVCenter ); | 105 | date->setAlignment( AlignHCenter | AlignVCenter ); |
106 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | 106 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); |
107 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | 107 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); |
108 | 108 | ||
109 | QWidget *controls = new QWidget( this ); | 109 | QWidget *controls = new QWidget( this ); |
110 | QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); | 110 | QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); |
111 | 111 | ||
112 | QButtonGroup *grp = new QButtonGroup( controls ); | 112 | QButtonGroup *grp = new QButtonGroup( controls ); |
113 | grp->setRadioButtonExclusive( true ); | 113 | grp->setRadioButtonExclusive( true ); |
114 | grp->hide(); | 114 | grp->hide(); |
115 | 115 | ||
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; |
181 | hour = tmp.toInt( &ok, 10 ); | 181 | hour = tmp.toInt( &ok, 10 ); |
182 | tmp = config.readEntry( "clockAlarmMinute", "" ); | 182 | tmp = config.readEntry( "clockAlarmMinute", "" ); |
183 | minute = tmp.toInt( &ok, 10 ); | 183 | minute = tmp.toInt( &ok, 10 ); |
184 | 184 | ||
185 | if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" ) | 185 | if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" ) |
186 | { | 186 | { |
187 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); | 187 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); |
188 | alarmBool = TRUE; | 188 | alarmBool = TRUE; |
189 | snoozeBtn->show(); | 189 | snoozeBtn->show(); |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 193 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); |
194 | alarmBool = FALSE; | 194 | alarmBool = FALSE; |
195 | snoozeBtn->hide(); | 195 | snoozeBtn->hide(); |
196 | } | 196 | } |
197 | 197 | ||
198 | QTimer::singleShot( 0, this, SLOT( updateClock() ) ); | 198 | QTimer::singleShot( 0, this, SLOT( updateClock() ) ); |
199 | 199 | ||
200 | Config cfg( "Clock" ); | 200 | Config cfg( "Clock" ); |
201 | cfg.setGroup( "Mode" ); | 201 | cfg.setGroup( "Mode" ); |
202 | int mode = cfg.readBoolEntry( "clockMode"); | 202 | int mode = cfg.readBoolEntry( "clockMode"); |
203 | setSwatchMode( mode); | 203 | setSwatchMode( mode); |
204 | modeSelect( mode); | 204 | modeSelect( mode); |
205 | } | 205 | } |
206 | 206 | ||
207 | Clock::~Clock() | 207 | Clock::~Clock() |
208 | { | 208 | { |
209 | toggleScreenSaver( true ); | 209 | toggleScreenSaver( true ); |
210 | } | 210 | } |
211 | 211 | ||
212 | void Clock::updateClock() | 212 | void Clock::updateClock() |