author | drw <drw> | 2005-06-15 22:39:20 (UTC) |
---|---|---|
committer | drw <drw> | 2005-06-15 22:39:20 (UTC) |
commit | e0205bac48b9d23af9feb48004c24fcf7a5e8200 (patch) (unidiff) | |
tree | 2faa077192fd0bfc4fc409f0513cc0e82113fa9e | |
parent | d2474c8e654d223b85b6200ce09fabd3a40af8e3 (diff) | |
download | opie-e0205bac48b9d23af9feb48004c24fcf7a5e8200.zip opie-e0205bac48b9d23af9feb48004c24fcf7a5e8200.tar.gz opie-e0205bac48b9d23af9feb48004c24fcf7a5e8200.tar.bz2 |
Resource -> OResource
24 files changed, 47 insertions, 70 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 @@ | |||
1 | CONFIG += warn_on qt | 1 | CONFIG += warn_on qt |
2 | 2 | ||
3 | TEMPLATE = lib | 3 | TEMPLATE = lib |
4 | DESTDIR = $(OPIEDIR)/plugins/applets | 4 | DESTDIR = $(OPIEDIR)/plugins/applets |
5 | TARGET = example | 5 | TARGET = example |
6 | 6 | ||
7 | SOURCES = simpleimpl.cpp | 7 | SOURCES = simpleimpl.cpp |
8 | HEADERS = simpleimpl.h | 8 | HEADERS = simpleimpl.h |
9 | 9 | ||
10 | INCLUDEPATH += $(OPIEDIR)/include | 10 | INCLUDEPATH += $(OPIEDIR)/include |
11 | DEPENDSPATH += $(OPIEDIR)/include | 11 | DEPENDSPATH += $(OPIEDIR)/include |
12 | 12 | ||
13 | LIBS += -lqpe -lopieui2 | 13 | LIBS += -lqpe -lopiecore2 -lopieui2 |
14 | 14 | ||
15 | 15 | ||
16 | include( $(OPIEDIR)/include.pro ) | 16 | 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 @@ | |||
1 | config APPLET_EXAMPLE | 1 | config APPLET_EXAMPLE |
2 | boolean "Taskbar Applet Example" | 2 | boolean "Taskbar Applet Example" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && EXAMPLES | 4 | 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,59 +1,42 @@ | |||
1 | 1 | ||
2 | #include "simpleimpl.h" | 2 | #include "simpleimpl.h" |
3 | 3 | ||
4 | #include <opie2/oresource.h> // for OResource loading | ||
4 | #include <opie2/otaskbarapplet.h> | 5 | #include <opie2/otaskbarapplet.h> |
5 | 6 | ||
6 | #include <qpe/applnk.h> // for AppLnk | 7 | #include <qpe/applnk.h> // for AppLnk |
7 | #include <qpe/resource.h> // for Resource loading | ||
8 | 8 | ||
9 | #include <qlabel.h> | 9 | #include <qlabel.h> |
10 | #include <qpainter.h> | 10 | #include <qpainter.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | 15 | ||
16 | SimpleApplet::SimpleApplet(QWidget *parent) | 16 | SimpleApplet::SimpleApplet(QWidget *parent) |
17 | : QWidget( parent, "Simple Applet" ) { | 17 | : QWidget( parent, "Simple Applet" ) { |
18 | /* | 18 | /* |
19 | * we will load an Image, scale it for the right usage | 19 | * we will load an Pixmap, scaled for the right usage |
20 | * remember your applet might be used by different | 20 | * remember your applet might be used by different |
21 | * resolutions. | 21 | * resolutions. |
22 | * Then we will convert the image back to an Pixmap | ||
23 | * and draw this Pimxap. We need to use Image because its | ||
24 | * the only class that allows scaling. | ||
25 | */ | 22 | */ |
26 | 23 | ||
27 | QImage image = Resource::loadImage("Tux"); | 24 | m_pix = new QPixmap( Opie::Core::OResource::loadPixmap("Tux", Opie::Core::OResource::SmallIcon) ); |
28 | /* | ||
29 | * smooth scale to AppLnk smallIconSize for applest | ||
30 | * smallIconSize gets adjusted to the resolution | ||
31 | * so on some displays like SIMpad and a C-750 the smallIconSize | ||
32 | * is greater than on a iPAQ h3870 | ||
33 | */ | ||
34 | image = image.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | ||
35 | |||
36 | /* | ||
37 | * now we need to convert the Image to a Pixmap cause these | ||
38 | * can be drawn more easily | ||
39 | */ | ||
40 | m_pix = new QPixmap(); | ||
41 | m_pix->convertFromImage( image ); | ||
42 | 25 | ||
43 | /* | 26 | /* |
44 | * Now we will say that we don't want to be bigger than our | 27 | * Now we will say that we don't want to be bigger than our |
45 | * Pixmap | 28 | * Pixmap |
46 | */ | 29 | */ |
47 | setFixedHeight(AppLnk::smallIconSize() ); | 30 | setFixedHeight( AppLnk::smallIconSize() ); |
48 | setFixedWidth( AppLnk::smallIconSize() ); | 31 | setFixedWidth( AppLnk::smallIconSize() ); |
49 | 32 | ||
50 | } | 33 | } |
51 | 34 | ||
52 | SimpleApplet::~SimpleApplet() { | 35 | SimpleApplet::~SimpleApplet() { |
53 | delete m_pix; | 36 | delete m_pix; |
54 | } | 37 | } |
55 | 38 | ||
56 | 39 | ||
57 | /* | 40 | /* |
58 | * here you would normal show or do something | 41 | * here you would normal show or do something |
59 | * useful. If you want to show a widget at the top left | 42 | * useful. If you want to show a widget at the top left |
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 @@ | |||
1 | config EXAMPLE_BOARD | 1 | config EXAMPLE_BOARD |
2 | boolean "Input Method Example" | 2 | boolean "Input Method Example" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES | 4 | 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,18 +1,19 @@ | |||
1 | #include <qwidget.h> | 1 | #include <qwidget.h> |
2 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qsignalmapper.h> | 4 | #include <qsignalmapper.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qpe/resource.h> | 6 | |
7 | #include <opie2/oresource.h> | ||
7 | 8 | ||
8 | #include "exampleboardimpl.h" | 9 | #include "exampleboardimpl.h" |
9 | 10 | ||
10 | ExampleBoard::ExampleBoard(QWidget* par, WFlags fl ) | 11 | ExampleBoard::ExampleBoard(QWidget* par, WFlags fl ) |
11 | : QHBox(par, "name", fl ) | 12 | : QHBox(par, "name", fl ) |
12 | { | 13 | { |
13 | QCheckBox *box1 = new QCheckBox(tr("Alt"),this); | 14 | QCheckBox *box1 = new QCheckBox(tr("Alt"),this); |
14 | connect(box1,SIGNAL(toggled(bool)), | 15 | connect(box1,SIGNAL(toggled(bool)), |
15 | this,SLOT(slotAlt(bool))); | 16 | this,SLOT(slotAlt(bool))); |
16 | m_alt = box1; | 17 | m_alt = box1; |
17 | box1 = new QCheckBox(tr("Shift"),this ); | 18 | box1 = new QCheckBox(tr("Shift"),this ); |
18 | connect(box1,SIGNAL(toggled(bool)), | 19 | connect(box1,SIGNAL(toggled(bool)), |
@@ -109,25 +110,25 @@ QWidget *ExampleboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | |||
109 | return m_pickboard; | 110 | return m_pickboard; |
110 | } | 111 | } |
111 | 112 | ||
112 | void ExampleboardImpl::resetState() | 113 | void ExampleboardImpl::resetState() |
113 | { | 114 | { |
114 | if ( m_pickboard ) | 115 | if ( m_pickboard ) |
115 | m_pickboard->resetState(); | 116 | m_pickboard->resetState(); |
116 | } | 117 | } |
117 | 118 | ||
118 | QPixmap *ExampleboardImpl::icon() | 119 | QPixmap *ExampleboardImpl::icon() |
119 | { | 120 | { |
120 | if ( !m_icn ) | 121 | if ( !m_icn ) |
121 | m_icn = new QPixmap(Resource::loadPixmap("Tux")); | 122 | m_icn = new QPixmap(Opie::Core::OResource::loadPixmap("Tux", Opie::Core::OResource::SmallIcon)); |
122 | return m_icn; | 123 | return m_icn; |
123 | } | 124 | } |
124 | 125 | ||
125 | QString ExampleboardImpl::name() | 126 | QString ExampleboardImpl::name() |
126 | { | 127 | { |
127 | return QObject::tr("Example Input"); | 128 | return QObject::tr("Example Input"); |
128 | } | 129 | } |
129 | 130 | ||
130 | void ExampleboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 131 | void ExampleboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
131 | { | 132 | { |
132 | if ( m_pickboard ) | 133 | if ( m_pickboard ) |
133 | QObject::connect( m_pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 134 | QObject::connect( m_pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
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 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS= exampleboardimpl.h | 3 | HEADERS= exampleboardimpl.h |
4 | SOURCES= exampleboardimpl.cpp | 4 | SOURCES= exampleboardimpl.cpp |
5 | TARGET = example_board | 5 | TARGET = example_board |
6 | DESTDIR = $(OPIEDIR)/plugins/inputmethods | 6 | DESTDIR = $(OPIEDIR)/plugins/inputmethods |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../../launcher | 8 | DEPENDPATH += ../../launcher |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | 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 @@ | |||
1 | config MAIN_TAB_EXAMPLE | 1 | config MAIN_TAB_EXAMPLE |
2 | boolean "Mainwindow with OTabWidget example" | 2 | boolean "Mainwindow with OTabWidget example" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES && LIBOPIE2UI | 4 | 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 | |||
@@ -3,15 +3,15 @@ CONFIG += qt warn_on quick-app | |||
3 | 3 | ||
4 | TARGET = main-tab | 4 | TARGET = main-tab |
5 | 5 | ||
6 | HEADERS = simple.h | 6 | HEADERS = simple.h |
7 | SOURCES = simple.cpp | 7 | SOURCES = simple.cpp |
8 | 8 | ||
9 | 9 | ||
10 | INCLUDEPATH += $(OPIEDIR)/include | 10 | INCLUDEPATH += $(OPIEDIR)/include |
11 | DEPENDPATH += $(OPIEDIR)/include | 11 | DEPENDPATH += $(OPIEDIR)/include |
12 | 12 | ||
13 | 13 | ||
14 | # we now also include opie | 14 | # we now also include opie |
15 | LIBS += -lqpe -lopieui2 | 15 | LIBS += -lqpe -lopiecore2 -lopieui2 |
16 | 16 | ||
17 | include( $(OPIEDIR)/include.pro ) | 17 | 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 @@ | |||
1 | Package: opie-main-tab-example | 1 | Package: opie-main-tab-example |
2 | Files: bin/main-tab apps/Examples/main-tab.desktop | 2 | Files: bin/main-tab apps/Examples/main-tab.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/examples | 4 | Section: opie/examples |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, opie-pics | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, opie-pics |
8 | Description: A simple example | 8 | Description: A simple example |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,24 +1,24 @@ | |||
1 | #include <qaction.h> // action | 1 | #include <qaction.h> // action |
2 | #include <qmenubar.h> // menubar | 2 | #include <qmenubar.h> // menubar |
3 | #include <qtoolbar.h> // toolbar | 3 | #include <qtoolbar.h> // toolbar |
4 | #include <qlabel.h> // a label | 4 | #include <qlabel.h> // a label |
5 | #include <qpushbutton.h> // the header file for the QPushButton | 5 | #include <qpushbutton.h> // the header file for the QPushButton |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | 7 | ||
8 | #include <qpe/qpeapplication.h> // the QPEApplication | 8 | #include <qpe/qpeapplication.h> // the QPEApplication |
9 | #include <qpe/resource.h> | ||
10 | #include <qpe/sound.h> | 9 | #include <qpe/sound.h> |
11 | 10 | ||
12 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching | 11 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching |
12 | #include <opie2/oresource.h> | ||
13 | #include <opie2/otabwidget.h> | 13 | #include <opie2/otabwidget.h> |
14 | 14 | ||
15 | #include "simple.h" | 15 | #include "simple.h" |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * implementation of simple | 18 | * implementation of simple |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * The factory is used for quicklaunching | 22 | * The factory is used for quicklaunching |
23 | * 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 | 23 | * 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 |
24 | * | 24 | * |
@@ -78,35 +78,34 @@ void MainWindow::initUI() { | |||
78 | 78 | ||
79 | setToolBarsMovable( false ); | 79 | setToolBarsMovable( false ); |
80 | 80 | ||
81 | QToolBar *menuBarHolder = new QToolBar( this ); | 81 | QToolBar *menuBarHolder = new QToolBar( this ); |
82 | 82 | ||
83 | menuBarHolder->setHorizontalStretchable( true ); | 83 | menuBarHolder->setHorizontalStretchable( true ); |
84 | QMenuBar *mb = new QMenuBar( menuBarHolder ); | 84 | QMenuBar *mb = new QMenuBar( menuBarHolder ); |
85 | QToolBar *tb = new QToolBar( this ); | 85 | QToolBar *tb = new QToolBar( this ); |
86 | 86 | ||
87 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 87 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
88 | 88 | ||
89 | 89 | ||
90 | QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), | 90 | QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), |
91 | QString::null, 0, this, "quit_action" ); | 91 | QString::null, 0, this, "quit_action" ); |
92 | /* | 92 | /* |
93 | * Connect quit to the QApplication quit slot | 93 | * Connect quit to the QApplication quit slot |
94 | */ | 94 | */ |
95 | connect(a, SIGNAL(activated() ), | 95 | connect(a, SIGNAL(activated() ), |
96 | qApp, SLOT(quit() ) ); | 96 | qApp, SLOT(quit() ) ); |
97 | a->addTo( fileMenu ); | 97 | a->addTo( fileMenu ); |
98 | 98 | ||
99 | a = new QAction(tr("Fire"), | 99 | a = new QAction(tr("Fire"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), |
100 | Resource::loadIconSet("new"), | ||
101 | QString::null, 0, this, "fire_button"); | 100 | QString::null, 0, this, "fire_button"); |
102 | 101 | ||
103 | /* see the power? */ | 102 | /* see the power? */ |
104 | a->addTo( fileMenu ); | 103 | a->addTo( fileMenu ); |
105 | a->addTo( tb ); | 104 | a->addTo( tb ); |
106 | m_fire = a; | 105 | m_fire = a; |
107 | 106 | ||
108 | 107 | ||
109 | mb->insertItem(tr("File"), fileMenu ); | 108 | mb->insertItem(tr("File"), fileMenu ); |
110 | 109 | ||
111 | } | 110 | } |
112 | 111 | ||
@@ -164,29 +163,29 @@ Simple2::Simple2( QWidget* parent, const char* name, WFlags fl ) | |||
164 | */ | 163 | */ |
165 | QVBoxLayout *layout = new QVBoxLayout( this ); | 164 | QVBoxLayout *layout = new QVBoxLayout( this ); |
166 | layout->setSpacing( 8 ); | 165 | layout->setSpacing( 8 ); |
167 | layout->setMargin( 11 ); | 166 | layout->setMargin( 11 ); |
168 | 167 | ||
169 | /* | 168 | /* |
170 | * creates a label | 169 | * creates a label |
171 | * The first parameter is this widget so the Label is a child | 170 | * The first parameter is this widget so the Label is a child |
172 | * of us and will be deleted when we're deleted. | 171 | * of us and will be deleted when we're deleted. |
173 | */ | 172 | */ |
174 | QLabel *lbl = new QLabel( this, "a name for the label" ); | 173 | QLabel *lbl = new QLabel( this, "a name for the label" ); |
175 | /* | 174 | /* |
176 | * Resource will search hard for a Pixmap in $OPIEDIR/pics | 175 | * OResource will search hard for a Pixmap in $OPIEDIR/pics |
177 | * to find 'logo/opielogo' You need to pass the subdir | 176 | * to find 'logo/opielogo' You need to pass the subdir |
178 | * but not the ending | 177 | * but not the ending |
179 | */ | 178 | */ |
180 | lbl->setPixmap( Resource::loadPixmap("logo/opielogo") ); | 179 | lbl->setPixmap( Opie::Core::OResource::loadPixmap("logo/opielogo", Opie::Core::OResource::SmallIcon) ); |
181 | layout->addWidget( lbl ); | 180 | layout->addWidget( lbl ); |
182 | 181 | ||
183 | 182 | ||
184 | /* creates a button as child of this widget */ | 183 | /* creates a button as child of this widget */ |
185 | m_button = new QPushButton(this); | 184 | m_button = new QPushButton(this); |
186 | /* | 185 | /* |
187 | * another way to call tr. The first parameter is the string | 186 | * another way to call tr. The first parameter is the string |
188 | * to translate and the second a hint to the translator | 187 | * to translate and the second a hint to the translator |
189 | */ | 188 | */ |
190 | m_button->setText( tr("Fire", "translatable fire string" ) ); | 189 | m_button->setText( tr("Fire", "translatable fire string" ) ); |
191 | layout->addWidget( m_button ); | 190 | layout->addWidget( m_button ); |
192 | 191 | ||
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 @@ | |||
1 | config EXAMPLE_MENU | 1 | config EXAMPLE_MENU |
2 | boolean "O-Menu Applet" | 2 | boolean "O-Menu Applet" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES | 4 | 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,16 +1,15 @@ | |||
1 | #include "example.h" | 1 | #include "example.h" |
2 | 2 | ||
3 | #include <qpe/applnk.h> | 3 | #include <opie2/oresource.h> |
4 | #include <qpe/resource.h> | ||
5 | 4 | ||
6 | /* QT */ | 5 | /* QT */ |
7 | #include <qiconset.h> | 6 | #include <qiconset.h> |
8 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
9 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
10 | 9 | ||
11 | 10 | ||
12 | MenuAppletExample::MenuAppletExample() | 11 | MenuAppletExample::MenuAppletExample() |
13 | :QObject( 0, "MenuAppletExample" ) | 12 | :QObject( 0, "MenuAppletExample" ) |
14 | { | 13 | { |
15 | } | 14 | } |
16 | 15 | ||
@@ -26,29 +25,25 @@ QString MenuAppletExample::name() const | |||
26 | { | 25 | { |
27 | return tr( "MenuApplet Example Name" ); | 26 | return tr( "MenuApplet Example Name" ); |
28 | } | 27 | } |
29 | 28 | ||
30 | QString MenuAppletExample::text() const | 29 | QString MenuAppletExample::text() const |
31 | { | 30 | { |
32 | return tr( "Click the white rabbit" ); | 31 | return tr( "Click the white rabbit" ); |
33 | } | 32 | } |
34 | 33 | ||
35 | 34 | ||
36 | QIconSet MenuAppletExample::icon() const | 35 | QIconSet MenuAppletExample::icon() const |
37 | { | 36 | { |
38 | QPixmap pix; | 37 | return Opie::Core::OResource::loadPixmap( "Tux", Opie::Core::OResource::SmallIcon ); |
39 | QImage img = Resource::loadImage( "Tux" ); | ||
40 | if ( !img.isNull() ) | ||
41 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
42 | return pix; | ||
43 | } | 38 | } |
44 | 39 | ||
45 | QPopupMenu* MenuAppletExample::popup(QWidget*) const | 40 | QPopupMenu* MenuAppletExample::popup(QWidget*) const |
46 | { | 41 | { |
47 | /* no subdir */ | 42 | /* no subdir */ |
48 | return 0; | 43 | return 0; |
49 | } | 44 | } |
50 | 45 | ||
51 | void MenuAppletExample::activated() | 46 | void MenuAppletExample::activated() |
52 | { | 47 | { |
53 | QMessageBox::information(0,tr("No white rabbit found"), | 48 | QMessageBox::information(0,tr("No white rabbit found"), |
54 | tr("<qt>No white rabbit was seen near Opie." | 49 | tr("<qt>No white rabbit was seen near Opie." |
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 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugn warn_on | 2 | CONFIG += qt plugn warn_on |
3 | HEADERS = example.h | 3 | HEADERS = example.h |
4 | SOURCES = example.cpp | 4 | SOURCES = example.cpp |
5 | TARGET = example_applet | 5 | TARGET = example_applet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | 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 @@ | |||
1 | config EXAMPLE_LIBOPIE2UI | 1 | config EXAMPLE_LIBOPIE2UI |
2 | boolean "libopieui2 examples" | 2 | boolean "libopieui2 examples" |
3 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI | 3 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && EXAMPLES |
4 | 4 | ||
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,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * You may use, modify and distribute this example without any limitation | 2 | * You may use, modify and distribute this example without any limitation |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "owidgetstack_example.h" | 5 | #include "owidgetstack_example.h" |
6 | 6 | ||
7 | /* OPIE */ | 7 | /* OPIE */ |
8 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
9 | #include <opie2/owidgetstack.h> | 9 | #include <opie2/owidgetstack.h> |
10 | #include <qpe/resource.h> | 10 | #include <opie2/oresource.h> |
11 | 11 | ||
12 | /* QT */ | 12 | /* QT */ |
13 | #include <qaction.h> | 13 | #include <qaction.h> |
14 | #include <qtoolbar.h> | 14 | #include <qtoolbar.h> |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmenubar.h> | 16 | #include <qmenubar.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qlabel.h> | 18 | #include <qlabel.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qsignalmapper.h> | 20 | #include <qsignalmapper.h> |
21 | 21 | ||
22 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
@@ -35,46 +35,46 @@ StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) | |||
35 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); | 35 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); |
36 | 36 | ||
37 | /* toolbar first but this should be known from the other examples */ | 37 | /* toolbar first but this should be known from the other examples */ |
38 | setToolBarsMovable( false ); | 38 | setToolBarsMovable( false ); |
39 | 39 | ||
40 | /* only a menubar here */ | 40 | /* only a menubar here */ |
41 | QToolBar* holder = new QToolBar( this ); | 41 | QToolBar* holder = new QToolBar( this ); |
42 | holder->setHorizontalStretchable( true ); | 42 | holder->setHorizontalStretchable( true ); |
43 | 43 | ||
44 | QMenuBar *bar = new QMenuBar( holder ); | 44 | QMenuBar *bar = new QMenuBar( holder ); |
45 | QPopupMenu *menu = new QPopupMenu( this ); | 45 | QPopupMenu *menu = new QPopupMenu( this ); |
46 | 46 | ||
47 | QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"), | 47 | QAction* a = new QAction( tr("Show MainWidget"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), |
48 | QString::null, 0, this, 0 ); | 48 | QString::null, 0, this, 0 ); |
49 | sm->setMapping(a, 1 ); | 49 | sm->setMapping(a, 1 ); |
50 | connect(a, SIGNAL(activated() ), | 50 | connect(a, SIGNAL(activated() ), |
51 | sm, SLOT(map() ) ); | 51 | sm, SLOT(map() ) ); |
52 | a->addTo( menu ); | 52 | a->addTo( menu ); |
53 | 53 | ||
54 | a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"), | 54 | a = new QAction( tr("Show Details Small"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), |
55 | QString::null, 0, this, 0 ); | 55 | QString::null, 0, this, 0 ); |
56 | sm->setMapping(a, 2 ); | 56 | sm->setMapping(a, 2 ); |
57 | connect(a, SIGNAL(activated() ), | 57 | connect(a, SIGNAL(activated() ), |
58 | sm, SLOT(map() ) ); | 58 | sm, SLOT(map() ) ); |
59 | a->addTo( menu ); | 59 | a->addTo( menu ); |
60 | 60 | ||
61 | a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"), | 61 | a = new QAction( tr("Show Details More"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), |
62 | QString::null, 0, this, 0 ); | 62 | QString::null, 0, this, 0 ); |
63 | sm->setMapping(a, 3 ); | 63 | sm->setMapping(a, 3 ); |
64 | connect(a, SIGNAL(activated() ), | 64 | connect(a, SIGNAL(activated() ), |
65 | sm, SLOT(map() ) ); | 65 | sm, SLOT(map() ) ); |
66 | a->addTo( menu ); | 66 | a->addTo( menu ); |
67 | 67 | ||
68 | a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"), | 68 | a = new QAction( tr("Show Details All"), Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), |
69 | QString::null, 0, this, 0 ); | 69 | QString::null, 0, this, 0 ); |
70 | sm->setMapping(a, 4 ); | 70 | sm->setMapping(a, 4 ); |
71 | connect(a, SIGNAL(activated() ), | 71 | connect(a, SIGNAL(activated() ), |
72 | sm, SLOT(map() ) ); | 72 | sm, SLOT(map() ) ); |
73 | 73 | ||
74 | bar->insertItem( tr("Actions"), menu ); | 74 | bar->insertItem( tr("Actions"), menu ); |
75 | 75 | ||
76 | /* now the gui */ | 76 | /* now the gui */ |
77 | 77 | ||
78 | /* first widget, main widget */ | 78 | /* first widget, main widget */ |
79 | QWidget * wid = new QWidget( m_stack ); | 79 | QWidget * wid = new QWidget( m_stack ); |
80 | QGridLayout *grid = new QGridLayout(wid, 2, 2 ); | 80 | QGridLayout *grid = new QGridLayout(wid, 2, 2 ); |
@@ -89,33 +89,33 @@ StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) | |||
89 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | 89 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); |
90 | grid->addWidget( btn, 0, 1 ); | 90 | grid->addWidget( btn, 0, 1 ); |
91 | 91 | ||
92 | btn = new QPushButton( tr("Show Details All"), wid, "details3"); | 92 | btn = new QPushButton( tr("Show Details All"), wid, "details3"); |
93 | sm->setMapping(btn, 4 ); | 93 | sm->setMapping(btn, 4 ); |
94 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | 94 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); |
95 | grid->addWidget( btn, 1, 1 ); | 95 | grid->addWidget( btn, 1, 1 ); |
96 | 96 | ||
97 | m_stack->addWidget( wid, 1 ); | 97 | m_stack->addWidget( wid, 1 ); |
98 | m_main = wid; | 98 | m_main = wid; |
99 | 99 | ||
100 | QLabel *lbl = new QLabel(m_stack ); | 100 | QLabel *lbl = new QLabel(m_stack ); |
101 | lbl->setText(tr("Only small Details are shown here. Määh") ); | 101 | lbl->setText(tr("Only small Details are shown here. M�h") ); |
102 | m_stack->addWidget( lbl, 2 ); | 102 | m_stack->addWidget( lbl, 2 ); |
103 | 103 | ||
104 | lbl = new QLabel( m_stack ); | 104 | lbl = new QLabel( m_stack ); |
105 | lbl->setText( tr("Some more details....Wo ist das Schaf?") ); | 105 | lbl->setText( tr("Some more details....Wo ist das Schaf?") ); |
106 | m_stack->addWidget( lbl, 3 ); | 106 | m_stack->addWidget( lbl, 3 ); |
107 | 107 | ||
108 | lbl = new QLabel( m_stack ); | 108 | lbl = new QLabel( m_stack ); |
109 | 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") ); | 109 | 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") ); |
110 | m_stack->addWidget( lbl, 4 ); | 110 | m_stack->addWidget( lbl, 4 ); |
111 | 111 | ||
112 | 112 | ||
113 | /* THE signal mapper does all the magic */ | 113 | /* THE signal mapper does all the magic */ |
114 | m_stack->raiseWidget( m_main ); | 114 | m_stack->raiseWidget( m_main ); |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | StackExample::~StackExample() { | 118 | StackExample::~StackExample() { |
119 | 119 | ||
120 | } | 120 | } |
121 | 121 | ||
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 @@ | |||
1 | CONFIG += qt warn_on | 1 | CONFIG += qt warn_on |
2 | TEMPLATE = app | 2 | TEMPLATE = app |
3 | TARGET = owidgetstack-example | 3 | TARGET = owidgetstack-example |
4 | 4 | ||
5 | SOURCES = owidgetstack_example.cpp | 5 | SOURCES = owidgetstack_example.cpp |
6 | HEADERS = owidgetstack_example.h | 6 | HEADERS = owidgetstack_example.h |
7 | 7 | ||
8 | INCLUDEPATH += $(OPIEDIR)/include | 8 | INCLUDEPATH += $(OPIEDIR)/include |
9 | DEPENDSPATH += $(OPIEDIR)/include | 9 | DEPENDSPATH += $(OPIEDIR)/include |
10 | 10 | ||
11 | LIBS += -lqpe -lopieui2 | 11 | LIBS += -lqpe -lopiecore2 -lopieui2 |
12 | 12 | ||
13 | include( $(OPIEDIR)/include.pro ) | 13 | 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 @@ | |||
1 | config SIMPLE_ICON | 1 | config SIMPLE_ICON |
2 | boolean "Simples Widget which loads Pixmaps and plays sound" | 2 | boolean "Simples Widget which loads Pixmaps and plays sound" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES | 4 | 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 @@ | |||
1 | Package: opie-simple-icon-example | 1 | Package: opie-simple-icon-example |
2 | Files: bin/simple-icon apps/Examples/simple-icon.desktop | 2 | Files: bin/simple-icon apps/Examples/simple-icon.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/examples | 4 | Section: opie/examples |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, opie-pics | 7 | Depends: task-opie-minimal, libopiecore2, opie-pics |
8 | Description: A simple icon example | 8 | Description: A simple icon example |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,22 +1,21 @@ | |||
1 | #include <qlabel.h> // a label | 1 | #include <qlabel.h> // a label |
2 | #include <qpushbutton.h> // the header file for the QPushButton | 2 | #include <qpushbutton.h> // the header file for the QPushButton |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | 4 | ||
5 | #include <qpe/qpeapplication.h> // the QPEApplication | 5 | #include <qpe/qpeapplication.h> // the QPEApplication |
6 | #include <qpe/resource.h> // for loading icon | ||
7 | #include <qpe/sound.h> // for playing a sound | 6 | #include <qpe/sound.h> // for playing a sound |
8 | 7 | ||
9 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching | 8 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching |
10 | 9 | #include <opie2/oresource.h> // for loading icon | |
11 | #include "simple.h" | 10 | #include "simple.h" |
12 | 11 | ||
13 | /* | 12 | /* |
14 | * implementation of simple | 13 | * implementation of simple |
15 | */ | 14 | */ |
16 | 15 | ||
17 | /* | 16 | /* |
18 | * The factory is used for quicklaunching | 17 | * The factory is used for quicklaunching |
19 | * 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 | 18 | * 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 |
20 | * | 19 | * |
21 | * Depending on the global quick launch setting this will create | 20 | * Depending on the global quick launch setting this will create |
22 | * either a main method or one for our component plugin system | 21 | * either a main method or one for our component plugin system |
@@ -44,25 +43,25 @@ Simple::Simple( QWidget* parent, const char* name, WFlags fl ) | |||
44 | 43 | ||
45 | /* | 44 | /* |
46 | * creates a label | 45 | * creates a label |
47 | * The first parameter is this widget so the Label is a child | 46 | * The first parameter is this widget so the Label is a child |
48 | * of us and will be deleted when we're deleted. | 47 | * of us and will be deleted when we're deleted. |
49 | */ | 48 | */ |
50 | QLabel *lbl = new QLabel( this, "a name for the label" ); | 49 | QLabel *lbl = new QLabel( this, "a name for the label" ); |
51 | /* | 50 | /* |
52 | * Resource will search hard for a Pixmap in $OPIEDIR/pics | 51 | * Resource will search hard for a Pixmap in $OPIEDIR/pics |
53 | * to find 'logo/opielogo' You need to pass the subdir | 52 | * to find 'logo/opielogo' You need to pass the subdir |
54 | * but not the ending | 53 | * but not the ending |
55 | */ | 54 | */ |
56 | lbl->setPixmap( Resource::loadPixmap("logo/opielogo") ); | 55 | lbl->setPixmap( Opie::Core::OResource::loadPixmap("logo/opielogo", Opie::Core::OResource::SmallIcon) ); |
57 | layout->addWidget( lbl ); | 56 | layout->addWidget( lbl ); |
58 | 57 | ||
59 | 58 | ||
60 | /* creates a button as child of this widget */ | 59 | /* creates a button as child of this widget */ |
61 | m_button = new QPushButton(this); | 60 | m_button = new QPushButton(this); |
62 | /* | 61 | /* |
63 | * another way to call tr. The first parameter is the string | 62 | * another way to call tr. The first parameter is the string |
64 | * to translate and the second a hint to the translator | 63 | * to translate and the second a hint to the translator |
65 | */ | 64 | */ |
66 | m_button->setText( tr("Fire", "translatable fire string" ) ); | 65 | m_button->setText( tr("Fire", "translatable fire string" ) ); |
67 | layout->addWidget( m_button ); | 66 | layout->addWidget( m_button ); |
68 | 67 | ||
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 @@ | |||
1 | config SIMPLE_MAIN | 1 | config SIMPLE_MAIN |
2 | boolean "Simple Mainwindow with Actions buttons and iconsets" | 2 | boolean "Simple Mainwindow with Actions buttons and iconsets" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES | 4 | 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 @@ | |||
1 | Package: opie-simple-main-example | 1 | Package: opie-simple-main-example |
2 | Files: bin/simple-main apps/Examples/simple-main.desktop | 2 | Files: bin/simple-main apps/Examples/simple-main.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/examples | 4 | Section: opie/examples |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, opie-pics | 7 | Depends: task-opie-minimal, libopiecore2, opie-pics |
8 | Description: A simple example | 8 | Description: A simple example |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,45 +1,45 @@ | |||
1 | #include <qaction.h> // action | 1 | #include <qaction.h> // action |
2 | #include <qmenubar.h> // menubar | 2 | #include <qmenubar.h> // menubar |
3 | #include <qtoolbar.h> // toolbar | 3 | #include <qtoolbar.h> // toolbar |
4 | #include <qlabel.h> // a label | 4 | #include <qlabel.h> // a label |
5 | #include <qpushbutton.h> // the header file for the QPushButton | 5 | #include <qpushbutton.h> // the header file for the QPushButton |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | 7 | ||
8 | #include <qpe/qpeapplication.h> // the QPEApplication | 8 | #include <qpe/qpeapplication.h> // the QPEApplication |
9 | #include <qpe/resource.h> | ||
10 | 9 | ||
11 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching | 10 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching |
11 | #include <opie2/oresource.h> | ||
12 | 12 | ||
13 | #include "simple.h" | 13 | #include "simple.h" |
14 | 14 | ||
15 | /* | 15 | /* |
16 | * implementation of simple | 16 | * implementation of simple |
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* | 19 | /* |
20 | * The factory is used for quicklaunching | 20 | * The factory is used for quicklaunching |
21 | * 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 | 21 | * 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 |
22 | * | 22 | * |
23 | * Depending on the global quick launch setting this will create | 23 | * Depending on the global quick launch setting this will create |
24 | * either a main method or one for our component plugin system | 24 | * either a main method or one for our component plugin system |
25 | */ | 25 | */ |
26 | 26 | ||
27 | using namespace Opie::Core; | 27 | using namespace Opie::Core; |
28 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) | 28 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
29 | 29 | ||
30 | MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) | 30 | MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) |
31 | : QMainWindow( parent, name, fl ) { | 31 | : QMainWindow( parent, name, fl ) { |
32 | setCaption(tr("My MainWindow") ); | 32 | setCaption(tr("My MainWindow") ); |
33 | setIcon( Resource::loadPixmap("new") ); | 33 | setIcon( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon) ); |
34 | /* | 34 | /* |
35 | * out mainwindow should have a menubar | 35 | * out mainwindow should have a menubar |
36 | * a toolbar, a mainwidget and use Resource | 36 | * a toolbar, a mainwidget and use Resource |
37 | * to get the IconSets | 37 | * to get the IconSets |
38 | */ | 38 | */ |
39 | /* | 39 | /* |
40 | * we initialize the GUI in a different methid | 40 | * we initialize the GUI in a different methid |
41 | */ | 41 | */ |
42 | initUI(); | 42 | initUI(); |
43 | 43 | ||
44 | Simple *simple = new Simple( this ); | 44 | Simple *simple = new Simple( this ); |
45 | setCentralWidget( simple ); | 45 | setCentralWidget( simple ); |
@@ -119,35 +119,35 @@ void MainWindow::initUI() { | |||
119 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 119 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * we create our first action with the Text Quit | 122 | * we create our first action with the Text Quit |
123 | * a IconSet, no menu name, no acceleration ( keyboard shortcut ), | 123 | * a IconSet, no menu name, no acceleration ( keyboard shortcut ), |
124 | * with parent this, and name "quit_action" | 124 | * with parent this, and name "quit_action" |
125 | */ | 125 | */ |
126 | /* | 126 | /* |
127 | * Note if you want a picture out of the inline directory | 127 | * Note if you want a picture out of the inline directory |
128 | * you musn't prefix inline/ inline means these pics are built in | 128 | * you musn't prefix inline/ inline means these pics are built in |
129 | * into libqpe so the name without ending and directory is enough | 129 | * into libqpe so the name without ending and directory is enough |
130 | */ | 130 | */ |
131 | QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), | 131 | QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), |
132 | QString::null, 0, this, "quit_action" ); | 132 | QString::null, 0, this, "quit_action" ); |
133 | /* | 133 | /* |
134 | * Connect quit to the QApplication quit slot | 134 | * Connect quit to the QApplication quit slot |
135 | */ | 135 | */ |
136 | connect(a, SIGNAL(activated() ), | 136 | connect(a, SIGNAL(activated() ), |
137 | qApp, SLOT(quit() ) ); | 137 | qApp, SLOT(quit() ) ); |
138 | a->addTo( fileMenu ); | 138 | a->addTo( fileMenu ); |
139 | 139 | ||
140 | a = new QAction(tr("Fire"), | 140 | a = new QAction(tr("Fire"), |
141 | Resource::loadIconSet("new"), | 141 | Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), |
142 | QString::null, 0, this, "fire_button"); | 142 | QString::null, 0, this, "fire_button"); |
143 | 143 | ||
144 | /* see the power? */ | 144 | /* see the power? */ |
145 | a->addTo( fileMenu ); | 145 | a->addTo( fileMenu ); |
146 | a->addTo( tb ); | 146 | a->addTo( tb ); |
147 | m_fire = a; | 147 | m_fire = a; |
148 | 148 | ||
149 | 149 | ||
150 | mb->insertItem(tr("File"), fileMenu ); | 150 | mb->insertItem(tr("File"), fileMenu ); |
151 | 151 | ||
152 | } | 152 | } |
153 | 153 | ||
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 @@ | |||
1 | Package: opie-simple-pim-example | 1 | Package: opie-simple-pim-example |
2 | Files: bin/main-tab apps/Examples/main-tab.desktop | 2 | Files: bin/main-tab apps/Examples/main-tab.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/examples | 4 | Section: opie/examples |
5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> | 5 | Maintainer: Holger 'zecke' Freyther <zecke@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, opie-pics | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2, opie-pics |
8 | Description: A simple example | 8 | Description: A simple example |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,26 +1,26 @@ | |||
1 | /* We use a sane order of include files, from the most special to the least special | 1 | /* We use a sane order of include files, from the most special to the least special |
2 | That helps to reduce the number of implicit includes hence increases the reuse */ | 2 | That helps to reduce the number of implicit includes hence increases the reuse */ |
3 | 3 | ||
4 | /* First the local include files */ | 4 | /* First the local include files */ |
5 | #include "simple.h" | 5 | #include "simple.h" |
6 | 6 | ||
7 | /* Then the Ope include files. | 7 | /* Then the Ope include files. |
8 | This includes qpe stuff which will eventually be merged with libopie2 */ | 8 | This includes qpe stuff which will eventually be merged with libopie2 */ |
9 | #include <opie2/odebug.h> // for odebug streams | 9 | #include <opie2/odebug.h> // for odebug streams |
10 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching | 10 | #include <opie2/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching |
11 | #include <opie2/oresource.h> | ||
11 | #include <opie2/otabwidget.h> | 12 | #include <opie2/otabwidget.h> |
12 | #include <opie2/owait.h> | 13 | #include <opie2/owait.h> |
13 | #include <qpe/qpeapplication.h> // the QPEApplication | 14 | #include <qpe/qpeapplication.h> // the QPEApplication |
14 | #include <qpe/resource.h> | ||
15 | #include <qpe/sound.h> | 15 | #include <qpe/sound.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 16 | #include <qpe/qcopenvelope_qws.h> |
17 | #include <qpe/datebookmonth.h> | 17 | #include <qpe/datebookmonth.h> |
18 | #include <qpe/timestring.h> | 18 | #include <qpe/timestring.h> |
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | 20 | ||
21 | /* Now the Qt includes */ | 21 | /* Now the Qt includes */ |
22 | #include <qaction.h> // action | 22 | #include <qaction.h> // action |
23 | #include <qmenubar.h> // menubar | 23 | #include <qmenubar.h> // menubar |
24 | #include <qtoolbar.h> // toolbar | 24 | #include <qtoolbar.h> // toolbar |
25 | #include <qlabel.h> // a label | 25 | #include <qlabel.h> // a label |
26 | #include <qpushbutton.h> // the header file for the QPushButton | 26 | #include <qpushbutton.h> // the header file for the QPushButton |
@@ -122,47 +122,47 @@ void MainWindow::initUI() { | |||
122 | 122 | ||
123 | setToolBarsMovable( false ); | 123 | setToolBarsMovable( false ); |
124 | 124 | ||
125 | QToolBar *menuBarHolder = new QToolBar( this ); | 125 | QToolBar *menuBarHolder = new QToolBar( this ); |
126 | 126 | ||
127 | menuBarHolder->setHorizontalStretchable( true ); | 127 | menuBarHolder->setHorizontalStretchable( true ); |
128 | QMenuBar *mb = new QMenuBar( menuBarHolder ); | 128 | QMenuBar *mb = new QMenuBar( menuBarHolder ); |
129 | QToolBar *tb = new QToolBar( this ); | 129 | QToolBar *tb = new QToolBar( this ); |
130 | 130 | ||
131 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 131 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
132 | 132 | ||
133 | 133 | ||
134 | QAction *a = new QAction( tr("Quit"), Resource::loadIconSet("quit_icon"), | 134 | QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon), |
135 | QString::null, 0, this, "quit_action" ); | 135 | QString::null, 0, this, "quit_action" ); |
136 | /* | 136 | /* |
137 | * Connect quit to the QApplication quit slot | 137 | * Connect quit to the QApplication quit slot |
138 | */ | 138 | */ |
139 | connect(a, SIGNAL(activated() ), | 139 | connect(a, SIGNAL(activated() ), |
140 | qApp, SLOT(quit() ) ); | 140 | qApp, SLOT(quit() ) ); |
141 | a->addTo( fileMenu ); | 141 | a->addTo( fileMenu ); |
142 | 142 | ||
143 | a = new QAction(tr("View Current"), | 143 | a = new QAction(tr("View Current"), |
144 | Resource::loadIconSet("zoom"), | 144 | Opie::Core::OResource::loadPixmap("zoom", Opie::Core::OResource::SmallIcon), |
145 | QString::null, 0, this, "view current"); | 145 | QString::null, 0, this, "view current"); |
146 | /* a simple whats this online explanation of out button */ | 146 | /* a simple whats this online explanation of out button */ |
147 | a->setWhatsThis(tr("Views the current record") ); | 147 | a->setWhatsThis(tr("Views the current record") ); |
148 | /* or QWhatsThis::add(widget, "description" ); */ | 148 | /* or QWhatsThis::add(widget, "description" ); */ |
149 | 149 | ||
150 | /* see the power? */ | 150 | /* see the power? */ |
151 | a->addTo( fileMenu ); | 151 | a->addTo( fileMenu ); |
152 | a->addTo( tb ); | 152 | a->addTo( tb ); |
153 | m_fire = a; | 153 | m_fire = a; |
154 | 154 | ||
155 | a = new QAction(tr("Choose Date"), | 155 | a = new QAction(tr("Choose Date"), |
156 | Resource::loadIconSet("day"), | 156 | Opie::Core::OResource::loadPixmap("day", Opie::Core::OResource::SmallIcon), |
157 | QString::null, 0, this, "choose date" ); | 157 | QString::null, 0, this, "choose date" ); |
158 | a->addTo( fileMenu ); | 158 | a->addTo( fileMenu ); |
159 | a->addTo( tb ); | 159 | a->addTo( tb ); |
160 | m_dateAction = a; | 160 | m_dateAction = a; |
161 | 161 | ||
162 | mb->insertItem(tr("File"), fileMenu ); | 162 | mb->insertItem(tr("File"), fileMenu ); |
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | void MainWindow::slotLoad() { | 166 | void MainWindow::slotLoad() { |
167 | /* | 167 | /* |
168 | * There is no real shared access in the PIM API | 168 | * There is no real shared access in the PIM API |