summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/setAlarm.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp
index bd964e0..990ff81 100644
--- a/noncore/tools/clock/setAlarm.cpp
+++ b/noncore/tools/clock/setAlarm.cpp
@@ -1,86 +1,87 @@
1 /*************************************************************************** 1 /***************************************************************************
2// setAlarm.cpp - description 2// setAlarm.cpp - description
3// ------------------- 3// -------------------
4// Created: Wed Mar 13 19:47:24 2002 4// Created: Wed Mar 13 19:47:24 2002
5// copyright : (C) 2002 by ljp 5// copyright : (C) 2002 by ljp
6// email : ljp@llornkcor.com 6// email : ljp@llornkcor.com
7// 7//
8*************************************************************************** 8***************************************************************************
9 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. * 12 * (at your option) any later version. *
13 ***************************************************************************/ 13 ***************************************************************************/
14 14
15#include "setAlarm.h" 15#include "setAlarm.h"
16 16
17#include <qpe/config.h> 17#include <qpe/config.h>
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qstring.h> 20#include <qstring.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qlcdnumber.h> 22#include <qlcdnumber.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qradiobutton.h> 24#include <qradiobutton.h>
25#include <qslider.h> 25#include <qslider.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvariant.h> 27#include <qvariant.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30#include <qbuttongroup.h> 30#include <qbuttongroup.h>
31 31
32Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) 32Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl )
33 : QDialog( parent, name, modal, fl ) 33 : QDialog( parent, name, modal, fl )
34{ 34{
35 if ( !name ) 35 if ( !name )
36 setName( "Set_Alarm" ); 36 setName( "Set_Alarm" );
37 resize( 240, 101 ); 37 resize( 240, 101 );
38 setMaximumSize( QSize( 240, 320 ) ); 38 setMaximumSize( QSize( 240, 320 ) );
39 move(0,48);
39 setCaption( tr( "Set Alarm" ) ); 40 setCaption( tr( "Set Alarm" ) );
40 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 41 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
41 42
42 Set_AlarmLayout = new QGridLayout( this ); 43 Set_AlarmLayout = new QGridLayout( this );
43 Set_AlarmLayout->setSpacing( 6 ); 44 Set_AlarmLayout->setSpacing( 6 );
44 Set_AlarmLayout->setMargin( 11 ); 45 Set_AlarmLayout->setMargin( 11 );
45 46
46 TextLabel1 = new QLabel( this, "TextLabel1" ); 47 TextLabel1 = new QLabel( this, "TextLabel1" );
47 TextLabel1->setText( tr( "Hour" ) ); 48 TextLabel1->setText( tr( "Hour" ) );
48 49
49 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 ); 50 Set_AlarmLayout->addWidget( TextLabel1, 0, 0 );
50 51
51 TextLabel2 = new QLabel( this, "TextLabel2" ); 52 TextLabel2 = new QLabel( this, "TextLabel2" );
52 TextLabel2->setText( tr( "Minute" ) ); 53 TextLabel2->setText( tr( "Minute" ) );
53 54
54 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 ); 55 Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 );
55 56
56 Hour_Slider = new QSlider( this, "Hour_Slider" ); 57 Hour_Slider = new QSlider( this, "Hour_Slider" );
57 Hour_Slider->setPageStep( 1); 58 Hour_Slider->setPageStep( 1);
58 Hour_Slider->setOrientation( QSlider::Horizontal ); 59 Hour_Slider->setOrientation( QSlider::Horizontal );
59 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int))); 60 connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int)));
60 61
61 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 ); 62 Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 );
62 63
63 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" ); 64 Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" );
64 Hour_LCDNumber->setFrameShape( QLCDNumber::Box ); 65 Hour_LCDNumber->setFrameShape( QLCDNumber::Box );
65 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 66 Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain );
66 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 67 Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
67 68
68 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 ); 69 Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 );
69 70
70 Minute_Slider = new QSlider( this, "Minute_Slider" ); 71 Minute_Slider = new QSlider( this, "Minute_Slider" );
71 Minute_Slider->setMaxValue( 59); 72 Minute_Slider->setMaxValue( 59);
72 Minute_Slider->setPageStep( 1); 73 Minute_Slider->setPageStep( 1);
73 Minute_Slider->setOrientation( QSlider::Horizontal ); 74 Minute_Slider->setOrientation( QSlider::Horizontal );
74 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int))); 75 connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int)));
75 76
76 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 ); 77 Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 );
77 78
78 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" ); 79 Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" );
79 Minute_LCDNumber->setFrameShape( QLCDNumber::Box ); 80 Minute_LCDNumber->setFrameShape( QLCDNumber::Box );
80 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 81 Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain );
81 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 82 Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
82 83
83 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 ); 84 Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 );
84 85
85 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" ); 86 Am_RadioButton = new QRadioButton( this, "Am_RadioButton" );
86 Am_RadioButton->setText( tr( "AM" ) ); 87 Am_RadioButton->setText( tr( "AM" ) );
@@ -88,98 +89,98 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
88 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool))); 89 connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool)));
89 90
90 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 ); 91 Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 );
91 92
92 93
93 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" ); 94 Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" );
94 Pm_RadioButton->setText( tr( "PM" ) ); 95 Pm_RadioButton->setText( tr( "PM" ) );
95 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool))); 96 connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool)));
96 97
97 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); 98 Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 );
98 99
99 TextLabel3 = new QLabel( this, "TextLabel3" ); 100 TextLabel3 = new QLabel( this, "TextLabel3" );
100 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); 101 TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) );
101 102
102 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 ); 103 Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 );
103 104
104 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" ); 105 Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" );
105 Snooze_LCDNumber->setFrameShape( QLCDNumber::Box ); 106 Snooze_LCDNumber->setFrameShape( QLCDNumber::Box );
106 Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain ); 107 Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain );
107 Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); 108 Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat );
108 109
109 Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 ); 110 Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 );
110 111
111 SnoozeSlider = new QSlider( this, "SnoozeSlider" ); 112 SnoozeSlider = new QSlider( this, "SnoozeSlider" );
112 SnoozeSlider->setMaxValue( 60 ); 113 SnoozeSlider->setMaxValue( 60 );
113 SnoozeSlider->setOrientation( QSlider::Horizontal ); 114 SnoozeSlider->setOrientation( QSlider::Horizontal );
114 connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); 115 connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int)));
115 116
116 Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 ); 117 Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 );
117 118
118 Config config( "qpe" ); 119 Config config( "qpe" );
119 config.setGroup("Time"); 120 config.setGroup("Time");
120 121
121 bool ok; 122 bool ok;
122 bool ampm = config.readBoolEntry( "AMPM", TRUE ); 123 bool ampm = config.readBoolEntry( "AMPM", TRUE );
123 QString alarmHour=config.readEntry("clockAlarmHour","8"); 124 QString alarmHour=config.readEntry("clockAlarmHour","8");
124 int i_alarmHour = alarmHour.toInt(&ok,10); 125 int i_alarmHour = alarmHour.toInt(&ok,10);
125 QString alarmMinute=config.readEntry("clockAlarmMinute","0"); 126 QString alarmMinute=config.readEntry("clockAlarmMinute","0");
126 QString snoozeTime=config.readEntry("clockAlarmSnooze","0"); 127 QString snoozeTime=config.readEntry("clockAlarmSnooze","0");
127 if(ampm) { 128 if(ampm) {
128 Hour_Slider->setMaxValue( 12); 129 Hour_Slider->setMaxValue( 12);
129 Hour_Slider->setMinValue( 1); 130 Hour_Slider->setMinValue( 1);
130 131
131 if( i_alarmHour > 12) { 132 if( i_alarmHour > 12) {
132 i_alarmHour = i_alarmHour - 12; 133 i_alarmHour = i_alarmHour - 12;
133 Pm_RadioButton->setChecked(TRUE); 134 Pm_RadioButton->setChecked(TRUE);
134 } 135 }
135 else if ( i_alarmHour == 0 ) { 136 else if ( i_alarmHour == 0 ) {
136 i_alarmHour = 12; 137 i_alarmHour = 12;
137 } 138 }
138 Hour_Slider->setValue( i_alarmHour ); 139 Hour_Slider->setValue( i_alarmHour );
139 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); 140 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
140 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); 141 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
141 } else { 142 } else {
142 Hour_Slider->setMaxValue( 23); 143 Hour_Slider->setMaxValue( 23);
143 Hour_Slider->setMinValue( 0); 144 Hour_Slider->setMinValue( 0);
144 Hour_Slider->setValue( i_alarmHour); 145 Hour_Slider->setValue( i_alarmHour);
145 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); 146 Minute_Slider->setValue( alarmMinute.toInt(&ok,10) );
146 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); 147 SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
147 Am_RadioButton->hide(); 148 Am_RadioButton->hide();
148 Pm_RadioButton->hide(); 149 Pm_RadioButton->hide();
149 } 150 }
150 // signals and slots connections 151 // signals and slots connections
151} 152}
152 153
153Set_Alarm::~Set_Alarm() 154Set_Alarm::~Set_Alarm()
154{ 155{
155 156
156} 157}
157 158
158void Set_Alarm::slotChangeHour(int hour) 159void Set_Alarm::slotChangeHour(int hour)
159{ 160{
160 Hour_LCDNumber->display(hour); 161 Hour_LCDNumber->display(hour);
161} 162}
162 163
163void Set_Alarm::slotChangeMinute(int minute) 164void Set_Alarm::slotChangeMinute(int minute)
164{ 165{
165 Minute_LCDNumber->display(minute); 166 Minute_LCDNumber->display(minute);
166} 167}
167 168
168void Set_Alarm::slotChangeSnooze(int minute) 169void Set_Alarm::slotChangeSnooze(int minute)
169{ 170{
170 Snooze_LCDNumber->display(minute); 171 Snooze_LCDNumber->display(minute);
171} 172}
172 173
173void Set_Alarm::amButtonToggled(bool b) 174void Set_Alarm::amButtonToggled(bool b)
174{ 175{
175 if ( b) 176 if ( b)
176 Pm_RadioButton->setChecked(FALSE); 177 Pm_RadioButton->setChecked(FALSE);
177} 178}
178 179
179void Set_Alarm::pmButtonToggled(bool b) 180void Set_Alarm::pmButtonToggled(bool b)
180{ 181{
181 if (b) 182 if (b)
182 Am_RadioButton->setChecked(FALSE); 183 Am_RadioButton->setChecked(FALSE);
183} 184}
184 185
185void Set_Alarm::cleanUp() 186void Set_Alarm::cleanUp()