Diffstat (limited to 'examples/applet/simpleimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | examples/applet/simpleimpl.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
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,49 +1,32 @@ | |||
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 | ||