-rw-r--r-- | noncore/tools/clock/clock.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 097ea90..a21a061 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -62,133 +62,133 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) 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 ); lcd->setFrameStyle( QFrame::NoFrame ); lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); lcd->setFixedHeight( 23 ); ampmLabel = new QLabel( tr("PM"), hb ); ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); ampmLabel->setAlignment( AlignLeft | AlignBottom ); space = new QWidget( hb ); 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, 2, 2, 6, 4 ); QButtonGroup *grp = new QButtonGroup( controls ); grp->setRadioButtonExclusive( true ); grp->hide(); clockRB = new QRadioButton ( tr( "Clock" ), controls ); gl->addWidget( clockRB, 0, 0 ); grp->insert( clockRB ); swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); gl->addWidget( swatchRB, 1, 0 ); grp->insert( swatchRB ); connect( grp, SIGNAL(clicked(int)), this, SLOT(modeSelect(int)) ); grp->setButton( 0 ); set = new QPushButton ( controls ); set->setMaximumSize(50,30); gl->addWidget( set, 0, 1 ); set->setText( tr( "Start" ) ); set->setEnabled( FALSE ); grp->insert( set ); reset = new QPushButton ( controls ); gl->addWidget( reset, 1, 1 ); reset->setText( tr( "Reset" ) ); reset->setEnabled( FALSE ); grp->insert( reset ); alarmOffBtn = new QPushButton ( controls ); - alarmOffBtn->setMaximumSize(60,30); +// alarmOffBtn->setMaximumSize(60,30); gl->addWidget( alarmOffBtn, 0, 2 ); alarmBtn = new QPushButton ( controls ); - alarmBtn->setMaximumSize(60,30); + // alarmBtn->setMaximumSize(60,30); gl->addWidget( alarmBtn, 1, 2 ); alarmBtn->setText( tr( "Set Alarm" ) ); 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() ) ); connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); t = new QTimer( this ); connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); t->start( 1000 ); connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); swatch_running = FALSE; swatch_totalms = 0; connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); QString tmp = config.readEntry("clockAlarmHour", ""); bool ok; hour = tmp.toInt(&ok,10); tmp = config.readEntry("clockAlarmMinute",""); minute = tmp.toInt(&ok,10); if( config.readEntry("clockAlarmSet","FALSE") == "TRUE") { alarmOffBtn->setText( tr( "Alarm Is On" ) ); alarmBool=TRUE; snoozeBtn->show(); } else { alarmOffBtn->setText( tr( "Alarm Is Off" ) ); alarmBool=FALSE; snoozeBtn->hide(); } QTimer::singleShot( 0, this, SLOT(updateClock()) ); modeSelect(0); } Clock::~Clock() { toggleScreenSaver( true ); } void Clock::updateClock() { if ( clockRB->isChecked() ) { QTime tm = QDateTime::currentDateTime().time(); QString s; if ( ampm ) { int hour = tm.hour(); if (hour == 0) hour = 12; if (hour > 12) hour -= 12; s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); ampmLabel->setText( (tm.hour() >= 12) ? "PM" : "AM" ); ampmLabel->show(); } else { |