author | llornkcor <llornkcor> | 2002-06-27 17:43:22 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-27 17:43:22 (UTC) |
commit | c2d32ceea75df8ad2e81c676acd8234597a89635 (patch) (unidiff) | |
tree | fbf407510d7e2540cbe0d0452def6d21146d389d /noncore/tools | |
parent | 63d7fd9b233a5b6a9e3670b6ef1c09a2e87ffa42 (diff) | |
download | opie-c2d32ceea75df8ad2e81c676acd8234597a89635.zip opie-c2d32ceea75df8ad2e81c676acd8234597a89635.tar.gz opie-c2d32ceea75df8ad2e81c676acd8234597a89635.tar.bz2 |
added mp3 alarm.. will refine later
-rw-r--r-- | noncore/tools/clock/clock.cpp | 9 | ||||
-rw-r--r-- | noncore/tools/clock/setAlarm.cpp | 35 | ||||
-rw-r--r-- | noncore/tools/clock/setAlarm.h | 4 |
3 files changed, 44 insertions, 4 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 | |||
@@ -387,9 +387,18 @@ void Clock::appMessage(const QCString& msg, const QByteArray& data) | |||
387 | bSound=TRUE; | 387 | bSound=TRUE; |
388 | qDebug("Message received in clock"); | 388 | qDebug("Message received in clock"); |
389 | if ( msg == "alarm(QDateTime,int)" ) { | 389 | if ( msg == "alarm(QDateTime,int)" ) { |
390 | Config config( "qpe" ); | ||
391 | config.setGroup("Time"); | ||
392 | if(config.readBoolEntry("mp3Alarm",0)){ | ||
393 | |||
394 | QCopEnvelope e("QPE/Application/opieplayer","setDocument(QString)"); | ||
395 | e<<config.readEntry("mp3File",""); | ||
396 | } else { | ||
397 | |||
390 | Sound::soundAlarm(); | 398 | Sound::soundAlarm(); |
391 | stopTimer = startTimer( timerStay); | 399 | stopTimer = startTimer( timerStay); |
392 | } | 400 | } |
401 | } | ||
393 | show(); | 402 | show(); |
394 | raise(); | 403 | raise(); |
395 | QPEApplication::setKeepRunning(); | 404 | QPEApplication::setKeepRunning(); |
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 | |||
@@ -14,8 +14,10 @@ | |||
14 | 14 | ||
15 | #include "setAlarm.h" | 15 | #include "setAlarm.h" |
16 | 16 | ||
17 | #include <qpe/config.h> | 17 | #include <opie/ofileselector.h> |
18 | #include <opie/ofiledialog.h> | ||
18 | 19 | ||
20 | #include <qpe/config.h> | ||
19 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
20 | #include <qstring.h> | 22 | #include <qstring.h> |
21 | #include <qlabel.h> | 23 | #include <qlabel.h> |
@@ -28,6 +30,7 @@ | |||
28 | #include <qtooltip.h> | 30 | #include <qtooltip.h> |
29 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
30 | #include <qbuttongroup.h> | 32 | #include <qbuttongroup.h> |
33 | #include <qcheckbox.h> | ||
31 | 34 | ||
32 | Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) | 35 | Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) |
33 | : QDialog( parent, name, modal, fl ) | 36 | : QDialog( parent, name, modal, fl ) |
@@ -36,7 +39,7 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl | |||
36 | setName( "Set_Alarm" ); | 39 | setName( "Set_Alarm" ); |
37 | resize( 240, 101 ); | 40 | resize( 240, 101 ); |
38 | setMaximumSize( QSize( 240, 320 ) ); | 41 | setMaximumSize( QSize( 240, 320 ) ); |
39 | move(0,48); | 42 | move(0,45); |
40 | setCaption( tr( "Set Alarm" ) ); | 43 | setCaption( tr( "Set Alarm" ) ); |
41 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 44 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
42 | 45 | ||
@@ -97,6 +100,12 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl | |||
97 | 100 | ||
98 | Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); | 101 | Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); |
99 | 102 | ||
103 | useMp3Check = new QCheckBox ( tr( "mp3 alarm" ), this ); | ||
104 | useMp3Check-> setFocusPolicy ( QWidget::NoFocus ); | ||
105 | Set_AlarmLayout->addMultiCellWidget( useMp3Check, 2, 3, 3, 4 ); | ||
106 | |||
107 | |||
108 | |||
100 | TextLabel3 = new QLabel( this, "TextLabel3" ); | 109 | TextLabel3 = new QLabel( this, "TextLabel3" ); |
101 | TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); | 110 | TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); |
102 | 111 | ||
@@ -114,7 +123,7 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl | |||
114 | SnoozeSlider->setOrientation( QSlider::Horizontal ); | 123 | SnoozeSlider->setOrientation( QSlider::Horizontal ); |
115 | connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); | 124 | connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); |
116 | 125 | ||
117 | Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 ); | 126 | Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 4, 4, 1, 2 ); |
118 | 127 | ||
119 | Config config( "qpe" ); | 128 | Config config( "qpe" ); |
120 | config.setGroup("Time"); | 129 | config.setGroup("Time"); |
@@ -148,7 +157,11 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl | |||
148 | Am_RadioButton->hide(); | 157 | Am_RadioButton->hide(); |
149 | Pm_RadioButton->hide(); | 158 | Pm_RadioButton->hide(); |
150 | } | 159 | } |
160 | if( config.readBoolEntry("mp3Alarm") ) | ||
161 | useMp3Check->setChecked(true); | ||
162 | |||
151 | // signals and slots connections | 163 | // signals and slots connections |
164 | connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool))); | ||
152 | } | 165 | } |
153 | 166 | ||
154 | Set_Alarm::~Set_Alarm() | 167 | Set_Alarm::~Set_Alarm() |
@@ -186,3 +199,19 @@ void Set_Alarm::pmButtonToggled(bool b) | |||
186 | void Set_Alarm::cleanUp() | 199 | void Set_Alarm::cleanUp() |
187 | { | 200 | { |
188 | } | 201 | } |
202 | |||
203 | void Set_Alarm::slotChangemp3CkeckBox(bool b) { | ||
204 | Config config( "qpe" ); | ||
205 | config.setGroup("Time"); | ||
206 | if(b) { | ||
207 | QString str = OFileDialog::getOpenFileName( 2,"/");//,"", "*", this ); | ||
208 | if(!str.isEmpty() ) { | ||
209 | qDebug(str); | ||
210 | config.writeEntry("mp3Alarm",1); | ||
211 | config.writeEntry("mp3File",str); | ||
212 | } | ||
213 | } else { | ||
214 | config.writeEntry("mp3Alarm",0); | ||
215 | config.writeEntry("mp3File",""); | ||
216 | } | ||
217 | } | ||
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 | |||
@@ -26,7 +26,7 @@ class QLabel; | |||
26 | class QRadioButton; | 26 | class QRadioButton; |
27 | class QSlider; | 27 | class QSlider; |
28 | class QButtonGroup; | 28 | class QButtonGroup; |
29 | 29 | class QCheckBox; | |
30 | class Set_Alarm : public QDialog | 30 | class Set_Alarm : public QDialog |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
@@ -43,7 +43,9 @@ public: | |||
43 | 43 | ||
44 | QRadioButton* Pm_RadioButton; | 44 | QRadioButton* Pm_RadioButton; |
45 | QButtonGroup *ButtonGroup1; | 45 | QButtonGroup *ButtonGroup1; |
46 | QCheckBox *useMp3Check; | ||
46 | protected slots: | 47 | protected slots: |
48 | void slotChangemp3CkeckBox(bool); | ||
47 | void slotChangeHour(int); | 49 | void slotChangeHour(int); |
48 | void slotChangeMinute(int); | 50 | void slotChangeMinute(int); |
49 | void slotChangeSnooze(int); | 51 | void slotChangeSnooze(int); |