24 files changed, 46 insertions, 69 deletions
diff --git a/examples/applet/applet.pro b/examples/applet/applet.pro index 6890141..1daf1b2 100644 --- a/examples/applet/applet.pro +++ b/examples/applet/applet.pro @@ -1,16 +1,16 @@ CONFIG += warn_on qt TEMPLATE = lib DESTDIR = $(OPIEDIR)/plugins/applets TARGET = example SOURCES = simpleimpl.cpp HEADERS = simpleimpl.h INCLUDEPATH += $(OPIEDIR)/include DEPENDSPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 include( $(OPIEDIR)/include.pro ) diff --git a/examples/applet/config.in b/examples/applet/config.in index f6a5d20..0d4d800 100644 --- a/examples/applet/config.in +++ b/examples/applet/config.in @@ -1,4 +1,4 @@ config APPLET_EXAMPLE boolean "Taskbar Applet Example" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && EXAMPLES + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && EXAMPLES diff --git a/examples/applet/simpleimpl.cpp b/examples/applet/simpleimpl.cpp index ff651ca..d7e2db9 100644 --- a/examples/applet/simpleimpl.cpp +++ b/examples/applet/simpleimpl.cpp @@ -1,73 +1,56 @@ #include "simpleimpl.h" +#include <opie2/oresource.h> // for OResource loading #include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> // for AppLnk -#include <qpe/resource.h> // for Resource loading #include <qlabel.h> #include <qpainter.h> #include <qmessagebox.h> SimpleApplet::SimpleApplet(QWidget *parent) : QWidget( parent, "Simple Applet" ) { /* - * we will load an Image, scale it for the right usage + * we will load an Pixmap, scaled for the right usage * remember your applet might be used by different * resolutions. - * Then we will convert the image back to an Pixmap - * and draw this Pimxap. We need to use Image because its - * the only class that allows scaling. */ - QImage image = Resource::loadImage("Tux"); - /* - * smooth scale to AppLnk smallIconSize for applest - * smallIconSize gets adjusted to the resolution - * so on some displays like SIMpad and a C-750 the smallIconSize - * is greater than on a iPAQ h3870 - */ - image = image.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize() ); - - /* - * now we need to convert the Image to a Pixmap cause these - * can be drawn more easily - */ - m_pix = new QPixmap(); - m_pix->convertFromImage( image ); + m_pix = new QPixmap( Opie::Core::OResource::loadPixmap("Tux", Opie::Core::OResource::SmallIcon) ); /* * Now we will say that we don't want to be bigger than our * Pixmap */ setFixedHeight(AppLnk::smallIconSize() ); setFixedWidth( AppLnk::smallIconSize() ); } SimpleApplet::~SimpleApplet() { delete m_pix; } /* * here you would normal show or do something * useful. If you want to show a widget at the top left * of your icon you need to map your rect().topLeft() to * global with mapToGlobal(). Then you might also need to * move the widgets so it is visible */ void SimpleApplet::mousePressEvent(QMouseEvent* ) { QMessageBox::information(this, tr("No action taken"), tr("<qt>This Plugin does not yet support anything usefule aye.</qt>"), QMessageBox::Ok ); } void SimpleApplet::paintEvent( QPaintEvent* ) { QPainter p(this); diff --git a/examples/inputmethod/config.in b/examples/inputmethod/config.in index c0aa7e8..85b9725 100644 --- a/examples/inputmethod/config.in +++ b/examples/inputmethod/config.in @@ -1,4 +1,4 @@ config EXAMPLE_BOARD boolean "Input Method Example" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && EXAMPLES diff --git a/examples/inputmethod/exampleboardimpl.cpp b/examples/inputmethod/exampleboardimpl.cpp index 36989a2..6c7196b 100644 --- a/examples/inputmethod/exampleboardimpl.cpp +++ b/examples/inputmethod/exampleboardimpl.cpp @@ -1,38 +1,39 @@ #include <qwidget.h> #include <qcheckbox.h> #include <qlabel.h> #include <qsignalmapper.h> #include <qpushbutton.h> -#include <qpe/resource.h> + +#include <opie2/oresource.h> #include "exampleboardimpl.h" ExampleBoard::ExampleBoard(QWidget* par, WFlags fl ) : QHBox(par, "name", fl ) { QCheckBox *box1 = new QCheckBox(tr("Alt"),this); connect(box1,SIGNAL(toggled(bool)), this,SLOT(slotAlt(bool))); m_alt = box1; box1 = new QCheckBox(tr("Shift"),this ); connect(box1,SIGNAL(toggled(bool)), this,SLOT(slotShift(bool))); m_shi = box1; box1 = new QCheckBox(tr("Ctrl","Control Shortcut on keyboard"),this ); connect(box1,SIGNAL(toggled(bool)), this,SLOT(slotCtrl(bool))); m_ctrl = box1; QSignalMapper *map = new QSignalMapper(this); QPushButton *btn = new QPushButton("a",this); map->setMapping(btn,0); connect(btn,SIGNAL(clicked()),map,SLOT(map())); btn = new QPushButton("b",this); map->setMapping(btn,1); connect(btn,SIGNAL(clicked()),map,SLOT(map())); btn = new QPushButton("c",this); map->setMapping(btn,2); connect(btn,SIGNAL(clicked()),map,SLOT(map())); @@ -89,65 +90,65 @@ void ExampleBoard::slotCtrl(bool b){ m_state &= ~ControlButton; } ExampleboardImpl::ExampleboardImpl() : m_pickboard(0), m_icn(0) { } ExampleboardImpl::~ExampleboardImpl() { delete m_pickboard; delete m_icn; } QWidget *ExampleboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !m_pickboard ) m_pickboard = new ExampleBoard( parent, f ); return m_pickboard; } void ExampleboardImpl::resetState() { if ( m_pickboard ) m_pickboard->resetState(); } QPixmap *ExampleboardImpl::icon() { if ( !m_icn ) - m_icn = new QPixmap(Resource::loadPixmap("Tux")); + m_icn = new QPixmap(Opie::Core::OResource::loadPixmap("Tux", Opie::Core::OResource::SmallIcon)); return m_icn; } QString ExampleboardImpl::name() { return QObject::tr("Example Input"); } void ExampleboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( m_pickboard ) QObject::connect( m_pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT ExampleboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; else return QS_FALSE; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { diff --git a/examples/inputmethod/inputmethod.pro b/examples/inputmethod/inputmethod.pro index ea98dd5..56881ff 100644 --- a/examples/inputmethod/inputmethod.pro +++ b/examples/inputmethod/inputmethod.pro @@ -1,12 +1,12 @@ TEMPLATE = lib CONFIG += qt plugin warn_on HEADERS = exampleboardimpl.h SOURCES = exampleboardimpl.cpp TARGET = example_board DESTDIR = $(OPIEDIR)/plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../../launcher -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 VERSION = 1.0.0 include( $(OPIEDIR)/include.pro ) diff --git a/examples/main-tab/config.in b/examples/main-tab/config.in index a40df56..640679e 100644 --- a/examples/main-tab/config.in +++ b/examples/main-tab/config.in @@ -1,4 +1,4 @@ config MAIN_TAB_EXAMPLE boolean "Mainwindow with OTabWidget example" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE2UI + depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE2CORE && LIBOPIE2UI diff --git a/examples/main-tab/main-tab.pro b/examples/main-tab/main-tab.pro index a0df875..033a028 100644 --- a/examples/main-tab/main-tab.pro +++ b/examples/main-tab/main-tab.pro @@ -1,17 +1,17 @@ CONFIG += qt warn_on quick-app TARGET = main-tab HEADERS = simple.h SOURCES = simple.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include # we now also include opie -LIBS += -lqpe -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 include( $(OPIEDIR)/include.pro ) diff --git a/examples/main-tab/opie-simple.control b/examples/main-tab/opie-simple.control index 8525a94..2046281 100644 --- a/examples/main-tab/opie-simple.control +++ b/examples/main-tab/opie-simple.control @@ -1,9 +1,9 @@ Package: opie-main-tab-example Files: bin/main-tab apps/Examples/main-tab.desktop Priority: optional Section: opie/examples Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> Architecture: arm -Depends: task-opie-minimal, opie-pics +Depends: task-opie-minimal, libopiecore2, libopieui2, opie-pics Description: A simple example Version: $QPE_VERSION$EXTRAVERSION diff --git a/examples/main-tab/simple.cpp b/examples/main-tab/simple.cpp index 7edb557..1e2d028 100644 --- a/examples/main-tab/simple.cpp +++ b/examples/main-tab/simple.cpp @@ -1,44 +1,44 @@ #include <qaction.h> // action #include <qmenubar.h> // menubar #include <qtoolbar.h> // toolbar #include <qlabel.h> // a label #include <qpushbutton.h> // the header file for the QPushButton #include <qlayout.h> #include <qpe/qpeapplication.h> // the QPEApplication -#include <qpe/resource.h> #include <qpe/sound.h> #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching +#include <opie2/oresource.h> #include <opie2/otabwidget.h> #include "simple.h" /* * implementation of simple */ /* * The factory is used for quicklaunching * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro * * Depending on the global quick launch setting this will create * either a main method or one for our component plugin system */ /* The OApplicationFactory is in the Opie::Core namespace */ using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { setCaption(tr("My MainWindow") ); initUI(); /* * Tab widget as central */ Opie::Ui::OTabWidget *tab = new Opie::Ui::OTabWidget(this); connect(tab, SIGNAL(currentChanged(QWidget*) ), @@ -58,75 +58,74 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) simple1, SLOT(slotFire() ) ); } MainWindow::~MainWindow() { // again nothing to delete because Qt takes care } void MainWindow::setDocument( const QString& /*str*/ ) { } void MainWindow::slotCurrentChanged( QWidget *wid) { disconnect(m_fire, SIGNAL(activated() ), m_oldCurrent, SLOT(slotFire() ) ); connect(m_fire, SIGNAL(activated() ), wid, SLOT(slotFire() ) ); m_oldCurrent = wid; } void MainWindow::initUI() { setToolBarsMovable( false ); QToolBar *menuBarHolder = new QToolBar( this ); menuBarHolder->setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( menuBarHolder ); QToolBar *tb = new QToolBar( this ); QPopupMenu *fileMenu = new QPopupMenu( this ); - QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), + QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "quit_action" ); /* * Connect quit to the QApplication quit slot */ connect(a, SIGNAL(activated() ), qApp, SLOT(quit() ) ); a->addTo( fileMenu ); - a = new QAction(tr("Fire"), - Resource::loadIconSet("new"), + a = new QAction(tr("Fire"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "fire_button"); /* see the power? */ a->addTo( fileMenu ); a->addTo( tb ); m_fire = a; mb->insertItem(tr("File"), fileMenu ); } Simple1::Simple1( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 8 ); layout->setMargin( 11 ); QLabel *lbl = new QLabel( this, "a name for the label" ); lbl->setText( tr("Click on the button or follow the white rabbit") ); layout->addWidget( lbl ); m_button = new QPushButton(this); m_button->setText( tr("Fire", "translatable quit string" ) ); layout->addWidget( m_button ); @@ -144,69 +143,69 @@ void Simple1::slotFire() { * close will hide() Simple and not delete it. But as * the mainwindow is shown all children will be shown as well */ close(); } Simple2::Simple2( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { /* * sets the caption of this toplevel widget * put all translatable string into tr() */ setCaption(tr("My Simple Application") ); /* * A simple vertical layout * either call layout->setAutoAdd( true ) * or use layout->addWidget( wid ) to add widgets */ QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 8 ); layout->setMargin( 11 ); /* * creates a label * The first parameter is this widget so the Label is a child * of us and will be deleted when we're deleted. */ QLabel *lbl = new QLabel( this, "a name for the label" ); /* - * Resource will search hard for a Pixmap in $OPIEDIR/pics + * OResource will search hard for a Pixmap in $OPIEDIR/pics * to find 'logo/opielogo' You need to pass the subdir * but not the ending */ - lbl->setPixmap( Resource::loadPixmap("logo/opielogo") ); + lbl->setPixmap( Opie::Core::OResource::loadPixmap("logo/opielogo", Opie::Core::OResource::SmallIcon) ); layout->addWidget( lbl ); /* creates a button as child of this widget */ m_button = new QPushButton(this); /* * another way to call tr. The first parameter is the string * to translate and the second a hint to the translator */ m_button->setText( tr("Fire", "translatable fire string" ) ); layout->addWidget( m_button ); connect( m_button, SIGNAL(clicked() ), this, SLOT( slotQuit() ) ); } Simple2::~Simple2() { } void Simple2::slotFire() { /* * We will fire up a sound * Note that Sound will use Resource as well * and we do not need to supply an ending * sounds are found in $OPIEDIR/sounds */ Sound snd("hit_target01"); snd.play(); diff --git a/examples/menuapplet/config.in b/examples/menuapplet/config.in index 3167478..9425d9f 100644 --- a/examples/menuapplet/config.in +++ b/examples/menuapplet/config.in @@ -1,4 +1,4 @@ config EXAMPLE_MENU boolean "O-Menu Applet" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && EXAMPLES diff --git a/examples/menuapplet/example.cpp b/examples/menuapplet/example.cpp index 8ae77da..079030f 100644 --- a/examples/menuapplet/example.cpp +++ b/examples/menuapplet/example.cpp @@ -1,74 +1,69 @@ #include "example.h" -#include <qpe/applnk.h> -#include <qpe/resource.h> +#include <opie2/oresource.h> /* QT */ #include <qiconset.h> #include <qpopupmenu.h> #include <qmessagebox.h> MenuAppletExample::MenuAppletExample() :QObject( 0, "MenuAppletExample" ) { } MenuAppletExample::~MenuAppletExample ( ) {} int MenuAppletExample::position() const { return 3; } QString MenuAppletExample::name() const { return tr( "MenuApplet Example Name" ); } QString MenuAppletExample::text() const { return tr( "Click the white rabbit" ); } QIconSet MenuAppletExample::icon() const { - QPixmap pix; - QImage img = Resource::loadImage( "Tux" ); - if ( !img.isNull() ) - pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); - return pix; + return Opie::Core::OResource::loadPixmap( "Tux", Opie::Core::OResource::SmallIcon ); } QPopupMenu* MenuAppletExample::popup(QWidget*) const { /* no subdir */ return 0; } void MenuAppletExample::activated() { QMessageBox::information(0,tr("No white rabbit found"), tr("<qt>No white rabbit was seen near Opie." "Only the beautiful OpieZilla is available" "for your pleassure</qt>")); } QRESULT MenuAppletExample::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_MenuApplet ) *iface = this; else return QS_FALSE; if ( *iface ) (*iface)->addRef(); return QS_OK; } diff --git a/examples/menuapplet/menuapplet.pro b/examples/menuapplet/menuapplet.pro index 1e20e78..e8858ec 100644 --- a/examples/menuapplet/menuapplet.pro +++ b/examples/menuapplet/menuapplet.pro @@ -1,12 +1,12 @@ TEMPLATE = lib CONFIG += qt plugn warn_on HEADERS = example.h SOURCES = example.cpp TARGET = example_applet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 VERSION = 1.0.0 include( $(OPIEDIR)/include.pro ) diff --git a/examples/opieui/config.in b/examples/opieui/config.in index f538430..cf5fd01 100644 --- a/examples/opieui/config.in +++ b/examples/opieui/config.in @@ -1,4 +1,4 @@ config EXAMPLE_LIBOPIE2UI boolean "libopieui2 examples" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && EXAMPLES diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.cpp b/examples/opieui/owidgetstack_example/owidgetstack_example.cpp index 272e42b..ded3b0c 100644 --- a/examples/opieui/owidgetstack_example/owidgetstack_example.cpp +++ b/examples/opieui/owidgetstack_example/owidgetstack_example.cpp @@ -1,133 +1,133 @@ /* * You may use, modify and distribute this example without any limitation */ #include "owidgetstack_example.h" /* OPIE */ #include <opie2/oapplicationfactory.h> #include <opie2/owidgetstack.h> -#include <qpe/resource.h> +#include <opie2/oresource.h> /* QT */ #include <qaction.h> #include <qtoolbar.h> #include <qpopupmenu.h> #include <qmenubar.h> #include <qlayout.h> #include <qlabel.h> #include <qpushbutton.h> #include <qsignalmapper.h> using namespace Opie::Core; using namespace Opie::Ui; OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { m_stack = new OWidgetStack( this ); setCentralWidget( m_stack ); /* nice Signal Mapper ;) */ QSignalMapper *sm = new QSignalMapper(this); connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); /* toolbar first but this should be known from the other examples */ setToolBarsMovable( false ); /* only a menubar here */ QToolBar* holder = new QToolBar( this ); holder->setHorizontalStretchable( true ); QMenuBar *bar = new QMenuBar( holder ); QPopupMenu *menu = new QPopupMenu( this ); - QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"), + QAction* a = new QAction( tr("Show MainWidget"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), QString::null, 0, this, 0 ); sm->setMapping(a, 1 ); connect(a, SIGNAL(activated() ), sm, SLOT(map() ) ); a->addTo( menu ); - a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"), + a = new QAction( tr("Show Details Small"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), QString::null, 0, this, 0 ); sm->setMapping(a, 2 ); connect(a, SIGNAL(activated() ), sm, SLOT(map() ) ); a->addTo( menu ); - a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"), + a = new QAction( tr("Show Details More"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), QString::null, 0, this, 0 ); sm->setMapping(a, 3 ); connect(a, SIGNAL(activated() ), sm, SLOT(map() ) ); a->addTo( menu ); - a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"), + a = new QAction( tr("Show Details All"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), QString::null, 0, this, 0 ); sm->setMapping(a, 4 ); connect(a, SIGNAL(activated() ), sm, SLOT(map() ) ); bar->insertItem( tr("Actions"), menu ); /* now the gui */ /* first widget, main widget */ QWidget * wid = new QWidget( m_stack ); QGridLayout *grid = new QGridLayout(wid, 2, 2 ); QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" ); sm->setMapping(btn, 2 ); connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); grid->addWidget( btn, 0, 0 ); btn = new QPushButton( tr("Show Details Medium"), wid, "details2"); sm->setMapping(btn, 3 ); connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); grid->addWidget( btn, 0, 1 ); btn = new QPushButton( tr("Show Details All"), wid, "details3"); sm->setMapping(btn, 4 ); connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); grid->addWidget( btn, 1, 1 ); m_stack->addWidget( wid, 1 ); m_main = wid; QLabel *lbl = new QLabel(m_stack ); - lbl->setText(tr("Only small Details are shown here. Määh") ); + lbl->setText(tr("Only small Details are shown here. M�h") ); m_stack->addWidget( lbl, 2 ); lbl = new QLabel( m_stack ); lbl->setText( tr("Some more details....Wo ist das Schaf?") ); m_stack->addWidget( lbl, 3 ); lbl = new QLabel( m_stack ); - lbl->setText( tr("<qt>Ne nicht in Bayerisch Gmain sondern in Berlin<br>Vermiss und meine Augen werden nicht eckig, da mein Bildschirm abgerundet ist<br>Es lebe Hamburg Süd,weiss du, verstehst du? ;)<br>Susi ist dOOf, es lebe die Ofenecke...", "hard to translate that") ); + lbl->setText( tr("<qt>Ne nicht in Bayerisch Gmain sondern in Berlin<br>Vermiss und meine Augen werden nicht eckig, da mein Bildschirm abgerundet ist<br>Es lebe Hamburg Sd,weiss du, verstehst du? ;)<br>Susi ist dOOf, es lebe die Ofenecke...", "hard to translate that") ); m_stack->addWidget( lbl, 4 ); /* THE signal mapper does all the magic */ m_stack->raiseWidget( m_main ); } StackExample::~StackExample() { } void StackExample::closeEvent( QCloseEvent* ev) { /* if the close even came when we displayed a details */ if (m_stack->visibleWidget() != m_main ) { m_stack->raiseWidget( m_main ); ev->ignore(); return; } ev->accept(); } diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.pro b/examples/opieui/owidgetstack_example/owidgetstack_example.pro index 4cfce9c..8960f03 100644 --- a/examples/opieui/owidgetstack_example/owidgetstack_example.pro +++ b/examples/opieui/owidgetstack_example/owidgetstack_example.pro @@ -1,13 +1,13 @@ CONFIG += qt warn_on TEMPLATE = app TARGET = owidgetstack-example SOURCES = owidgetstack_example.cpp HEADERS = owidgetstack_example.h INCLUDEPATH += $(OPIEDIR)/include DEPENDSPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 include( $(OPIEDIR)/include.pro ) diff --git a/examples/simple-icon/config.in b/examples/simple-icon/config.in index ec5e1ee..f0f9181 100644 --- a/examples/simple-icon/config.in +++ b/examples/simple-icon/config.in @@ -1,4 +1,4 @@ config SIMPLE_ICON boolean "Simples Widget which loads Pixmaps and plays sound" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && EXAMPLES diff --git a/examples/simple-icon/opie-simple.control b/examples/simple-icon/opie-simple.control index 5adcf01..5e326ab 100644 --- a/examples/simple-icon/opie-simple.control +++ b/examples/simple-icon/opie-simple.control @@ -1,9 +1,9 @@ Package: opie-simple-icon-example Files: bin/simple-icon apps/Examples/simple-icon.desktop Priority: optional Section: opie/examples Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> Architecture: arm -Depends: task-opie-minimal, opie-pics +Depends: task-opie-minimal, libopiecore2, opie-pics Description: A simple icon example Version: $QPE_VERSION$EXTRAVERSION diff --git a/examples/simple-icon/simple.cpp b/examples/simple-icon/simple.cpp index fec1823..2c98ec0 100644 --- a/examples/simple-icon/simple.cpp +++ b/examples/simple-icon/simple.cpp @@ -1,88 +1,87 @@ #include <qlabel.h> // a label #include <qpushbutton.h> // the header file for the QPushButton #include <qlayout.h> #include <qpe/qpeapplication.h> // the QPEApplication -#include <qpe/resource.h> // for loading icon #include <qpe/sound.h> // for playing a sound #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching - +#include <opie2/oresource.h> // for loading icon #include "simple.h" /* * implementation of simple */ /* * The factory is used for quicklaunching * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro * * Depending on the global quick launch setting this will create * either a main method or one for our component plugin system */ using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<Simple> ) Simple::Simple( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { /* * sets the caption of this toplevel widget * put all translatable string into tr() */ setCaption(tr("My Simple Application") ); /* * A simple vertical layout * either call layout->setAutoAdd( true ) * or use layout->addWidget( wid ) to add widgets */ QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 8 ); layout->setMargin( 11 ); /* * creates a label * The first parameter is this widget so the Label is a child * of us and will be deleted when we're deleted. */ QLabel *lbl = new QLabel( this, "a name for the label" ); /* * Resource will search hard for a Pixmap in $OPIEDIR/pics * to find 'logo/opielogo' You need to pass the subdir * but not the ending */ - lbl->setPixmap( Resource::loadPixmap("logo/opielogo") ); + lbl->setPixmap( Opie::Core::OResource::loadPixmap("logo/opielogo", Opie::Core::OResource::SmallIcon) ); layout->addWidget( lbl ); /* creates a button as child of this widget */ m_button = new QPushButton(this); /* * another way to call tr. The first parameter is the string * to translate and the second a hint to the translator */ m_button->setText( tr("Fire", "translatable fire string" ) ); layout->addWidget( m_button ); /* * Now we bring the action into it. The power of qt is the dynamic * signal and slots model * Usage is simple connect m_buttons clicked signal to our * slotQuit slot. * We could also have connected a SIGNAL to a SIGNAL or the clicked * signal directly to qApp and SLOT(quit() ) */ connect( m_button, SIGNAL(clicked() ), this, SLOT( slotQuit() ) ); } /* * Our destructor is empty because all child * widgets and layouts will be deleted by Qt. * Same applies to QObjects */ Simple::~Simple() { } diff --git a/examples/simple-main/config.in b/examples/simple-main/config.in index 57cf603..bc509ea 100644 --- a/examples/simple-main/config.in +++ b/examples/simple-main/config.in @@ -1,4 +1,4 @@ config SIMPLE_MAIN boolean "Simple Mainwindow with Actions buttons and iconsets" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && EXAMPLES diff --git a/examples/simple-main/opie-simple.control b/examples/simple-main/opie-simple.control index 331b2f4..3cde394 100644 --- a/examples/simple-main/opie-simple.control +++ b/examples/simple-main/opie-simple.control @@ -1,9 +1,9 @@ Package: opie-simple-main-example Files: bin/simple-main apps/Examples/simple-main.desktop Priority: optional Section: opie/examples Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> Architecture: arm -Depends: task-opie-minimal, opie-pics +Depends: task-opie-minimal, libopiecore2, opie-pics Description: A simple example Version: $QPE_VERSION$EXTRAVERSION diff --git a/examples/simple-main/simple.cpp b/examples/simple-main/simple.cpp index cf00cc6..b227a1f 100644 --- a/examples/simple-main/simple.cpp +++ b/examples/simple-main/simple.cpp @@ -1,65 +1,65 @@ #include <qaction.h> // action #include <qmenubar.h> // menubar #include <qtoolbar.h> // toolbar #include <qlabel.h> // a label #include <qpushbutton.h> // the header file for the QPushButton #include <qlayout.h> #include <qpe/qpeapplication.h> // the QPEApplication -#include <qpe/resource.h> #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching +#include <opie2/oresource.h> #include "simple.h" /* * implementation of simple */ /* * The factory is used for quicklaunching * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro * * Depending on the global quick launch setting this will create * either a main method or one for our component plugin system */ using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { setCaption(tr("My MainWindow") ); - setIcon( Resource::loadPixmap("new") ); + setIcon( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon) ); /* * out mainwindow should have a menubar * a toolbar, a mainwidget and use Resource * to get the IconSets */ /* * we initialize the GUI in a different methid */ initUI(); Simple *simple = new Simple( this ); setCentralWidget( simple ); /* * If you use signal and slots do not include the parameter * names inside * so SIGNAL(fooBar(int) ) and NOT SIGNAL(fooBar(int foo) ) */ /* * We connect the activation of our QAction * to the slot connected to the firebutton * We could also connect the signal to the clicked * signal of the button */ connect(m_fire, SIGNAL(activated() ), simple, SLOT(slotFire() ) ); } MainWindow::~MainWindow() { // again nothing to delete because Qt takes care } @@ -99,75 +99,75 @@ void MainWindow::setDocument( const QString& /*str*/ ) { void MainWindow::initUI() { /* * We want to provde a File Menu with Quit as option * and a Fire Toolbutton ( QAction ) * So we need two actions * A toolbar and a popupMenu */ setToolBarsMovable( false ); /* *We don't want the static toolbar but share it with the * toolbar on small screens */ QToolBar *menuBarHolder = new QToolBar( this ); /* we allow the menubarholder to become bigger than * the screen width and to offer a > for the additional items */ menuBarHolder->setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( menuBarHolder ); QToolBar *tb = new QToolBar( this ); QPopupMenu *fileMenu = new QPopupMenu( this ); /* * we create our first action with the Text Quit * a IconSet, no menu name, no acceleration ( keyboard shortcut ), * with parent this, and name "quit_action" */ /* * Note if you want a picture out of the inline directory * you musn't prefix inline/ inline means these pics are built in * into libqpe so the name without ending and directory is enough */ - QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), + QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "quit_action" ); /* * Connect quit to the QApplication quit slot */ connect(a, SIGNAL(activated() ), qApp, SLOT(quit() ) ); a->addTo( fileMenu ); a = new QAction(tr("Fire"), - Resource::loadIconSet("new"), + Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "fire_button"); /* see the power? */ a->addTo( fileMenu ); a->addTo( tb ); m_fire = a; mb->insertItem(tr("File"), fileMenu ); } Simple::Simple( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { /* * sets the caption of this toplevel widget * put all translatable string into tr() */ setCaption(tr("My Simple Application") ); /* * A simple vertical layout * either call layout->setAutoAdd( true ) * or use layout->addWidget( wid ) to add widgets */ QVBoxLayout *layout = new QVBoxLayout( this ); layout->setSpacing( 8 ); layout->setMargin( 11 ); /* * creates a label diff --git a/examples/simple-pim/opie-simple.control b/examples/simple-pim/opie-simple.control index 1b54f91..80ad85b 100644 --- a/examples/simple-pim/opie-simple.control +++ b/examples/simple-pim/opie-simple.control @@ -1,9 +1,9 @@ Package: opie-simple-pim-example Files: bin/main-tab apps/Examples/main-tab.desktop Priority: optional Section: opie/examples Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> Architecture: arm -Depends: task-opie-minimal, opie-pics +Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2, opie-pics Description: A simple example Version: $QPE_VERSION$EXTRAVERSION diff --git a/examples/simple-pim/simple.cpp b/examples/simple-pim/simple.cpp index 00c5600..6019d04 100644 --- a/examples/simple-pim/simple.cpp +++ b/examples/simple-pim/simple.cpp @@ -1,46 +1,46 @@ /* We use a sane order of include files, from the most special to the least special That helps to reduce the number of implicit includes hence increases the reuse */ /* First the local include files */ #include "simple.h" /* Then the Ope include files. This includes qpe stuff which will eventually be merged with libopie2 */ #include <opie2/odebug.h> // for odebug streams #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching +#include <opie2/oresource.h> #include <opie2/otabwidget.h> #include <opie2/owait.h> #include <qpe/qpeapplication.h> // the QPEApplication -#include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/datebookmonth.h> #include <qpe/timestring.h> using namespace Opie::Core; /* Now the Qt includes */ #include <qaction.h> // action #include <qmenubar.h> // menubar #include <qtoolbar.h> // toolbar #include <qlabel.h> // a label #include <qpushbutton.h> // the header file for the QPushButton #include <qlayout.h> #include <qtimer.h> // we use it for the singleShot #include <qdatetime.h> // for QDate #include <qtextview.h> // a rich text widget #include <qdialog.h> #include <qwhatsthis.h> // for whats this /* Add standard includes here if you need some Examples are: stdlib.h, socket.h, etc. */ /* * implementation of simple */ /* * The factory is used for quicklaunching * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro * * Depending on the global quick launch setting this will create * either a main method or one for our component plugin system @@ -102,87 +102,87 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) * SO we will load once our window is mapped to screen * to achieve that we use a QTimer::singleShot * After 10 milli seconds the timer fires and on TimerEvent * out slot slotLoad will be called * Remember this a Constructor to construct your object and not * to load */ QTimer::singleShot( 10, this, SLOT(slotLoad() ) ); } MainWindow::~MainWindow() { // again nothing to delete because Qt takes care } void MainWindow::setDocument( const QString& /*str*/ ) { } void MainWindow::initUI() { setToolBarsMovable( false ); QToolBar *menuBarHolder = new QToolBar( this ); menuBarHolder->setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( menuBarHolder ); QToolBar *tb = new QToolBar( this ); QPopupMenu *fileMenu = new QPopupMenu( this ); - QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), + QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "quit_action" ); /* * Connect quit to the QApplication quit slot */ connect(a, SIGNAL(activated() ), qApp, SLOT(quit() ) ); a->addTo( fileMenu ); a = new QAction(tr("View Current"), - Resource::loadIconSet("zoom"), + Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "view current"); /* a simple whats this online explanation of out button */ a->setWhatsThis(tr("Views the current record") ); /* or QWhatsThis::add(widget, "description" ); */ /* see the power? */ a->addTo( fileMenu ); a->addTo( tb ); m_fire = a; a = new QAction(tr("Choose Date"), - Resource::loadIconSet("day"), + Opie::Core::OResource::loadPixmap("day", Opie::Core::OResource::SmallIcon), QString::null, 0, this, "choose date" ); a->addTo( fileMenu ); a->addTo( tb ); m_dateAction = a; mb->insertItem(tr("File"), fileMenu ); } void MainWindow::slotLoad() { /* * There is no real shared access in the PIM API * It wasn't finish cause of health problems of one * of the authors so we do something fancy and use QCOP * the IPC system to get a current copy */ /* NOTES to QCOP: QCOP operates over channels and use QDataStream * to send data. You can check if a channel isRegistered or hook * yourself to that channel. A Channel is QCString and normally * prefix with QPE/ and then the system in example QPE/System, * QPE/Desktop a special channel is the application channel * it QPE/Application/appname this channel gets created on app * startup by QPEApplication. QCOP is asynchronous * * To send you'll use QCopEnevelope * */ /* * What we will do is first is get to know if either * datebook or todolist are running if so we will kindly * asked to save the data for us. * If neither are running we can load directly |