author | drw <drw> | 2005-05-17 23:02:25 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-17 23:02:25 (UTC) |
commit | f37c642f417a58ee489ab5a8bab56e5efb59bada (patch) (side-by-side diff) | |
tree | a3cf08e41dc605906ec08ce5e47d29776d461410 | |
parent | 0892a9d473bfeacc921d586266e6889153654737 (diff) | |
download | opie-f37c642f417a58ee489ab5a8bab56e5efb59bada.zip opie-f37c642f417a58ee489ab5a8bab56e5efb59bada.tar.gz opie-f37c642f417a58ee489ab5a8bab56e5efb59bada.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/apps/opie-bartender/bartender.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index bee164c..57b28d4 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp @@ -1,147 +1,149 @@ /**************************************************************************** ** ** Created: Sat Jul 20 08:10:53 2002 ** by: L.J. Potter <ljp@llornkcor.com> ** copyright : (C) 2002 by ljp email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "bartender.h" #include "showdrinks.h" #include "inputDialog.h" #include "searchresults.h" #include "bac.h" #include "drinkdata.h" /* OPIE */ #include <opie2/odebug.h> +#include <opie2/oresource.h> #include <qpe/qpeapplication.h> -#include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qlineedit.h> #include <qdir.h> #include <qpushbutton.h> #include <qlistbox.h> #include <qmultilineedit.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qaction.h> #include <qheader.h> #include <qlistview.h> #include <qlayout.h> #include <qtoolbar.h> #include <qmenubar.h> /* STD */ #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { if ( !name ) - setName( "Bartender" ); - QGridLayout *layout = new QGridLayout( this ); - layout->setSpacing( 2); - layout->setMargin( 2); + setName( "Bartender" ); + connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); setCaption( tr( "Bartender" ) ); - setToolBarsMovable( FALSE ); - - ToolBar1 = new QToolBar( this, "ToolBar1" ); - ToolBar1->setFixedHeight(22); - layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); + setToolBarsMovable( false ); + QToolBar *dock = new QToolBar( this ); + dock->setHorizontalStretchable( true ); - QMenuBar *menuBar = new QMenuBar( ToolBar1 ); + QMenuBar *menuBar = new QMenuBar( dock ); + menuBar->setMargin( 0 ); QPopupMenu *fileMenu; fileMenu = new QPopupMenu( this); menuBar->insertItem( tr("File"), fileMenu ); fileMenu->insertItem(tr("New Drink")); fileMenu->insertItem(tr("Open Drink")); fileMenu->insertItem(tr("Find by Drink Name")); fileMenu->insertItem(tr("Find by Ingredient")); QPopupMenu *editMenu; editMenu = new QPopupMenu( this); menuBar->insertItem( tr("Edit"), editMenu ); editMenu->insertItem(tr("Edit Drink")); connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); + ToolBar1 = new QToolBar( this ); - QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); + QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), + "New", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( ToolBar1 ); - a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); + a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "bartender/bartender_sm", Opie::Core::OResource::SmallIcon ), + "open", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); a->addTo( ToolBar1 ); - a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); + a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), + "Find", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); a->addTo( ToolBar1 ); - a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); + a = new QAction( tr( "Edit" ), Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), + "Edit", 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); a->addTo( ToolBar1 ); QPushButton *t; t= new QPushButton( "BAC", ToolBar1, "bacButtin"); connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); DrinkView = new QListView( this, "DrinkView" ); DrinkView->addColumn( tr( "Name of Drink" ) ); -// DrinkView->setRootIsDecorated( TRUE ); DrinkView->header()->hide(); QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); - layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); if(QDir("db").exists()) drinkDB.setFile("db/drinkdb.txt"); else drinkDB.setFile(QPEApplication::qpeDir()+"etc/bartender/drinkdb.txt"); initDrinkDb(); DrinkView->setFocus(); + + setCentralWidget( DrinkView ); } Bartender::~Bartender() { } /* this happens right before exit */ void Bartender::cleanUp() { } void Bartender::initDrinkDb() { if(drinkDB.read()) fillList(); else QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); } void Bartender::fillList() { QString lastName; if( DrinkView->currentItem() != NULL ) lastName = DrinkView->currentItem()->text(0); else lastName = ""; |