summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-06 10:00:16 (UTC)
committer mickeyl <mickeyl>2004-04-06 10:00:16 (UTC)
commitdde22f9a9bfcb4c6bcb6c7c6d07fdabb16b399cc (patch) (unidiff)
tree99706abcf20ecc0c08cb50c2384ec3e2e6530f38
parent1b7592f11a2499c3e7d6652dde1ee15fb661fce2 (diff)
downloadopie-dde22f9a9bfcb4c6bcb6c7c6d07fdabb16b399cc.zip
opie-dde22f9a9bfcb4c6bcb6c7c6d07fdabb16b399cc.tar.gz
opie-dde22f9a9bfcb4c6bcb6c7c6d07fdabb16b399cc.tar.bz2
use include "" inside .cpp to play nice with external build systems
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otimepicker.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp
index 7de0fd3..d741c7e 100644
--- a/libopie2/opieui/otimepicker.cpp
+++ b/libopie2/opieui/otimepicker.cpp
@@ -1,301 +1,301 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de> 3 Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30/* OPIE */ 30/* OPIE */
31#include <opie2/otimepicker.h> 31#include "otimepicker.h"
32 32
33/* QT */ 33/* QT */
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37 37
38 38
39 39
40namespace Opie { 40namespace Opie {
41namespace Ui { 41namespace Ui {
42 42
43/** 43/**
44 * Constructs the widget 44 * Constructs the widget
45 * @param parent The parent of the OTimePicker 45 * @param parent The parent of the OTimePicker
46 * @param name The name of the object 46 * @param name The name of the object
47 * @param fl Window Flags 47 * @param fl Window Flags
48 */ 48 */
49OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl) 49OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl)
50 :QWidget(parent,name,fl) 50 :QWidget(parent,name,fl)
51{ 51{
52 QVBoxLayout *vbox=new QVBoxLayout(this); 52 QVBoxLayout *vbox=new QVBoxLayout(this);
53 53
54 OClickableLabel *r; 54 OClickableLabel *r;
55 QString s; 55 QString s;
56 56
57 // Hour Row 57 // Hour Row
58 QWidget *row=new QWidget(this); 58 QWidget *row=new QWidget(this);
59 QHBoxLayout *l=new QHBoxLayout(row); 59 QHBoxLayout *l=new QHBoxLayout(row);
60 vbox->addWidget(row); 60 vbox->addWidget(row);
61 61
62 for (int i=0; i<24; i++) 62 for (int i=0; i<24; i++)
63 { 63 {
64 r=new OClickableLabel(row); 64 r=new OClickableLabel(row);
65 hourLst.append(r); 65 hourLst.append(r);
66 s.sprintf("%.2d",i); 66 s.sprintf("%.2d",i);
67 r->setText(s); 67 r->setText(s);
68 r->setToggleButton(true); 68 r->setToggleButton(true);
69 r->setAlignment(AlignHCenter | AlignVCenter); 69 r->setAlignment(AlignHCenter | AlignVCenter);
70 l->addWidget(r); 70 l->addWidget(r);
71 connect(r, SIGNAL(toggled(bool)), 71 connect(r, SIGNAL(toggled(bool)),
72 this, SLOT(slotHour(bool))); 72 this, SLOT(slotHour(bool)));
73 73
74 if (i==11) 74 if (i==11)
75 { // Second row 75 { // Second row
76 row=new QWidget(this); 76 row=new QWidget(this);
77 l=new QHBoxLayout(row); 77 l=new QHBoxLayout(row);
78 vbox->addWidget(row); 78 vbox->addWidget(row);
79 } 79 }
80 } 80 }
81 81
82 // Minute Row 82 // Minute Row
83 row=new QWidget(this); 83 row=new QWidget(this);
84 l=new QHBoxLayout(row); 84 l=new QHBoxLayout(row);
85 vbox->addWidget(row); 85 vbox->addWidget(row);
86 86
87 for (int i=0; i<60; i+=5) 87 for (int i=0; i<60; i+=5)
88 { 88 {
89 r=new OClickableLabel(row); 89 r=new OClickableLabel(row);
90 minuteLst.append(r); 90 minuteLst.append(r);
91 s.sprintf("%.2d",i); 91 s.sprintf("%.2d",i);
92 r->setText(s); 92 r->setText(s);
93 r->setToggleButton(true); 93 r->setToggleButton(true);
94 r->setAlignment(AlignHCenter | AlignVCenter); 94 r->setAlignment(AlignHCenter | AlignVCenter);
95 l->addWidget(r); 95 l->addWidget(r);
96 connect(r, SIGNAL(toggled(bool)), 96 connect(r, SIGNAL(toggled(bool)),
97 this, SLOT(slotMinute(bool))); 97 this, SLOT(slotMinute(bool)));
98 } 98 }
99} 99}
100 100
101/** 101/**
102 * This method return the current time 102 * This method return the current time
103 * @return the time 103 * @return the time
104 */ 104 */
105QTime OTimePicker::time()const 105QTime OTimePicker::time()const
106{ 106{
107 return tm; 107 return tm;
108} 108}
109 109
110void OTimePicker::slotHour(bool b) 110void OTimePicker::slotHour(bool b)
111{ 111{
112 112
113 OClickableLabel *r = (OClickableLabel *) sender(); 113 OClickableLabel *r = (OClickableLabel *) sender();
114 114
115 if (b) 115 if (b)
116 { 116 {
117 QValueListIterator<OClickableLabel *> it; 117 QValueListIterator<OClickableLabel *> it;
118 for (it=hourLst.begin(); it!=hourLst.end(); it++) 118 for (it=hourLst.begin(); it!=hourLst.end(); it++)
119 { 119 {
120 if (*it != r) (*it)->setOn(false); 120 if (*it != r) (*it)->setOn(false);
121 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0); 121 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
122 } 122 }
123 emit timeChanged(tm); 123 emit timeChanged(tm);
124 } 124 }
125 else 125 else
126 { 126 {
127 r->setOn(true); 127 r->setOn(true);
128 } 128 }
129 129
130} 130}
131 131
132void OTimePicker::slotMinute(bool b) 132void OTimePicker::slotMinute(bool b)
133{ 133{
134 134
135 OClickableLabel *r = (OClickableLabel *) sender(); 135 OClickableLabel *r = (OClickableLabel *) sender();
136 136
137 if (b) 137 if (b)
138 { 138 {
139 QValueListIterator<OClickableLabel *> it; 139 QValueListIterator<OClickableLabel *> it;
140 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) 140 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
141 { 141 {
142 if (*it != r) (*it)->setOn(false); 142 if (*it != r) (*it)->setOn(false);
143 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); 143 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
144 } 144 }
145 emit timeChanged(tm); 145 emit timeChanged(tm);
146 } 146 }
147 else 147 else
148 { 148 {
149 r->setOn(true); 149 r->setOn(true);
150 } 150 }
151 151
152} 152}
153 153
154/** 154/**
155 * Method to set the time. No signal gets emitted during this method call 155 * Method to set the time. No signal gets emitted during this method call
156 * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... ) 156 * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... )
157 * @param t The time to be set 157 * @param t The time to be set
158 */ 158 */
159void OTimePicker::setTime( const QTime& t) 159void OTimePicker::setTime( const QTime& t)
160{ 160{
161 setTime( t.hour(), t.minute() ); 161 setTime( t.hour(), t.minute() );
162} 162}
163 163
164/** 164/**
165 * Method to set the time. No signal gets emitted during this method call 165 * Method to set the time. No signal gets emitted during this method call
166 * @param h The hour 166 * @param h The hour
167 * @param m The minute. Minutes need to set by 5 minute steps 167 * @param m The minute. Minutes need to set by 5 minute steps
168 */ 168 */
169void OTimePicker::setTime( int h, int m ) 169void OTimePicker::setTime( int h, int m )
170{ 170{
171 setHour(h); 171 setHour(h);
172 setMinute(m); 172 setMinute(m);
173} 173}
174 174
175/* 175/*
176 * FIXME round minutes to the 5 minute arrangement -zecke 176 * FIXME round minutes to the 5 minute arrangement -zecke
177 */ 177 */
178/** 178/**
179 * Method to set the minutes 179 * Method to set the minutes
180 * @param m minutes 180 * @param m minutes
181 */ 181 */
182void OTimePicker::setMinute(int m) 182void OTimePicker::setMinute(int m)
183{ 183{
184 184
185 QString minute; 185 QString minute;
186 minute.sprintf("%.2d",m); 186 minute.sprintf("%.2d",m);
187 187
188 QValueListIterator<OClickableLabel *> it; 188 QValueListIterator<OClickableLabel *> it;
189 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) 189 for (it=minuteLst.begin(); it!=minuteLst.end(); it++)
190 { 190 {
191 if ((*it)->text() == minute) (*it)->setOn(true); 191 if ((*it)->text() == minute) (*it)->setOn(true);
192 else (*it)->setOn(false); 192 else (*it)->setOn(false);
193 } 193 }
194 194
195 tm.setHMS(tm.hour(),m,0); 195 tm.setHMS(tm.hour(),m,0);
196} 196}
197 197
198/** 198/**
199 * Method to set the hour 199 * Method to set the hour
200 */ 200 */
201void OTimePicker::setHour(int h) 201void OTimePicker::setHour(int h)
202{ 202{
203 203
204 QString hour; 204 QString hour;
205 hour.sprintf("%.2d",h); 205 hour.sprintf("%.2d",h);
206 206
207 QValueListIterator<OClickableLabel *> it; 207 QValueListIterator<OClickableLabel *> it;
208 for (it=hourLst.begin(); it!=hourLst.end(); it++) 208 for (it=hourLst.begin(); it!=hourLst.end(); it++)
209 { 209 {
210 if ((*it)->text() == hour) (*it)->setOn(true); 210 if ((*it)->text() == hour) (*it)->setOn(true);
211 else (*it)->setOn(false); 211 else (*it)->setOn(false);
212 } 212 }
213 tm.setHMS(h,tm.minute(),0); 213 tm.setHMS(h,tm.minute(),0);
214} 214}
215 215
216 216
217/** 217/**
218 * This is a modal Dialog. 218 * This is a modal Dialog.
219 * 219 *
220 * @param parent The parent widget 220 * @param parent The parent widget
221 * @param name The name of the object 221 * @param name The name of the object
222 * @param fl Possible window flags 222 * @param fl Possible window flags
223 */ 223 */
224OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) 224OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
225 : OTimePickerDialogBase (parent , name, true , fl) 225 : OTimePickerDialogBase (parent , name, true , fl)
226{ 226{
227 m_timePicker = new OTimePicker( GroupBox1, "m_timePicker" ); 227 m_timePicker = new OTimePicker( GroupBox1, "m_timePicker" );
228 GroupBox1Layout->addWidget( m_timePicker, 0, 0 ); 228 GroupBox1Layout->addWidget( m_timePicker, 0, 0 );
229 229
230 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), 230 connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ),
231 this, SLOT( setTime(const QTime&) ) ); 231 this, SLOT( setTime(const QTime&) ) );
232 connect ( minuteField, SIGNAL( textChanged(const QString&) ), 232 connect ( minuteField, SIGNAL( textChanged(const QString&) ),
233 this, SLOT ( setMinute(const QString&) ) ); 233 this, SLOT ( setMinute(const QString&) ) );
234 connect ( hourField, SIGNAL( textChanged(const QString&) ), 234 connect ( hourField, SIGNAL( textChanged(const QString&) ),
235 this, SLOT ( setHour(const QString&) ) ); 235 this, SLOT ( setHour(const QString&) ) );
236 236
237} 237}
238 238
239/** 239/**
240 * @return the time 240 * @return the time
241 */ 241 */
242QTime OTimePickerDialog::time()const 242QTime OTimePickerDialog::time()const
243{ 243{
244 return m_time; 244 return m_time;
245} 245}
246 246
247/** 247/**
248 * Set the time to time 248 * Set the time to time
249 * @param time The time to be set 249 * @param time The time to be set
250 */ 250 */
251void OTimePickerDialog::setTime( const QTime& time ) 251void OTimePickerDialog::setTime( const QTime& time )
252{ 252{
253 m_time = time; 253 m_time = time;
254 254
255 m_timePicker->setHour ( time.hour() ); 255 m_timePicker->setHour ( time.hour() );
256 m_timePicker->setMinute( time.minute() ); 256 m_timePicker->setMinute( time.minute() );
257 257
258 // Set Textfields 258 // Set Textfields
259 if ( time.hour() < 10 ) 259 if ( time.hour() < 10 )
260 hourField->setText( "0" + QString::number( time.hour() ) ); 260 hourField->setText( "0" + QString::number( time.hour() ) );
261 else 261 else
262 hourField->setText( QString::number( time.hour() ) ); 262 hourField->setText( QString::number( time.hour() ) );
263 263
264 if ( time.minute() < 10 ) 264 if ( time.minute() < 10 )
265 minuteField->setText( "0" + QString::number( time.minute() ) ); 265 minuteField->setText( "0" + QString::number( time.minute() ) );
266 else 266 else
267 minuteField->setText( QString::number( time.minute() ) ); 267 minuteField->setText( QString::number( time.minute() ) );
268 268
269} 269}
270 270
271/** 271/**
272 * This method takes the current minute and tries to set hour 272 * This method takes the current minute and tries to set hour
273 * to hour. This succeeds if the resulting date is valid 273 * to hour. This succeeds if the resulting date is valid
274 * @param hour The hour as a string 274 * @param hour The hour as a string
275 */ 275 */
276void OTimePickerDialog::setHour ( const QString& hour ) 276void OTimePickerDialog::setHour ( const QString& hour )
277{ 277{
278 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ) 278 if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) )
279 { 279 {
280 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); 280 m_time.setHMS ( hour.toInt(), m_time.minute() , 00 );
281 setTime ( m_time ); 281 setTime ( m_time );
282 } 282 }
283 283
284} 284}
285 285
286/** 286/**
287 * Method to set a new minute. It tries to convert the string to int and 287 * Method to set a new minute. It tries to convert the string to int and
288 * if the resulting date is valid a new date is set. 288 * if the resulting date is valid a new date is set.
289 * @see setHour 289 * @see setHour
290 */ 290 */
291void OTimePickerDialog::setMinute ( const QString& minute ) 291void OTimePickerDialog::setMinute ( const QString& minute )
292{ 292{
293 if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ) 293 if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) )
294 { 294 {
295 m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); 295 m_time.setHMS ( m_time.hour(), minute.toInt(), 00 );
296 setTime ( m_time ); 296 setTime ( m_time );
297 } 297 }
298} 298}
299 299
300} 300}
301} 301}