-rw-r--r-- | noncore/tools/clock/alarmdlgbase.ui | 154 | ||||
-rw-r--r-- | noncore/tools/clock/analogclock.cpp | 203 | ||||
-rw-r--r-- | noncore/tools/clock/analogclock.h | 49 | ||||
-rw-r--r-- | noncore/tools/clock/clockbase.ui | 921 | ||||
-rw-r--r-- | noncore/tools/clock/specification.html | 145 | ||||
-rw-r--r-- | noncore/tools/clock/tests.html | 203 |
6 files changed, 1675 insertions, 0 deletions
diff --git a/noncore/tools/clock/alarmdlgbase.ui b/noncore/tools/clock/alarmdlgbase.ui new file mode 100644 index 0000000..63759f3 --- a/dev/null +++ b/noncore/tools/clock/alarmdlgbase.ui @@ -0,0 +1,154 @@ +<!DOCTYPE UI><UI> +<class>AlarmDlgBase</class> +<widget> + <class>QDialog</class> + <property stdset="1"> + <name>name</name> + <cstring>AlarmDlgBase</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>124</width> + <height>92</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Form1</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>6</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout1</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>pixmap</cstring> + </property> + <property stdset="1"> + <name>scaledContents</name> + <bool>true</bool> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>alarmDlgLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>TextLabel1</string> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout2</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Snooze</string> + </property> + </widget> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>snoozeTime</cstring> + </property> + <property stdset="1"> + <name>suffix</name> + <string> mins</string> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>60</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>5</number> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>cmdOk</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Close</string> + </property> + </widget> + </vbox> +</widget> +</UI> diff --git a/noncore/tools/clock/analogclock.cpp b/noncore/tools/clock/analogclock.cpp new file mode 100644 index 0000000..bf358e2 --- a/dev/null +++ b/noncore/tools/clock/analogclock.cpp @@ -0,0 +1,203 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of the Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ + +#include "analogclock.h" + +#include <qlayout.h> +#include <qpainter.h> +#include <qtopia/global.h> + +#include <math.h> + +const double deg2rad = 0.017453292519943295769; // pi/180 + +AnalogClock::AnalogClock( QWidget *parent, const char *name ) + : QFrame( parent, name ), clear(false) +{ + setMinimumSize(50,50); +} + +QSizePolicy AnalogClock::sizePolicy() const +{ + return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); +} + +void AnalogClock::drawContents( QPainter *p ) +{ +#if !defined(NO_DEBUG) + static bool first = true; + if ( first ) { + QTOPIA_PROFILE("first paint event"); + first = false; + } +#endif + + QRect r = contentsRect(); + + if ( r.width() < r.height() ) { + r.setY( (r.height() - r.width())/2 ); + r.setHeight( r.width() ); + } + + QPoint center( r.x() + r.width() / 2, r.y() + r.height() / 2 ); + + const int w_tick = r.width()/300+1; + const int w_sec = r.width()/400+1; + const int w_hour = r.width()/80+1; + + QPoint l1( r.x() + r.width() / 2, r.y() + 2 ); + QPoint l2( r.x() + r.width() / 2, r.y() + 8 ); + + QPoint h1( r.x() + r.width() / 2, r.y() + r.height() / 4 ); + QPoint h2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); + + QPoint m1( r.x() + r.width() / 2, r.y() + r.height() / 9 ); + QPoint m2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); + + QPoint s1( r.x() + r.width() / 2, r.y() + 8 ); + QPoint s2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); + + QColor color( clear ? backgroundColor() : black ); + QTime time = clear ? prevTime : currTime; + + if ( clear && prevTime.secsTo(currTime) > 1 ) { + p->eraseRect( rect() ); + return; + } + + if ( !clear ) { + // draw ticks + p->setPen( QPen( color, w_tick ) ); + for ( int i = 0; i < 12; i++ ) + p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); + } + + if ( !clear || prevTime.minute() != currTime.minute() || + prevTime.hour() != currTime.hour() ) { + // draw hour pointer + h1 = rotate( center, h1, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); + h2 = rotate( center, h2, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); + p->setPen( color ); + p->setBrush( color ); + drawHand( p, h1, h2 ); + } + + if ( !clear || prevTime.minute() != currTime.minute() ) { + // draw minute pointer + m1 = rotate( center, m1, time.minute() * 6 ); + m2 = rotate( center, m2, time.minute() * 6 ); + p->setPen( color ); + p->setBrush( color ); + drawHand( p, m1, m2 ); + } + + // draw second pointer + s1 = rotate( center, s1, time.second() * 6 ); + s2 = rotate( center, s2, time.second() * 6 ); + p->setPen( QPen( color, w_sec ) ); + p->drawLine( s1, s2 ); + + // cap + p->setBrush(color); + p->drawEllipse( center.x()-w_hour/2, center.y()-w_hour/2, w_hour, w_hour ); + + if ( !clear ) + prevTime = currTime; +} + +// Dijkstra's bisection algorithm to find the square root as an integer. + +static uint int_sqrt(uint n) +{ + if ( n >= UINT_MAX>>2 ) // n must be in the range 0...UINT_MAX/2-1 + return 2*int_sqrt( n/4 ); + uint h, p= 0, q= 1, r= n; + while ( q <= n ) + q <<= 2; + while ( q != 1 ) { + q >>= 2; + h= p + q; + p >>= 1; + if ( r >= h ) { + p += q; + r -= h; + } + } + return p; +} + +void AnalogClock::drawHand( QPainter *p, QPoint p1, QPoint p2 ) +{ + int hw = 7; + if ( contentsRect().height() < 100 ) + hw = 5; + + int dx = p2.x() - p1.x(); + int dy = p2.y() - p1.y(); + int w = dx*dx+dy*dy; + int ix,iy; + w = int_sqrt(w*256); + iy = w ? (hw * dy * 16)/ w : dy ? 0 : hw; + ix = w ? (hw * dx * 16)/ w : dx ? 0 : hw; + + // rounding dependent on sign + int nix, niy; + if ( ix < 0 ) { + nix = ix/2; + ix = (ix-1)/2; + } else { + nix = (ix+1)/2; + ix = ix/2; + } + if ( iy < 0 ) { + niy = iy/2; + iy = (iy-1)/2; + } else { + niy = (iy+1)/2; + iy = iy/2; + } + + QPointArray pa(4); + pa[0] = p1; + pa[1] = QPoint( p2.x()+iy, p2.y()-nix ); + pa[2] = QPoint( p2.x()-niy, p2.y()+ix ); + pa[3] = p1; + + p->drawPolygon( pa ); +} + +void AnalogClock::display( const QTime& t ) +{ + currTime = t; + clear = true; + repaint( false ); + clear = false; + repaint( false ); +} + +QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) +{ + double angle = deg2rad * ( - a + 180 ); + double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - + ( p.y() - c.y() ) * sin( angle ); + double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + + ( p.x() - c.x() ) * sin( angle ); + return QPoint( int(nx), int(ny) ); +} diff --git a/noncore/tools/clock/analogclock.h b/noncore/tools/clock/analogclock.h new file mode 100644 index 0000000..3aa035e --- a/dev/null +++ b/noncore/tools/clock/analogclock.h @@ -0,0 +1,49 @@ +/********************************************************************** +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** +** This file is part of the Qtopia Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** See http://www.trolltech.com/gpl/ for GPL licensing information. +** +** Contact info@trolltech.com if any conditions of this licensing are +** not clear to you. +** +**********************************************************************/ +#ifndef ANALOGCLOCK_H +#define ANALOGCLOCK_H + +#include <qdatetime.h> +#include <qframe.h> + +class AnalogClock : public QFrame +{ + Q_OBJECT +public: + AnalogClock( QWidget *parent=0, const char *name=0 ); + + QSizePolicy sizePolicy() const; + + void display( const QTime& time ); + +protected: + void drawContents( QPainter *p ); + void drawHand( QPainter *p, QPoint, QPoint ); + +private: + QPoint rotate( QPoint center, QPoint p, int angle ); + + QTime currTime; + QTime prevTime; + bool clear; +}; + +#endif + diff --git a/noncore/tools/clock/clockbase.ui b/noncore/tools/clock/clockbase.ui new file mode 100644 index 0000000..91d0da0 --- a/dev/null +++ b/noncore/tools/clock/clockbase.ui @@ -0,0 +1,921 @@ +<!DOCTYPE UI><UI> +<class>ClockBase</class> +<widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>ClockBase</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>220</width> + <height>337</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Clock</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>6</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QTabWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tabs</cstring> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> + <string>Clock</string> + </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>4</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>4</number> + </property> + <widget> + <class>AnalogClock</class> + <property stdset="1"> + <name>name</name> + <cstring>analogClock</cstring> + </property> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout3</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QFrame</class> + <property stdset="1"> + <name>name</name> + <cstring>Frame3</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Plain</enum> + </property> + <property stdset="1"> + <name>lineWidth</name> + <number>0</number> + </property> + </widget> + <widget> + <class>QLCDNumber</class> + <property stdset="1"> + <name>name</name> + <cstring>clockLcd</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>0</width> + <height>23</height> + </size> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Plain</enum> + </property> + <property stdset="1"> + <name>segmentStyle</name> + <enum>Flat</enum> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>clockAmPm</cstring> + </property> + <property stdset="1"> + <name>font</name> + <font> + <pointsize>14</pointsize> + <bold>1</bold> + </font> + </property> + <property stdset="1"> + <name>text</name> + <string>...</string> + </property> + <property stdset="1"> + <name>alignment</name> + <set>AlignBottom|AlignLeft</set> + </property> + <property> + <name>vAlign</name> + </property> + </widget> + <widget> + <class>QFrame</class> + <property stdset="1"> + <name>name</name> + <cstring>Frame4</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Plain</enum> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>date</cstring> + </property> + <property stdset="1"> + <name>font</name> + <font> + <pointsize>16</pointsize> + <bold>1</bold> + </font> + </property> + <property stdset="1"> + <name>text</name> + <string>...</string> + </property> + <property stdset="1"> + <name>textFormat</name> + <enum>RichText</enum> + </property> + <property stdset="1"> + <name>alignment</name> + <set>AlignCenter</set> + </property> + <property> + <name>hAlign</name> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> + <string>Stopwatch</string> + </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>6</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>4</number> + </property> + <widget> + <class>QFrame</class> + <property stdset="1"> + <name>name</name> + <cstring>swFrame</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Raised</enum> + </property> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout7</cstring> + </property> + <property> + <name>layoutSpacing</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>0</number> + </property> + <widget row="1" column="3" > + <class>QLCDNumber</class> + <property stdset="1"> + <name>name</name> + <cstring>lapLcd</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>maximumSize</name> + <size> + <width>32767</width> + <height>20</height> + </size> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>numDigits</name> + <number>11</number> + </property> + <property stdset="1"> + <name>segmentStyle</name> + <enum>Flat</enum> + </property> + </widget> + <widget row="0" column="1" rowspan="2" colspan="1" > + <class>QLCDNumber</class> + <property stdset="1"> + <name>name</name> + <cstring>lapNumLcd</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>numDigits</name> + <number>2</number> + </property> + <property stdset="1"> + <name>segmentStyle</name> + <enum>Flat</enum> + </property> + </widget> + <widget row="0" column="0" rowspan="2" colspan="1" > + <class>QFrame</class> + <property stdset="1"> + <name>name</name> + <cstring>lapFrame</cstring> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>15</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Raised</enum> + </property> + </widget> + <widget row="0" column="2" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel4</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Split</string> + </property> + <property stdset="1"> + <name>alignment</name> + <set>AlignTop|AlignRight</set> + </property> + <property> + <name>hAlign</name> + </property> + <property> + <name>vAlign</name> + </property> + </widget> + <widget row="0" column="3" > + <class>QLCDNumber</class> + <property stdset="1"> + <name>name</name> + <cstring>splitLcd</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>maximumSize</name> + <size> + <width>32767</width> + <height>20</height> + </size> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>numDigits</name> + <number>11</number> + </property> + <property stdset="1"> + <name>segmentStyle</name> + <enum>Flat</enum> + </property> + </widget> + <widget row="1" column="2" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3_2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Lap</string> + </property> + <property stdset="1"> + <name>alignment</name> + <set>AlignTop|AlignRight</set> + </property> + <property> + <name>hAlign</name> + </property> + <property> + <name>vAlign</name> + </property> + </widget> + </grid> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout5</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>stopStart</cstring> + </property> + <property stdset="1"> + <name>font</name> + <font> + <pointsize>14</pointsize> + <bold>1</bold> + </font> + </property> + <property stdset="1"> + <name>text</name> + <string>Start</string> + </property> + <property> + <name>whatsThis</name> + <string>Starts and stops the stopwatch.</string> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>reset</cstring> + </property> + <property stdset="1"> + <name>font</name> + <font> + <pointsize>14</pointsize> + <bold>1</bold> + </font> + </property> + <property stdset="1"> + <name>text</name> + <string>Lap/Split</string> + </property> + <property> + <name>whatsThis</name> + <string>Resets the stopwatch.</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> + <string>Alarm</string> + </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>6</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>4</number> + </property> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>dailyGroup</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Daily Alarm</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>6</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>dailyEnabled</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Enabled</string> + </property> + <property> + <name>whatsThis</name> + <string>Check to enable the daily alarm</string> + </property> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout4</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>dailyHour</cstring> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>wrapping</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>23</number> + </property> + <property> + <name>whatsThis</name> + <string>Set the hour the alarm will sound.</string> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>5</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>text</name> + <string>:</string> + </property> + </widget> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>dailyMinute</cstring> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>wrapping</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>59</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>5</number> + </property> + <property> + <name>whatsThis</name> + <string>Set the minute the alarm will sound.</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>AM</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>PM</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>dailyAmPm</cstring> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + </widget> + <widget> + <class>QFrame</class> + <property stdset="1"> + <name>name</name> + <cstring>Frame5</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Plain</enum> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Days:</string> + </property> + </widget> + <widget> + <class>QFrame</class> + <property stdset="1"> + <name>name</name> + <cstring>daysFrame</cstring> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Raised</enum> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>cdGroup</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Countdown Alarm</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>6</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>:</string> + </property> + </widget> + <widget row="0" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout5</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>cdHour</cstring> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>999</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>1</number> + </property> + </widget> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>cdMinute</cstring> + </property> + <property stdset="1"> + <name>minimumSize</name> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + <property stdset="1"> + <name>wrapping</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>55</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>5</number> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>cdStartStop</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Start</string> + </property> + </widget> + </hbox> + </widget> + <widget row="1" column="0" > + <class>QLCDNumber</class> + <property stdset="1"> + <name>name</name> + <cstring>cdLcd</cstring> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>frameShadow</name> + <enum>Plain</enum> + </property> + <property stdset="1"> + <name>segmentStyle</name> + <enum>Flat</enum> + </property> + </widget> + </grid> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>AnalogClock</class> + <header location="local">analogclock.h</header> + <sizehint> + <width>50</width> + <height>50</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>3</hordata> + <verdata>3</verdata> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image> + <name>image0</name> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> +</UI> diff --git a/noncore/tools/clock/specification.html b/noncore/tools/clock/specification.html new file mode 100644 index 0000000..5913277 --- a/dev/null +++ b/noncore/tools/clock/specification.html @@ -0,0 +1,145 @@ +<html> +<title> +Clock Specification +</title> + +<body> + +<h1>Clock Specification</h1> + + +<!-- +<h2>Specification goals</h2> +This specification: +<ol> +<li> Describes all of the end-user stories and interactions. + (eg. the user can view a slide show of images from a digital camera). +<li> Lists all features, derived from end-user stories, + in enough detail to allow the definition of + tests for all features. +<li> Defines contraints and limitations on the application. + (eg. can view image sizes as large as 1MB). +<li>Aides the developer on focusing on the most important aspects of + the application and ensuring all important elements are completed. +</ol> +--> + +<a name=description> +</a> +<!-- A one-line description of what this application is and does. + This description is then duplicated in the .desktop Comment and + the .control file description. + + (eg. The image viewer allows viewing and very minor editing of image files.) +--> +The clock shows the time, a stopwatch and allows a daily alarm to be set. +<!-- A one-paragraph description of what this application is and does. + This description is then duplicated in the .desktop Comment and + the .control file description. + + (eg. The image viewer allows viewing and very minor editing + of image files. It assists format conversion, beaming logos + to phones, captioning, etc.) +--> +<p> +The clock provides three functions: 1. Displays the current date and time. +2. Provides a stopwatch. 3. Allows a daily alarm to be set and enabled/disabled. +</p> + +<p> +Status: BT +</p> + +<a name=usecases> +<h2>Use Cases</h2> +</a> +<!-- Describe real-world stories. Implicit in these use cases is + "these things are easy to do". + (eg. + Roving News Reporter + + The journalist/cameraman takes photos with a digital camera, + loads them into the PDAs via CF card, adjusts the contrast, + blacks-out a license plate, adds a copyright caption, and + emails the image and short story to Reuters. + ) + + Note: TITLEs may be used as identifiers in bug reports. + --> +<ul> +<li><b>Viewing Date and Time</b> + <p>While the PDA is in its cradle, the office worker uses it as a + desktop clock. +<li><b>Jogger</b> + <p>A jogger runs around a 400m track 6 times. He starts the stopwatch as + he starts, and presses a button each time he rounds the track. He can + observe the precise time taken for each lap. +<li><b>Setting Daily Alarm</b> + <p>The traveller sets an alarm to wake him up at 5:30 each morning. + <p>(not yet implemented: The traveller never wants to be woken on Saturday, + Sunday, or Wednesday; the traveller can easily press a "Snooze" button + to get a little more rest, but the alarm will sound again; he never + misses getting woken) +</ul> + +<a name=features> +<h2>Features</h2> +</a> +<!-- features are brief + + (eg. + * Slide show: view multiple images in sequence + * Configurable delay between images. + * Hardware-button-controlled stepping between images. + * Big images: view larger-than-available-RAM images in some formats. + * Formats: view JPEG, PNG, GIF format images. + * Scribbling: draw black or white lines on images. + * Save: in JPEG, PNG formats. + ) + + Note: TITLEs may be used as identifiers in bug reports. +--> + +<ul> +<li>Clock: Display an analog clock, digital clock and the date in one view. +<li>Stopwatch: Display an analog and digital stopwatch timer. + The digital timer has a resolution of 1/100 second. + <ul> + <li>Start/Stop: The [Select] hardware button must Start/Stop the stopwatch. + </ul> +<li>Daily Alarm: Allows a daily alarm to be enabled/disabled and set. + <ul> + <li>Audible Alarm: When the alarm is activated an audible alarm must be + sounded. + <li>Visual Alarm: When the alarm is activated a dialog box must be shown + with the alarm details. + </ul> +</ul> + +<a name=prerequisites> +<h2>Prerequisites</h2> +</a> +<!-- + Describes unresolved limitations that cannot + be shown within the features list. + + Describes memory and other requirements quantitatively. + + This is a short list, mainly intended as a "known bugs" + list for missing features. + + (eg. + * Stylus: required for Scribbling. + * Memory: requires 250 bytes per event, plus content strings. + ) + + Note: TITLEs may be used as identifiers in bug reports. +--> + +<ul> +<li>Alarm Server: requires a working alarm server for daily alarm function. +<li>Audible Alarm: requires speaker/buzzer. +</ul> + +</body> +</html> diff --git a/noncore/tools/clock/tests.html b/noncore/tools/clock/tests.html new file mode 100644 index 0000000..4df5ead --- a/dev/null +++ b/noncore/tools/clock/tests.html @@ -0,0 +1,203 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> + <title>Qtopia test</title> + <meta http-equiv="Content-Type" + content="text/html; charset=iso-8859-1"> + <meta content="Ed Baak" name="Author"> +</head> +<body> +<h1>Qtopia/Clock</h1> +<h2>Test cases</h2> +<br> +<br> +<h3> Basic Clock</h3> +<table cellpadding="2" cellspacing="2" border="1" + style="width: 100%; text-align: left;"> + <tbody> + <tr> + <th style="vertical-align: top; width: 20%;">Test Purpose<br> + </th> + <td style="vertical-align: top;">Verify that the basic clock +functionality works as expected.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Test +Description<br> + </th> + <td style="vertical-align: top;"> + <ol> + <li>Start the clock. </li> + <li>Confirm that the Clock tab is displayed. </li> + <li>Check that the time displayed on the analog clock matches +the device system time. </li> + <li>Check that the time displayed on the digital clock matches +the device system time. </li> + <li>Check that the date displayed matches the device system +date.</li> + </ol> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Expected +TestResult<br> + </th> + <td style="vertical-align: top;">All the verification steps as +described in the Test Description must be met.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Testnorm/Criteria<br> + </th> + <td style="vertical-align: top;">Exact Match<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Test +Suitability<br> + </th> + <td style="vertical-align: top;">Manual test<br> + </td> + </tr> + </tbody> +</table> +<br> +<br> +<h3> Stopwatch</h3> +<table cellpadding="2" cellspacing="2" border="1" + style="width: 100%; text-align: left;"> + <tbody> + <tr> + <th style="vertical-align: top; width: 20%;">Test Purpose<br> + </th> + <td style="vertical-align: top;">Verify that the clock app can be +used as a stopwatch.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Test +Description<br> + </th> + <td style="vertical-align: top;"> + <ol> + <li>Click on the Stopwatch tab. </li> + <li>Confirm that the stopwatch reads 00:00:00.00 and that the +analog hands indicate 00:00. </li> + <li>Press the Start button and confirm that the analog and +digital timers count up (resolution 1 sec). </li> + <li>Press the Stop button and confirm that the timers have +stopped. The digital timer should show 1/100 sec resolution. </li> + <li>Press the Reset button and confirm that the stopwatch reads +00:00:00.00 and that the analog hands indicate 00:00. </li> + <li>Press the Start button and wait 3 seconds. </li> + <li>Press the Lap/Split button and wait 3 seconds again.</li> + <li>Press Stop.</li> + <li>Verify that the lap counter reads 3.</li> + <li>Use the decrement button in front of the lap counter to +select lap 1.</li> + <li>Verify that the Split value reads a value of approx 3 +seconds and the Lap value is the same.</li> + <li>Use the increment button in front of the lap counter to +select lap 2.</li> + <li>Verify that the Split value reads a value of approx 6 +seconds (2 laps total) and the Lap value again is approx 3 seconds.</li> + <li>Use the increment button to select lap 3.</li> + <li>Verify that the Split value reads a value of approx 9 +seconds (3 laps total) and the Lap value is approx 3 seconds.</li> + <li>Verify that no other laps can be selected using the +incr/decr buttons that 1, 2 or 3.</li> + <li>Tap the Reset button.</li> + <li>Verify that all values are reset to 0, the lap counter is +reset to 1 and the incr/decr buttons are disabled.<br> + </li> + </ol> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Expected +TestResult<br> + </th> + <td style="vertical-align: top;">All the verification steps as +described in the Test Description must be met.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Testnorm/Criteria<br> + </th> + <td style="vertical-align: top;">Exact Match, but the actual +values for the Lap and Split readouts depend on the timing of the +tester.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Test +Suitability<br> + </th> + <td style="vertical-align: top;">Manual test<br> + </td> + </tr> + </tbody> +</table> +<br> +<br> +<h3> Daily alarm</h3> +<table cellpadding="2" cellspacing="2" border="1" + style="width: 100%; text-align: left;"> + <tbody> + <tr> + <th style="vertical-align: top; width: 20%;">Test Purpose<br> + </th> + <td style="vertical-align: top;">Verify that a daily alarm can be +set.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Test +Description<br> + </th> + <td style="vertical-align: top;"> + <ol> + <li>Click on the Alarms tab. </li> + <li>Set the alarm time 1-5 minutes in the future and check the +Enabled box. </li> + <li>Confirm that when the alarm time is reached the alarm +sounds and a message box is displayed with the alarm details. </li> + <li>Set the alarm time 1-5 minutes in the future and uncheck +the Enabled box. </li> + <li>Confirm that when the alarm time is reached no alarm is +sounded. </li> + <li>Set the alarm time 1-5 minutes in the future, check +Enabled, and close the clock application. </li> + <li>Confirm that when the alarm time is reached the alarm +sounds and a message box is displayed with the alarm details.</li> + </ol> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Expected +TestResult<br> + </th> + <td style="vertical-align: top;">All the verification steps as +described in the Test Description must be met.<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Testnorm/Criteria<br> + </th> + <td style="vertical-align: top;">Exact Match<br> + </td> + </tr> + <tr> + <th style="vertical-align: top; width: 15%;" width="20%">Test +Suitability<br> + </th> + <td style="vertical-align: top;">Manual test<br> + </td> + </tr> + </tbody> +</table> +<br> +<br> +</body> +</html> |