summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/clock/setAlarm.cpp224
-rw-r--r--noncore/tools/clock/setAlarm.h59
2 files changed, 0 insertions, 283 deletions
diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp
deleted file mode 100644
index 049af8d..0000000
--- a/noncore/tools/clock/setAlarm.cpp
+++ b/dev/null
@@ -1,224 +0,0 @@
1 /***************************************************************************
2// setAlarm.cpp - description
3// -------------------
4// Created: Wed Mar 13 19:47:24 2002
5// copyright : (C) 2002 by ljp
6// email : ljp@llornkcor.com
7//
8***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 ***************************************************************************/
14
15#include "setAlarm.h"
16
17#include <opie2/ofileselector.h>
18#include <opie2/ofiledialog.h>
19
20#include <qpe/config.h>
21#include <qpe/qpeapplication.h>
22#include <qstring.h>
23#include <qlabel.h>
24#include <qlcdnumber.h>
25#include <qpushbutton.h>
26#include <qradiobutton.h>
27#include <qslider.h>
28#include <qlayout.h>
29#include <qvariant.h>
30#include <qtooltip.h>
31#include <qwhatsthis.h>
32#include <qbuttongroup.h>
33#include <qcheckbox.h>
34
35using namespace Opie::Ui;
36Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl )
37 : QDialog( parent, name, modal, fl )
38{
39 if ( !name )
40 setName( "Set_Alarm" );
41 resize( 240, 101 );
42 setMaximumSize( QSize( 240, 320 ) );
43 move(0,45);
44 setCaption( tr( "Set Alarm" ) );
45 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
46
47 Set_AlarmLayout = new QGridLayout( this );
48 Set_AlarmLayout->setSpacing( 6 );
49 Set_AlarmLayout->setMargin( 11 );
50
51 TextLabel1 = new QLabel( this, "TextLabel1" );
52 TextLabel1->setText( tr( "Hour" ) );
53
54 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 );
55
56 TextLabel2 = new QLabel( this, "TextLabel2" );
57 TextLabel2->setText( tr( "Minute" ) );
58
59 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 );
60
61 Hour_Slider = new QSlider( this, "Hour_Slider" );
62 Hour_Slider->setPageStep( 1);
63 Hour_Slider->setOrientation( QSlider::Horizontal );
64 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int)));
65
66 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 );
67
68 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" );
69 Hour_LCDNumber->setFrameShape( QLCDNumber::Box );
70 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain );
71 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
72
73 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 );
74
75 Minute_Slider = new QSlider( this, "Minute_Slider" );
76 Minute_Slider->setMaxValue( 59);
77 Minute_Slider->setPageStep( 1);
78 Minute_Slider->setOrientation( QSlider::Horizontal );
79 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int)));
80
81 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 );
82
83 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" );
84 Minute_LCDNumber->setFrameShape( QLCDNumber::Box );
85 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain );
86 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
87
88 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 );
89
90 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" );
91 Am_RadioButton->setText( tr( "AM" ) );
92 Am_RadioButton->setChecked(TRUE);
93 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool)));
94
95 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 );
96
97
98 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" );
99 Pm_RadioButton->setText( tr( "PM" ) );
100 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool)));
101
102 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 );
103
104 useMp3Check = new QCheckBox ( tr( "mp3 alarm" ), this );
105 useMp3Check-> setFocusPolicy ( QWidget::NoFocus );
106 Set_AlarmLayout->addMultiCellWidget( useMp3Check, 2, 3, 3, 4 );
107
108
109
110 TextLabel3 = new QLabel( this, "TextLabel3" );
111 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) );
112
113 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 );
114
115 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" );
116 Snooze_LCDNumber->setFrameShape( QLCDNumber::Box );
117 Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain );
118 Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
119
120 Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 );
121
122 SnoozeSlider = new QSlider( this, "SnoozeSlider" );
123 SnoozeSlider->setMaxValue( 60 );
124 SnoozeSlider->setOrientation( QSlider::Horizontal );
125 connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int)));
126
127 Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 4, 4, 1, 2 );
128
129 Config config( "qpe" );
130 config.setGroup("Time");
131
132 bool ok;
133 bool ampm = config.readBoolEntry( "AMPM", TRUE );
134 QString alarmHour=config.readEntry("clockAlarmHour","8");
135 int i_alarmHour = alarmHour.toInt(&ok,10);
136 QString alarmMinute=config.readEntry("clockAlarmMinute","0");
137 QString snoozeTime=config.readEntry("clockAlarmSnooze","0");
138 if(ampm) {
139 Hour_Slider->setMaxValue( 12);
140 Hour_Slider->setMinValue( 1);
141
142 if( i_alarmHour > 12) {
143 i_alarmHour = i_alarmHour - 12;
144 Pm_RadioButton->setChecked(TRUE);
145 }
146 else if ( i_alarmHour == 0 ) {
147 i_alarmHour = 12;
148 }
149 Hour_Slider->setValue( i_alarmHour );
150 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
151 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
152 } else {
153 Hour_Slider->setMaxValue( 23);
154 Hour_Slider->setMinValue( 0);
155 Hour_Slider->setValue( i_alarmHour);
156 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
157 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
158 Am_RadioButton->hide();
159 Pm_RadioButton->hide();
160 }
161 if( config.readBoolEntry("mp3Alarm") )
162 useMp3Check->setChecked(true);
163
164 // signals and slots connections
165 connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool)));
166}
167
168Set_Alarm::~Set_Alarm()
169{
170
171}
172
173void Set_Alarm::slotChangeHour(int hour)
174{
175 Hour_LCDNumber->display(hour);
176}
177
178void Set_Alarm::slotChangeMinute(int minute)
179{
180 Minute_LCDNumber->display(minute);
181}
182
183void Set_Alarm::slotChangeSnooze(int minute)
184{
185 Snooze_LCDNumber->display(minute);
186}
187
188void Set_Alarm::amButtonToggled(bool b)
189{
190 if ( b)
191 Pm_RadioButton->setChecked(FALSE);
192}
193
194void Set_Alarm::pmButtonToggled(bool b)
195{
196 if (b)
197 Am_RadioButton->setChecked(FALSE);
198}
199
200void Set_Alarm::cleanUp()
201{
202}
203
204void Set_Alarm::slotChangemp3CkeckBox(bool b) {
205 Config config( "qpe" );
206 config.setGroup("Time");
207 if(b) {
208 QMap<QString, QStringList> map;
209 map.insert(tr("All"), QStringList() );
210 QStringList text;
211 text << "audio/*";
212 map.insert(tr("Audio"), text );
213 QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);//,"", "*", this );
214// QString str = Opie::OFileDialog::getOpenFileName( 2,"/");//,"", "*", this );
215 if(!str.isEmpty() ) {
216 odebug << str << oendl;
217 config.writeEntry("mp3Alarm",1);
218 config.writeEntry("mp3File",str);
219 }
220 } else {
221 config.writeEntry("mp3Alarm",0);
222 config.writeEntry("mp3File","");
223 }
224}
diff --git a/noncore/tools/clock/setAlarm.h b/noncore/tools/clock/setAlarm.h
deleted file mode 100644
index a21af05..0000000
--- a/noncore/tools/clock/setAlarm.h
+++ b/dev/null
@@ -1,59 +0,0 @@
1 /***************************************************************************
2// setAlarm.h - description
3// -------------------
4// Created: Wed Mar 13 19:47:24 2002
5// copyright : (C) 2002 by ljp
6// email : ljp@llornkcor.com
7//
8***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 ***************************************************************************/
14
15#ifndef SET_ALARM_H
16#define SET_ALARM_H
17
18#include <qvariant.h>
19#include <qdialog.h>
20
21class QVBoxLayout;
22class QHBoxLayout;
23class QGridLayout;
24class QLCDNumber;
25class QLabel;
26class QRadioButton;
27class QSlider;
28class QButtonGroup;
29class QCheckBox;
30class Set_Alarm : public QDialog
31{
32 Q_OBJECT
33
34public:
35 Set_Alarm( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
36 ~Set_Alarm();
37
38 QLabel *TextLabel1, *TextLabel2, *TextLabel3;
39 QSlider *Hour_Slider, *Minute_Slider, *SnoozeSlider;
40 QLCDNumber *Hour_LCDNumber, *Minute_LCDNumber, *Snooze_LCDNumber;
41
42 QRadioButton* Am_RadioButton;
43
44 QRadioButton* Pm_RadioButton;
45 QButtonGroup *ButtonGroup1;
46 QCheckBox *useMp3Check;
47protected slots:
48 void slotChangemp3CkeckBox(bool);
49 void slotChangeHour(int);
50 void slotChangeMinute(int);
51 void slotChangeSnooze(int);
52 void amButtonToggled(bool);
53 void pmButtonToggled(bool);
54 void cleanUp();
55protected:
56 QGridLayout* Set_AlarmLayout;
57};
58
59#endif // SET_ALARM_H