summaryrefslogtreecommitdiff
authorzecke <zecke>2002-05-21 14:21:59 (UTC)
committer zecke <zecke>2002-05-21 14:21:59 (UTC)
commitd65dc25caec62d4c554c99fbc151bf4d07c63b72 (patch) (unidiff)
tree37485591f8cd642df0177ea77b860f8d4432e9ef
parent3eb1e88e5915c9dbd521a150cc5dd7eb7dbb3663 (diff)
downloadopie-d65dc25caec62d4c554c99fbc151bf4d07c63b72.zip
opie-d65dc25caec62d4c554c99fbc151bf4d07c63b72.tar.gz
opie-d65dc25caec62d4c554c99fbc151bf4d07c63b72.tar.bz2
usbaility updates a clock should be able to set the time
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp24
-rw-r--r--noncore/tools/clock/clock.h1
-rw-r--r--noncore/tools/clock/clock.pro2
3 files changed, 20 insertions, 7 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index a21a061..ea8e8ca 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -30,8 +30,10 @@
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qsound.h> 31#include <qsound.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <opie/oclickablelabel.h>
35
34#include <qlcdnumber.h> 36#include <qlcdnumber.h>
35#include <qslider.h> 37#include <qslider.h>
36#include <qlabel.h> 38#include <qlabel.h>
37#include <qlayout.h> 39#include <qlayout.h>
@@ -91,9 +93,9 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
91 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); 93 date->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
92 date->setText( TimeString::longDateString( QDate::currentDate() ) ); 94 date->setText( TimeString::longDateString( QDate::currentDate() ) );
93 95
94 QWidget *controls = new QWidget( this ); 96 QWidget *controls = new QWidget( this );
95 QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 ); 97 QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 );
96 98
97 QButtonGroup *grp = new QButtonGroup( controls ); 99 QButtonGroup *grp = new QButtonGroup( controls );
98 grp->setRadioButtonExclusive( true ); 100 grp->setRadioButtonExclusive( true );
99 grp->hide(); 101 grp->hide();
@@ -130,8 +132,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
130 // alarmBtn->setMaximumSize(60,30); 132 // alarmBtn->setMaximumSize(60,30);
131 gl->addWidget( alarmBtn, 1, 2 ); 133 gl->addWidget( alarmBtn, 1, 2 );
132 alarmBtn->setText( tr( "Set Alarm" ) ); 134 alarmBtn->setText( tr( "Set Alarm" ) );
133 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
134 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) ); 141 connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) );
135 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); 142 connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
136 143
137 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); 144 connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
@@ -166,9 +173,9 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
166 alarmOffBtn->setText( tr( "Alarm Is Off" ) ); 173 alarmOffBtn->setText( tr( "Alarm Is Off" ) );
167 alarmBool=FALSE; 174 alarmBool=FALSE;
168 snoozeBtn->hide(); 175 snoozeBtn->hide();
169 } 176 }
170 177
171 QTimer::singleShot( 0, this, SLOT(updateClock()) ); 178 QTimer::singleShot( 0, this, SLOT(updateClock()) );
172 modeSelect(0); 179 modeSelect(0);
173} 180}
174 181
@@ -183,9 +190,9 @@ void Clock::updateClock()
183 QTime tm = QDateTime::currentDateTime().time(); 190 QTime tm = QDateTime::currentDateTime().time();
184 QString s; 191 QString s;
185 if ( ampm ) { 192 if ( ampm ) {
186 int hour = tm.hour(); 193 int hour = tm.hour();
187 if (hour == 0) 194 if (hour == 0)
188 hour = 12; 195 hour = 12;
189 if (hour > 12) 196 if (hour > 12)
190 hour -= 12; 197 hour -= 12;
191 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); 198 s.sprintf( "%2d%c%02d", hour, ':', tm.minute() );
@@ -280,9 +287,9 @@ void Clock::modeSelect( int m )
280 updateClock(); 287 updateClock();
281} 288}
282 289
283//this sets the alarm time 290//this sets the alarm time
284void Clock::slotSetAlarm() 291void Clock::slotSetAlarm()
285{ 292{
286 if( !snoozeBtn->isHidden()) 293 if( !snoozeBtn->isHidden())
287 slotToggleAlarm(); 294 slotToggleAlarm();
288 Set_Alarm *setAlarmDlg; 295 Set_Alarm *setAlarmDlg;
@@ -302,9 +309,9 @@ void Clock::slotSetAlarm()
302 config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10); 309 config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10);
303 config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10); 310 config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10);
304 config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10); 311 config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10);
305 config.write(); 312 config.write();
306 } 313 }
307} 314}
308 315
309void Clock::slotSnooze() 316void Clock::slotSnooze()
310{ 317{
@@ -319,9 +326,9 @@ void Clock::slotSnooze()
319 326
320} 327}
321 328
322//toggles alarm on/off 329//toggles alarm on/off
323void Clock::slotToggleAlarm() 330void Clock::slotToggleAlarm()
324{ 331{
325 Config config( "qpe" ); 332 Config config( "qpe" );
326 config.setGroup("Time"); 333 config.setGroup("Time");
327 if(alarmBool) { 334 if(alarmBool) {
@@ -473,4 +480,9 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a )
473 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + 480 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) +
474 ( p.x() - c.x() ) * sin( angle ); 481 ( p.x() - c.x() ) * sin( angle );
475 return QPoint( nx, ny ); 482 return QPoint( nx, ny );
476} 483}
484void Clock::slotAdjustTime()
485{
486 QCopEnvelope e("QPE/System", "execute(QString)");
487 e << QString("systemtime");
488}
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h
index 9b756b5..024dd28 100644
--- a/noncore/tools/clock/clock.h
+++ b/noncore/tools/clock/clock.h
@@ -75,8 +75,9 @@ private slots:
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 80
80private: 81private:
81 void clearClock(); 82 void clearClock();
82 83
diff --git a/noncore/tools/clock/clock.pro b/noncore/tools/clock/clock.pro
index 5373515..7eecce1 100644
--- a/noncore/tools/clock/clock.pro
+++ b/noncore/tools/clock/clock.pro
@@ -5,9 +5,9 @@ HEADERS = clock.h setAlarm.h
5SOURCES = clock.cpp setAlarm.cpp \ 5SOURCES = clock.cpp setAlarm.cpp \
6 main.cpp 6 main.cpp
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe -lopie
10INTERFACES = 10INTERFACES =
11TARGET = clock 11TARGET = clock
12 12
13TRANSLATIONS = ../i18n/de/clock.ts 13TRANSLATIONS = ../i18n/de/clock.ts