summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2002-06-27 17:43:22 (UTC)
committer llornkcor <llornkcor>2002-06-27 17:43:22 (UTC)
commitc2d32ceea75df8ad2e81c676acd8234597a89635 (patch) (side-by-side diff)
treefbf407510d7e2540cbe0d0452def6d21146d389d /noncore
parent63d7fd9b233a5b6a9e3670b6ef1c09a2e87ffa42 (diff)
downloadopie-c2d32ceea75df8ad2e81c676acd8234597a89635.zip
opie-c2d32ceea75df8ad2e81c676acd8234597a89635.tar.gz
opie-c2d32ceea75df8ad2e81c676acd8234597a89635.tar.bz2
added mp3 alarm.. will refine later
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp13
-rw-r--r--noncore/tools/clock/setAlarm.cpp35
-rw-r--r--noncore/tools/clock/setAlarm.h4
3 files changed, 46 insertions, 6 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index a47793b..69d8214 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -296,26 +296,26 @@ void Clock::slotSetAlarm()
slotToggleAlarm();
Set_Alarm *setAlarmDlg;
setAlarmDlg = new Set_Alarm(this,"SetAlarm", TRUE);
int result = setAlarmDlg->exec();
if(result == 1) {
Config config( "qpe" );
config.setGroup("Time");
QString tmp;
hour = setAlarmDlg->Hour_Slider->value();
minute = setAlarmDlg->Minute_Slider->value();
snoozeTime=setAlarmDlg->SnoozeSlider->value();
if(ampm) {
- if ( hour == 12 )
- hour = 0;
+ if ( hour == 12 )
+ hour = 0;
if(setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 )
hour+=12;
}
config.writeEntry("clockAlarmHour", tmp.setNum( hour ),10);
config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10);
config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10);
config.write();
}
}
void Clock::slotSnooze()
@@ -378,26 +378,35 @@ void Clock::alarmOff()
"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)" ) {
+ Config config( "qpe" );
+ config.setGroup("Time");
+ if(config.readBoolEntry("mp3Alarm",0)){
+
+ QCopEnvelope e("QPE/Application/opieplayer","setDocument(QString)");
+ e<<config.readEntry("mp3File","");
+ } else {
+
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();
diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp
index 990ff81..38de396 100644
--- a/noncore/tools/clock/setAlarm.cpp
+++ b/noncore/tools/clock/setAlarm.cpp
@@ -5,47 +5,50 @@
// copyright : (C) 2002 by ljp
// email : ljp@llornkcor.com
//
***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "setAlarm.h"
-#include <qpe/config.h>
+#include <opie/ofileselector.h>
+#include <opie/ofiledialog.h>
+#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qstring.h>
#include <qlabel.h>
#include <qlcdnumber.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qslider.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qbuttongroup.h>
+#include <qcheckbox.h>
Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "Set_Alarm" );
resize( 240, 101 );
setMaximumSize( QSize( 240, 320 ) );
- move(0,48);
+ move(0,45);
setCaption( tr( "Set Alarm" ) );
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
Set_AlarmLayout = new QGridLayout( this );
Set_AlarmLayout->setSpacing( 6 );
Set_AlarmLayout->setMargin( 11 );
TextLabel1 = new QLabel( this, "TextLabel1" );
TextLabel1->setText( tr( "Hour" ) );
Set_AlarmLayout->addWidget( TextLabel1, 0, 0 );
@@ -88,42 +91,48 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
Am_RadioButton->setChecked(TRUE);
connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool)));
Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 );
Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" );
Pm_RadioButton->setText( tr( "PM" ) );
connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool)));
Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 );
+ useMp3Check = new QCheckBox ( tr( "mp3 alarm" ), this );
+ useMp3Check-> setFocusPolicy ( QWidget::NoFocus );
+ Set_AlarmLayout->addMultiCellWidget( useMp3Check, 2, 3, 3, 4 );
+
+
+
TextLabel3 = new QLabel( this, "TextLabel3" );
TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) );
Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 );
Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" );
Snooze_LCDNumber->setFrameShape( QLCDNumber::Box );
Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain );
Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 );
SnoozeSlider = new QSlider( this, "SnoozeSlider" );
SnoozeSlider->setMaxValue( 60 );
SnoozeSlider->setOrientation( QSlider::Horizontal );
connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int)));
- Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 );
+ Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 4, 4, 1, 2 );
Config config( "qpe" );
config.setGroup("Time");
bool ok;
bool ampm = config.readBoolEntry( "AMPM", TRUE );
QString alarmHour=config.readEntry("clockAlarmHour","8");
int i_alarmHour = alarmHour.toInt(&ok,10);
QString alarmMinute=config.readEntry("clockAlarmMinute","0");
QString snoozeTime=config.readEntry("clockAlarmSnooze","0");
if(ampm) {
Hour_Slider->setMaxValue( 12);
@@ -139,25 +148,29 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
Hour_Slider->setValue( i_alarmHour );
Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
} else {
Hour_Slider->setMaxValue( 23);
Hour_Slider->setMinValue( 0);
Hour_Slider->setValue( i_alarmHour);
Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
Am_RadioButton->hide();
Pm_RadioButton->hide();
}
+ if( config.readBoolEntry("mp3Alarm") )
+ useMp3Check->setChecked(true);
+
// signals and slots connections
+ connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool)));
}
Set_Alarm::~Set_Alarm()
{
}
void Set_Alarm::slotChangeHour(int hour)
{
Hour_LCDNumber->display(hour);
}
@@ -177,12 +190,28 @@ void Set_Alarm::amButtonToggled(bool b)
Pm_RadioButton->setChecked(FALSE);
}
void Set_Alarm::pmButtonToggled(bool b)
{
if (b)
Am_RadioButton->setChecked(FALSE);
}
void Set_Alarm::cleanUp()
{
}
+
+void Set_Alarm::slotChangemp3CkeckBox(bool b) {
+ Config config( "qpe" );
+ config.setGroup("Time");
+ if(b) {
+ QString str = OFileDialog::getOpenFileName( 2,"/");//,"", "*", this );
+ if(!str.isEmpty() ) {
+ qDebug(str);
+ config.writeEntry("mp3Alarm",1);
+ config.writeEntry("mp3File",str);
+ }
+ } else {
+ config.writeEntry("mp3Alarm",0);
+ config.writeEntry("mp3File","");
+ }
+}
diff --git a/noncore/tools/clock/setAlarm.h b/noncore/tools/clock/setAlarm.h
index 7d63237..a21af05 100644
--- a/noncore/tools/clock/setAlarm.h
+++ b/noncore/tools/clock/setAlarm.h
@@ -17,41 +17,43 @@
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QLCDNumber;
class QLabel;
class QRadioButton;
class QSlider;
class QButtonGroup;
-
+class QCheckBox;
class Set_Alarm : public QDialog
{
Q_OBJECT
public:
Set_Alarm( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~Set_Alarm();
QLabel *TextLabel1, *TextLabel2, *TextLabel3;
QSlider *Hour_Slider, *Minute_Slider, *SnoozeSlider;
QLCDNumber *Hour_LCDNumber, *Minute_LCDNumber, *Snooze_LCDNumber;
QRadioButton* Am_RadioButton;
QRadioButton* Pm_RadioButton;
QButtonGroup *ButtonGroup1;
+ QCheckBox *useMp3Check;
protected slots:
+ void slotChangemp3CkeckBox(bool);
void slotChangeHour(int);
void slotChangeMinute(int);
void slotChangeSnooze(int);
void amButtonToggled(bool);
void pmButtonToggled(bool);
void cleanUp();
protected:
QGridLayout* Set_AlarmLayout;
};
#endif // SET_ALARM_H