summaryrefslogtreecommitdiff
path: root/noncore/tools/clock/clock.cpp
Side-by-side diff
Diffstat (limited to 'noncore/tools/clock/clock.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 0a21146..9b9e644 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -8,24 +8,25 @@
** 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.
**
**********************************************************************/
+// changes 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>
#include <qpe/config.h>
#include <qpe/timestring.h>
#include <qpe/alarmserver.h>
#include <qpe/sound.h>
#include <qpe/resource.h>
#include <qsound.h>
@@ -57,24 +58,25 @@ static void toggleScreenSaver( bool on )
}
Clock::Clock( QWidget * parent, const char * name, WFlags f )
: QVBox( parent, name , f )
{
setSpacing( 4 );
setMargin( 1 );
Config config( "qpe" );
config.setGroup("Time");
ampm = config.readBoolEntry( "AMPM", TRUE );
+
snoozeBtn = new QPushButton ( this);
snoozeBtn->setText( tr( "Snooze" ) );
aclock = new AnalogClock( this );
aclock->display( QTime::currentTime() );
aclock->setLineWidth( 2 );
QHBox *hb = new QHBox( this );
hb->setMargin( 0 );
QWidget *space = new QWidget( hb );
lcd = new QLCDNumber( hb );
lcd->setSegmentStyle( QLCDNumber::Flat );
@@ -371,28 +373,33 @@ void Clock::alarmOff()
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;
bSound=TRUE;
+ qDebug("Message received in clock");
if ( msg == "alarm(QDateTime,int)" ) {
Sound::soundAlarm();
stopTimer = startTimer( timerStay);
}
+ show();
+ raise();
+ QPEApplication::setKeepRunning();
+ setActiveWindow();
}
void Clock::timerEvent( QTimerEvent *e )
{
static int stop = 0;
if ( stop < 120 && bSound) {
Sound::soundAlarm();
stop++;
} else {
stop = 0;
killTimer( e->timerId() );
alarmOffBtn->setText( tr( "Alarm Is Off" ) );
@@ -476,17 +483,17 @@ void AnalogClock::display( const QTime& t )
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( nx, ny );
}
-void Clock::slotAdjustTime()
-{
+
+void Clock::slotAdjustTime() {
QCopEnvelope e("QPE/System", "execute(QString)");
e << QString("systemtime");
}