author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/apps/opie-bartender | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
-rw-r--r-- | noncore/apps/opie-bartender/bartender.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/opie-bartender/bartender.pro | 7 | ||||
-rw-r--r-- | noncore/apps/opie-bartender/config.in | 3 |
3 files changed, 24 insertions, 21 deletions
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index e6cb515..59fc242 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp | |||
@@ -15,14 +15,15 @@ | |||
15 | #include "inputDialog.h" | 15 | #include "inputDialog.h" |
16 | #include "searchresults.h" | 16 | #include "searchresults.h" |
17 | #include "bac.h" | 17 | #include "bac.h" |
18 | 18 | ||
19 | #include <qtoolbar.h> | 19 | /* OPIE */ |
20 | #include <qmenubar.h> | 20 | #include <opie2/odebug.h> |
21 | //#include <opie2/colorpopupmenu.h> | ||
22 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | using namespace Opie::Core; | ||
24 | 24 | ||
25 | /* QT */ | ||
25 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
26 | #include <qdir.h> | 27 | #include <qdir.h> |
27 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
28 | #include <qlistbox.h> | 29 | #include <qlistbox.h> |
@@ -32,16 +33,18 @@ | |||
32 | #include <qaction.h> | 33 | #include <qaction.h> |
33 | #include <qheader.h> | 34 | #include <qheader.h> |
34 | #include <qlistview.h> | 35 | #include <qlistview.h> |
35 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qtoolbar.h> | ||
38 | #include <qmenubar.h> | ||
36 | 39 | ||
40 | /* STD */ | ||
37 | #include <fcntl.h> | 41 | #include <fcntl.h> |
38 | #include <unistd.h> | 42 | #include <unistd.h> |
39 | #include <stdlib.h> | 43 | #include <stdlib.h> |
40 | #include <stdio.h> | 44 | #include <stdio.h> |
41 | #include <errno.h> | 45 | #include <errno.h> |
42 | 46 | ||
43 | |||
44 | Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | 47 | Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) |
45 | : QMainWindow( parent, name, fl ) { | 48 | : QMainWindow( parent, name, fl ) { |
46 | if ( !name ) | 49 | if ( !name ) |
47 | setName( "Bartender" ); | 50 | setName( "Bartender" ); |
@@ -143,15 +146,15 @@ void Bartender::fillList() { | |||
143 | QString s; | 146 | QString s; |
144 | while ( !t.eof()) { | 147 | while ( !t.eof()) { |
145 | s = t.readLine(); | 148 | s = t.readLine(); |
146 | if(s.find("#",0,TRUE) != -1) { | 149 | if(s.find("#",0,TRUE) != -1) { |
147 | // qDebug(s.right(s.length()-2)); | 150 | // odebug << s.right(s.length()-2) << oendl; |
148 | item= new QListViewItem( DrinkView, 0 ); | 151 | item= new QListViewItem( DrinkView, 0 ); |
149 | item->setText( 0, s.right(s.length()-2)); | 152 | item->setText( 0, s.right(s.length()-2)); |
150 | i++; | 153 | i++; |
151 | } | 154 | } |
152 | } | 155 | } |
153 | qDebug("there are currently %d of drinks", i); | 156 | odebug << "there are currently " << i << " of drinks" << oendl; |
154 | } | 157 | } |
155 | 158 | ||
156 | void Bartender::fileNew() { | 159 | void Bartender::fileNew() { |
157 | 160 | ||
@@ -170,9 +173,9 @@ void Bartender::fileNew() { | |||
170 | } | 173 | } |
171 | if(newDrinks ->result() == 1 ) { | 174 | if(newDrinks ->result() == 1 ) { |
172 | QString newDrink="\n# "+newName+"\n"; | 175 | QString newDrink="\n# "+newName+"\n"; |
173 | newDrink.append(newIng+"\n"); | 176 | newDrink.append(newIng+"\n"); |
174 | qDebug("writing "+newDrink); | 177 | odebug << "writing "+newDrink << oendl; |
175 | dbFile.writeBlock( newDrink.latin1(), newDrink.length()); | 178 | dbFile.writeBlock( newDrink.latin1(), newDrink.length()); |
176 | clearList(); | 179 | clearList(); |
177 | dbFile.close(); | 180 | dbFile.close(); |
178 | 181 | ||
@@ -206,9 +209,9 @@ void Bartender::showDrink( QListViewItem *item) { | |||
206 | if(s.find( myDrink, 0, TRUE) != -1) { | 209 | if(s.find( myDrink, 0, TRUE) != -1) { |
207 | for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { | 210 | for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { |
208 | s2 = t.readLine(); | 211 | s2 = t.readLine(); |
209 | if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { | 212 | if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { |
210 | // qDebug(s2); | 213 | // odebug << s2 << oendl; |
211 | showDrinks->MultiLineEdit1->append(s2); | 214 | showDrinks->MultiLineEdit1->append(s2); |
212 | } | 215 | } |
213 | if( dbFile.atEnd() ) break; | 216 | if( dbFile.atEnd() ) break; |
214 | } | 217 | } |
@@ -247,9 +250,9 @@ void Bartender::doSearchByName() { | |||
247 | searchForDrinkName = fileDlg->LineEdit1->text(); | 250 | searchForDrinkName = fileDlg->LineEdit1->text(); |
248 | QListViewItemIterator it( DrinkView ); | 251 | QListViewItemIterator it( DrinkView ); |
249 | for ( ; it.current(); ++it ) { | 252 | for ( ; it.current(); ++it ) { |
250 | if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { | 253 | if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { |
251 | // qDebug( it.current()->text(0)); | 254 | // odebug << it.current()->text(0) << oendl; |
252 | searchList.append(it.current()->text(0)); | 255 | searchList.append(it.current()->text(0)); |
253 | } | 256 | } |
254 | } | 257 | } |
255 | if(searchList.count() >0) | 258 | if(searchList.count() >0) |
@@ -278,12 +281,12 @@ void Bartender::doSearchByDrink() { | |||
278 | while ( !t.eof()) { | 281 | while ( !t.eof()) { |
279 | s = t.readLine(); | 282 | s = t.readLine(); |
280 | if(s.find("#",0,TRUE) != -1) { | 283 | if(s.find("#",0,TRUE) != -1) { |
281 | lastDrinkName=s.right(s.length()-2); | 284 | lastDrinkName=s.right(s.length()-2); |
282 | // qDebug("last drink name "+lastDrinkName); | 285 | // odebug << "last drink name "+lastDrinkName << oendl; |
283 | } | 286 | } |
284 | else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { | 287 | else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { |
285 | // qDebug("appending "+lastDrinkName); | 288 | // odebug << "appending "+lastDrinkName << oendl; |
286 | searchList.append( lastDrinkName); | 289 | searchList.append( lastDrinkName); |
287 | tempName=lastDrinkName; | 290 | tempName=lastDrinkName; |
288 | } | 291 | } |
289 | // if( dbFile.atEnd() ) break; | 292 | // if( dbFile.atEnd() ) break; |
@@ -312,9 +315,9 @@ void Bartender::showSearchResult(QStringList &searchList) { | |||
312 | } | 315 | } |
313 | QListViewItemIterator it2( DrinkView ); | 316 | QListViewItemIterator it2( DrinkView ); |
314 | for ( ; it2.current(); ++it2 ) { | 317 | for ( ; it2.current(); ++it2 ) { |
315 | if ( it2.current()->text(0)== result ) { | 318 | if ( it2.current()->text(0)== result ) { |
316 | // qDebug( it2.current()->text(0)); | 319 | // odebug << it2.current()->text(0) << oendl; |
317 | showDrink(it2.current()); | 320 | showDrink(it2.current()); |
318 | } | 321 | } |
319 | } | 322 | } |
320 | delete searchDlg; | 323 | delete searchDlg; |
@@ -342,9 +345,9 @@ void Bartender::doEdit() { | |||
342 | foundAt = dbFile.at() - (s.length()+1); | 345 | foundAt = dbFile.at() - (s.length()+1); |
343 | for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { | 346 | for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { |
344 | s2 = t.readLine(); | 347 | s2 = t.readLine(); |
345 | if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { | 348 | if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { |
346 | // qDebug(s2); | 349 | // odebug << s2 << oendl; |
347 | newDrinks->MultiLineEdit1->append(s2); | 350 | newDrinks->MultiLineEdit1->append(s2); |
348 | newDrinks->LineEdit1->setText(myDrink); | 351 | newDrinks->LineEdit1->setText(myDrink); |
349 | } | 352 | } |
350 | if( dbFile.atEnd() ) break; | 353 | if( dbFile.atEnd() ) break; |
@@ -369,9 +372,9 @@ void Bartender::doEdit() { | |||
369 | #warning FIXME problems with editing drinks db | 372 | #warning FIXME problems with editing drinks db |
370 | ////////// FIXME write to user file | 373 | ////////// FIXME write to user file |
371 | QString newDrink="# "+newName+"\n"; | 374 | QString newDrink="# "+newName+"\n"; |
372 | newDrink.append(newIng+"\n"); | 375 | newDrink.append(newIng+"\n"); |
373 | qDebug("writing "+newDrink); | 376 | odebug << "writing "+newDrink << oendl; |
374 | dbFile.writeBlock( newDrink.latin1(), newDrink.length()); | 377 | dbFile.writeBlock( newDrink.latin1(), newDrink.length()); |
375 | clearList(); | 378 | clearList(); |
376 | 379 | ||
377 | dbFile.flush(); | 380 | dbFile.flush(); |
@@ -396,9 +399,9 @@ void Bartender::openCurrentDrink() { | |||
396 | showDrink(DrinkView->currentItem()); | 399 | showDrink(DrinkView->currentItem()); |
397 | } | 400 | } |
398 | 401 | ||
399 | void Bartender::fileMenuActivated( int item) { | 402 | void Bartender::fileMenuActivated( int item) { |
400 | qDebug("Item %d", item); | 403 | odebug << "Item " << item << "" << oendl; |
401 | switch(item) { | 404 | switch(item) { |
402 | case -3: // new -3 | 405 | case -3: // new -3 |
403 | fileNew(); | 406 | fileNew(); |
404 | break; | 407 | break; |
@@ -417,9 +420,9 @@ void Bartender::fileMenuActivated( int item) { | |||
417 | } | 420 | } |
418 | } | 421 | } |
419 | 422 | ||
420 | void Bartender::editMenuActivated(int item) { | 423 | void Bartender::editMenuActivated(int item) { |
421 | qDebug("Item %d", item); | 424 | odebug << "Item " << item << "" << oendl; |
422 | /* | 425 | /* |
423 | edit -8 | 426 | edit -8 |
424 | */ | 427 | */ |
425 | switch(item) { | 428 | switch(item) { |
diff --git a/noncore/apps/opie-bartender/bartender.pro b/noncore/apps/opie-bartender/bartender.pro index 4ad3c31..41fc0e5 100644 --- a/noncore/apps/opie-bartender/bartender.pro +++ b/noncore/apps/opie-bartender/bartender.pro | |||
@@ -1,12 +1,11 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on | ||
3 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
4 | HEADERS = bartender.h newdrinks.h showdrinks.h inputDialog.h searchresults.h bac.h | 3 | HEADERS = bartender.h newdrinks.h showdrinks.h inputDialog.h searchresults.h bac.h |
5 | SOURCES = main.cpp bartender.cpp newdrinks.cpp showdrinks.cpp inputDialog.cpp searchresults.cpp bac.cpp | 4 | SOURCES = main.cpp bartender.cpp newdrinks.cpp showdrinks.cpp inputDialog.cpp searchresults.cpp bac.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lqpe | 7 | LIBS += -lqpe -lopiecore2 |
9 | DESTDIR = $(OPIEDIR)/bin | 8 | DESTDIR = $(OPIEDIR)/bin |
10 | TARGET = bartender | 9 | TARGET = bartender |
11 | 10 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/opie-bartender/config.in b/noncore/apps/opie-bartender/config.in index c6ca2e6..c39a7d6 100644 --- a/noncore/apps/opie-bartender/config.in +++ b/noncore/apps/opie-bartender/config.in | |||
@@ -1,4 +1,5 @@ | |||
1 | config BARTENDER | 1 | config BARTENDER |
2 | boolean "bartender - bar receipe and blood alcohol estimator" | 2 | boolean "bartender - bar receipe and blood alcohol estimator" |
3 | default "n" | 3 | default "n" |
4 | depends ( LIBQPE || LIBQPE-X11 ) | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE |
5 | |||