summaryrefslogtreecommitdiff
path: root/noncore/tools/clock/clock.cpp
authorllornkcor <llornkcor>2002-05-31 00:54:13 (UTC)
committer llornkcor <llornkcor>2002-05-31 00:54:13 (UTC)
commit460454a3a117afafde6094da6a4e12625f880908 (patch) (side-by-side diff)
tree3a362f6eb5dbeec3f92e9a5e1c65e0c0ea94b012 /noncore/tools/clock/clock.cpp
parent294fecd1c15c4940bdab8566e5afaee9f305abb6 (diff)
downloadopie-460454a3a117afafde6094da6a4e12625f880908.zip
opie-460454a3a117afafde6094da6a4e12625f880908.tar.gz
opie-460454a3a117afafde6094da6a4e12625f880908.tar.bz2
lengthened time of alarm sounding, removed nag screen and put alarm info into caption
Diffstat (limited to 'noncore/tools/clock/clock.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index ea8e8ca..a85cc19 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -14,12 +14,13 @@
** 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.
**
**********************************************************************/
+// code added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002
#include "clock.h"
#include "setAlarm.h"
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
@@ -28,14 +29,12 @@
#include <qpe/alarmserver.h>
#include <qpe/sound.h>
#include <qpe/resource.h>
#include <qsound.h>
#include <qtimer.h>
-#include <opie/oclickablelabel.h>
-
#include <qlcdnumber.h>
#include <qslider.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qtimer.h>
#include <qpushbutton.h>
@@ -91,13 +90,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
date = new QLabel( this );
date->setAlignment( AlignHCenter | AlignVCenter );
date->setFont( QFont( "Helvetica", 14, QFont::Bold ) );
date->setText( TimeString::longDateString( QDate::currentDate() ) );
QWidget *controls = new QWidget( this );
- QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 );
+ QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 );
QButtonGroup *grp = new QButtonGroup( controls );
grp->setRadioButtonExclusive( true );
grp->hide();
clockRB = new QRadioButton ( tr( "Clock" ), controls );
@@ -130,17 +129,12 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
alarmBtn = new QPushButton ( controls );
// alarmBtn->setMaximumSize(60,30);
gl->addWidget( alarmBtn, 1, 2 );
alarmBtn->setText( tr( "Set Alarm" ) );
- OClickableLabel *click = new OClickableLabel(controls, "label" );
- click->setText(tr("Set date and time." ) );
- gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter);
- connect( click, SIGNAL(clicked() ), this, SLOT(slotAdjustTime() ) );
-
connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) );
connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) );
connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) );
connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
@@ -358,24 +352,24 @@ void Clock::alarmOn()
int warn;
QDateTime whenl(d,tm);
when=whenl;
AlarmServer::addAlarm( when,
"QPE/Application/clock",
"alarm(QDateTime,int)", warn );
- QMessageBox::message("Note","Alarm is set for:\n"+ whenl.toString());
+ setCaption("Alarm set: "+ whenl.toString());
}
void Clock::alarmOff()
{
int warn;
bSound=FALSE;
AlarmServer::deleteAlarm( when,
"QPE/Application/clock",
"alarm(QDateTime,int)", warn );
qDebug("Alarm Off "+ when.toString());
-
+ setCaption("Clock");
}
void Clock::appMessage(const QCString& msg, const QByteArray& data)
{
int stopTimer = 0;
int timerStay = 5000;
@@ -386,18 +380,22 @@ void Clock::appMessage(const QCString& msg, const QByteArray& data)
}
}
void Clock::timerEvent( QTimerEvent *e )
{
static int stop = 0;
- if ( stop < 10 && bSound) {
+ if ( stop < 120 && bSound) {
Sound::soundAlarm();
stop++;
} else {
stop = 0;
killTimer( e->timerId() );
+ alarmOffBtn->setText( tr( "Alarm Is Off" ) );
+ alarmBool=FALSE;
+ snoozeBtn->hide();
+ setCaption("Clock: Alarm was missed.");
}
}
QSizePolicy AnalogClock::sizePolicy() const
{
@@ -478,11 +476,6 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a )
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( nx, ny );
}
-void Clock::slotAdjustTime()
-{
- QCopEnvelope e("QPE/System", "execute(QString)");
- e << QString("systemtime");
-}