summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/showimg/config.in2
-rw-r--r--noncore/multimedia/showimg/main.cpp4
-rw-r--r--noncore/multimedia/showimg/opie-showimg.control2
-rw-r--r--noncore/multimedia/showimg/showimg.cpp11
-rw-r--r--noncore/multimedia/showimg/showimg.pro2
5 files changed, 11 insertions, 10 deletions
diff --git a/noncore/multimedia/showimg/config.in b/noncore/multimedia/showimg/config.in
index 36e8cf0..808c841 100644
--- a/noncore/multimedia/showimg/config.in
+++ b/noncore/multimedia/showimg/config.in
@@ -1,4 +1,4 @@
1 config SHOWIMG 1 config SHOWIMG
2 boolean "opie-showimg (image viewer)" 2 boolean "opie-showimg (image viewer)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
diff --git a/noncore/multimedia/showimg/main.cpp b/noncore/multimedia/showimg/main.cpp
index 1c864e9..b61cffb 100644
--- a/noncore/multimedia/showimg/main.cpp
+++ b/noncore/multimedia/showimg/main.cpp
@@ -1,26 +1,26 @@
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#include "showimg.h" 21#include "showimg.h"
22 22
23 23
24#include <opie/oapplicationfactory.h> 24#include <opie2/oapplicationfactory.h>
25 25
26OPIE_EXPORT_APP( OApplicationFactory<ImageViewer> ) \ No newline at end of file 26OPIE_EXPORT_APP( OApplicationFactory<ImageViewer> )
diff --git a/noncore/multimedia/showimg/opie-showimg.control b/noncore/multimedia/showimg/opie-showimg.control
index 1e54383..2fbfabc 100644
--- a/noncore/multimedia/showimg/opie-showimg.control
+++ b/noncore/multimedia/showimg/opie-showimg.control
@@ -1,11 +1,11 @@
1Package: opie-showimg 1Package: opie-showimg
2Files: plugins/application/libshowimg.so* bin/showimg apps/Applications/showimg.desktop pics/imageviewer 2Files: plugins/application/libshowimg.so* bin/showimg apps/Applications/showimg.desktop pics/imageviewer
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: Opie Team <opie@handhelds.org> 5Maintainer: Opie Team <opie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal,libopiecore2, libopieui2
8Description: Image Viewer 8Description: Image Viewer
9 The image viewer for the Opie environment. Supports 9 The image viewer for the Opie environment. Supports
10 all graphics formats are compiled into Qt/Embedded (eg. PNG). 10 all graphics formats are compiled into Qt/Embedded (eg. PNG).
11Version: $QPE_VERSION$EXTRAVERSION 11Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index 82eac33..6c0c4db 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -1,89 +1,90 @@
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#include "ImageFileSelector.h" 26#include "ImageFileSelector.h"
27#include "settingsdialog.h" 27#include "settingsdialog.h"
28 28
29 29
30#include <opie/ofiledialog.h> 30#include <opie2/ofiledialog.h>
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <math.h>
36#include <qmenubar.h>
37#include <qpe/qpetoolbar.h> 35#include <qpe/qpetoolbar.h>
36
38#include <qaction.h> 37#include <qaction.h>
39#include <qfiledialog.h> 38#include <qfiledialog.h>
39#include <qmenubar.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41 41
42#include <math.h>
42 43
43 44
44ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) 45ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent)
45 : QDialog(parent,0,true) 46 : QDialog(parent,0,true)
46{ 47{
47 setCaption(caption); 48 setCaption(caption);
48 49
49 if ( parent ) { 50 if ( parent ) {
50 setPalette(parent->palette()); 51 setPalette(parent->palette());
51 } 52 }
52 53
53 b=brightness; 54 b=brightness;
54 img=image; 55 img=image;
55 56
56 setMinimumSize(140,80); 57 setMinimumSize(140,80);
57 58
58 QGridLayout *gl= new QGridLayout(this,2,2,4,4); 59 QGridLayout *gl= new QGridLayout(this,2,2,4,4);
59 60
60 pixmap =new ImageWidget(this);; 61 pixmap =new ImageWidget(this);;
61 QPixmap pm; 62 QPixmap pm;
62 pm.convertFromImage(img); 63 pm.convertFromImage(img);
63 pixmap->setPixmap(pm); 64 pixmap->setPixmap(pm);
64 pixmap->setMinimumSize(pm.width(),pm.height()); 65 pixmap->setMinimumSize(pm.width(),pm.height());
65 gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter); 66 gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter);
66 QLabel *l=new QLabel(tr("Brightness")+":",this); 67 QLabel *l=new QLabel(tr("Brightness")+":",this);
67 gl->addWidget(l,1,0,AlignLeft); 68 gl->addWidget(l,1,0,AlignLeft);
68 spb=new QSpinBox(-100,100,2,this); 69 spb=new QSpinBox(-100,100,2,this);
69 gl->addWidget(spb,1,1,AlignRight); 70 gl->addWidget(spb,1,1,AlignRight);
70 71
71 spb->setValue(0); 72 spb->setValue(0);
72 73
73 connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int))); 74 connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int)));
74 75
75} 76}
76 77
77void ControlsDialog::bValueChanged(int value) 78void ControlsDialog::bValueChanged(int value)
78{ 79{
79 QImage nImage=img; 80 QImage nImage=img;
80 nImage.detach(); 81 nImage.detach();
81 ImageViewer::intensity(nImage, (float)value/100); 82 ImageViewer::intensity(nImage, (float)value/100);
82 QPixmap pm; 83 QPixmap pm;
83 pm.convertFromImage(nImage); 84 pm.convertFromImage(nImage);
84 pixmap->setPixmap(pm); 85 pixmap->setPixmap(pm);
85 pixmap->repaint(false); 86 pixmap->repaint(false);
86 87
87 88
88} 89}
89 90
@@ -153,97 +154,97 @@ ImagePane::ImagePane( QWidget *parent ) : QWidget( parent )
153 154
154 image = new QScrollView(this,0,WResizeNoErase|WNorthWestGravity); 155 image = new QScrollView(this,0,WResizeNoErase|WNorthWestGravity);
155 pic=new ImageWidget(image); 156 pic=new ImageWidget(image);
156 image->addChild(pic); 157 image->addChild(pic);
157 158
158 connect(pic, SIGNAL( clicked() ), this, SLOT( imageClicked() )); 159 connect(pic, SIGNAL( clicked() ), this, SLOT( imageClicked() ));
159 160
160 vb->addWidget( image ); 161 vb->addWidget( image );
161 162
162} 163}
163 164
164void ImagePane::setPixmap( const QPixmap &pm ) 165void ImagePane::setPixmap( const QPixmap &pm )
165{ 166{
166 pic->setPixmap( pm ); 167 pic->setPixmap( pm );
167 pic->resize(pm.width(),pm.height()); 168 pic->resize(pm.width(),pm.height());
168 image->updateScrollBars (); 169 image->updateScrollBars ();
169 pic->repaint(false); 170 pic->repaint(false);
170} 171}
171 172
172void ImagePane::imageClicked() 173void ImagePane::imageClicked()
173{ 174{
174 emit clicked(); 175 emit clicked();
175} 176}
176//=========================================================================== 177//===========================================================================
177/* 178/*
178 Draws the portion of the scaled pixmap that needs to be updated 179 Draws the portion of the scaled pixmap that needs to be updated
179*/ 180*/
180 181
181void ImageWidget::paintEvent( QPaintEvent *e ) 182void ImageWidget::paintEvent( QPaintEvent *e )
182{ 183{
183 QPainter painter(this); 184 QPainter painter(this);
184 185
185 painter.setClipRect(e->rect()); 186 painter.setClipRect(e->rect());
186 painter.fillRect(0,0,width(),height(),QColor(0,0,0)); 187 painter.fillRect(0,0,width(),height(),QColor(0,0,0));
187 188
188 if ( pixmap.size() != QSize( 0, 0 ) ) 189 if ( pixmap.size() != QSize( 0, 0 ) )
189 { // is an image loaded? 190 { // is an image loaded?
190 painter.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap); 191 painter.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap);
191 } 192 }
192} 193}
193 194
194void ImageWidget::mouseReleaseEvent(QMouseEvent *) 195void ImageWidget::mouseReleaseEvent(QMouseEvent *)
195{ 196{
196 emit clicked(); 197 emit clicked();
197} 198}
198 199
199//=========================================================================== 200//===========================================================================
200 201
201ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) 202ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ )
202: QMainWindow( parent, name, WResizeNoErase ), filename( 0 ), bFromDocView( FALSE ) 203: QMainWindow( parent, name, WResizeNoErase ), filename( 0 ), bFromDocView( FALSE )
203{ 204{
204 setCaption( tr("Image Viewer") ); 205 setCaption( tr("Image Viewer") );
205 setIcon( Resource::loadPixmap( "ImageViewer" ) ); 206 setIcon( Resource::loadPixmap( "ImageViewer" ) );
206 207
207 208
208 Config cfg("Image Viewer"); 209 Config cfg("Image Viewer");
209 cfg.setGroup("Image Viewer"); 210 cfg.setGroup("Image Viewer");
210 211
211 showThumbView=cfg.readBoolEntry("ShowThumbnails",false); 212 showThumbView=cfg.readBoolEntry("ShowThumbnails",false);
212 isSized=cfg.readBoolEntry("SizeToScreen",true); 213 isSized=cfg.readBoolEntry("SizeToScreen",true);
213 214
214 isFullScreen = FALSE; 215 isFullScreen = FALSE;
215 216
216 setToolBarsMovable( FALSE ); 217 setToolBarsMovable( FALSE );
217 218
218 toolBar = new QToolBar( this ); 219 toolBar = new QToolBar( this );
219 toolBar->setHorizontalStretchable( TRUE ); 220 toolBar->setHorizontalStretchable( TRUE );
220 221
221 menuBar = new QMenuBar( toolBar ); 222 menuBar = new QMenuBar( toolBar );
222 223
223 current=menuBar; 224 current=menuBar;
224 225
225 226
226 227
227 fileMenuFile = new QPopupMenu(this); 228 fileMenuFile = new QPopupMenu(this);
228 //menuBarmenubarFile->insertItem( tr("File"), fileMenu ); 229 //menuBarmenubarFile->insertItem( tr("File"), fileMenu );
229 fileMenuFile->insertItem(tr("Open"), 230 fileMenuFile->insertItem(tr("Open"),
230 this, SLOT(openFile()), 0); 231 this, SLOT(openFile()), 0);
231 232
232 viewMenuFile = new QPopupMenu( this ); 233 viewMenuFile = new QPopupMenu( this );
233 //menubarFile->insertItem( tr("View"), viewMenu ); 234 //menubarFile->insertItem( tr("View"), viewMenu );
234 viewMenuFile->insertItem( tr("Thumbnail View"), 235 viewMenuFile->insertItem( tr("Thumbnail View"),
235 this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS ); 236 this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS );
236 237
237 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView ); 238 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView );
238 239
239 240
240 241
241 242
242 optionsMenuFile = new QPopupMenu( this); 243 optionsMenuFile = new QPopupMenu( this);
243 //menubarFile->insertItem( tr("Options"),optionsMenu ); 244 //menubarFile->insertItem( tr("Options"),optionsMenu );
244 slideAction = new QAction( tr( "Slide show" ), Resource::loadIconSet( "slideshow" ), 245 slideAction = new QAction( tr( "Slide show" ), Resource::loadIconSet( "slideshow" ),
245 QString::null, 0, this, 0 ); 246 QString::null, 0, this, 0 );
246 slideAction->setToggleAction( TRUE ); 247 slideAction->setToggleAction( TRUE );
247 connect( slideAction, SIGNAL( toggled(bool) ), this, SLOT( slideShow(bool) ) ); 248 connect( slideAction, SIGNAL( toggled(bool) ), this, SLOT( slideShow(bool) ) );
248 slideAction->addTo( optionsMenuFile); 249 slideAction->addTo( optionsMenuFile);
249// slideAction->addTo( toolBar ); 250// slideAction->addTo( toolBar );
@@ -477,97 +478,97 @@ void ImageViewer::switchToImageView()
477 menuBar->insertItem( tr("View"), viewMenuView ); 478 menuBar->insertItem( tr("View"), viewMenuView );
478 viewMenuView->setItemEnabled(BLACKANDWHITE,true); 479 viewMenuView->setItemEnabled(BLACKANDWHITE,true);
479 iconToolBar->show(); 480 iconToolBar->show();
480 481
481 imagePanel->setPosition(0,0); 482 imagePanel->setPosition(0,0);
482 483
483} 484}
484 485
485 486
486void ImageViewer::setDocument(const QString& fileref) 487void ImageViewer::setDocument(const QString& fileref)
487{ 488{
488 delayLoad = fileref; 489 delayLoad = fileref;
489 switchToImageView(); 490 switchToImageView();
490 QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); 491 QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) );
491} 492}
492 493
493void ImageViewer::doDelayedLoad() 494void ImageViewer::doDelayedLoad()
494{ 495{
495 show(delayLoad); 496 show(delayLoad);
496} 497}
497 498
498void ImageViewer::show() 499void ImageViewer::show()
499{ 500{
500 normalView(); 501 normalView();
501 QMainWindow::show(); 502 QMainWindow::show();
502} 503}
503 504
504void ImageViewer::show(const QString& fileref) 505void ImageViewer::show(const QString& fileref)
505{ 506{
506// qDebug("Show "+fileref); 507// qDebug("Show "+fileref);
507 bFromDocView = TRUE; 508 bFromDocView = TRUE;
508 closeFileSelector(); 509 closeFileSelector();
509 DocLnk link(fileref); 510 DocLnk link(fileref);
510 if ( link.isValid() ) { 511 if ( link.isValid() ) {
511 openFile(link); 512 openFile(link);
512 } else { 513 } else {
513 filename = fileref; 514 filename = fileref;
514 updateCaption( fileref ); 515 updateCaption( fileref );
515 loadImage( fileref ); 516 loadImage( fileref );
516 } 517 }
517} 518}
518 519
519void ImageViewer::openFile() { 520void ImageViewer::openFile() {
520 MimeTypes types; 521 MimeTypes types;
521 QStringList image; 522 QStringList image;
522 image << "image/*"; 523 image << "image/*";
523 types.insert("Images", image); 524 types.insert("Images", image);
524 525
525 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); 526 QString str = Opie::OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 );
526 DocLnk link(str); 527 DocLnk link(str);
527// if ( link.isValid() ) 528// if ( link.isValid() )
528 openFile(link); 529 openFile(link);
529 530
530} 531}
531 532
532void ImageViewer::openFile( const DocLnk &link ) 533void ImageViewer::openFile( const DocLnk &link )
533{ 534{
534 closeFileSelector(); 535 closeFileSelector();
535// DocLnk link(file); 536// DocLnk link(file);
536 qDebug("open "+link.name()); 537 qDebug("open "+link.name());
537 updateCaption( link.name() ); 538 updateCaption( link.name() );
538 loadImage( link.file() ); 539 loadImage( link.file() );
539 if (slideTimer->isActive()) { 540 if (slideTimer->isActive()) {
540 slideTimer->start(slideDelay * 1000, FALSE); 541 slideTimer->start(slideDelay * 1000, FALSE);
541 } 542 }
542 543
543} 544}
544 545
545void ImageViewer::open() 546void ImageViewer::open()
546{ 547{
547 switchToFileSelector(); 548 switchToFileSelector();
548} 549}
549 550
550void ImageViewer::closeFileSelector() 551void ImageViewer::closeFileSelector()
551{ 552{
552 switchToImageView(); 553 switchToImageView();
553} 554}
554 555
555void ImageViewer::updateCaption( QString name ) 556void ImageViewer::updateCaption( QString name )
556{ 557{
557 int sep = name.findRev( '/' ); 558 int sep = name.findRev( '/' );
558 if ( sep >= 0 ) 559 if ( sep >= 0 )
559 name = name.mid( sep+1 ); 560 name = name.mid( sep+1 );
560 setCaption( name + tr(" - Image Viewer") ); 561 setCaption( name + tr(" - Image Viewer") );
561} 562}
562 563
563/* 564/*
564 This function loads an image from a file. 565 This function loads an image from a file.
565*/ 566*/
566 567
567void ImageViewer::loadImage( const char *fileName ) 568void ImageViewer::loadImage( const char *fileName )
568{ 569{
569 filename = fileName; 570 filename = fileName;
570 if ( filename ) { 571 if ( filename ) {
571 QApplication::setOverrideCursor( waitCursor ); // this might take time 572 QApplication::setOverrideCursor( waitCursor ); // this might take time
572 //imagePanel->statusLabel()->setText( tr("Loading image...") ); 573 //imagePanel->statusLabel()->setText( tr("Loading image...") );
573 qApp->processEvents(); 574 qApp->processEvents();
diff --git a/noncore/multimedia/showimg/showimg.pro b/noncore/multimedia/showimg/showimg.pro
index 76b020e..94fb162 100644
--- a/noncore/multimedia/showimg/showimg.pro
+++ b/noncore/multimedia/showimg/showimg.pro
@@ -1,9 +1,9 @@
1CONFIG += qt warn_on release quick-app 1CONFIG += qt warn_on release quick-app
2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h 2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h
3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp 3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp
4TARGET = showimg 4TARGET = showimg
5INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lqpe -lopie 7LIBS += -lqpe -lopiecore2 -l opieui2
8 8
9include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )