-rw-r--r-- | noncore/multimedia/showimg/showimg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp index c56994d..7c43e11 100644 --- a/noncore/multimedia/showimg/showimg.cpp +++ b/noncore/multimedia/showimg/showimg.cpp | |||
@@ -1,110 +1,110 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // | 21 | // |
22 | // Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> | 22 | // Full-screen and rotation options contributed by Robert Wittams <robert@wittams.com> |
23 | // | 23 | // |
24 | 24 | ||
25 | #include "showimg.h" | 25 | #include "showimg.h" |
26 | 26 | ||
27 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
28 | #include <qpe/fileselector.h> | 28 | #include <qpe/fileselector.h> |
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | 30 | ||
31 | #include <qpe/qpemenubar.h> | 31 | #include <qpe/qpemenubar.h> |
32 | #include <qwidgetstack.h> | 32 | #include <qwidgetstack.h> |
33 | #include <qpe/qpetoolbar.h> | 33 | #include <qpe/qpetoolbar.h> |
34 | #include <qaction.h> | 34 | #include <qaction.h> |
35 | #include <qfiledialog.h> | 35 | #include <qfiledialog.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qpainter.h> | 39 | #include <qpainter.h> |
40 | #include <qkeycode.h> | 40 | #include <qkeycode.h> |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | #include <qclipboard.h> | 42 | #include <qclipboard.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | 44 | ||
45 | 45 | ||
46 | ImagePane::ImagePane( QWidget *parent=0 ) : QWidget( parent ) | 46 | ImagePane::ImagePane( QWidget *parent ) : QWidget( parent ) |
47 | { | 47 | { |
48 | vb = new QVBoxLayout( this ); | 48 | vb = new QVBoxLayout( this ); |
49 | 49 | ||
50 | image = new ImageWidget( this ); | 50 | image = new ImageWidget( this ); |
51 | connect(image, SIGNAL( clicked() ), this, SLOT( imageClicked() )); | 51 | connect(image, SIGNAL( clicked() ), this, SLOT( imageClicked() )); |
52 | 52 | ||
53 | vb->addWidget( image ); | 53 | vb->addWidget( image ); |
54 | 54 | ||
55 | status = new QLabel( this ); | 55 | status = new QLabel( this ); |
56 | status->setFixedHeight( fontMetrics().height() + 4 ); | 56 | status->setFixedHeight( fontMetrics().height() + 4 ); |
57 | vb->addWidget( status ); | 57 | vb->addWidget( status ); |
58 | } | 58 | } |
59 | 59 | ||
60 | void ImagePane::setPixmap( const QPixmap &pm ) | 60 | void ImagePane::setPixmap( const QPixmap &pm ) |
61 | { | 61 | { |
62 | image->setPixmap( pm ); | 62 | image->setPixmap( pm ); |
63 | image->repaint( false ); | 63 | image->repaint( false ); |
64 | } | 64 | } |
65 | 65 | ||
66 | void ImagePane::imageClicked() | 66 | void ImagePane::imageClicked() |
67 | { | 67 | { |
68 | emit clicked(); | 68 | emit clicked(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void ImagePane::showStatus() | 71 | void ImagePane::showStatus() |
72 | { | 72 | { |
73 | delete vb; | 73 | delete vb; |
74 | vb = new QVBoxLayout( this ); | 74 | vb = new QVBoxLayout( this ); |
75 | vb->addWidget( image ); | 75 | vb->addWidget( image ); |
76 | status->show(); | 76 | status->show(); |
77 | vb->addWidget( status ); | 77 | vb->addWidget( status ); |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | void ImagePane::hideStatus() | 81 | void ImagePane::hideStatus() |
82 | { | 82 | { |
83 | delete vb; | 83 | delete vb; |
84 | vb = new QVBoxLayout( this ); | 84 | vb = new QVBoxLayout( this ); |
85 | vb->addWidget( image ); | 85 | vb->addWidget( image ); |
86 | status->hide(); | 86 | status->hide(); |
87 | } | 87 | } |
88 | 88 | ||
89 | //=========================================================================== | 89 | //=========================================================================== |
90 | /* | 90 | /* |
91 | Draws the portion of the scaled pixmap that needs to be updated | 91 | Draws the portion of the scaled pixmap that needs to be updated |
92 | */ | 92 | */ |
93 | 93 | ||
94 | void ImageWidget::paintEvent( QPaintEvent *e ) | 94 | void ImageWidget::paintEvent( QPaintEvent *e ) |
95 | { | 95 | { |
96 | QPainter painter(this); | 96 | QPainter painter(this); |
97 | 97 | ||
98 | painter.setClipRect(e->rect()); | 98 | painter.setClipRect(e->rect()); |
99 | painter.setBrush( black ); | 99 | painter.setBrush( black ); |
100 | painter.drawRect( 0, 0, width(), height() ); | 100 | painter.drawRect( 0, 0, width(), height() ); |
101 | 101 | ||
102 | if ( pixmap.size() != QSize( 0, 0 ) ) { // is an image loaded? | 102 | if ( pixmap.size() != QSize( 0, 0 ) ) { // is an image loaded? |
103 | painter.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap); | 103 | painter.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | void ImageWidget::mouseReleaseEvent(QMouseEvent *) | 107 | void ImageWidget::mouseReleaseEvent(QMouseEvent *) |
108 | { | 108 | { |
109 | emit clicked(); | 109 | emit clicked(); |
110 | } | 110 | } |