-rw-r--r-- | noncore/tools/clock/clock.cpp | 3 | ||||
-rw-r--r-- | noncore/tools/clock/main.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/clock/setAlarm.cpp | 3 | ||||
-rw-r--r-- | noncore/tools/euroconv/main.cpp | 4 | ||||
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/formatter/main.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/opie-sh/config.in | 2 | ||||
-rw-r--r-- | noncore/tools/remote/config.in | 2 | ||||
-rw-r--r-- | noncore/tools/remote/recorddialog.cpp | 8 | ||||
-rw-r--r-- | noncore/tools/remote/recorddialog.h | 8 | ||||
-rw-r--r-- | noncore/tools/remote/remote.pro | 2 |
11 files changed, 24 insertions, 14 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index b780675..485354b 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp | |||
@@ -1,663 +1,664 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 | 20 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 |
21 | 21 | ||
22 | #include "clock.h" | 22 | #include "clock.h" |
23 | #include "setAlarm.h" | 23 | #include "setAlarm.h" |
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
29 | #include <qpe/alarmserver.h> | 29 | #include <qpe/alarmserver.h> |
30 | #include <qpe/sound.h> | 30 | #include <qpe/sound.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #include <qsound.h> | 32 | #include <qsound.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | 34 | ||
35 | #include <opie2/oclickablelabel.h> | 35 | #include <opie2/oclickablelabel.h> |
36 | 36 | ||
37 | #include <qlcdnumber.h> | 37 | #include <qlcdnumber.h> |
38 | #include <qslider.h> | 38 | #include <qslider.h> |
39 | #include <qlabel.h> | 39 | #include <qlabel.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qtimer.h> | 41 | #include <qtimer.h> |
42 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
43 | #include <qradiobutton.h> | 43 | #include <qradiobutton.h> |
44 | #include <qbuttongroup.h> | 44 | #include <qbuttongroup.h> |
45 | #include <qpainter.h> | 45 | #include <qpainter.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | #include <qdatetime.h> | 47 | #include <qdatetime.h> |
48 | 48 | ||
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <unistd.h> | 50 | #include <unistd.h> |
51 | #include <sys/types.h> | 51 | #include <sys/types.h> |
52 | 52 | ||
53 | #include <pthread.h> | 53 | #include <pthread.h> |
54 | 54 | ||
55 | 55 | ||
56 | const double deg2rad = 0.017453292519943295769; // pi/180 | 56 | const double deg2rad = 0.017453292519943295769; // pi/180 |
57 | const int sw_prec = 2; | 57 | const int sw_prec = 2; |
58 | 58 | ||
59 | using namespace Opie::Ui; | ||
59 | void startPlayer() | 60 | void startPlayer() |
60 | { | 61 | { |
61 | Config config( "qpe" ); | 62 | Config config( "qpe" ); |
62 | config.setGroup( "Time" ); | 63 | config.setGroup( "Time" ); |
63 | sleep(15); | 64 | sleep(15); |
64 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | 65 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); |
65 | e << config.readEntry( "mp3File", "" ); | 66 | e << config.readEntry( "mp3File", "" ); |
66 | } | 67 | } |
67 | 68 | ||
68 | 69 | ||
69 | static void toggleScreenSaver( bool on ) | 70 | static void toggleScreenSaver( bool on ) |
70 | { | 71 | { |
71 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); | 72 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); |
72 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); | 73 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); |
73 | } | 74 | } |
74 | 75 | ||
75 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) | 76 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) |
76 | : QVBox( parent, name , f ) | 77 | : QVBox( parent, name , f ) |
77 | { | 78 | { |
78 | setSpacing( 4 ); | 79 | setSpacing( 4 ); |
79 | setMargin( 1 ); | 80 | setMargin( 1 ); |
80 | 81 | ||
81 | 82 | ||
82 | snoozeBtn = new QPushButton ( this ); | 83 | snoozeBtn = new QPushButton ( this ); |
83 | snoozeBtn->setText( tr( "Snooze" ) ); | 84 | snoozeBtn->setText( tr( "Snooze" ) ); |
84 | 85 | ||
85 | aclock = new AnalogClock( this ); | 86 | aclock = new AnalogClock( this ); |
86 | aclock->display( QTime::currentTime() ); | 87 | aclock->display( QTime::currentTime() ); |
87 | aclock->setLineWidth( 2 ); | 88 | aclock->setLineWidth( 2 ); |
88 | 89 | ||
89 | QHBox *hb = new QHBox( this ); | 90 | QHBox *hb = new QHBox( this ); |
90 | hb->setMargin( 0 ); | 91 | hb->setMargin( 0 ); |
91 | QWidget *space = new QWidget( hb ); | 92 | QWidget *space = new QWidget( hb ); |
92 | lcd = new QLCDNumber( hb ); | 93 | lcd = new QLCDNumber( hb ); |
93 | lcd->setSegmentStyle( QLCDNumber::Flat ); | 94 | lcd->setSegmentStyle( QLCDNumber::Flat ); |
94 | lcd->setFrameStyle( QFrame::NoFrame ); | 95 | lcd->setFrameStyle( QFrame::NoFrame ); |
95 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 96 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
96 | lcd->setFixedHeight( 23 ); | 97 | lcd->setFixedHeight( 23 ); |
97 | 98 | ||
98 | ampmLabel = new QLabel( tr( "PM" ), hb ); | 99 | ampmLabel = new QLabel( tr( "PM" ), hb ); |
99 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | 100 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); |
100 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); | 101 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); |
101 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); | 102 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); |
102 | space = new QWidget( hb ); | 103 | space = new QWidget( hb ); |
103 | 104 | ||
104 | date = new QLabel( this ); | 105 | date = new QLabel( this ); |
105 | date->setAlignment( AlignHCenter | AlignVCenter ); | 106 | date->setAlignment( AlignHCenter | AlignVCenter ); |
106 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | 107 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); |
107 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | 108 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); |
108 | 109 | ||
109 | QWidget *controls = new QWidget( this ); | 110 | QWidget *controls = new QWidget( this ); |
110 | QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); | 111 | QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); |
111 | 112 | ||
112 | QButtonGroup *grp = new QButtonGroup( controls ); | 113 | QButtonGroup *grp = new QButtonGroup( controls ); |
113 | grp->setRadioButtonExclusive( true ); | 114 | grp->setRadioButtonExclusive( true ); |
114 | grp->hide(); | 115 | grp->hide(); |
115 | 116 | ||
116 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); | 117 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); |
117 | gl->addWidget( clockRB, 0, 0 ); | 118 | gl->addWidget( clockRB, 0, 0 ); |
118 | grp->insert( clockRB ); | 119 | grp->insert( clockRB ); |
119 | 120 | ||
120 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); | 121 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); |
121 | gl->addWidget( swatchRB, 1, 0 ); | 122 | gl->addWidget( swatchRB, 1, 0 ); |
122 | grp->insert( swatchRB ); | 123 | grp->insert( swatchRB ); |
123 | 124 | ||
124 | connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) ); | 125 | connect( grp, SIGNAL( clicked(int) ), this, SLOT( modeSelect(int) ) ); |
125 | grp->setButton( 0 ); | 126 | grp->setButton( 0 ); |
126 | 127 | ||
127 | set = new QPushButton ( controls ); | 128 | set = new QPushButton ( controls ); |
128 | set->setMaximumSize( 50, 30 ); | 129 | set->setMaximumSize( 50, 30 ); |
129 | gl->addWidget( set , 0, 1 ); | 130 | gl->addWidget( set , 0, 1 ); |
130 | set->setText( tr( "Start" ) ); | 131 | set->setText( tr( "Start" ) ); |
131 | set->setEnabled( FALSE ); | 132 | set->setEnabled( FALSE ); |
132 | grp->insert( set ); | 133 | grp->insert( set ); |
133 | 134 | ||
134 | reset = new QPushButton ( controls ); | 135 | reset = new QPushButton ( controls ); |
135 | gl->addWidget( reset, 1, 1 ); | 136 | gl->addWidget( reset, 1, 1 ); |
136 | reset->setText( tr( "Reset" ) ); | 137 | reset->setText( tr( "Reset" ) ); |
137 | reset->setEnabled( FALSE ); | 138 | reset->setEnabled( FALSE ); |
138 | grp->insert( reset ); | 139 | grp->insert( reset ); |
139 | 140 | ||
140 | alarmOffBtn = new QPushButton ( controls ); | 141 | alarmOffBtn = new QPushButton ( controls ); |
141 | gl->addWidget( alarmOffBtn, 0, 2 ); | 142 | gl->addWidget( alarmOffBtn, 0, 2 ); |
142 | 143 | ||
143 | alarmBtn = new QPushButton ( controls ); | 144 | alarmBtn = new QPushButton ( controls ); |
144 | gl->addWidget( alarmBtn, 1, 2 ); | 145 | gl->addWidget( alarmBtn, 1, 2 ); |
145 | 146 | ||
146 | alarmBtn->setText( tr( "Set Alarm" ) ); | 147 | alarmBtn->setText( tr( "Set Alarm" ) ); |
147 | 148 | ||
148 | Opie::OClickableLabel *click = new Opie::OClickableLabel( controls, "label" ); | 149 | OClickableLabel *click = new Opie::Ui::OClickableLabel( controls, "label" ); |
149 | click->setText( tr( "Set date and time." ) ); | 150 | click->setText( tr( "Set date and time." ) ); |
150 | gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); | 151 | gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter ); |
151 | connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); | 152 | connect( click, SIGNAL( clicked() ), this, SLOT( slotAdjustTime() ) ); |
152 | 153 | ||
153 | connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); | 154 | connect( set , SIGNAL( pressed() ), SLOT( slotSet() ) ); |
154 | connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); | 155 | connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); |
155 | 156 | ||
156 | connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); | 157 | connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); |
157 | connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); | 158 | connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) ); |
158 | connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); | 159 | connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) ); |
159 | 160 | ||
160 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 161 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
161 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 162 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
162 | 163 | ||
163 | t = new QTimer( this ); | 164 | t = new QTimer( this ); |
164 | connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); | 165 | connect( t, SIGNAL( timeout() ), SLOT( updateClock() ) ); |
165 | t->start( 1000 ); | 166 | t->start( 1000 ); |
166 | 167 | ||
167 | connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); | 168 | connect( qApp, SIGNAL( timeChanged() ), SLOT( updateClock() ) ); |
168 | 169 | ||
169 | swatch_running = FALSE; | 170 | swatch_running = FALSE; |
170 | swatch_totalms = 0; | 171 | swatch_totalms = 0; |
171 | 172 | ||
172 | connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); | 173 | connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); |
173 | 174 | ||
174 | 175 | ||
175 | Config config( "qpe" ); | 176 | Config config( "qpe" ); |
176 | config.setGroup( "Time" ); | 177 | config.setGroup( "Time" ); |
177 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 178 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
178 | 179 | ||
179 | QString tmp = config.readEntry( "clockAlarmHour", "" ); | 180 | QString tmp = config.readEntry( "clockAlarmHour", "" ); |
180 | bool ok; | 181 | bool ok; |
181 | hour = tmp.toInt( &ok, 10 ); | 182 | hour = tmp.toInt( &ok, 10 ); |
182 | tmp = config.readEntry( "clockAlarmMinute", "" ); | 183 | tmp = config.readEntry( "clockAlarmMinute", "" ); |
183 | minute = tmp.toInt( &ok, 10 ); | 184 | minute = tmp.toInt( &ok, 10 ); |
184 | 185 | ||
185 | if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" ) | 186 | if ( config.readEntry( "clockAlarmSet", "FALSE" ) == "TRUE" ) |
186 | { | 187 | { |
187 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); | 188 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); |
188 | alarmBool = TRUE; | 189 | alarmBool = TRUE; |
189 | snoozeBtn->show(); | 190 | snoozeBtn->show(); |
190 | } | 191 | } |
191 | else | 192 | else |
192 | { | 193 | { |
193 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 194 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); |
194 | alarmBool = FALSE; | 195 | alarmBool = FALSE; |
195 | snoozeBtn->hide(); | 196 | snoozeBtn->hide(); |
196 | } | 197 | } |
197 | 198 | ||
198 | QTimer::singleShot( 0, this, SLOT( updateClock() ) ); | 199 | QTimer::singleShot( 0, this, SLOT( updateClock() ) ); |
199 | 200 | ||
200 | Config cfg( "Clock" ); | 201 | Config cfg( "Clock" ); |
201 | cfg.setGroup( "Mode" ); | 202 | cfg.setGroup( "Mode" ); |
202 | int mode = cfg.readBoolEntry( "clockMode"); | 203 | int mode = cfg.readBoolEntry( "clockMode"); |
203 | setSwatchMode( mode); | 204 | setSwatchMode( mode); |
204 | modeSelect( mode); | 205 | modeSelect( mode); |
205 | } | 206 | } |
206 | 207 | ||
207 | Clock::~Clock() | 208 | Clock::~Clock() |
208 | { | 209 | { |
209 | toggleScreenSaver( true ); | 210 | toggleScreenSaver( true ); |
210 | } | 211 | } |
211 | 212 | ||
212 | void Clock::updateClock() | 213 | void Clock::updateClock() |
213 | { | 214 | { |
214 | if ( clockRB->isChecked() ) | 215 | if ( clockRB->isChecked() ) |
215 | { | 216 | { |
216 | QTime tm = QDateTime::currentDateTime().time(); | 217 | QTime tm = QDateTime::currentDateTime().time(); |
217 | QString s; | 218 | QString s; |
218 | if ( ampm ) | 219 | if ( ampm ) |
219 | { | 220 | { |
220 | int hour = tm.hour(); | 221 | int hour = tm.hour(); |
221 | if ( hour == 0 ) | 222 | if ( hour == 0 ) |
222 | hour = 12; | 223 | hour = 12; |
223 | if ( hour > 12 ) | 224 | if ( hour > 12 ) |
224 | hour -= 12; | 225 | hour -= 12; |
225 | s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); | 226 | s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); |
226 | ampmLabel->setText( ( tm.hour() >= 12 ) ? "PM" : "AM" ); | 227 | ampmLabel->setText( ( tm.hour() >= 12 ) ? "PM" : "AM" ); |
227 | ampmLabel->show(); | 228 | ampmLabel->show(); |
228 | } | 229 | } |
229 | else | 230 | else |
230 | { | 231 | { |
231 | s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); | 232 | s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); |
232 | ampmLabel->hide(); | 233 | ampmLabel->hide(); |
233 | } | 234 | } |
234 | lcd->display( s ); | 235 | lcd->display( s ); |
235 | lcd->repaint( FALSE ); | 236 | lcd->repaint( FALSE ); |
236 | aclock->display( QTime::currentTime() ); | 237 | aclock->display( QTime::currentTime() ); |
237 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | 238 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); |
238 | } | 239 | } |
239 | else | 240 | else |
240 | { | 241 | { |
241 | QTime swatch_time; | 242 | QTime swatch_time; |
242 | QString lcdtext; | 243 | QString lcdtext; |
243 | int totalms = swatch_totalms; | 244 | int totalms = swatch_totalms; |
244 | if ( swatch_running ) | 245 | if ( swatch_running ) |
245 | totalms += swatch_start.elapsed(); | 246 | totalms += swatch_start.elapsed(); |
246 | swatch_time = QTime( 0, 0, 0 ).addMSecs( totalms ); | 247 | swatch_time = QTime( 0, 0, 0 ).addMSecs( totalms ); |
247 | QString d = swatch_running ? QString( " " ) | 248 | QString d = swatch_running ? QString( " " ) |
248 | : QString::number( totalms % 1000 + 1000 ); | 249 | : QString::number( totalms % 1000 + 1000 ); |
249 | lcdtext = swatch_time.toString() + "." + d.right( 3 ).left( sw_prec ); | 250 | lcdtext = swatch_time.toString() + "." + d.right( 3 ).left( sw_prec ); |
250 | lcd->display( lcdtext ); | 251 | lcd->display( lcdtext ); |
251 | lcd->repaint( FALSE ); | 252 | lcd->repaint( FALSE ); |
252 | aclock->display( swatch_time ); | 253 | aclock->display( swatch_time ); |
253 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | 254 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); |
254 | } | 255 | } |
255 | } | 256 | } |
256 | 257 | ||
257 | void Clock::changeClock( bool a ) | 258 | void Clock::changeClock( bool a ) |
258 | { | 259 | { |
259 | ampm = a; | 260 | ampm = a; |
260 | updateClock(); | 261 | updateClock(); |
261 | } | 262 | } |
262 | 263 | ||
263 | void Clock::clearClock( void ) | 264 | void Clock::clearClock( void ) |
264 | { | 265 | { |
265 | lcd->display( QTime( 0, 0, 0 ).toString() ); | 266 | lcd->display( QTime( 0, 0, 0 ).toString() ); |
266 | aclock->display( QTime( 0, 0, 0 ) ); | 267 | aclock->display( QTime( 0, 0, 0 ) ); |
267 | } | 268 | } |
268 | 269 | ||
269 | void Clock::startSWatch() | 270 | void Clock::startSWatch() |
270 | { | 271 | { |
271 | if(swatch_running) { | 272 | if(swatch_running) { |
272 | stopSWatch(); | 273 | stopSWatch(); |
273 | return; | 274 | return; |
274 | } | 275 | } |
275 | qDebug("startSWatch()"); | 276 | qDebug("startSWatch()"); |
276 | swatch_start.start(); | 277 | swatch_start.start(); |
277 | set->setText( tr( "Stop" ) ); | 278 | set->setText( tr( "Stop" ) ); |
278 | t->start( 1000 ); | 279 | t->start( 1000 ); |
279 | swatch_running = TRUE; | 280 | swatch_running = TRUE; |
280 | // disable screensaver while stop watch is running | 281 | // disable screensaver while stop watch is running |
281 | toggleScreenSaver( FALSE ); | 282 | toggleScreenSaver( FALSE ); |
282 | } | 283 | } |
283 | 284 | ||
284 | void Clock::stopSWatch() | 285 | void Clock::stopSWatch() |
285 | { | 286 | { |
286 | qDebug("stopSWatch()"); | 287 | qDebug("stopSWatch()"); |
287 | swatch_totalms += swatch_start.elapsed(); | 288 | swatch_totalms += swatch_start.elapsed(); |
288 | set->setText( tr( "Start" ) ); | 289 | set->setText( tr( "Start" ) ); |
289 | t->stop(); | 290 | t->stop(); |
290 | swatch_running = FALSE; | 291 | swatch_running = FALSE; |
291 | toggleScreenSaver( TRUE ); | 292 | toggleScreenSaver( TRUE ); |
292 | updateClock(); | 293 | updateClock(); |
293 | } | 294 | } |
294 | 295 | ||
295 | 296 | ||
296 | void Clock::slotSet() | 297 | void Clock::slotSet() |
297 | { | 298 | { |
298 | if ( t->isActive() ) | 299 | if ( t->isActive() ) |
299 | { | 300 | { |
300 | startSWatch(); | 301 | startSWatch(); |
301 | } | 302 | } |
302 | else | 303 | else |
303 | { | 304 | { |
304 | stopSWatch(); | 305 | stopSWatch(); |
305 | } | 306 | } |
306 | } | 307 | } |
307 | 308 | ||
308 | void Clock::slotReset() | 309 | void Clock::slotReset() |
309 | { | 310 | { |
310 | t->stop(); | 311 | t->stop(); |
311 | swatch_start.start(); | 312 | swatch_start.start(); |
312 | swatch_totalms = 0; | 313 | swatch_totalms = 0; |
313 | 314 | ||
314 | if ( swatch_running ) | 315 | if ( swatch_running ) |
315 | t->start( 1000 ); | 316 | t->start( 1000 ); |
316 | 317 | ||
317 | updateClock(); | 318 | updateClock(); |
318 | } | 319 | } |
319 | 320 | ||
320 | void Clock::modeSelect( int m ) | 321 | void Clock::modeSelect( int m ) |
321 | { | 322 | { |
322 | qDebug("Clock::modeSelect( %d) ", m); | 323 | qDebug("Clock::modeSelect( %d) ", m); |
323 | if ( m != 0 ) | 324 | if ( m != 0 ) |
324 | { | 325 | { |
325 | lcd->setNumDigits( 8 + 1 + sw_prec ); | 326 | lcd->setNumDigits( 8 + 1 + sw_prec ); |
326 | lcd->setMinimumWidth( lcd->sizeHint().width() ); | 327 | lcd->setMinimumWidth( lcd->sizeHint().width() ); |
327 | set->setEnabled( TRUE ); | 328 | set->setEnabled( TRUE ); |
328 | reset->setEnabled( TRUE ); | 329 | reset->setEnabled( TRUE ); |
329 | ampmLabel->hide(); | 330 | ampmLabel->hide(); |
330 | 331 | ||
331 | // if(m == 2) { | 332 | // if(m == 2) { |
332 | if ( !swatch_running ) { | 333 | if ( !swatch_running ) { |
333 | t->start( 1000 ); | 334 | t->start( 1000 ); |
334 | } | 335 | } |
335 | // else | 336 | // else |
336 | // { | 337 | // { |
337 | // stopSWatch(); | 338 | // stopSWatch(); |
338 | // } | 339 | // } |
339 | // } | 340 | // } |
340 | } | 341 | } |
341 | else //clock mode | 342 | else //clock mode |
342 | { | 343 | { |
343 | lcd->setNumDigits( 5 ); | 344 | lcd->setNumDigits( 5 ); |
344 | lcd->setMinimumWidth( lcd->sizeHint().width() ); | 345 | lcd->setMinimumWidth( lcd->sizeHint().width() ); |
345 | set->setEnabled( FALSE ); | 346 | set->setEnabled( FALSE ); |
346 | reset->setEnabled( FALSE ); | 347 | reset->setEnabled( FALSE ); |
347 | t->start( 1000 ); | 348 | t->start( 1000 ); |
348 | } | 349 | } |
349 | 350 | ||
350 | Config config( "Clock" ); | 351 | Config config( "Clock" ); |
351 | config.setGroup( "Mode" ); | 352 | config.setGroup( "Mode" ); |
352 | config.writeEntry( "clockMode", m ); | 353 | config.writeEntry( "clockMode", m ); |
353 | updateClock(); | 354 | updateClock(); |
354 | } | 355 | } |
355 | 356 | ||
356 | //this sets the alarm time | 357 | //this sets the alarm time |
357 | void Clock::slotSetAlarm() | 358 | void Clock::slotSetAlarm() |
358 | { | 359 | { |
359 | if ( !snoozeBtn->isHidden() ) | 360 | if ( !snoozeBtn->isHidden() ) |
360 | slotToggleAlarm(); | 361 | slotToggleAlarm(); |
361 | Set_Alarm *setAlarmDlg; | 362 | Set_Alarm *setAlarmDlg; |
362 | setAlarmDlg = new Set_Alarm( this, "SetAlarm", TRUE ); | 363 | setAlarmDlg = new Set_Alarm( this, "SetAlarm", TRUE ); |
363 | int result = setAlarmDlg->exec(); | 364 | int result = setAlarmDlg->exec(); |
364 | if ( result == 1 ) { | 365 | if ( result == 1 ) { |
365 | Config config( "qpe" ); | 366 | Config config( "qpe" ); |
366 | config.setGroup( "Time" ); | 367 | config.setGroup( "Time" ); |
367 | QString tmp; | 368 | QString tmp; |
368 | hour = setAlarmDlg->Hour_Slider->value(); | 369 | hour = setAlarmDlg->Hour_Slider->value(); |
369 | minute = setAlarmDlg->Minute_Slider->value(); | 370 | minute = setAlarmDlg->Minute_Slider->value(); |
370 | snoozeTime = setAlarmDlg->SnoozeSlider->value(); | 371 | snoozeTime = setAlarmDlg->SnoozeSlider->value(); |
371 | if ( ampm ) { | 372 | if ( ampm ) { |
372 | if ( hour == 12 ) | 373 | if ( hour == 12 ) |
373 | hour = 0; | 374 | hour = 0; |
374 | 375 | ||
375 | if ( setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 ) | 376 | if ( setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 ) |
376 | hour += 12; | 377 | hour += 12; |
377 | } | 378 | } |
378 | config.writeEntry( "clockAlarmHour", tmp.setNum( hour ), 10 ); | 379 | config.writeEntry( "clockAlarmHour", tmp.setNum( hour ), 10 ); |
379 | config.writeEntry( "clockAlarmMinute", tmp.setNum( minute ), 10 ); | 380 | config.writeEntry( "clockAlarmMinute", tmp.setNum( minute ), 10 ); |
380 | config.writeEntry( "clockAlarmSnooze", tmp.setNum( snoozeTime ), 10 ); | 381 | config.writeEntry( "clockAlarmSnooze", tmp.setNum( snoozeTime ), 10 ); |
381 | config.write(); | 382 | config.write(); |
382 | } | 383 | } |
383 | } | 384 | } |
384 | 385 | ||
385 | void Clock::slotSnooze() | 386 | void Clock::slotSnooze() |
386 | { | 387 | { |
387 | bSound = FALSE; | 388 | bSound = FALSE; |
388 | int warn = 0; | 389 | int warn = 0; |
389 | QTime t = QTime::currentTime(); | 390 | QTime t = QTime::currentTime(); |
390 | QDateTime whenl( when.date(), t.addSecs( snoozeTime * 60 ) ); | 391 | QDateTime whenl( when.date(), t.addSecs( snoozeTime * 60 ) ); |
391 | when = whenl; | 392 | when = whenl; |
392 | AlarmServer::addAlarm( when, | 393 | AlarmServer::addAlarm( when, |
393 | "QPE/Application/clock", | 394 | "QPE/Application/clock", |
394 | "alarm(QDateTime,int)", warn ); | 395 | "alarm(QDateTime,int)", warn ); |
395 | 396 | ||
396 | } | 397 | } |
397 | 398 | ||
398 | //toggles alarm on/off | 399 | //toggles alarm on/off |
399 | void Clock::slotToggleAlarm() | 400 | void Clock::slotToggleAlarm() |
400 | { | 401 | { |
401 | Config config( "qpe" ); | 402 | Config config( "qpe" ); |
402 | config.setGroup( "Time" ); | 403 | config.setGroup( "Time" ); |
403 | if ( alarmBool ) | 404 | if ( alarmBool ) |
404 | { | 405 | { |
405 | config.writeEntry( "clockAlarmSet", "FALSE" ); | 406 | config.writeEntry( "clockAlarmSet", "FALSE" ); |
406 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 407 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); |
407 | snoozeBtn->hide(); | 408 | snoozeBtn->hide(); |
408 | alarmBool = FALSE; | 409 | alarmBool = FALSE; |
409 | alarmOff(); | 410 | alarmOff(); |
410 | } | 411 | } |
411 | else | 412 | else |
412 | { | 413 | { |
413 | config.writeEntry( "clockAlarmSet", "TRUE" ); | 414 | config.writeEntry( "clockAlarmSet", "TRUE" ); |
414 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); | 415 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); |
415 | snoozeBtn->show(); | 416 | snoozeBtn->show(); |
416 | alarmBool = TRUE; | 417 | alarmBool = TRUE; |
417 | alarmOn(); | 418 | alarmOn(); |
418 | } | 419 | } |
419 | config.write(); | 420 | config.write(); |
420 | } | 421 | } |
421 | 422 | ||
422 | void Clock::alarmOn() | 423 | void Clock::alarmOn() |
423 | { | 424 | { |
424 | QDate d = QDate::currentDate(); | 425 | QDate d = QDate::currentDate(); |
425 | QTime tm( ( int ) hour, ( int ) minute, 0 ); | 426 | QTime tm( ( int ) hour, ( int ) minute, 0 ); |
426 | qDebug( "Time set " + tm.toString() ); | 427 | qDebug( "Time set " + tm.toString() ); |
427 | QTime t = QTime::currentTime(); | 428 | QTime t = QTime::currentTime(); |
428 | if ( t > tm ) | 429 | if ( t > tm ) |
429 | d = d.addDays( 1 ); | 430 | d = d.addDays( 1 ); |
430 | int warn = 0; | 431 | int warn = 0; |
431 | QDateTime whenl( d, tm ); | 432 | QDateTime whenl( d, tm ); |
432 | when = whenl; | 433 | when = whenl; |
433 | AlarmServer::addAlarm( when, | 434 | AlarmServer::addAlarm( when, |
434 | "QPE/Application/clock", | 435 | "QPE/Application/clock", |
435 | "alarm(QDateTime,int)", warn ); | 436 | "alarm(QDateTime,int)", warn ); |
436 | // setCaption( "Alarm set: " + whenl.toString() ); | 437 | // setCaption( "Alarm set: " + whenl.toString() ); |
437 | setCaption( tr("Alarm set: %1" ).arg(whenl.toString()) ); | 438 | setCaption( tr("Alarm set: %1" ).arg(whenl.toString()) ); |
438 | } | 439 | } |
439 | 440 | ||
440 | void Clock::alarmOff() | 441 | void Clock::alarmOff() |
441 | { | 442 | { |
442 | int warn = 0; | 443 | int warn = 0; |
443 | bSound = FALSE; | 444 | bSound = FALSE; |
444 | AlarmServer::deleteAlarm( when, | 445 | AlarmServer::deleteAlarm( when, |
445 | "QPE/Application/clock", | 446 | "QPE/Application/clock", |
446 | "alarm(QDateTime,int)", warn ); | 447 | "alarm(QDateTime,int)", warn ); |
447 | qDebug( "Alarm Off " + when.toString() ); | 448 | qDebug( "Alarm Off " + when.toString() ); |
448 | setCaption( tr("Clock") ); | 449 | setCaption( tr("Clock") ); |
449 | } | 450 | } |
450 | 451 | ||
451 | void Clock::clearTimer() | 452 | void Clock::clearTimer() |
452 | { | 453 | { |
453 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 454 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); |
454 | alarmBool = FALSE; | 455 | alarmBool = FALSE; |
455 | snoozeBtn->hide(); | 456 | snoozeBtn->hide(); |
456 | setCaption( tr("Clock") ); | 457 | setCaption( tr("Clock") ); |
457 | } | 458 | } |
458 | 459 | ||
459 | void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) | 460 | void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) |
460 | { | 461 | { |
461 | int stopTimer = 0; | 462 | int stopTimer = 0; |
462 | int timerStay = 5000; | 463 | int timerStay = 5000; |
463 | bSound = TRUE; | 464 | bSound = TRUE; |
464 | qDebug( "Message received in clock" ); | 465 | qDebug( "Message received in clock" ); |
465 | if ( msg == "alarm(QDateTime,int)" ) | 466 | if ( msg == "alarm(QDateTime,int)" ) |
466 | { | 467 | { |
467 | Config config( "qpe" ); | 468 | Config config( "qpe" ); |
468 | config.setGroup( "Time" ); | 469 | config.setGroup( "Time" ); |
469 | if ( config.readBoolEntry( "mp3Alarm", 0 ) ) | 470 | if ( config.readBoolEntry( "mp3Alarm", 0 ) ) |
470 | { | 471 | { |
471 | clearTimer(); | 472 | clearTimer(); |
472 | pthread_t thread; | 473 | pthread_t thread; |
473 | pthread_create(&thread, NULL, (void * (*) (void *))startPlayer, NULL/* &*/); | 474 | pthread_create(&thread, NULL, (void * (*) (void *))startPlayer, NULL/* &*/); |
474 | 475 | ||
475 | } | 476 | } |
476 | else | 477 | else |
477 | { | 478 | { |
478 | 479 | ||
479 | Sound::soundAlarm(); | 480 | Sound::soundAlarm(); |
480 | stopTimer = startTimer( timerStay ); | 481 | stopTimer = startTimer( timerStay ); |
481 | } | 482 | } |
482 | } | 483 | } |
483 | 484 | ||
484 | if ( msg == "timerStart()" ) | 485 | if ( msg == "timerStart()" ) |
485 | { | 486 | { |
486 | slotStartTimer(); | 487 | slotStartTimer(); |
487 | } | 488 | } |
488 | if ( msg == "timerStop()" ) | 489 | if ( msg == "timerStop()" ) |
489 | { | 490 | { |
490 | slotStopTimer(); | 491 | slotStopTimer(); |
491 | } | 492 | } |
492 | if ( msg == "timerReset()" ) | 493 | if ( msg == "timerReset()" ) |
493 | { | 494 | { |
494 | slotResetTimer(); | 495 | slotResetTimer(); |
495 | } | 496 | } |
496 | 497 | ||
497 | show(); | 498 | show(); |
498 | raise(); | 499 | raise(); |
499 | QPEApplication::setKeepRunning(); | 500 | QPEApplication::setKeepRunning(); |
500 | setActiveWindow(); | 501 | setActiveWindow(); |
501 | } | 502 | } |
502 | 503 | ||
503 | void Clock::timerEvent( QTimerEvent *e ) | 504 | void Clock::timerEvent( QTimerEvent *e ) |
504 | { | 505 | { |
505 | static int stop = 0; | 506 | static int stop = 0; |
506 | if ( stop < 120 && bSound ) | 507 | if ( stop < 120 && bSound ) |
507 | { | 508 | { |
508 | Sound::soundAlarm(); | 509 | Sound::soundAlarm(); |
509 | stop++; | 510 | stop++; |
510 | } | 511 | } |
511 | else | 512 | else |
512 | { | 513 | { |
513 | stop = 0; | 514 | stop = 0; |
514 | killTimer( e->timerId() ); | 515 | killTimer( e->timerId() ); |
515 | clearTimer(); | 516 | clearTimer(); |
516 | setCaption( tr( "Clock: Alarm was missed." ) ); | 517 | setCaption( tr( "Clock: Alarm was missed." ) ); |
517 | } | 518 | } |
518 | } | 519 | } |
519 | 520 | ||
520 | AnalogClock::AnalogClock(QWidget * parent, const char * name) : QFrame( parent, name ), clear(true) | 521 | AnalogClock::AnalogClock(QWidget * parent, const char * name) : QFrame( parent, name ), clear(true) |
521 | { | 522 | { |
522 | QWidget *d = QApplication::desktop(); | 523 | QWidget *d = QApplication::desktop(); |
523 | if(d->width() <= 240) | 524 | if(d->width() <= 240) |
524 | bg = Resource::loadPixmap("clock/bg"); | 525 | bg = Resource::loadPixmap("clock/bg"); |
525 | } | 526 | } |
526 | 527 | ||
527 | QSizePolicy AnalogClock::sizePolicy() const | 528 | QSizePolicy AnalogClock::sizePolicy() const |
528 | { | 529 | { |
529 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); | 530 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); |
530 | } | 531 | } |
531 | 532 | ||
532 | void AnalogClock::drawContents( QPainter *p ) | 533 | void AnalogClock::drawContents( QPainter *p ) |
533 | { | 534 | { |
534 | QRect r = contentsRect(); | 535 | QRect r = contentsRect(); |
535 | QRect fr; | 536 | QRect fr; |
536 | 537 | ||
537 | p->drawPixmap(QPoint(0, 0), bg, r); | 538 | p->drawPixmap(QPoint(0, 0), bg, r); |
538 | 539 | ||
539 | if ( r. width ( ) > r. height ( )) | 540 | if ( r. width ( ) > r. height ( )) |
540 | fr. setRect (( r. width ( ) - r. height ( )) / 2, r. y ( ), r. height ( ), r. height ( )); | 541 | fr. setRect (( r. width ( ) - r. height ( )) / 2, r. y ( ), r. height ( ), r. height ( )); |
541 | else | 542 | else |
542 | fr. setRect ( r. x ( ), ( r. height ( ) - r. width ( )) / 2, r. width ( ), r. width ( )); | 543 | fr. setRect ( r. x ( ), ( r. height ( ) - r. width ( )) / 2, r. width ( ), r. width ( )); |
543 | 544 | ||
544 | QPoint center = fr. center ( ); // ( fr.x() + fr.width() / 2, fr.y() + fr.height() / 2 ); | 545 | QPoint center = fr. center ( ); // ( fr.x() + fr.width() / 2, fr.y() + fr.height() / 2 ); |
545 | QPoint l1 ( center. x ( ), fr. y ( ) + 2 ); | 546 | QPoint l1 ( center. x ( ), fr. y ( ) + 2 ); |
546 | QPoint l2 ( center. x ( ), fr. y ( ) + 8 ); | 547 | QPoint l2 ( center. x ( ), fr. y ( ) + 8 ); |
547 | 548 | ||
548 | 549 | ||
549 | 550 | ||
550 | if ( clear ) | 551 | if ( clear ) |
551 | { | 552 | { |
552 | erase ( r ); | 553 | erase ( r ); |
553 | p-> setPen ( NoPen ); | 554 | p-> setPen ( NoPen ); |
554 | p-> setBrush ( colorGroup ( ). color ( QColorGroup::Base )); | 555 | p-> setBrush ( colorGroup ( ). color ( QColorGroup::Base )); |
555 | p-> drawEllipse ( fr ); | 556 | p-> drawEllipse ( fr ); |
556 | p-> setBrush ( NoBrush ); | 557 | p-> setBrush ( NoBrush ); |
557 | 558 | ||
558 | // draw ticks | 559 | // draw ticks |
559 | p->setPen( QPen( colorGroup ( ). color ( QColorGroup::Text ), 1 ) ); | 560 | p->setPen( QPen( colorGroup ( ). color ( QColorGroup::Text ), 1 ) ); |
560 | for ( int i = 0; i < 12; i++ ) | 561 | for ( int i = 0; i < 12; i++ ) |
561 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); | 562 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); |
562 | } | 563 | } |
563 | else | 564 | else |
564 | { | 565 | { |
565 | drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Base ), prevTime, &currTime ); | 566 | drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Base ), prevTime, &currTime ); |
566 | } | 567 | } |
567 | 568 | ||
568 | drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Text ), currTime ); | 569 | drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Text ), currTime ); |
569 | 570 | ||
570 | prevTime = currTime; | 571 | prevTime = currTime; |
571 | } | 572 | } |
572 | 573 | ||
573 | void AnalogClock::drawPointers ( QPainter *p, const QRect &r, const QColor &c, const QTime &t, const QTime *t2 ) | 574 | void AnalogClock::drawPointers ( QPainter *p, const QRect &r, const QColor &c, const QTime &t, const QTime *t2 ) |
574 | { | 575 | { |
575 | QPoint center = r. center ( ); | 576 | QPoint center = r. center ( ); |
576 | 577 | ||
577 | QPoint h1( center. x ( ), r. y ( ) + r. height ( ) / 4 ); | 578 | QPoint h1( center. x ( ), r. y ( ) + r. height ( ) / 4 ); |
578 | QPoint h2( center. x ( ), center. y ( ) ); | 579 | QPoint h2( center. x ( ), center. y ( ) ); |
579 | 580 | ||
580 | QPoint m1( center. x ( ), r.y() + r.height() / 8 ); | 581 | QPoint m1( center. x ( ), r.y() + r.height() / 8 ); |
581 | QPoint m2( center. x ( ), center. y ( ) ); | 582 | QPoint m2( center. x ( ), center. y ( ) ); |
582 | 583 | ||
583 | QPoint s1( center. x ( ), r. y ( ) + 8 ); | 584 | QPoint s1( center. x ( ), r. y ( ) + 8 ); |
584 | QPoint s2( center. x ( ), center. y ( ) ); | 585 | QPoint s2( center. x ( ), center. y ( ) ); |
585 | 586 | ||
586 | 587 | ||
587 | if ( !t2 || ( t. minute ( ) != t2-> minute ( ) || t. hour ( ) != t2-> hour ( ))) { | 588 | if ( !t2 || ( t. minute ( ) != t2-> minute ( ) || t. hour ( ) != t2-> hour ( ))) { |
588 | // draw hour pointer | 589 | // draw hour pointer |
589 | h1 = rotate( center, h1, 30 * ( t.hour() % 12 ) + t.minute() / 2 ); | 590 | h1 = rotate( center, h1, 30 * ( t.hour() % 12 ) + t.minute() / 2 ); |
590 | h2 = rotate( center, h2, 30 * ( t.hour() % 12 ) + t.minute() / 2 ); | 591 | h2 = rotate( center, h2, 30 * ( t.hour() % 12 ) + t.minute() / 2 ); |
591 | p-> setPen ( QPen ( c, 3 )); | 592 | p-> setPen ( QPen ( c, 3 )); |
592 | p-> drawLine ( h1, h2 ); | 593 | p-> drawLine ( h1, h2 ); |
593 | } | 594 | } |
594 | 595 | ||
595 | if ( !t2 || ( t. minute ( ) != t2-> minute ( ))) { | 596 | if ( !t2 || ( t. minute ( ) != t2-> minute ( ))) { |
596 | // draw minute pointer | 597 | // draw minute pointer |
597 | m1 = rotate( center, m1, t.minute() * 6 ); | 598 | m1 = rotate( center, m1, t.minute() * 6 ); |
598 | m2 = rotate( center, m2, t.minute() * 6 ); | 599 | m2 = rotate( center, m2, t.minute() * 6 ); |
599 | p-> setPen ( QPen ( c, 2 )); | 600 | p-> setPen ( QPen ( c, 2 )); |
600 | p-> drawLine ( m1, m2 ); | 601 | p-> drawLine ( m1, m2 ); |
601 | } | 602 | } |
602 | 603 | ||
603 | if ( !t2 || ( t. second ( ) != t2-> second ( ))) { | 604 | if ( !t2 || ( t. second ( ) != t2-> second ( ))) { |
604 | // draw second pointer | 605 | // draw second pointer |
605 | s1 = rotate( center, s1, t.second() * 6 ); | 606 | s1 = rotate( center, s1, t.second() * 6 ); |
606 | s2 = rotate( center, s2, t.second() * 6 ); | 607 | s2 = rotate( center, s2, t.second() * 6 ); |
607 | p-> setPen ( QPen ( c, 1 )); | 608 | p-> setPen ( QPen ( c, 1 )); |
608 | p-> drawLine ( s1, s2 ); | 609 | p-> drawLine ( s1, s2 ); |
609 | } | 610 | } |
610 | } | 611 | } |
611 | 612 | ||
612 | void AnalogClock::display( const QTime& t ) | 613 | void AnalogClock::display( const QTime& t ) |
613 | { | 614 | { |
614 | currTime = t; | 615 | currTime = t; |
615 | clear = false; | 616 | clear = false; |
616 | repaint( false ); | 617 | repaint( false ); |
617 | clear = true; | 618 | clear = true; |
618 | } | 619 | } |
619 | 620 | ||
620 | QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) | 621 | QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) |
621 | { | 622 | { |
622 | double angle = deg2rad * ( - a + 180 ); | 623 | double angle = deg2rad * ( - a + 180 ); |
623 | double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - | 624 | double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - |
624 | ( p.y() - c.y() ) * sin( angle ); | 625 | ( p.y() - c.y() ) * sin( angle ); |
625 | double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + | 626 | double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + |
626 | ( p.x() - c.x() ) * sin( angle ); | 627 | ( p.x() - c.x() ) * sin( angle ); |
627 | return QPoint( nx, ny ); | 628 | return QPoint( nx, ny ); |
628 | } | 629 | } |
629 | 630 | ||
630 | void Clock::slotAdjustTime() | 631 | void Clock::slotAdjustTime() |
631 | { | 632 | { |
632 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 633 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
633 | e << QString( "systemtime" ); | 634 | e << QString( "systemtime" ); |
634 | } | 635 | } |
635 | 636 | ||
636 | void Clock::slotStartTimer() | 637 | void Clock::slotStartTimer() |
637 | { | 638 | { |
638 | if ( clockRB->isChecked() ) | 639 | if ( clockRB->isChecked() ) |
639 | setSwatchMode( 1); | 640 | setSwatchMode( 1); |
640 | startSWatch(); | 641 | startSWatch(); |
641 | } | 642 | } |
642 | 643 | ||
643 | void Clock::slotStopTimer() | 644 | void Clock::slotStopTimer() |
644 | { | 645 | { |
645 | if ( clockRB->isChecked() ) | 646 | if ( clockRB->isChecked() ) |
646 | setSwatchMode( 1); | 647 | setSwatchMode( 1); |
647 | stopSWatch(); | 648 | stopSWatch(); |
648 | } | 649 | } |
649 | 650 | ||
650 | void Clock::slotResetTimer() | 651 | void Clock::slotResetTimer() |
651 | { | 652 | { |
652 | if ( clockRB->isChecked() ) | 653 | if ( clockRB->isChecked() ) |
653 | setSwatchMode( 1); | 654 | setSwatchMode( 1); |
654 | slotReset(); | 655 | slotReset(); |
655 | } | 656 | } |
656 | 657 | ||
657 | void Clock::setSwatchMode(int mode) | 658 | void Clock::setSwatchMode(int mode) |
658 | { | 659 | { |
659 | qDebug("Clock::setSwatchMode( %d)", mode); | 660 | qDebug("Clock::setSwatchMode( %d)", mode); |
660 | swatchRB->setChecked( mode); | 661 | swatchRB->setChecked( mode); |
661 | clearClock( ); | 662 | clearClock( ); |
662 | modeSelect( mode ); | 663 | modeSelect( mode ); |
663 | } | 664 | } |
diff --git a/noncore/tools/clock/main.cpp b/noncore/tools/clock/main.cpp index 89dd1bd..237d9f0 100644 --- a/noncore/tools/clock/main.cpp +++ b/noncore/tools/clock/main.cpp | |||
@@ -1,26 +1,28 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "clock.h" | 21 | #include "clock.h" |
22 | 22 | ||
23 | #include <opie2/oapplicationfactory.h> | 23 | #include <opie2/oapplicationfactory.h> |
24 | 24 | ||
25 | 25 | ||
26 | using namespace Opie::Core; | ||
27 | using namespace Opie::Core; | ||
26 | OPIE_EXPORT_APP( OApplicationFactory<Clock> ) | 28 | OPIE_EXPORT_APP( OApplicationFactory<Clock> ) |
diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp index 6fec5a0..9d5fc49 100644 --- a/noncore/tools/clock/setAlarm.cpp +++ b/noncore/tools/clock/setAlarm.cpp | |||
@@ -1,223 +1,224 @@ | |||
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 <opie2/ofileselector.h> | 17 | #include <opie2/ofileselector.h> |
18 | #include <opie2/ofiledialog.h> | 18 | #include <opie2/ofiledialog.h> |
19 | 19 | ||
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qlcdnumber.h> | 24 | #include <qlcdnumber.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qradiobutton.h> | 26 | #include <qradiobutton.h> |
27 | #include <qslider.h> | 27 | #include <qslider.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qvariant.h> | 29 | #include <qvariant.h> |
30 | #include <qtooltip.h> | 30 | #include <qtooltip.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #include <qbuttongroup.h> | 32 | #include <qbuttongroup.h> |
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | 34 | ||
35 | using namespace Opie::Ui; | ||
35 | Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) | 36 | Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) |
36 | : QDialog( parent, name, modal, fl ) | 37 | : QDialog( parent, name, modal, fl ) |
37 | { | 38 | { |
38 | if ( !name ) | 39 | if ( !name ) |
39 | setName( "Set_Alarm" ); | 40 | setName( "Set_Alarm" ); |
40 | resize( 240, 101 ); | 41 | resize( 240, 101 ); |
41 | setMaximumSize( QSize( 240, 320 ) ); | 42 | setMaximumSize( QSize( 240, 320 ) ); |
42 | move(0,45); | 43 | move(0,45); |
43 | setCaption( tr( "Set Alarm" ) ); | 44 | setCaption( tr( "Set Alarm" ) ); |
44 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 45 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
45 | 46 | ||
46 | Set_AlarmLayout = new QGridLayout( this ); | 47 | Set_AlarmLayout = new QGridLayout( this ); |
47 | Set_AlarmLayout->setSpacing( 6 ); | 48 | Set_AlarmLayout->setSpacing( 6 ); |
48 | Set_AlarmLayout->setMargin( 11 ); | 49 | Set_AlarmLayout->setMargin( 11 ); |
49 | 50 | ||
50 | TextLabel1 = new QLabel( this, "TextLabel1" ); | 51 | TextLabel1 = new QLabel( this, "TextLabel1" ); |
51 | TextLabel1->setText( tr( "Hour" ) ); | 52 | TextLabel1->setText( tr( "Hour" ) ); |
52 | 53 | ||
53 | Set_AlarmLayout->addWidget( TextLabel1, 0, 0 ); | 54 | Set_AlarmLayout->addWidget( TextLabel1, 0, 0 ); |
54 | 55 | ||
55 | TextLabel2 = new QLabel( this, "TextLabel2" ); | 56 | TextLabel2 = new QLabel( this, "TextLabel2" ); |
56 | TextLabel2->setText( tr( "Minute" ) ); | 57 | TextLabel2->setText( tr( "Minute" ) ); |
57 | 58 | ||
58 | Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 ); | 59 | Set_AlarmLayout->addMultiCellWidget( TextLabel2, 0, 0, 1, 2 ); |
59 | 60 | ||
60 | Hour_Slider = new QSlider( this, "Hour_Slider" ); | 61 | Hour_Slider = new QSlider( this, "Hour_Slider" ); |
61 | Hour_Slider->setPageStep( 1); | 62 | Hour_Slider->setPageStep( 1); |
62 | Hour_Slider->setOrientation( QSlider::Horizontal ); | 63 | Hour_Slider->setOrientation( QSlider::Horizontal ); |
63 | connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int))); | 64 | connect(Hour_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeHour(int))); |
64 | 65 | ||
65 | Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 ); | 66 | Set_AlarmLayout->addWidget( Hour_Slider, 2, 0 ); |
66 | 67 | ||
67 | Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" ); | 68 | Hour_LCDNumber = new QLCDNumber( this, "Hour_LCDNumber" ); |
68 | Hour_LCDNumber->setFrameShape( QLCDNumber::Box ); | 69 | Hour_LCDNumber->setFrameShape( QLCDNumber::Box ); |
69 | Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain ); | 70 | Hour_LCDNumber->setFrameShadow( QLCDNumber::Plain ); |
70 | Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); | 71 | Hour_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); |
71 | 72 | ||
72 | Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 ); | 73 | Set_AlarmLayout->addWidget( Hour_LCDNumber, 1, 0 ); |
73 | 74 | ||
74 | Minute_Slider = new QSlider( this, "Minute_Slider" ); | 75 | Minute_Slider = new QSlider( this, "Minute_Slider" ); |
75 | Minute_Slider->setMaxValue( 59); | 76 | Minute_Slider->setMaxValue( 59); |
76 | Minute_Slider->setPageStep( 1); | 77 | Minute_Slider->setPageStep( 1); |
77 | Minute_Slider->setOrientation( QSlider::Horizontal ); | 78 | Minute_Slider->setOrientation( QSlider::Horizontal ); |
78 | connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int))); | 79 | connect(Minute_Slider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeMinute(int))); |
79 | 80 | ||
80 | Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 ); | 81 | Set_AlarmLayout->addMultiCellWidget( Minute_Slider, 2, 2, 1, 2 ); |
81 | 82 | ||
82 | Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" ); | 83 | Minute_LCDNumber = new QLCDNumber( this, "Minute_LCDNumber" ); |
83 | Minute_LCDNumber->setFrameShape( QLCDNumber::Box ); | 84 | Minute_LCDNumber->setFrameShape( QLCDNumber::Box ); |
84 | Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain ); | 85 | Minute_LCDNumber->setFrameShadow( QLCDNumber::Plain ); |
85 | Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); | 86 | Minute_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); |
86 | 87 | ||
87 | Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 ); | 88 | Set_AlarmLayout->addMultiCellWidget( Minute_LCDNumber, 1, 1, 1, 2 ); |
88 | 89 | ||
89 | Am_RadioButton = new QRadioButton( this, "Am_RadioButton" ); | 90 | Am_RadioButton = new QRadioButton( this, "Am_RadioButton" ); |
90 | Am_RadioButton->setText( tr( "AM" ) ); | 91 | Am_RadioButton->setText( tr( "AM" ) ); |
91 | Am_RadioButton->setChecked(TRUE); | 92 | Am_RadioButton->setChecked(TRUE); |
92 | connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool))); | 93 | connect( Am_RadioButton, SIGNAL(toggled(bool)),this,SLOT( amButtonToggled(bool))); |
93 | 94 | ||
94 | Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 ); | 95 | Set_AlarmLayout->addMultiCellWidget( Am_RadioButton, 0, 1, 3, 4 ); |
95 | 96 | ||
96 | 97 | ||
97 | Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" ); | 98 | Pm_RadioButton = new QRadioButton( this, "Pm_RadioButton" ); |
98 | Pm_RadioButton->setText( tr( "PM" ) ); | 99 | Pm_RadioButton->setText( tr( "PM" ) ); |
99 | connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool))); | 100 | connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool))); |
100 | 101 | ||
101 | Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); | 102 | Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); |
102 | 103 | ||
103 | useMp3Check = new QCheckBox ( tr( "mp3 alarm" ), this ); | 104 | useMp3Check = new QCheckBox ( tr( "mp3 alarm" ), this ); |
104 | useMp3Check-> setFocusPolicy ( QWidget::NoFocus ); | 105 | useMp3Check-> setFocusPolicy ( QWidget::NoFocus ); |
105 | Set_AlarmLayout->addMultiCellWidget( useMp3Check, 2, 3, 3, 4 ); | 106 | Set_AlarmLayout->addMultiCellWidget( useMp3Check, 2, 3, 3, 4 ); |
106 | 107 | ||
107 | 108 | ||
108 | 109 | ||
109 | TextLabel3 = new QLabel( this, "TextLabel3" ); | 110 | TextLabel3 = new QLabel( this, "TextLabel3" ); |
110 | TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); | 111 | TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); |
111 | 112 | ||
112 | Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 ); | 113 | Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 ); |
113 | 114 | ||
114 | Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" ); | 115 | Snooze_LCDNumber = new QLCDNumber( this, "Snooze_LCDNumber" ); |
115 | Snooze_LCDNumber->setFrameShape( QLCDNumber::Box ); | 116 | Snooze_LCDNumber->setFrameShape( QLCDNumber::Box ); |
116 | Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain ); | 117 | Snooze_LCDNumber->setFrameShadow( QLCDNumber::Plain ); |
117 | Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); | 118 | Snooze_LCDNumber->setSegmentStyle( QLCDNumber::Flat ); |
118 | 119 | ||
119 | Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 ); | 120 | Set_AlarmLayout->addMultiCellWidget( Snooze_LCDNumber, 3, 3, 1, 2 ); |
120 | 121 | ||
121 | SnoozeSlider = new QSlider( this, "SnoozeSlider" ); | 122 | SnoozeSlider = new QSlider( this, "SnoozeSlider" ); |
122 | SnoozeSlider->setMaxValue( 60 ); | 123 | SnoozeSlider->setMaxValue( 60 ); |
123 | SnoozeSlider->setOrientation( QSlider::Horizontal ); | 124 | SnoozeSlider->setOrientation( QSlider::Horizontal ); |
124 | connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); | 125 | connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); |
125 | 126 | ||
126 | Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 4, 4, 1, 2 ); | 127 | Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 4, 4, 1, 2 ); |
127 | 128 | ||
128 | Config config( "qpe" ); | 129 | Config config( "qpe" ); |
129 | config.setGroup("Time"); | 130 | config.setGroup("Time"); |
130 | 131 | ||
131 | bool ok; | 132 | bool ok; |
132 | bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 133 | bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
133 | QString alarmHour=config.readEntry("clockAlarmHour","8"); | 134 | QString alarmHour=config.readEntry("clockAlarmHour","8"); |
134 | int i_alarmHour = alarmHour.toInt(&ok,10); | 135 | int i_alarmHour = alarmHour.toInt(&ok,10); |
135 | QString alarmMinute=config.readEntry("clockAlarmMinute","0"); | 136 | QString alarmMinute=config.readEntry("clockAlarmMinute","0"); |
136 | QString snoozeTime=config.readEntry("clockAlarmSnooze","0"); | 137 | QString snoozeTime=config.readEntry("clockAlarmSnooze","0"); |
137 | if(ampm) { | 138 | if(ampm) { |
138 | Hour_Slider->setMaxValue( 12); | 139 | Hour_Slider->setMaxValue( 12); |
139 | Hour_Slider->setMinValue( 1); | 140 | Hour_Slider->setMinValue( 1); |
140 | 141 | ||
141 | if( i_alarmHour > 12) { | 142 | if( i_alarmHour > 12) { |
142 | i_alarmHour = i_alarmHour - 12; | 143 | i_alarmHour = i_alarmHour - 12; |
143 | Pm_RadioButton->setChecked(TRUE); | 144 | Pm_RadioButton->setChecked(TRUE); |
144 | } | 145 | } |
145 | else if ( i_alarmHour == 0 ) { | 146 | else if ( i_alarmHour == 0 ) { |
146 | i_alarmHour = 12; | 147 | i_alarmHour = 12; |
147 | } | 148 | } |
148 | Hour_Slider->setValue( i_alarmHour ); | 149 | Hour_Slider->setValue( i_alarmHour ); |
149 | Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); | 150 | Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); |
150 | SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); | 151 | SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); |
151 | } else { | 152 | } else { |
152 | Hour_Slider->setMaxValue( 23); | 153 | Hour_Slider->setMaxValue( 23); |
153 | Hour_Slider->setMinValue( 0); | 154 | Hour_Slider->setMinValue( 0); |
154 | Hour_Slider->setValue( i_alarmHour); | 155 | Hour_Slider->setValue( i_alarmHour); |
155 | Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); | 156 | Minute_Slider->setValue( alarmMinute.toInt(&ok,10) ); |
156 | SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); | 157 | SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) ); |
157 | Am_RadioButton->hide(); | 158 | Am_RadioButton->hide(); |
158 | Pm_RadioButton->hide(); | 159 | Pm_RadioButton->hide(); |
159 | } | 160 | } |
160 | if( config.readBoolEntry("mp3Alarm") ) | 161 | if( config.readBoolEntry("mp3Alarm") ) |
161 | useMp3Check->setChecked(true); | 162 | useMp3Check->setChecked(true); |
162 | 163 | ||
163 | // signals and slots connections | 164 | // signals and slots connections |
164 | connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool))); | 165 | connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool))); |
165 | } | 166 | } |
166 | 167 | ||
167 | Set_Alarm::~Set_Alarm() | 168 | Set_Alarm::~Set_Alarm() |
168 | { | 169 | { |
169 | 170 | ||
170 | } | 171 | } |
171 | 172 | ||
172 | void Set_Alarm::slotChangeHour(int hour) | 173 | void Set_Alarm::slotChangeHour(int hour) |
173 | { | 174 | { |
174 | Hour_LCDNumber->display(hour); | 175 | Hour_LCDNumber->display(hour); |
175 | } | 176 | } |
176 | 177 | ||
177 | void Set_Alarm::slotChangeMinute(int minute) | 178 | void Set_Alarm::slotChangeMinute(int minute) |
178 | { | 179 | { |
179 | Minute_LCDNumber->display(minute); | 180 | Minute_LCDNumber->display(minute); |
180 | } | 181 | } |
181 | 182 | ||
182 | void Set_Alarm::slotChangeSnooze(int minute) | 183 | void Set_Alarm::slotChangeSnooze(int minute) |
183 | { | 184 | { |
184 | Snooze_LCDNumber->display(minute); | 185 | Snooze_LCDNumber->display(minute); |
185 | } | 186 | } |
186 | 187 | ||
187 | void Set_Alarm::amButtonToggled(bool b) | 188 | void Set_Alarm::amButtonToggled(bool b) |
188 | { | 189 | { |
189 | if ( b) | 190 | if ( b) |
190 | Pm_RadioButton->setChecked(FALSE); | 191 | Pm_RadioButton->setChecked(FALSE); |
191 | } | 192 | } |
192 | 193 | ||
193 | void Set_Alarm::pmButtonToggled(bool b) | 194 | void Set_Alarm::pmButtonToggled(bool b) |
194 | { | 195 | { |
195 | if (b) | 196 | if (b) |
196 | Am_RadioButton->setChecked(FALSE); | 197 | Am_RadioButton->setChecked(FALSE); |
197 | } | 198 | } |
198 | 199 | ||
199 | void Set_Alarm::cleanUp() | 200 | void Set_Alarm::cleanUp() |
200 | { | 201 | { |
201 | } | 202 | } |
202 | 203 | ||
203 | void Set_Alarm::slotChangemp3CkeckBox(bool b) { | 204 | void Set_Alarm::slotChangemp3CkeckBox(bool b) { |
204 | Config config( "qpe" ); | 205 | Config config( "qpe" ); |
205 | config.setGroup("Time"); | 206 | config.setGroup("Time"); |
206 | if(b) { | 207 | if(b) { |
207 | QMap<QString, QStringList> map; | 208 | QMap<QString, QStringList> map; |
208 | map.insert(tr("All"), QStringList() ); | 209 | map.insert(tr("All"), QStringList() ); |
209 | QStringList text; | 210 | QStringList text; |
210 | text << "audio/*"; | 211 | text << "audio/*"; |
211 | map.insert(tr("Audio"), text ); | 212 | map.insert(tr("Audio"), text ); |
212 | QString str = Opie::OFileDialog::getOpenFileName( 2,"/", QString::null, map);//,"", "*", this ); | 213 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map);//,"", "*", this ); |
213 | // QString str = Opie::OFileDialog::getOpenFileName( 2,"/");//,"", "*", this ); | 214 | // QString str = Opie::OFileDialog::getOpenFileName( 2,"/");//,"", "*", this ); |
214 | if(!str.isEmpty() ) { | 215 | if(!str.isEmpty() ) { |
215 | qDebug(str); | 216 | qDebug(str); |
216 | config.writeEntry("mp3Alarm",1); | 217 | config.writeEntry("mp3Alarm",1); |
217 | config.writeEntry("mp3File",str); | 218 | config.writeEntry("mp3File",str); |
218 | } | 219 | } |
219 | } else { | 220 | } else { |
220 | config.writeEntry("mp3Alarm",0); | 221 | config.writeEntry("mp3Alarm",0); |
221 | config.writeEntry("mp3File",""); | 222 | config.writeEntry("mp3File",""); |
222 | } | 223 | } |
223 | } | 224 | } |
diff --git a/noncore/tools/euroconv/main.cpp b/noncore/tools/euroconv/main.cpp index b765a5e..d5f6c7f 100644 --- a/noncore/tools/euroconv/main.cpp +++ b/noncore/tools/euroconv/main.cpp | |||
@@ -1,37 +1,39 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | * | 2 | * |
3 | using namespace Opie::Core; | ||
4 | using namespace Opie::Core; | ||
3 | * File: main.cpp | 5 | * File: main.cpp |
4 | * | 6 | * |
5 | * Description: main file for OPIE Euroconv aapp | 7 | * Description: main file for OPIE Euroconv aapp |
6 | * | 8 | * |
7 | * | 9 | * |
8 | * Authors: Eric Santonacci <Eric.Santonacci@talc.fr> | 10 | * Authors: Eric Santonacci <Eric.Santonacci@talc.fr> |
9 | * | 11 | * |
10 | * Requirements: Qt | 12 | * Requirements: Qt |
11 | * | 13 | * |
12 | * | 14 | * |
13 | ***************************************************************************/ | 15 | ***************************************************************************/ |
14 | 16 | ||
15 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
16 | #include <qvbox.h> | 18 | #include <qvbox.h> |
17 | 19 | ||
18 | #include "calcdisplay.h" | 20 | #include "calcdisplay.h" |
19 | #include "calckeypad.h" | 21 | #include "calckeypad.h" |
20 | 22 | ||
21 | #include <opie/oapplicationfactory.h> | 23 | #include <opie2/oapplicationfactory.h> |
22 | 24 | ||
23 | struct Layout : QVBox{ | 25 | struct Layout : QVBox{ |
24 | static QString appName() { return QString::fromLatin1("euroconv"); } | 26 | static QString appName() { return QString::fromLatin1("euroconv"); } |
25 | Layout(QWidget *p, const char* n, WFlags) | 27 | Layout(QWidget *p, const char* n, WFlags) |
26 | :QVBox(0,"fond" ) | 28 | :QVBox(0,"fond" ) |
27 | { | 29 | { |
28 | LCDDisplay *lcd = new LCDDisplay(this, "lcd"); | 30 | LCDDisplay *lcd = new LCDDisplay(this, "lcd"); |
29 | KeyPad *num = new KeyPad(lcd, this, "keypad"); | 31 | KeyPad *num = new KeyPad(lcd, this, "keypad"); |
30 | 32 | ||
31 | setCaption( QObject::tr("Euroconv") ); | 33 | setCaption( QObject::tr("Euroconv") ); |
32 | }; | 34 | }; |
33 | 35 | ||
34 | }; | 36 | }; |
35 | 37 | ||
36 | OPIE_EXPORT_APP( OApplicationFactory<Layout> ) | 38 | OPIE_EXPORT_APP( OApplicationFactory<Layout> ) |
37 | 39 | ||
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index 77e1790..4204d73 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp | |||
@@ -1,632 +1,632 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** formatter.cpp | 2 | ** formatter.cpp |
3 | ** | 3 | ** |
4 | ** Copyright: Thu Apr 11 11:01:13 2002 | 4 | ** Copyright: Thu Apr 11 11:01:13 2002 |
5 | ** by: L. J. Potter | 5 | ** by: L. J. Potter |
6 | ** | 6 | ** |
7 | ****************************************************************************/ | 7 | ****************************************************************************/ |
8 | 8 | ||
9 | #include "formatter.h" | 9 | #include "formatter.h" |
10 | #include "inputDialog.h" | 10 | #include "inputDialog.h" |
11 | #include "output.h" | 11 | #include "output.h" |
12 | 12 | ||
13 | /* OPIE */ | 13 | /* OPIE */ |
14 | #include <qpe/qpetoolbar.h> | 14 | #include <qtoolbar.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/mimetype.h> | 18 | #include <qpe/mimetype.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/storage.h> | 20 | #include <qpe/storage.h> |
21 | 21 | ||
22 | /* QT */ | 22 | /* QT */ |
23 | #include <qmenubar.h> | 23 | #include <qmenubar.h> |
24 | #include <qmultilineedit.h> | 24 | #include <qmultilineedit.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qlist.h> | 26 | #include <qlist.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtstream.h> | 30 | #include <qtstream.h> |
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
39 | #include <qwidget.h> | 39 | #include <qwidget.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qvariant.h> | 41 | #include <qvariant.h> |
42 | 42 | ||
43 | /* STD */ | 43 | /* STD */ |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <stdio.h> | 45 | #include <stdio.h> |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <sys/vfs.h> | 47 | #include <sys/vfs.h> |
48 | #include <mntent.h> | 48 | #include <mntent.h> |
49 | #include <string.h> | 49 | #include <string.h> |
50 | #include <errno.h> | 50 | #include <errno.h> |
51 | 51 | ||
52 | #define BLANK ' ' | 52 | #define BLANK ' ' |
53 | #define DELIMITER '#' | 53 | #define DELIMITER '#' |
54 | 54 | ||
55 | /* | 55 | /* |
56 | Blah blah blah blah */ | 56 | Blah blah blah blah */ |
57 | FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool modal ) | 57 | FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool modal ) |
58 | : QMainWindow( parent, name, fl ) | 58 | : QMainWindow( parent, name, fl ) |
59 | // : QDialog( parent, name, modal, fl ) | 59 | // : QDialog( parent, name, modal, fl ) |
60 | { | 60 | { |
61 | if ( !name ) | 61 | if ( !name ) |
62 | setName( "FormatterApp" ); | 62 | setName( "FormatterApp" ); |
63 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 63 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
64 | 64 | ||
65 | setCaption( tr( "Formatter" ) ); | 65 | setCaption( tr( "Formatter" ) ); |
66 | FormatterAppLayout = new QGridLayout( this ); | 66 | FormatterAppLayout = new QGridLayout( this ); |
67 | FormatterAppLayout->setSpacing( 2); | 67 | FormatterAppLayout->setSpacing( 2); |
68 | FormatterAppLayout->setMargin( 2 ); | 68 | FormatterAppLayout->setMargin( 2 ); |
69 | 69 | ||
70 | TabWidget = new QTabWidget( this, "TabWidget" ); | 70 | TabWidget = new QTabWidget( this, "TabWidget" ); |
71 | 71 | ||
72 | tab = new QWidget( TabWidget, "tab" ); | 72 | tab = new QWidget( TabWidget, "tab" ); |
73 | tabLayout = new QGridLayout( tab ); | 73 | tabLayout = new QGridLayout( tab ); |
74 | tabLayout->setSpacing( 3); | 74 | tabLayout->setSpacing( 3); |
75 | tabLayout->setMargin( 2); | 75 | tabLayout->setMargin( 2); |
76 | 76 | ||
77 | storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); | 77 | storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); |
78 | storageComboBox->setMaximumWidth(220); | 78 | storageComboBox->setMaximumWidth(220); |
79 | 79 | ||
80 | tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1); | 80 | tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1); |
81 | 81 | ||
82 | TextLabel4 = new QLabel( tab, "TextLabel4" ); | 82 | TextLabel4 = new QLabel( tab, "TextLabel4" ); |
83 | TextLabel4->setText( tr( "Storage Type" ) ); | 83 | TextLabel4->setText( tr( "Storage Type" ) ); |
84 | 84 | ||
85 | tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1); | 85 | tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1); |
86 | 86 | ||
87 | TextLabel2 = new QLabel( tab, "TextLabel2" ); | 87 | TextLabel2 = new QLabel( tab, "TextLabel2" ); |
88 | TextLabel2->setText( tr( "File Systems" ) ); | 88 | TextLabel2->setText( tr( "File Systems" ) ); |
89 | 89 | ||
90 | tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); | 90 | tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); |
91 | 91 | ||
92 | fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); | 92 | fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); |
93 | fileSystemsCombo->setMaximumWidth(220); | 93 | fileSystemsCombo->setMaximumWidth(220); |
94 | 94 | ||
95 | tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); | 95 | tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); |
96 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); | 96 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); |
97 | tabLayout->addItem( spacer, 2, 0 ); | 97 | tabLayout->addItem( spacer, 2, 0 ); |
98 | 98 | ||
99 | formatPushButton = new QPushButton( tab, "formatPushButton" ); | 99 | formatPushButton = new QPushButton( tab, "formatPushButton" ); |
100 | formatPushButton->setText( tr( "Format" ) ); | 100 | formatPushButton->setText( tr( "Format" ) ); |
101 | formatPushButton->setMaximumWidth(170); | 101 | formatPushButton->setMaximumWidth(170); |
102 | 102 | ||
103 | tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); | 103 | tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); |
104 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); | 104 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); |
105 | tabLayout->addItem( spacer_2, 5, 0 ); | 105 | tabLayout->addItem( spacer_2, 5, 0 ); |
106 | 106 | ||
107 | TabWidget->insertTab( tab, tr( "Main" ) ); | 107 | TabWidget->insertTab( tab, tr( "Main" ) ); |
108 | 108 | ||
109 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 109 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
110 | tabLayout_2 = new QGridLayout( tab_2 ); | 110 | tabLayout_2 = new QGridLayout( tab_2 ); |
111 | tabLayout_2->setSpacing(3); | 111 | tabLayout_2->setSpacing(3); |
112 | tabLayout_2->setMargin(2); | 112 | tabLayout_2->setMargin(2); |
113 | 113 | ||
114 | mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); | 114 | mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); |
115 | 115 | ||
116 | tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); | 116 | tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); |
117 | 117 | ||
118 | deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); | 118 | deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); |
119 | 119 | ||
120 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); | 120 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); |
121 | 121 | ||
122 | TextLabel5 = new QLabel( tab_2, "TextLabel5" ); | 122 | TextLabel5 = new QLabel( tab_2, "TextLabel5" ); |
123 | TextLabel5->setText( tr( "CAUTION:\n" | 123 | TextLabel5->setText( tr( "CAUTION:\n" |
124 | "Changing parameters on this\n" | 124 | "Changing parameters on this\n" |
125 | "page may cause your system\n" | 125 | "page may cause your system\n" |
126 | "to stop functioning properly!" ) );//idiot message | 126 | "to stop functioning properly!" ) );//idiot message |
127 | 127 | ||
128 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); | 128 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); |
129 | 129 | ||
130 | editPushButton = new QPushButton( tab_2, "editPushButton" ); | 130 | editPushButton = new QPushButton( tab_2, "editPushButton" ); |
131 | editPushButton->setText( tr( "Edit fstab" ) ); | 131 | editPushButton->setText( tr( "Edit fstab" ) ); |
132 | editPushButton->setMaximumWidth(100); | 132 | editPushButton->setMaximumWidth(100); |
133 | 133 | ||
134 | tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); | 134 | tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); |
135 | 135 | ||
136 | fsckButton = new QPushButton( tab_2, "fsckPushButton" ); | 136 | fsckButton = new QPushButton( tab_2, "fsckPushButton" ); |
137 | fsckButton->setText( tr( "Check Disk" ) ); | 137 | fsckButton->setText( tr( "Check Disk" ) ); |
138 | fsckButton->setMaximumWidth(100); | 138 | fsckButton->setMaximumWidth(100); |
139 | 139 | ||
140 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); | 140 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); |
141 | 141 | ||
142 | TextLabel3 = new QLabel( tab_2, "TextLabel3" ); | 142 | TextLabel3 = new QLabel( tab_2, "TextLabel3" ); |
143 | TextLabel3->setText( tr( "Device" ) ); | 143 | TextLabel3->setText( tr( "Device" ) ); |
144 | 144 | ||
145 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); | 145 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); |
146 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 146 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
147 | tabLayout_2->addItem( spacer_3, 5, 0 ); | 147 | tabLayout_2->addItem( spacer_3, 5, 0 ); |
148 | 148 | ||
149 | TextLabel1 = new QLabel( tab_2, "TextLabel1" ); | 149 | TextLabel1 = new QLabel( tab_2, "TextLabel1" ); |
150 | TextLabel1->setText( tr( "Mount Point" ) ); | 150 | TextLabel1->setText( tr( "Mount Point" ) ); |
151 | 151 | ||
152 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); | 152 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); |
153 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 153 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
154 | tabLayout_2->addItem( spacer_4, 2, 1 ); | 154 | tabLayout_2->addItem( spacer_4, 2, 1 ); |
155 | TabWidget->insertTab( tab_2, tr( "Advanced" ) ); | 155 | TabWidget->insertTab( tab_2, tr( "Advanced" ) ); |
156 | 156 | ||
157 | FormatterAppLayout->addWidget( TabWidget, 0, 1 ); | 157 | FormatterAppLayout->addWidget( TabWidget, 0, 1 ); |
158 | 158 | ||
159 | connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); | 159 | connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); |
160 | connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); | 160 | connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); |
161 | connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); | 161 | connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); |
162 | 162 | ||
163 | connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int) )); | 163 | connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int) )); |
164 | connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int) )); | 164 | connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int) )); |
165 | connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int) )); | 165 | connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int) )); |
166 | 166 | ||
167 | 167 | ||
168 | fillCombos(); | 168 | fillCombos(); |
169 | } | 169 | } |
170 | 170 | ||
171 | FormatterApp::~FormatterApp() | 171 | FormatterApp::~FormatterApp() |
172 | {} | 172 | {} |
173 | 173 | ||
174 | void FormatterApp::doFormat() | 174 | void FormatterApp::doFormat() |
175 | { | 175 | { |
176 | int err=0; | 176 | int err=0; |
177 | Output *outDlg; | 177 | Output *outDlg; |
178 | QString umountS, remountS; | 178 | QString umountS, remountS; |
179 | QString text = storageComboBox->currentText(); | 179 | QString text = storageComboBox->currentText(); |
180 | QString currentText = storageComboBox->currentText(); | 180 | QString currentText = storageComboBox->currentText(); |
181 | QString cmd; | 181 | QString cmd; |
182 | QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); | 182 | QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); |
183 | QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); | 183 | QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); |
184 | QString fs = fileSystemsCombo->currentText(); | 184 | QString fs = fileSystemsCombo->currentText(); |
185 | 185 | ||
186 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap | 186 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap |
187 | #else | 187 | #else |
188 | currentText = diskDevice = "/dev/fd0"; | 188 | currentText = diskDevice = "/dev/fd0"; |
189 | umountS = "umount -v /floppy 2>&1"; | 189 | umountS = "umount -v /floppy 2>&1"; |
190 | remountS = "mount -v /floppy 2>&1"; | 190 | remountS = "mount -v /floppy 2>&1"; |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | if( currentText.find("CF",0,TRUE) != -1) | 193 | if( currentText.find("CF",0,TRUE) != -1) |
194 | { | 194 | { |
195 | umountS = "umount "; | 195 | umountS = "umount "; |
196 | remountS = "mount "; | 196 | remountS = "mount "; |
197 | 197 | ||
198 | // umountS = "/sbin/cardctl eject"; | 198 | // umountS = "/sbin/cardctl eject"; |
199 | // remountS = "/sbin/cardctl insert"; | 199 | // remountS = "/sbin/cardctl insert"; |
200 | } | 200 | } |
201 | if( currentText.find("SD",0,TRUE) != -1) | 201 | if( currentText.find("SD",0,TRUE) != -1) |
202 | { | 202 | { |
203 | umountS = "umount "; | 203 | umountS = "umount "; |
204 | remountS = "mount "; | 204 | remountS = "mount "; |
205 | // umountS = "/etc/sdcontrol compeject"; | 205 | // umountS = "/etc/sdcontrol compeject"; |
206 | // remountS = "/etc/sdcontrol insert"; | 206 | // remountS = "/etc/sdcontrol insert"; |
207 | } | 207 | } |
208 | 208 | ||
209 | switch ( QMessageBox::warning(this,tr("Format?") | 209 | switch ( QMessageBox::warning(this,tr("Format?") |
210 | , tr("Really format\n") +diskName+" "+ currentText + | 210 | , tr("Really format\n") +diskName+" "+ currentText + |
211 | tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) | 211 | tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) |
212 | ,tr("Yes") | 212 | ,tr("Yes") |
213 | ,tr("No") | 213 | ,tr("No") |
214 | ,0 | 214 | ,0 |
215 | ,1 | 215 | ,1 |
216 | ,1) ) | 216 | ,1) ) |
217 | { | 217 | { |
218 | case 0: | 218 | case 0: |
219 | { | 219 | { |
220 | if(fs == "vfat") | 220 | if(fs == "vfat") |
221 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; | 221 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; |
222 | else if(fs == "ext2") | 222 | else if(fs == "ext2") |
223 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; | 223 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; |
224 | else | 224 | else |
225 | { | 225 | { |
226 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); | 226 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); |
227 | break; | 227 | break; |
228 | } | 228 | } |
229 | // cmd = "ls -l"; | 229 | // cmd = "ls -l"; |
230 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 230 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
231 | QPEApplication::showDialog( outDlg); | 231 | QPEApplication::showDialog( outDlg); |
232 | qApp->processEvents(); | 232 | qApp->processEvents(); |
233 | FILE *fp; | 233 | FILE *fp; |
234 | char line[130]; | 234 | char line[130]; |
235 | 235 | ||
236 | 236 | ||
237 | outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); | 237 | outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); |
238 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 238 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
239 | 239 | ||
240 | sleep(1); | 240 | sleep(1); |
241 | qDebug("Command is "+umountS); | 241 | qDebug("Command is "+umountS); |
242 | fp = popen( (const char *) umountS, "r"); | 242 | fp = popen( (const char *) umountS, "r"); |
243 | // qDebug("%d", fp); | 243 | // qDebug("%d", fp); |
244 | if ( !fp ) | 244 | if ( !fp ) |
245 | { | 245 | { |
246 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); | 246 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); |
247 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 247 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
248 | pclose(fp); | 248 | pclose(fp); |
249 | return; | 249 | return; |
250 | } | 250 | } |
251 | else | 251 | else |
252 | { | 252 | { |
253 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 253 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
254 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 254 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
255 | while ( fgets( line, sizeof line, fp)) | 255 | while ( fgets( line, sizeof line, fp)) |
256 | { | 256 | { |
257 | if( ((QString)line).find("busy",0,TRUE) != -1) | 257 | if( ((QString)line).find("busy",0,TRUE) != -1) |
258 | { | 258 | { |
259 | qDebug("Could not find '" + umountS); | 259 | qDebug("Could not find '" + umountS); |
260 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 260 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
261 | pclose(fp); | 261 | pclose(fp); |
262 | return; | 262 | return; |
263 | } | 263 | } |
264 | else | 264 | else |
265 | { | 265 | { |
266 | QString lineStr = line; | 266 | QString lineStr = line; |
267 | lineStr=lineStr.left(lineStr.length()-1); | 267 | lineStr=lineStr.left(lineStr.length()-1); |
268 | outDlg->OutputEdit->append(lineStr); | 268 | outDlg->OutputEdit->append(lineStr); |
269 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 269 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | } | 272 | } |
273 | pclose(fp); | 273 | pclose(fp); |
274 | 274 | ||
275 | qDebug("Command would be: "+cmd); | 275 | qDebug("Command would be: "+cmd); |
276 | outDlg->OutputEdit->append( tr("Trying to format.") ); | 276 | outDlg->OutputEdit->append( tr("Trying to format.") ); |
277 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 277 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
278 | 278 | ||
279 | fp = popen( (const char *) cmd, "r"); | 279 | fp = popen( (const char *) cmd, "r"); |
280 | while ( fgets( line, sizeof line, fp)) | 280 | while ( fgets( line, sizeof line, fp)) |
281 | { | 281 | { |
282 | if( ((QString)line).find("No such device",0,TRUE) != -1) | 282 | if( ((QString)line).find("No such device",0,TRUE) != -1) |
283 | { | 283 | { |
284 | qDebug("No such device '" + umountS); | 284 | qDebug("No such device '" + umountS); |
285 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 285 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
286 | pclose(fp); | 286 | pclose(fp); |
287 | // outDlg->OutputEdit->append("No such device"); | 287 | // outDlg->OutputEdit->append("No such device"); |
288 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 288 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
289 | return; | 289 | return; |
290 | } | 290 | } |
291 | else | 291 | else |
292 | { | 292 | { |
293 | QString lineStr = line; | 293 | QString lineStr = line; |
294 | lineStr=lineStr.left(lineStr.length()-1); | 294 | lineStr=lineStr.left(lineStr.length()-1); |
295 | outDlg->OutputEdit->append(lineStr); | 295 | outDlg->OutputEdit->append(lineStr); |
296 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 296 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 299 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
300 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 300 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
301 | pclose(fp); | 301 | pclose(fp); |
302 | 302 | ||
303 | outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); | 303 | outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); |
304 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 304 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
305 | fp = popen( (const char *) remountS, "r"); | 305 | fp = popen( (const char *) remountS, "r"); |
306 | if ( !fp) | 306 | if ( !fp) |
307 | { | 307 | { |
308 | qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); | 308 | qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); |
309 | QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); | 309 | QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); |
310 | 310 | ||
311 | } | 311 | } |
312 | else | 312 | else |
313 | { | 313 | { |
314 | outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); | 314 | outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); |
315 | while ( fgets( line, sizeof line, fp)) | 315 | while ( fgets( line, sizeof line, fp)) |
316 | { | 316 | { |
317 | QString lineStr = line; | 317 | QString lineStr = line; |
318 | lineStr=lineStr.left(lineStr.length()-1); | 318 | lineStr=lineStr.left(lineStr.length()-1); |
319 | outDlg->OutputEdit->append(lineStr); | 319 | outDlg->OutputEdit->append(lineStr); |
320 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 320 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | pclose(fp); | 323 | pclose(fp); |
324 | sleep(1); | 324 | sleep(1); |
325 | 325 | ||
326 | outDlg->OutputEdit->append(tr("You can now close the output window.")); | 326 | outDlg->OutputEdit->append(tr("You can now close the output window.")); |
327 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 327 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
328 | // outDlg->close(); | 328 | // outDlg->close(); |
329 | // if(outDlg) | 329 | // if(outDlg) |
330 | // delete outDlg; | 330 | // delete outDlg; |
331 | } | 331 | } |
332 | break; | 332 | break; |
333 | }; | 333 | }; |
334 | } | 334 | } |
335 | 335 | ||
336 | bool FormatterApp::doFdisk() | 336 | bool FormatterApp::doFdisk() |
337 | { | 337 | { |
338 | return FALSE; | 338 | return FALSE; |
339 | 339 | ||
340 | } | 340 | } |
341 | 341 | ||
342 | void FormatterApp::fillCombos() | 342 | void FormatterApp::fillCombos() |
343 | { | 343 | { |
344 | 344 | ||
345 | StorageInfo storageInfo; | 345 | StorageInfo storageInfo; |
346 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 346 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
347 | QListIterator<FileSystem> it ( fs ); | 347 | QListIterator<FileSystem> it ( fs ); |
348 | QString storage; | 348 | QString storage; |
349 | for( ; it.current(); ++it ) | 349 | for( ; it.current(); ++it ) |
350 | { | 350 | { |
351 | const QString name = (*it)->name(); | 351 | const QString name = (*it)->name(); |
352 | const QString path = (*it)->path(); | 352 | const QString path = (*it)->path(); |
353 | const QString disk = (*it)->disk(); | 353 | const QString disk = (*it)->disk(); |
354 | const QString options = (*it)->options(); | 354 | const QString options = (*it)->options(); |
355 | if( name.find( tr("Internal"),0,TRUE) == -1) | 355 | if( name.find( tr("Internal"),0,TRUE) == -1) |
356 | { | 356 | { |
357 | storageComboBox->insertItem(name +" -> "+disk); | 357 | storageComboBox->insertItem(name +" -> "+disk); |
358 | } | 358 | } |
359 | // deviceComboBox->insertItem(disk); | 359 | // deviceComboBox->insertItem(disk); |
360 | } | 360 | } |
361 | parsetab("/etc/mtab"); | 361 | parsetab("/etc/mtab"); |
362 | // parsetab("/etc/fstab"); | 362 | // parsetab("/etc/fstab"); |
363 | fileSystemsCombo->insertStringList( fsList,-1); | 363 | fileSystemsCombo->insertStringList( fsList,-1); |
364 | deviceComboBox->insertStringList( deviceList,-1); | 364 | deviceComboBox->insertStringList( deviceList,-1); |
365 | storageComboSelected(0); | 365 | storageComboSelected(0); |
366 | deviceComboSelected(0); | 366 | deviceComboSelected(0); |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | void FormatterApp::fsComboSelected(int ) | 370 | void FormatterApp::fsComboSelected(int ) |
371 | {} | 371 | {} |
372 | 372 | ||
373 | void FormatterApp::storageComboSelected(int index ) | 373 | void FormatterApp::storageComboSelected(int index ) |
374 | { | 374 | { |
375 | 375 | ||
376 | QString currentText = storageComboBox->text(index); | 376 | QString currentText = storageComboBox->text(index); |
377 | QString nameS = currentText.left( currentText.find("->",0,TRUE)); | 377 | QString nameS = currentText.left( currentText.find("->",0,TRUE)); |
378 | 378 | ||
379 | TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); | 379 | TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); |
380 | currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); | 380 | currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); |
381 | 381 | ||
382 | QString fsType = getFileSystemType((const QString &) currentText); | 382 | QString fsType = getFileSystemType((const QString &) currentText); |
383 | // qDebug(fsType); | 383 | // qDebug(fsType); |
384 | for(int i = 0; i < fileSystemsCombo->count(); i++) | 384 | for(int i = 0; i < fileSystemsCombo->count(); i++) |
385 | { | 385 | { |
386 | if( fsType == fileSystemsCombo->text(i)) | 386 | if( fsType == fileSystemsCombo->text(i)) |
387 | fileSystemsCombo->setCurrentItem(i); | 387 | fileSystemsCombo->setCurrentItem(i); |
388 | } | 388 | } |
389 | // deviceComboSelected(index); | 389 | // deviceComboSelected(index); |
390 | } | 390 | } |
391 | 391 | ||
392 | void FormatterApp::deviceComboSelected(int index) | 392 | void FormatterApp::deviceComboSelected(int index) |
393 | { | 393 | { |
394 | 394 | ||
395 | StorageInfo storageInfo; | 395 | StorageInfo storageInfo; |
396 | QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; | 396 | QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; |
397 | 397 | ||
398 | selectedText = deviceComboBox->text(index); | 398 | selectedText = deviceComboBox->text(index); |
399 | 399 | ||
400 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 400 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
401 | QListIterator<FileSystem> it ( fs ); | 401 | QListIterator<FileSystem> it ( fs ); |
402 | QString storage; | 402 | QString storage; |
403 | for( ; it.current(); ++it ) | 403 | for( ; it.current(); ++it ) |
404 | { | 404 | { |
405 | const QString name = (*it)->name(); | 405 | const QString name = (*it)->name(); |
406 | const QString path = (*it)->path(); | 406 | const QString path = (*it)->path(); |
407 | const QString disk = (*it)->disk(); | 407 | const QString disk = (*it)->disk(); |
408 | // const QString options = (*it)->options(); | 408 | // const QString options = (*it)->options(); |
409 | if( selectedText == disk) | 409 | if( selectedText == disk) |
410 | { | 410 | { |
411 | diskS = disk; nameS= name; | 411 | diskS = disk; nameS= name; |
412 | mountPointLineEdit->setText(path); | 412 | mountPointLineEdit->setText(path); |
413 | long mult = (*it)->blockSize() / 1024; | 413 | long mult = (*it)->blockSize() / 1024; |
414 | long div = 1024 / (*it)->blockSize(); | 414 | long div = 1024 / (*it)->blockSize(); |
415 | if ( !mult ) mult = 1; | 415 | if ( !mult ) mult = 1; |
416 | if ( !div ) div = 1; | 416 | if ( !div ) div = 1; |
417 | long total = (*it)->totalBlocks() * mult / div; | 417 | long total = (*it)->totalBlocks() * mult / div; |
418 | long totalMb = total/1024; | 418 | long totalMb = total/1024; |
419 | long avail = (*it)->availBlocks() * mult / div; | 419 | long avail = (*it)->availBlocks() * mult / div; |
420 | long availMb = avail/1024; | 420 | long availMb = avail/1024; |
421 | long used = total - avail; | 421 | long used = total - avail; |
422 | long usedMb = used/1024; | 422 | long usedMb = used/1024; |
423 | totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); | 423 | totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); |
424 | usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); | 424 | usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); |
425 | avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); | 425 | avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | fsType = getFileSystemType((const QString &)selectedText); | 428 | fsType = getFileSystemType((const QString &)selectedText); |
429 | 429 | ||
430 | TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); | 430 | TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); |
431 | TextLabel5->setTextFormat( Qt::RichText ); | 431 | TextLabel5->setTextFormat( Qt::RichText ); |
432 | // storageComboSelected(0); | 432 | // storageComboSelected(0); |
433 | } | 433 | } |
434 | 434 | ||
435 | void FormatterApp::cleanUp() | 435 | void FormatterApp::cleanUp() |
436 | {} | 436 | {} |
437 | 437 | ||
438 | 438 | ||
439 | void FormatterApp::editFstab() | 439 | void FormatterApp::editFstab() |
440 | { | 440 | { |
441 | QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); | 441 | QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); |
442 | e << (const QString &)"/etc/fstab"; | 442 | e << (const QString &)"/etc/fstab"; |
443 | } | 443 | } |
444 | 444 | ||
445 | void FormatterApp::parsetab(const QString &fileName) | 445 | void FormatterApp::parsetab(const QString &fileName) |
446 | { | 446 | { |
447 | 447 | ||
448 | fileSystemTypeList.clear(); | 448 | fileSystemTypeList.clear(); |
449 | fsList.clear(); | 449 | fsList.clear(); |
450 | struct mntent *me; | 450 | struct mntent *me; |
451 | // if(fileName == "/etc/mtab") { | 451 | // if(fileName == "/etc/mtab") { |
452 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 452 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
453 | if ( mntfp ) | 453 | if ( mntfp ) |
454 | { | 454 | { |
455 | while ( (me = getmntent( mntfp )) != 0 ) | 455 | while ( (me = getmntent( mntfp )) != 0 ) |
456 | { | 456 | { |
457 | QString deviceName = me->mnt_fsname; | 457 | QString deviceName = me->mnt_fsname; |
458 | QString filesystemType = me->mnt_type; | 458 | QString filesystemType = me->mnt_type; |
459 | if(deviceName != "none") | 459 | if(deviceName != "none") |
460 | { | 460 | { |
461 | if( fsList.contains(filesystemType) == 0 | 461 | if( fsList.contains(filesystemType) == 0 |
462 | & filesystemType.find("proc",0,TRUE) == -1 | 462 | & filesystemType.find("proc",0,TRUE) == -1 |
463 | & filesystemType.find("cramfs",0,TRUE) == -1 | 463 | & filesystemType.find("cramfs",0,TRUE) == -1 |
464 | & filesystemType.find("auto",0,TRUE) == -1) | 464 | & filesystemType.find("auto",0,TRUE) == -1) |
465 | fsList << filesystemType; | 465 | fsList << filesystemType; |
466 | deviceList << deviceName; | 466 | deviceList << deviceName; |
467 | qDebug(deviceName+"::"+filesystemType); | 467 | qDebug(deviceName+"::"+filesystemType); |
468 | fileSystemTypeList << deviceName+"::"+filesystemType; | 468 | fileSystemTypeList << deviceName+"::"+filesystemType; |
469 | } | 469 | } |
470 | } | 470 | } |
471 | } | 471 | } |
472 | endmntent( mntfp ); | 472 | endmntent( mntfp ); |
473 | // } else if(fileName == "/etc/fstab") { | 473 | // } else if(fileName == "/etc/fstab") { |
474 | // QFile f("/etc/fstab"); | 474 | // QFile f("/etc/fstab"); |
475 | // if ( f.open(IO_ReadOnly) ) { | 475 | // if ( f.open(IO_ReadOnly) ) { |
476 | // QTextStream t (&f); | 476 | // QTextStream t (&f); |
477 | // QString s; | 477 | // QString s; |
478 | // while (! t.eof()) { | 478 | // while (! t.eof()) { |
479 | // s=t.readLine(); | 479 | // s=t.readLine(); |
480 | // s=s.simplifyWhiteSpace(); | 480 | // s=s.simplifyWhiteSpace(); |
481 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { | 481 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { |
482 | // // = me->mnt_fsname; | 482 | // // = me->mnt_fsname; |
483 | // QString filesystemType = me->mnt_type; | 483 | // QString filesystemType = me->mnt_type; |
484 | // QString deviceName = s.left(0,s.find(BLANK) ); | 484 | // QString deviceName = s.left(0,s.find(BLANK) ); |
485 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename | 485 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename |
486 | 486 | ||
487 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint | 487 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint |
488 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); | 488 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); |
489 | // s=s.remove(0,s.find(BLANK)+1 ); // fs | 489 | // s=s.remove(0,s.find(BLANK)+1 ); // fs |
490 | // QString filesystemType= s.left(0,s.find(BLANK) ); | 490 | // QString filesystemType= s.left(0,s.find(BLANK) ); |
491 | // } | 491 | // } |
492 | // } | 492 | // } |
493 | // } | 493 | // } |
494 | // f.close(); | 494 | // f.close(); |
495 | // } | 495 | // } |
496 | } | 496 | } |
497 | 497 | ||
498 | QString FormatterApp::getFileSystemType(const QString ¤tText) | 498 | QString FormatterApp::getFileSystemType(const QString ¤tText) |
499 | { | 499 | { |
500 | 500 | ||
501 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 501 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
502 | 502 | ||
503 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) | 503 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) |
504 | { | 504 | { |
505 | QString temp = (*it); | 505 | QString temp = (*it); |
506 | if( temp.find( currentText,0,TRUE) != -1) | 506 | if( temp.find( currentText,0,TRUE) != -1) |
507 | { | 507 | { |
508 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 508 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
509 | // qDebug(fsType); | 509 | // qDebug(fsType); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | return ""; | 512 | return ""; |
513 | } | 513 | } |
514 | 514 | ||
515 | bool FormatterApp::doFsck() | 515 | bool FormatterApp::doFsck() |
516 | { | 516 | { |
517 | 517 | ||
518 | Output *outDlg; | 518 | Output *outDlg; |
519 | QString selectedDevice; | 519 | QString selectedDevice; |
520 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 520 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
521 | selectedDevice = deviceComboBox->currentText(); | 521 | selectedDevice = deviceComboBox->currentText(); |
522 | QString mountPoint = mountPointLineEdit->text(); | 522 | QString mountPoint = mountPointLineEdit->text(); |
523 | QString umountS = "umount -v "+mountPoint+" 2>&1"; | 523 | QString umountS = "umount -v "+mountPoint+" 2>&1"; |
524 | QString remountS = "mount -v "+mountPoint+" 2>&1"; | 524 | QString remountS = "mount -v "+mountPoint+" 2>&1"; |
525 | // #else | 525 | // #else |
526 | // // for testing | 526 | // // for testing |
527 | // // currentText = diskDevice = "/dev/fd0"; | 527 | // // currentText = diskDevice = "/dev/fd0"; |
528 | // QString umountS = "umount -v /floppy 2>&1"; | 528 | // QString umountS = "umount -v /floppy 2>&1"; |
529 | // QString remountS = "mount -v /floppy 2>&1"; | 529 | // QString remountS = "mount -v /floppy 2>&1"; |
530 | // selectedDevice ="/dev/fd0"; | 530 | // selectedDevice ="/dev/fd0"; |
531 | 531 | ||
532 | // #endif | 532 | // #endif |
533 | 533 | ||
534 | QString fsType = getFileSystemType((const QString &)selectedDevice); | 534 | QString fsType = getFileSystemType((const QString &)selectedDevice); |
535 | QString cmd; | 535 | QString cmd; |
536 | qDebug( selectedDevice +" "+ fsType); | 536 | qDebug( selectedDevice +" "+ fsType); |
537 | if(fsType == "vfat") cmd = "dosfsck -vy "; | 537 | if(fsType == "vfat") cmd = "dosfsck -vy "; |
538 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; | 538 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; |
539 | cmd += selectedDevice + " 2>&1"; | 539 | cmd += selectedDevice + " 2>&1"; |
540 | 540 | ||
541 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 541 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
542 | QPEApplication::showDialog( outDlg ); | 542 | QPEApplication::showDialog( outDlg ); |
543 | qApp->processEvents(); | 543 | qApp->processEvents(); |
544 | FILE *fp; | 544 | FILE *fp; |
545 | char line[130]; | 545 | char line[130]; |
546 | outDlg->OutputEdit->append( tr("Trying to umount.")); | 546 | outDlg->OutputEdit->append( tr("Trying to umount.")); |
547 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 547 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
548 | 548 | ||
549 | sleep(1); | 549 | sleep(1); |
550 | // qDebug("Command is "+umountS); | 550 | // qDebug("Command is "+umountS); |
551 | fp = popen( (const char *) umountS, "r"); | 551 | fp = popen( (const char *) umountS, "r"); |
552 | // qDebug("%d", fp); | 552 | // qDebug("%d", fp); |
553 | if ( !fp ) | 553 | if ( !fp ) |
554 | { | 554 | { |
555 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); | 555 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); |
556 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 556 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
557 | pclose(fp); | 557 | pclose(fp); |
558 | return false; | 558 | return false; |
559 | } | 559 | } |
560 | else | 560 | else |
561 | { | 561 | { |
562 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 562 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
563 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 563 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
564 | while ( fgets( line, sizeof line, fp)) | 564 | while ( fgets( line, sizeof line, fp)) |
565 | { | 565 | { |
566 | if( ((QString)line).find("busy",0,TRUE) != -1) | 566 | if( ((QString)line).find("busy",0,TRUE) != -1) |
567 | { | 567 | { |
568 | qDebug("Could not find '" + umountS); | 568 | qDebug("Could not find '" + umountS); |
569 | QMessageBox::warning( this, tr("Formatter"), | 569 | QMessageBox::warning( this, tr("Formatter"), |
570 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 570 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
571 | pclose(fp); | 571 | pclose(fp); |
572 | return false; | 572 | return false; |
573 | } | 573 | } |
574 | else | 574 | else |
575 | { | 575 | { |
576 | QString lineStr = line; | 576 | QString lineStr = line; |
577 | lineStr=lineStr.left(lineStr.length()-1); | 577 | lineStr=lineStr.left(lineStr.length()-1); |
578 | outDlg->OutputEdit->append(lineStr); | 578 | outDlg->OutputEdit->append(lineStr); |
579 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 579 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
580 | } | 580 | } |
581 | } | 581 | } |
582 | } | 582 | } |
583 | pclose(fp); | 583 | pclose(fp); |
584 | ///////////////////////////////////// | 584 | ///////////////////////////////////// |
585 | fp = popen( (const char *) cmd, "r"); | 585 | fp = popen( (const char *) cmd, "r"); |
586 | while ( fgets( line, sizeof line, fp)) | 586 | while ( fgets( line, sizeof line, fp)) |
587 | { | 587 | { |
588 | if( ((QString)line).find("No such device",0,TRUE) != -1) | 588 | if( ((QString)line).find("No such device",0,TRUE) != -1) |
589 | { | 589 | { |
590 | qDebug("No such device '" + umountS); | 590 | qDebug("No such device '" + umountS); |
591 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 591 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
592 | pclose(fp); | 592 | pclose(fp); |
593 | // outDlg->OutputEdit->append("No such device"); | 593 | // outDlg->OutputEdit->append("No such device"); |
594 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 594 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
595 | return false; | 595 | return false; |
596 | } | 596 | } |
597 | else | 597 | else |
598 | { | 598 | { |
599 | QString lineStr = line; | 599 | QString lineStr = line; |
600 | lineStr=lineStr.left(lineStr.length()-1); | 600 | lineStr=lineStr.left(lineStr.length()-1); |
601 | outDlg->OutputEdit->append(lineStr); | 601 | outDlg->OutputEdit->append(lineStr); |
602 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 602 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
603 | } | 603 | } |
604 | } | 604 | } |
605 | outDlg->OutputEdit->append(tr("You can now close the output window.")); | 605 | outDlg->OutputEdit->append(tr("You can now close the output window.")); |
606 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 606 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
607 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 607 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
608 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 608 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
609 | pclose(fp); | 609 | pclose(fp); |
610 | 610 | ||
611 | ///////////////////////////////////////// | 611 | ///////////////////////////////////////// |
612 | 612 | ||
613 | return true; | 613 | return true; |
614 | } | 614 | } |
615 | 615 | ||
616 | bool FormatterApp::doFsckCheck() | 616 | bool FormatterApp::doFsckCheck() |
617 | { | 617 | { |
618 | 618 | ||
619 | return FALSE; | 619 | return FALSE; |
620 | } | 620 | } |
621 | 621 | ||
622 | int FormatterApp::formatCheck(const QString &) | 622 | int FormatterApp::formatCheck(const QString &) |
623 | { | 623 | { |
624 | 624 | ||
625 | return -1; | 625 | return -1; |
626 | } | 626 | } |
627 | 627 | ||
628 | int FormatterApp::runCommand(const QString &) | 628 | int FormatterApp::runCommand(const QString &) |
629 | { | 629 | { |
630 | 630 | ||
631 | return -1; | 631 | return -1; |
632 | } | 632 | } |
diff --git a/noncore/tools/formatter/main.cpp b/noncore/tools/formatter/main.cpp index bdd4a2c..d47479e 100644 --- a/noncore/tools/formatter/main.cpp +++ b/noncore/tools/formatter/main.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | 1 | ||
2 | /*************************************************************************** | 2 | /*************************************************************************** |
3 | |||
3 | main.cpp - description | 4 | main.cpp - description |
4 | ------------------- | 5 | ------------------- |
5 | begin : March 10, 2002 | 6 | begin : March 10, 2002 |
6 | copyright : (C) 2002 by llornkcor | 7 | copyright : (C) 2002 by llornkcor |
7 | email : ljp@llornkcor.com | 8 | email : ljp@llornkcor.com |
8 | * 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 * |
9 | * 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 * |
10 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
11 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
12 | ***************************************************************************/ | 13 | ***************************************************************************/ |
13 | 14 | ||
14 | #include "formatter.h" | 15 | #include "formatter.h" |
15 | 16 | ||
16 | #include <opie2/oapplicationfactory.h> | 17 | #include <opie2/oapplicationfactory.h> |
17 | 18 | ||
19 | using namespace Opie::Core; | ||
18 | OPIE_EXPORT_APP( OApplicationFactory<FormatterApp> ) | 20 | OPIE_EXPORT_APP( OApplicationFactory<FormatterApp> ) |
diff --git a/noncore/tools/opie-sh/config.in b/noncore/tools/opie-sh/config.in index 614ac8b..b3ca373 100644 --- a/noncore/tools/opie-sh/config.in +++ b/noncore/tools/opie-sh/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OPIE-SH | 1 | config OPIE-SH |
2 | boolean "opie-sh (qdialog frontend allows you to write dialogs from shell scripts)" | 2 | boolean "opie-sh (qdialog frontend allows you to write dialogs from shell scripts)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) |
diff --git a/noncore/tools/remote/config.in b/noncore/tools/remote/config.in index 3b70590..2a42c58 100644 --- a/noncore/tools/remote/config.in +++ b/noncore/tools/remote/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config REMOTE | 1 | config REMOTE |
2 | boolean "opie-remote (remote control using irda, frontent to lirc)" | 2 | boolean "opie-remote (remote control using irda, frontent to lirc)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2 |
diff --git a/noncore/tools/remote/recorddialog.cpp b/noncore/tools/remote/recorddialog.cpp index 1ce5472..a9c4c61 100644 --- a/noncore/tools/remote/recorddialog.cpp +++ b/noncore/tools/remote/recorddialog.cpp | |||
@@ -1,82 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "recorddialog.h" | 17 | #include "recorddialog.h" |
18 | 18 | ||
19 | using namespace Opie::Core; | ||
20 | using namespace Opie::Core; | ||
19 | RecordDialog::RecordDialog(QWidget *parent, const char *name) | 21 | RecordDialog::RecordDialog(QWidget *parent, const char *name) |
20 | :QDialog(parent, name) | 22 | :QDialog(parent, name) |
21 | { | 23 | { |
22 | QVBoxLayout *layout = new QVBoxLayout(this); | 24 | QVBoxLayout *layout = new QVBoxLayout(this); |
23 | QHBoxLayout *hlayout = new QHBoxLayout(this); | 25 | QHBoxLayout *hlayout = new QHBoxLayout(this); |
24 | 26 | ||
25 | layout->insertSpacing(0,5); | 27 | layout->insertSpacing(0,5); |
26 | output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output"); | 28 | output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output"); |
27 | layout->insertWidget(-1, output); | 29 | layout->insertWidget(-1, output); |
28 | layout->insertSpacing(-1, 5); | 30 | layout->insertSpacing(-1, 5); |
29 | layout->insertLayout(-1, hlayout); | 31 | layout->insertLayout(-1, hlayout); |
30 | layout->insertSpacing(-1, 5); | 32 | layout->insertSpacing(-1, 5); |
31 | 33 | ||
32 | hlayout->insertSpacing(0, 5); | 34 | hlayout->insertSpacing(0, 5); |
33 | input = new QLineEdit(this, "input"); | 35 | input = new QLineEdit(this, "input"); |
34 | hlayout->insertWidget(-1, input, 1); | 36 | hlayout->insertWidget(-1, input, 1); |
35 | hlayout->insertSpacing(-1, 5); | 37 | hlayout->insertSpacing(-1, 5); |
36 | 38 | ||
37 | QPushButton *ret = new QPushButton("Return", this, "return"); | 39 | QPushButton *ret = new QPushButton("Return", this, "return"); |
38 | hlayout->insertWidget(-1, ret); | 40 | hlayout->insertWidget(-1, ret); |
39 | hlayout->insertSpacing(-1, 5); | 41 | hlayout->insertSpacing(-1, 5); |
40 | connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) ); | 42 | connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) ); |
41 | where = 0; | 43 | where = 0; |
42 | 44 | ||
43 | record = new OProcess; | 45 | record = new OProcess; |
44 | } | 46 | } |
45 | 47 | ||
46 | void RecordDialog::retPressed() | 48 | void RecordDialog::retPressed() |
47 | { | 49 | { |
48 | printf("RecordDialog::retPressed: ret pressed\n"); | 50 | printf("RecordDialog::retPressed: ret pressed\n"); |
49 | 51 | ||
50 | if(where == 0) | 52 | if(where == 0) |
51 | { | 53 | { |
52 | connect(record, SIGNAL(receivedStdout(OProcess*,char*,int)), this, SLOT(incoming(OProcess*,char*,int)) ); | 54 | connect(record, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), this, SLOT(incoming(Opie::Core::OProcess*,char*,int)) ); |
53 | connect(record, SIGNAL(receivedStderr(OProcess*,char*,int)), this, SLOT(incoming(OProcess*,char*,int)) ); | 55 | connect(record, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT(incoming(Opie::Core::OProcess*,char*,int)) ); |
54 | connect(record, SIGNAL(processExited(OProcess*)), this, SLOT(done(OProcess*)) ); | 56 | connect(record, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT(done(Opie::Core::OProcess*)) ); |
55 | printf("RecordDialog::retPressed: starting irrecord\n"); | 57 | printf("RecordDialog::retPressed: starting irrecord\n"); |
56 | QString file = "/tmp/" + input->text(); | 58 | QString file = "/tmp/" + input->text(); |
57 | *record<<"irrecord"<<file.latin1(); | 59 | *record<<"irrecord"<<file.latin1(); |
58 | if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput)) | 60 | if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput)) |
59 | { | 61 | { |
60 | QMessageBox *mb = new QMessageBox("Error!", | 62 | QMessageBox *mb = new QMessageBox("Error!", |
61 | "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord", | 63 | "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord", |
62 | QMessageBox::NoIcon, | 64 | QMessageBox::NoIcon, |
63 | QMessageBox::Ok, | 65 | QMessageBox::Ok, |
64 | QMessageBox::NoButton, | 66 | QMessageBox::NoButton, |
65 | QMessageBox::NoButton); | 67 | QMessageBox::NoButton); |
66 | mb->exec(); | 68 | mb->exec(); |
67 | return; | 69 | return; |
68 | } | 70 | } |
69 | // record->resume(); | 71 | // record->resume(); |
70 | where = 1; | 72 | where = 1; |
71 | } | 73 | } |
72 | } | 74 | } |
73 | 75 | ||
74 | void RecordDialog::incoming(OProcess *proc, char *buffer, int len) | 76 | void RecordDialog::incoming(OProcess *proc, char *buffer, int len) |
75 | { | 77 | { |
76 | //output->setText(output->text() + QString(buffer).truncate(len-1)); | 78 | //output->setText(output->text() + QString(buffer).truncate(len-1)); |
77 | printf("RecordDialog::incoming: got text from irrecord\n"); | 79 | printf("RecordDialog::incoming: got text from irrecord\n"); |
78 | } | 80 | } |
79 | 81 | ||
80 | void RecordDialog::done(OProcess *proc) | 82 | void RecordDialog::done(OProcess *proc) |
81 | { | 83 | { |
82 | } | 84 | } |
diff --git a/noncore/tools/remote/recorddialog.h b/noncore/tools/remote/recorddialog.h index e4dcae6..46a82ce 100644 --- a/noncore/tools/remote/recorddialog.h +++ b/noncore/tools/remote/recorddialog.h | |||
@@ -1,49 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef RecordDialog_H | 17 | #ifndef RecordDialog_H |
18 | #define RecordDialog_H | 18 | #define RecordDialog_H |
19 | 19 | ||
20 | #include <qdialog.h> | 20 | #include <qdialog.h> |
21 | #include <qtextview.h> | 21 | #include <qtextview.h> |
22 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
27 | 27 | ||
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | 29 | ||
30 | #include <opie/oprocess.h> | 30 | #include <opie2/oprocess.h> |
31 | 31 | ||
32 | class RecordDialog : public QDialog | 32 | class RecordDialog : public QDialog |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | RecordDialog(QWidget *parent=0, const char *name=0); | 36 | RecordDialog(QWidget *parent=0, const char *name=0); |
37 | public slots: | 37 | public slots: |
38 | void retPressed(); | 38 | void retPressed(); |
39 | void incoming(OProcess *proc, char *buffer, int len); | 39 | void incoming(Opie::Core::OProcess *proc, char *buffer, int len); |
40 | void done(OProcess *proc); | 40 | void done(Opie::Core::OProcess *proc); |
41 | private: | 41 | private: |
42 | QTextView *output; | 42 | QTextView *output; |
43 | QLineEdit *input; | 43 | QLineEdit *input; |
44 | OProcess *record; | 44 | Opie::Core::OProcess *record; |
45 | int where; | 45 | int where; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #endif | 48 | #endif |
49 | 49 | ||
diff --git a/noncore/tools/remote/remote.pro b/noncore/tools/remote/remote.pro index 660c7f7..8b3e4be 100644 --- a/noncore/tools/remote/remote.pro +++ b/noncore/tools/remote/remote.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE=app | 1 | TEMPLATE=app |
2 | CONFIG +=qt warn_on release | 2 | CONFIG +=qt warn_on release |
3 | DESTDIR =$(OPIEDIR)/bin | 3 | DESTDIR =$(OPIEDIR)/bin |
4 | HEADERS = remotetab.h learntab.h configtab.h topgroup.h dvdgroup.h channelgroup.h vcrgroup.h buttondialog.h topgroupconf.h dvdgroupconf.h channelgroupconf.h vcrgroupconf.h mainview.h recorddialog.h helptab.h | 4 | HEADERS = remotetab.h learntab.h configtab.h topgroup.h dvdgroup.h channelgroup.h vcrgroup.h buttondialog.h topgroupconf.h dvdgroupconf.h channelgroupconf.h vcrgroupconf.h mainview.h recorddialog.h helptab.h |
5 | SOURCES =remote.cpp remotetab.cpp learntab.cpp configtab.cpp topgroup.cpp dvdgroup.cpp channelgroup.cpp vcrgroup.cpp buttondialog.cpp topgroupconf.cpp dvdgroupconf.cpp channelgroupconf.cpp vcrgroupconf.cpp mainview.cpp recorddialog.cpp helptab.cpp | 5 | SOURCES =remote.cpp remotetab.cpp learntab.cpp configtab.cpp topgroup.cpp dvdgroup.cpp channelgroup.cpp vcrgroup.cpp buttondialog.cpp topgroupconf.cpp dvdgroupconf.cpp channelgroupconf.cpp vcrgroupconf.cpp mainview.cpp recorddialog.cpp helptab.cpp |
6 | INCLUDEPATH+=$(OPIEDIR)/include | 6 | INCLUDEPATH+=$(OPIEDIR)/include |
7 | DEPENDPATH+=$(OPIEDIR)/include | 7 | DEPENDPATH+=$(OPIEDIR)/include |
8 | LIBS +=-lqpe -lopie | 8 | LIBS +=-lqpe -lopiecore2 |
9 | TARGET = remote | 9 | TARGET = remote |
10 | 10 | ||
11 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |