-rw-r--r-- | libopie2/opieui/otimepicker.cpp | 2 |
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,127 +1,127 @@ | |||
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 | ||
40 | namespace Opie { | 40 | namespace Opie { |
41 | namespace Ui { | 41 | namespace 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 | */ |
49 | OTimePicker::OTimePicker(QWidget* parent, const char* name, Qt::WFlags fl) | 49 | OTimePicker::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 | */ |
105 | QTime OTimePicker::time()const | 105 | QTime OTimePicker::time()const |
106 | { | 106 | { |
107 | return tm; | 107 | return tm; |
108 | } | 108 | } |
109 | 109 | ||
110 | void OTimePicker::slotHour(bool b) | 110 | void 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); |