author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /noncore/tools/clock | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
-rw-r--r-- | noncore/tools/clock/.cvsignore | 2 | ||||
-rw-r--r-- | noncore/tools/clock/Makefile.in | 118 | ||||
-rw-r--r-- | noncore/tools/clock/clock.cpp | 319 | ||||
-rw-r--r-- | noncore/tools/clock/clock.h | 87 | ||||
-rw-r--r-- | noncore/tools/clock/clock.pro | 13 | ||||
-rw-r--r-- | noncore/tools/clock/main.cpp | 34 | ||||
-rw-r--r-- | noncore/tools/clock/qpe-clock.control | 9 |
7 files changed, 582 insertions, 0 deletions
diff --git a/noncore/tools/clock/.cvsignore b/noncore/tools/clock/.cvsignore new file mode 100644 index 0000000..6fe2396 --- a/dev/null +++ b/noncore/tools/clock/.cvsignore | |||
@@ -0,0 +1,2 @@ | |||
1 | moc_* | ||
2 | Makefile | ||
diff --git a/noncore/tools/clock/Makefile.in b/noncore/tools/clock/Makefile.in new file mode 100644 index 0000000..adda9e6 --- a/dev/null +++ b/noncore/tools/clock/Makefile.in | |||
@@ -0,0 +1,118 @@ | |||
1 | ############################################################################# | ||
2 | |||
3 | ####### Compiler, tools and options | ||
4 | |||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | ||
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) | ||
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
8 | CFLAGS =$(SYSCONF_CFLAGS) | ||
9 | INCPATH =-I$(QPEDIR)/include | ||
10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) | ||
12 | MOC =$(SYSCONF_MOC) | ||
13 | UIC =$(SYSCONF_UIC) | ||
14 | |||
15 | ####### Target | ||
16 | |||
17 | DESTDIR = $(QPEDIR)/bin/ | ||
18 | VER_MAJ = 1 | ||
19 | VER_MIN = 0 | ||
20 | VER_PATCH = 0 | ||
21 | TARGET= clock | ||
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =clock.h | ||
27 | SOURCES =clock.cpp \ | ||
28 | main.cpp | ||
29 | OBJECTS =clock.o \ | ||
30 | main.o | ||
31 | INTERFACES = | ||
32 | UICDECLS = | ||
33 | UICIMPLS = | ||
34 | SRCMOC =moc_clock.cpp | ||
35 | OBJMOC =moc_clock.o | ||
36 | |||
37 | |||
38 | ####### Implicit rules | ||
39 | |||
40 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
41 | |||
42 | .cpp.o: | ||
43 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
44 | |||
45 | .cxx.o: | ||
46 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
47 | |||
48 | .cc.o: | ||
49 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
50 | |||
51 | .C.o: | ||
52 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
53 | |||
54 | .c.o: | ||
55 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
56 | |||
57 | ####### Build rules | ||
58 | |||
59 | |||
60 | all: $(DESTDIR)$(TARGET) | ||
61 | |||
62 | $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
63 | $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) | ||
64 | |||
65 | moc: $(SRCMOC) | ||
66 | |||
67 | tmake: | ||
68 | tmake clock.pro | ||
69 | |||
70 | clean: | ||
71 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | ||
72 | -rm -f *~ core | ||
73 | -rm -f allmoc.cpp | ||
74 | |||
75 | ####### Extension Modules | ||
76 | |||
77 | listpromodules: | ||
78 | @echo | ||
79 | |||
80 | listallmodules: | ||
81 | @echo | ||
82 | |||
83 | listaddonpromodules: | ||
84 | @echo | ||
85 | |||
86 | listaddonentmodules: | ||
87 | @echo | ||
88 | |||
89 | |||
90 | REQUIRES= | ||
91 | |||
92 | ####### Sub-libraries | ||
93 | |||
94 | |||
95 | ###### Combined headers | ||
96 | |||
97 | |||
98 | |||
99 | ####### Compile | ||
100 | |||
101 | clock.o: clock.cpp \ | ||
102 | clock.h \ | ||
103 | $(QPEDIR)/include/qpe/qpeapplication.h \ | ||
104 | $(QPEDIR)/include/qpe/qcopenvelope_qws.h \ | ||
105 | $(QPEDIR)/include/qpe/config.h \ | ||
106 | $(QPEDIR)/include/qpe/timestring.h | ||
107 | |||
108 | main.o: main.cpp \ | ||
109 | clock.h \ | ||
110 | $(QPEDIR)/include/qpe/qpeapplication.h | ||
111 | |||
112 | moc_clock.o: moc_clock.cpp \ | ||
113 | clock.h | ||
114 | |||
115 | moc_clock.cpp: clock.h | ||
116 | $(MOC) clock.h -o moc_clock.cpp | ||
117 | |||
118 | |||
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp new file mode 100644 index 0000000..ef93e11 --- a/dev/null +++ b/noncore/tools/clock/clock.cpp | |||
@@ -0,0 +1,319 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "clock.h" | ||
22 | |||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <qpe/qcopenvelope_qws.h> | ||
25 | #include <qpe/config.h> | ||
26 | #include <qpe/timestring.h> | ||
27 | |||
28 | #include <qlcdnumber.h> | ||
29 | #include <qlabel.h> | ||
30 | #include <qlayout.h> | ||
31 | #include <qtimer.h> | ||
32 | #include <qpushbutton.h> | ||
33 | #include <qradiobutton.h> | ||
34 | #include <qbuttongroup.h> | ||
35 | #include <qpainter.h> | ||
36 | |||
37 | #include <math.h> | ||
38 | |||
39 | const double deg2rad = 0.017453292519943295769;// pi/180 | ||
40 | const int sw_prec = 2; | ||
41 | |||
42 | static void toggleScreenSaver( bool on ) | ||
43 | { | ||
44 | QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" ); | ||
45 | e << (on ? QPEApplication::Enable: QPEApplication::DisableSuspend ); | ||
46 | } | ||
47 | |||
48 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) | ||
49 | : QVBox( parent, name , f ) | ||
50 | { | ||
51 | setSpacing( 4 ); | ||
52 | setMargin( 1 ); | ||
53 | |||
54 | Config config( "qpe" ); | ||
55 | config.setGroup("Time"); | ||
56 | ampm = config.readBoolEntry( "AMPM", TRUE ); | ||
57 | |||
58 | aclock = new AnalogClock( this ); | ||
59 | aclock->display( QTime::currentTime() ); | ||
60 | aclock->setLineWidth( 2 ); | ||
61 | |||
62 | QHBox *hb = new QHBox( this ); | ||
63 | hb->setMargin( 0 ); | ||
64 | QWidget *space = new QWidget( hb ); | ||
65 | lcd = new QLCDNumber( hb ); | ||
66 | lcd->setSegmentStyle( QLCDNumber::Flat ); | ||
67 | lcd->setFrameStyle( QFrame::NoFrame ); | ||
68 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | ||
69 | lcd->setFixedHeight( 23 ); | ||
70 | |||
71 | ampmLabel = new QLabel( "PM", hb ); | ||
72 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | ||
73 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); | ||
74 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); | ||
75 | space = new QWidget( hb ); | ||
76 | |||
77 | date = new QLabel( this ); | ||
78 | date->setAlignment( AlignHCenter | AlignVCenter ); | ||
79 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | ||
80 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | ||
81 | |||
82 | QWidget *controls = new QWidget( this ); | ||
83 | QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 ); | ||
84 | |||
85 | QButtonGroup *grp = new QButtonGroup( controls ); | ||
86 | grp->setRadioButtonExclusive( true ); | ||
87 | grp->hide(); | ||
88 | |||
89 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); | ||
90 | gl->addWidget( clockRB, 0, 0 ); | ||
91 | grp->insert( clockRB ); | ||
92 | |||
93 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); | ||
94 | gl->addWidget( swatchRB, 1, 0 ); | ||
95 | grp->insert( swatchRB ); | ||
96 | |||
97 | connect( grp, SIGNAL(clicked(int)), this, SLOT(modeSelect(int)) ); | ||
98 | grp->setButton( 0 ); | ||
99 | |||
100 | set = new QPushButton ( controls ); | ||
101 | gl->addWidget( set, 0, 1 ); | ||
102 | set->setText( tr( "Start" ) ); | ||
103 | set->setEnabled( FALSE ); | ||
104 | grp->insert( set ); | ||
105 | |||
106 | reset = new QPushButton ( controls ); | ||
107 | gl->addWidget( reset, 1, 1 ); | ||
108 | reset->setText( tr( "Reset" ) ); | ||
109 | reset->setEnabled( FALSE ); | ||
110 | grp->insert( reset ); | ||
111 | |||
112 | connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) ); | ||
113 | connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); | ||
114 | |||
115 | t = new QTimer( this ); | ||
116 | connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); | ||
117 | t->start( 1000 ); | ||
118 | |||
119 | connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); | ||
120 | |||
121 | swatch_running = FALSE; | ||
122 | swatch_totalms = 0; | ||
123 | |||
124 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); | ||
125 | |||
126 | QTimer::singleShot( 0, this, SLOT(updateClock()) ); | ||
127 | modeSelect(0); | ||
128 | } | ||
129 | |||
130 | Clock::~Clock() | ||
131 | { | ||
132 | toggleScreenSaver( true ); | ||
133 | } | ||
134 | |||
135 | void Clock::updateClock() | ||
136 | { | ||
137 | if ( clockRB->isChecked() ) { | ||
138 | QTime tm = QDateTime::currentDateTime().time(); | ||
139 | QString s; | ||
140 | if ( ampm ) { | ||
141 | int hour = tm.hour(); | ||
142 | if (hour == 0) | ||
143 | hour = 12; | ||
144 | if (hour > 12) | ||
145 | hour -= 12; | ||
146 | s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); | ||
147 | ampmLabel->setText( (tm.hour() >= 12) ? "PM" : "AM" ); | ||
148 | ampmLabel->show(); | ||
149 | } else { | ||
150 | s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); | ||
151 | ampmLabel->hide(); | ||
152 | } | ||
153 | lcd->display( s ); | ||
154 | lcd->repaint( FALSE ); | ||
155 | aclock->display( QTime::currentTime() ); | ||
156 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | ||
157 | } else { | ||
158 | QTime swatch_time; | ||
159 | QString lcdtext; | ||
160 | int totalms = swatch_totalms; | ||
161 | if ( swatch_running ) | ||
162 | totalms += swatch_start.elapsed(); | ||
163 | swatch_time = QTime(0,0,0).addMSecs(totalms); | ||
164 | QString d = swatch_running ? QString(" ") | ||
165 | : QString::number(totalms%1000+1000); | ||
166 | lcdtext = swatch_time.toString() + "." + d.right(3).left(sw_prec); | ||
167 | lcd->display( lcdtext ); | ||
168 | lcd->repaint( FALSE ); | ||
169 | aclock->display( swatch_time ); | ||
170 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | void Clock::changeClock( bool a ) | ||
175 | { | ||
176 | ampm = a; | ||
177 | updateClock(); | ||
178 | } | ||
179 | |||
180 | void Clock::clearClock( void ) | ||
181 | { | ||
182 | lcd->display( QTime( 0,0,0 ).toString() ); | ||
183 | aclock->display( QTime( 0,0,0 ) ); | ||
184 | } | ||
185 | |||
186 | void Clock::slotSet() | ||
187 | { | ||
188 | if ( t->isActive() ) { | ||
189 | swatch_totalms += swatch_start.elapsed(); | ||
190 | set->setText( tr( "Start" ) ); | ||
191 | t->stop(); | ||
192 | swatch_running = FALSE; | ||
193 | toggleScreenSaver( TRUE ); | ||
194 | updateClock(); | ||
195 | } else { | ||
196 | swatch_start.start(); | ||
197 | set->setText( tr( "Stop" ) ); | ||
198 | t->start( 1000 ); | ||
199 | swatch_running = TRUE; | ||
200 | // disable screensaver while stop watch is running | ||
201 | toggleScreenSaver( FALSE ); | ||
202 | } | ||
203 | } | ||
204 | |||
205 | void Clock::slotReset() | ||
206 | { | ||
207 | t->stop(); | ||
208 | swatch_start.start(); | ||
209 | swatch_totalms = 0; | ||
210 | |||
211 | if (swatch_running ) | ||
212 | t->start(1000); | ||
213 | |||
214 | updateClock(); | ||
215 | } | ||
216 | |||
217 | void Clock::modeSelect( int m ) | ||
218 | { | ||
219 | if ( m ) { | ||
220 | lcd->setNumDigits( 8+1+sw_prec ); | ||
221 | lcd->setMinimumWidth( lcd->sizeHint().width() ); | ||
222 | set->setEnabled( TRUE ); | ||
223 | reset->setEnabled( TRUE ); | ||
224 | ampmLabel->hide(); | ||
225 | |||
226 | if ( !swatch_running ) | ||
227 | t->stop(); | ||
228 | } else { | ||
229 | lcd->setNumDigits( 5 ); | ||
230 | lcd->setMinimumWidth( lcd->sizeHint().width() ); | ||
231 | set->setEnabled( FALSE ); | ||
232 | reset->setEnabled( FALSE ); | ||
233 | t->start(1000); | ||
234 | } | ||
235 | updateClock(); | ||
236 | } | ||
237 | |||
238 | QSizePolicy AnalogClock::sizePolicy() const | ||
239 | { | ||
240 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); | ||
241 | } | ||
242 | |||
243 | void AnalogClock::drawContents( QPainter *p ) | ||
244 | { | ||
245 | QRect r = contentsRect(); | ||
246 | QPoint center( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | ||
247 | |||
248 | QPoint l1( r.x() + r.width() / 2, r.y() + 2 ); | ||
249 | QPoint l2( r.x() + r.width() / 2, r.y() + 8 ); | ||
250 | |||
251 | QPoint h1( r.x() + r.width() / 2, r.y() + r.height() / 4 ); | ||
252 | QPoint h2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | ||
253 | |||
254 | QPoint m1( r.x() + r.width() / 2, r.y() + r.height() / 8 ); | ||
255 | QPoint m2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | ||
256 | |||
257 | QPoint s1( r.x() + r.width() / 2, r.y() + 8 ); | ||
258 | QPoint s2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | ||
259 | |||
260 | QColor color( clear ? backgroundColor() : black ); | ||
261 | QTime time = clear ? prevTime : currTime; | ||
262 | |||
263 | if ( clear && prevTime.secsTo(currTime) > 1 ) { | ||
264 | p->eraseRect( rect() ); | ||
265 | return; | ||
266 | } | ||
267 | |||
268 | if ( !clear ) { | ||
269 | // draw ticks | ||
270 | p->setPen( QPen( color, 1 ) ); | ||
271 | for ( int i = 0; i < 12; i++ ) | ||
272 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); | ||
273 | } | ||
274 | |||
275 | if ( !clear || prevTime.minute() != currTime.minute() || | ||
276 | prevTime.hour() != currTime.hour() ) { | ||
277 | // draw hour pointer | ||
278 | h1 = rotate( center, h1, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); | ||
279 | h2 = rotate( center, h2, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); | ||
280 | p->setPen( QPen( color, 3 ) ); | ||
281 | p->drawLine( h1, h2 ); | ||
282 | } | ||
283 | |||
284 | if ( !clear || prevTime.minute() != currTime.minute() ) { | ||
285 | // draw minute pointer | ||
286 | m1 = rotate( center, m1, time.minute() * 6 ); | ||
287 | m2 = rotate( center, m2, time.minute() * 6 ); | ||
288 | p->setPen( QPen( color, 2 ) ); | ||
289 | p->drawLine( m1, m2 ); | ||
290 | } | ||
291 | |||
292 | // draw second pointer | ||
293 | s1 = rotate( center, s1, time.second() * 6 ); | ||
294 | s2 = rotate( center, s2, time.second() * 6 ); | ||
295 | p->setPen( QPen( color, 1 ) ); | ||
296 | p->drawLine( s1, s2 ); | ||
297 | |||
298 | if ( !clear ) | ||
299 | prevTime = currTime; | ||
300 | } | ||
301 | |||
302 | void AnalogClock::display( const QTime& t ) | ||
303 | { | ||
304 | currTime = t; | ||
305 | clear = true; | ||
306 | repaint( false ); | ||
307 | clear = false; | ||
308 | repaint( false ); | ||
309 | } | ||
310 | |||
311 | QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) | ||
312 | { | ||
313 | double angle = deg2rad * ( - a + 180 ); | ||
314 | double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - | ||
315 | ( p.y() - c.y() ) * sin( angle ); | ||
316 | double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + | ||
317 | ( p.x() - c.x() ) * sin( angle ); | ||
318 | return QPoint( nx, ny ); | ||
319 | } | ||
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h new file mode 100644 index 0000000..6dbebf7 --- a/dev/null +++ b/noncore/tools/clock/clock.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef CLOCK_H | ||
21 | #define CLOCK_H | ||
22 | |||
23 | #include <qdatetime.h> | ||
24 | #include <qvbox.h> | ||
25 | |||
26 | class QLCDNumber; | ||
27 | class QLabel; | ||
28 | class QTimer; | ||
29 | class QRadioButton; | ||
30 | class QPushButton; | ||
31 | |||
32 | class AnalogClock : public QFrame | ||
33 | { | ||
34 | Q_OBJECT | ||
35 | |||
36 | public: | ||
37 | AnalogClock( QWidget * parent = 0, const char * name = 0 ) | ||
38 | : QFrame( parent, name ), clear(false) {} | ||
39 | |||
40 | QSizePolicy sizePolicy() const; | ||
41 | |||
42 | void display( const QTime& time ); | ||
43 | |||
44 | protected: | ||
45 | void drawContents( QPainter *p ); | ||
46 | |||
47 | private: | ||
48 | QPoint rotate( QPoint center, QPoint p, int angle ); | ||
49 | |||
50 | QTime currTime; | ||
51 | QTime prevTime; | ||
52 | bool clear; | ||
53 | }; | ||
54 | |||
55 | class Clock : public QVBox | ||
56 | { | ||
57 | Q_OBJECT | ||
58 | |||
59 | public: | ||
60 | Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 ); | ||
61 | ~Clock(); | ||
62 | |||
63 | private slots: | ||
64 | void slotSet(); | ||
65 | void slotReset(); | ||
66 | void modeSelect(int); | ||
67 | void updateClock(); | ||
68 | void changeClock( bool ); | ||
69 | |||
70 | private: | ||
71 | void clearClock(); | ||
72 | |||
73 | QTimer *t; | ||
74 | QLCDNumber *lcd; | ||
75 | QLabel *date; | ||
76 | QLabel *ampmLabel; | ||
77 | QPushButton *set, *reset; | ||
78 | QRadioButton *clockRB, *swatchRB; | ||
79 | AnalogClock *aclock; | ||
80 | QTime swatch_start; | ||
81 | int swatch_totalms; | ||
82 | bool swatch_running; | ||
83 | bool ampm; | ||
84 | }; | ||
85 | |||
86 | #endif | ||
87 | |||
diff --git a/noncore/tools/clock/clock.pro b/noncore/tools/clock/clock.pro new file mode 100644 index 0000000..97f4d2c --- a/dev/null +++ b/noncore/tools/clock/clock.pro | |||
@@ -0,0 +1,13 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(QPEDIR)/bin | ||
4 | HEADERS = clock.h | ||
5 | SOURCES = clock.cpp \ | ||
6 | main.cpp | ||
7 | INCLUDEPATH += $(QPEDIR)/include | ||
8 | DEPENDPATH+= $(QPEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | INTERFACES= | ||
11 | TARGET = clock | ||
12 | |||
13 | TRANSLATIONS = ../i18n/de/clock.ts | ||
diff --git a/noncore/tools/clock/main.cpp b/noncore/tools/clock/main.cpp new file mode 100644 index 0000000..cbfb73b --- a/dev/null +++ b/noncore/tools/clock/main.cpp | |||
@@ -0,0 +1,34 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "clock.h" | ||
22 | |||
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
25 | int main( int argc, char ** argv ) | ||
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | |||
29 | Clock mw; | ||
30 | mw.setCaption( Clock::tr("Clock") ); | ||
31 | a.showMainWidget( &mw ); | ||
32 | |||
33 | return a.exec(); | ||
34 | } | ||
diff --git a/noncore/tools/clock/qpe-clock.control b/noncore/tools/clock/qpe-clock.control new file mode 100644 index 0000000..62f377f --- a/dev/null +++ b/noncore/tools/clock/qpe-clock.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Files: bin/clock apps/Applications/clock.desktop | ||
2 | Priority: optional | ||
3 | Section: qpe/applications | ||
4 | Maintainer: Warwick Allison <warwick@trolltech.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-3 | ||
7 | Depends: qpe-base ($QPE_VERSION) | ||
8 | Description: Clock and stop-watch | ||
9 | A simple clock and stop-watch for the Qtopia environment. | ||