author | zecke <zecke> | 2004-09-10 11:46:08 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-10 11:46:08 (UTC) |
commit | e2fa8fdfff6bb0460350d5f1017ead99deea7a0b (patch) (unidiff) | |
tree | 1a4513b5959514a4b33ead8f4970abc2ab37cb19 | |
parent | 5f85bf8c95f2c9f1ca6b784d3adbbcad396a16fa (diff) | |
download | opie-e2fa8fdfff6bb0460350d5f1017ead99deea7a0b.zip opie-e2fa8fdfff6bb0460350d5f1017ead99deea7a0b.tar.gz opie-e2fa8fdfff6bb0460350d5f1017ead99deea7a0b.tar.bz2 |
Add new line at the end
-rw-r--r-- | examples/applet/simpleimpl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/applet/simpleimpl.cpp b/examples/applet/simpleimpl.cpp index 62d9bf7..ff651ca 100644 --- a/examples/applet/simpleimpl.cpp +++ b/examples/applet/simpleimpl.cpp | |||
@@ -1,90 +1,91 @@ | |||
1 | 1 | ||
2 | #include "simpleimpl.h" | 2 | #include "simpleimpl.h" |
3 | 3 | ||
4 | #include <opie2/otaskbarapplet.h> | 4 | #include <opie2/otaskbarapplet.h> |
5 | 5 | ||
6 | #include <qpe/applnk.h> // for AppLnk | 6 | #include <qpe/applnk.h> // for AppLnk |
7 | #include <qpe/resource.h> // for Resource loading | 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 Image, scale it 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 | 22 | * Then we will convert the image back to an Pixmap |
23 | * and draw this Pimxap. We need to use Image because its | 23 | * and draw this Pimxap. We need to use Image because its |
24 | * the only class that allows scaling. | 24 | * the only class that allows scaling. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | QImage image = Resource::loadImage("Tux"); | 27 | QImage image = Resource::loadImage("Tux"); |
28 | /* | 28 | /* |
29 | * smooth scale to AppLnk smallIconSize for applest | 29 | * smooth scale to AppLnk smallIconSize for applest |
30 | * smallIconSize gets adjusted to the resolution | 30 | * smallIconSize gets adjusted to the resolution |
31 | * so on some displays like SIMpad and a C-750 the smallIconSize | 31 | * so on some displays like SIMpad and a C-750 the smallIconSize |
32 | * is greater than on a iPAQ h3870 | 32 | * is greater than on a iPAQ h3870 |
33 | */ | 33 | */ |
34 | image = image.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 34 | image = image.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * now we need to convert the Image to a Pixmap cause these | 37 | * now we need to convert the Image to a Pixmap cause these |
38 | * can be drawn more easily | 38 | * can be drawn more easily |
39 | */ | 39 | */ |
40 | m_pix = new QPixmap(); | 40 | m_pix = new QPixmap(); |
41 | m_pix->convertFromImage( image ); | 41 | m_pix->convertFromImage( image ); |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Now we will say that we don't want to be bigger than our | 44 | * Now we will say that we don't want to be bigger than our |
45 | * Pixmap | 45 | * Pixmap |
46 | */ | 46 | */ |
47 | setFixedHeight(AppLnk::smallIconSize() ); | 47 | setFixedHeight(AppLnk::smallIconSize() ); |
48 | setFixedWidth( AppLnk::smallIconSize() ); | 48 | setFixedWidth( AppLnk::smallIconSize() ); |
49 | 49 | ||
50 | } | 50 | } |
51 | 51 | ||
52 | SimpleApplet::~SimpleApplet() { | 52 | SimpleApplet::~SimpleApplet() { |
53 | delete m_pix; | 53 | delete m_pix; |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | /* | 57 | /* |
58 | * here you would normal show or do something | 58 | * here you would normal show or do something |
59 | * useful. If you want to show a widget at the top left | 59 | * useful. If you want to show a widget at the top left |
60 | * of your icon you need to map your rect().topLeft() to | 60 | * of your icon you need to map your rect().topLeft() to |
61 | * global with mapToGlobal(). Then you might also need to | 61 | * global with mapToGlobal(). Then you might also need to |
62 | * move the widgets so it is visible | 62 | * move the widgets so it is visible |
63 | */ | 63 | */ |
64 | void SimpleApplet::mousePressEvent(QMouseEvent* ) { | 64 | void SimpleApplet::mousePressEvent(QMouseEvent* ) { |
65 | QMessageBox::information(this, tr("No action taken"), | 65 | QMessageBox::information(this, tr("No action taken"), |
66 | tr("<qt>This Plugin does not yet support anything usefule aye.</qt>"), | 66 | tr("<qt>This Plugin does not yet support anything usefule aye.</qt>"), |
67 | QMessageBox::Ok ); | 67 | QMessageBox::Ok ); |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | void SimpleApplet::paintEvent( QPaintEvent* ) { | 71 | void SimpleApplet::paintEvent( QPaintEvent* ) { |
72 | QPainter p(this); | 72 | QPainter p(this); |
73 | 73 | ||
74 | /* simpy draw the pixmap from the start of this widget */ | 74 | /* simpy draw the pixmap from the start of this widget */ |
75 | p.drawPixmap(0, 0, *m_pix ); | 75 | p.drawPixmap(0, 0, *m_pix ); |
76 | } | 76 | } |
77 | 77 | ||
78 | /* | 78 | /* |
79 | * We need to add this symbol for the plugin exporter! | 79 | * We need to add this symbol for the plugin exporter! |
80 | */ | 80 | */ |
81 | int SimpleApplet::position(){ | 81 | int SimpleApplet::position(){ |
82 | return 1; | 82 | return 1; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Here comes the implementation of the interface | 88 | * Here comes the implementation of the interface |
89 | */ | 89 | */ |
90 | EXPORT_OPIE_APPLET_v1( SimpleApplet ) \ No newline at end of file | 90 | EXPORT_OPIE_APPLET_v1( SimpleApplet ) |
91 | |||