summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/showimg/main.cpp10
-rw-r--r--noncore/multimedia/showimg/showimg.cpp90
-rw-r--r--noncore/multimedia/showimg/showimg.h1
-rw-r--r--noncore/multimedia/showimg/showimg.pro4
4 files changed, 50 insertions, 55 deletions
diff --git a/noncore/multimedia/showimg/main.cpp b/noncore/multimedia/showimg/main.cpp
index c28cc85..efb1c68 100644
--- a/noncore/multimedia/showimg/main.cpp
+++ b/noncore/multimedia/showimg/main.cpp
@@ -22,12 +22,6 @@
22 22
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25int main( int argc, char **argv ) 25#include <opie/oapplicationfactory.h>
26{
27 QPEApplication a( argc, argv );
28
29 ImageViewer w(0, "new window", Qt::WResizeNoErase );
30 a.showMainDocumentWidget(&w);
31 26
32 return a.exec(); 27OPIE_EXPORT_APP( OApplicationFactory<ImageViewer> ) \ No newline at end of file
33}
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index d6f0733..56bdecf 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -26,7 +26,7 @@
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 <opie/ofiledialog.h>
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
@@ -75,11 +75,11 @@ ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightne
75 pm.convertFromImage(img); 75 pm.convertFromImage(img);
76 pixmap->setPixmap(pm); 76 pixmap->setPixmap(pm);
77 pixmap->setMinimumSize(pm.width(),pm.height()); 77 pixmap->setMinimumSize(pm.width(),pm.height());
78 gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter); 78 gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter);
79 QLabel *l=new QLabel(tr("Brightness")+":",this); 79 QLabel *l=new QLabel(tr("Brightness")+":",this);
80 gl->addWidget(l,1,0,AlignLeft); 80 gl->addWidget(l,1,0,AlignLeft);
81 spb=new QSpinBox(-100,100,2,this); 81 spb=new QSpinBox(-100,100,2,this);
82 gl->addWidget(spb,1,1,AlignRight); 82 gl->addWidget(spb,1,1,AlignRight);
83 83
84 spb->setValue(0); 84 spb->setValue(0);
85 85
@@ -102,7 +102,7 @@ void ControlsDialog::bValueChanged(int value)
102 102
103void ControlsDialog::accept() 103void ControlsDialog::accept()
104{ 104{
105 *b=spb->value(); 105 *b=spb->value();
106 done(1); 106 done(1);
107} 107}
108 108
@@ -118,7 +118,9 @@ InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *p
118 setPalette(parent->palette()); 118 setPalette(parent->palette());
119 } 119 }
120 120
121 const char *labels[]={"File Name","Format","File Size","Size","Colors","Alpha"}; 121
122
123 QString labels[]={ tr("File Name"),tr("Format"),tr("File Size"),tr("Size"),tr("Colors"),tr("Alpha") };
122 124
123 setMinimumSize(180,80); 125 setMinimumSize(180,80);
124 int num=ImageViewer::LAST+1; 126 int num=ImageViewer::LAST+1;
@@ -133,18 +135,18 @@ InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *p
133 { 135 {
134 QFrame *frm=new QFrame(this); 136 QFrame *frm=new QFrame(this);
135 frm->setFrameStyle(QFrame::HLine|QFrame::Sunken); 137 frm->setFrameStyle(QFrame::HLine|QFrame::Sunken);
136 gl->addMultiCellWidget(frm,i,i,0,1); 138 gl->addMultiCellWidget(frm,i,i,0,1);
137 } 139 }
138 else 140 else
139 { 141 {
140 l=new QLabel(tr(labels[count])+":",this); 142 l=new QLabel( tr( labels[count] )+":",this);
141 gl->addWidget(l,i,0,AlignLeft); 143 gl->addWidget(l,i,0,AlignLeft);
142 l=new QLabel(text[count],this); 144 l=new QLabel(text[count],this);
143 gl->addWidget(l,i,1,AlignRight); 145 gl->addWidget(l,i,1,AlignRight);
144 count++; 146 count++;
145 } 147 }
146 148
147 } 149 }
148 150
149} 151}
150 152
@@ -153,7 +155,7 @@ void InfoDialog::displayInfo(const QString &caption, const QStringList text, QWi
153 InfoDialog *dlg=new InfoDialog(caption,text,parent); 155 InfoDialog *dlg=new InfoDialog(caption,text,parent);
154 dlg->exec(); 156 dlg->exec();
155 delete dlg; 157 delete dlg;
156} 158}
157 159
158//=========================================================================== 160//===========================================================================
159 161
@@ -210,7 +212,7 @@ void ImageWidget::mouseReleaseEvent(QMouseEvent *)
210//=========================================================================== 212//===========================================================================
211 213
212ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) 214ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
213: QMainWindow( parent, name, wFlags ), filename( 0 ), bFromDocView( FALSE ) 215: QMainWindow( parent, name, WResizeNoErase ), filename( 0 ), bFromDocView( FALSE )
214{ 216{
215 setCaption( tr("Image Viewer") ); 217 setCaption( tr("Image Viewer") );
216 setIcon( Resource::loadPixmap( "ImageViewer" ) ); 218 setIcon( Resource::loadPixmap( "ImageViewer" ) );
@@ -241,11 +243,11 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
241 this, SLOT(openFile()), 0); 243 this, SLOT(openFile()), 0);
242 244
243 viewMenuFile = new QPopupMenu( this ); 245 viewMenuFile = new QPopupMenu( this );
244 //menubarFile->insertItem( tr("View"), viewMenu ); 246 //menubarFile->insertItem( tr("View"), viewMenu );
245 viewMenuFile->insertItem( tr("Thumbnail View"), 247 viewMenuFile->insertItem( tr("Thumbnail View"),
246 this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS ); 248 this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS );
247 249
248 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView ); 250 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView );
249 251
250 252
251 253
@@ -269,14 +271,14 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
269 271
270 272
271 fileMenuView = new QPopupMenu( this ); 273 fileMenuView = new QPopupMenu( this );
272 //menubarView->insertItem( tr("File"),fileMenu ); 274 //menubarView->insertItem( tr("File"),fileMenu );
273 fileMenuView->insertItem( tr("Image Info ..."),this, SLOT(displayInfoDialog()),0 ); 275 fileMenuView->insertItem( tr("Image Info ..."),this, SLOT(displayInfoDialog()),0 );
274 fileMenuView->insertSeparator(); 276 fileMenuView->insertSeparator();
275 277
276 viewMenuView = new QPopupMenu(this ); 278 viewMenuView = new QPopupMenu(this );
277 viewMenuView->setCheckable ( true ); 279 viewMenuView->setCheckable ( true );
278 280
279 //menubarView->insertItem( tr("View"),viewMenu ); 281 //menubarView->insertItem( tr("View"),viewMenu );
280 viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0); 282 viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0);
281 viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0); 283 viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0);
282 284
@@ -285,7 +287,7 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
285 setCentralWidget( stack ); 287 setCentralWidget( stack );
286 288
287 289
288 imagePanel = new ImagePane( stack ); 290 imagePanel = new ImagePane( stack );
289 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); 291 connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView()));
290 292
291 293
@@ -297,10 +299,10 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
297 299
298 qDebug("cv = %d",cv); 300 qDebug("cv = %d",cv);
299 301
300 fileSelector = new ImageFileSelector( cv,stack, "fs"); 302 fileSelector = new ImageFileSelector( cv,stack, "fs");
301 303
302 //switchThumbView(); 304 //switchThumbView();
303 305
304 306
305 //fileSelector = new ImageFileSelector("image/*", stack, "fs"); 307 //fileSelector = new ImageFileSelector("image/*", stack, "fs");
306 //fileSelector->setNewVisible(FALSE); 308 //fileSelector->setNewVisible(FALSE);
@@ -319,7 +321,7 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
319 a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); 321 a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
320 connect( a, SIGNAL( activated() ), this, SLOT( open() ) ); 322 connect( a, SIGNAL( activated() ), this, SLOT( open() ) );
321 a->addTo( fileMenuView); 323 a->addTo( fileMenuView);
322 a->addTo( iconToolBar ); 324 a->addTo( iconToolBar );
323 325
324 326
325 a = new QAction( tr( "Rotate 90"), Resource::loadPixmap( "rotate90" ), QString::null, 0, this, 0); 327 a = new QAction( tr( "Rotate 90"), Resource::loadPixmap( "rotate90" ), QString::null, 0, this, 0);
@@ -351,7 +353,7 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
351 sss->addTo( iconToolBar ); 353 sss->addTo( iconToolBar );
352 sss->addTo( viewMenuView ); 354 sss->addTo( viewMenuView );
353 355
354 sss->setOn(isSized); 356 sss->setOn(isSized);
355 viewMenuView->insertSeparator(); 357 viewMenuView->insertSeparator();
356 358
357 359
@@ -382,16 +384,16 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
382 384
383 switchToFileSelector(); 385 switchToFileSelector();
384 386
385 setMouseTracking( TRUE ); 387 setMouseTracking( TRUE );
388
386 389
387
388} 390}
389 391
390ImageViewer::~ImageViewer() 392ImageViewer::~ImageViewer()
391{ 393{
392 Config cfg("Image Viewer"); 394 Config cfg("Image Viewer");
393 cfg.setGroup("Image Viewer"); 395 cfg.setGroup("Image Viewer");
394 396
395 cfg.writeEntry("ShowThumbnails",(int)showThumbView); 397 cfg.writeEntry("ShowThumbnails",(int)showThumbView);
396 cfg.writeEntry("SizeToScreen",(int)isSized); 398 cfg.writeEntry("SizeToScreen",(int)isSized);
397 399
@@ -463,7 +465,7 @@ void ImageViewer::switchThumbView()
463 showThumbView=!showThumbView; 465 showThumbView=!showThumbView;
464 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView ); 466 viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView );
465 fileSelector->switchView(); 467 fileSelector->switchView();
466 468
467} 469}
468 470
469void ImageViewer::switchToFileSelector() 471void ImageViewer::switchToFileSelector()
@@ -497,7 +499,7 @@ void ImageViewer::switchToImageView()
497void ImageViewer::setDocument(const QString& fileref) 499void ImageViewer::setDocument(const QString& fileref)
498{ 500{
499 delayLoad = fileref; 501 delayLoad = fileref;
500 switchToImageView(); 502 switchToImageView();
501 QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); 503 QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) );
502} 504}
503 505
@@ -532,7 +534,7 @@ void ImageViewer::openFile() {
532 QStringList image; 534 QStringList image;
533 image << "image/*"; 535 image << "image/*";
534 types.insert("Images", image); 536 types.insert("Images", image);
535 537
536 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); 538 QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 );
537 DocLnk link(str); 539 DocLnk link(str);
538// if ( link.isValid() ) 540// if ( link.isValid() )
@@ -550,7 +552,7 @@ void ImageViewer::openFile( const DocLnk &link )
550 if (slideTimer->isActive()) { 552 if (slideTimer->isActive()) {
551 slideTimer->start(slideDelay * 1000, FALSE); 553 slideTimer->start(slideDelay * 1000, FALSE);
552 } 554 }
553 555
554} 556}
555 557
556void ImageViewer::open() 558void ImageViewer::open()
@@ -560,7 +562,7 @@ void ImageViewer::open()
560 562
561void ImageViewer::closeFileSelector() 563void ImageViewer::closeFileSelector()
562{ 564{
563 switchToImageView(); 565 switchToImageView();
564} 566}
565 567
566void ImageViewer::updateCaption( QString name ) 568void ImageViewer::updateCaption( QString name )
@@ -582,7 +584,7 @@ void ImageViewer::loadImage( const char *fileName )
582 QApplication::setOverrideCursor( waitCursor ); // this might take time 584 QApplication::setOverrideCursor( waitCursor ); // this might take time
583 //imagePanel->statusLabel()->setText( tr("Loading image...") ); 585 //imagePanel->statusLabel()->setText( tr("Loading image...") );
584 qApp->processEvents(); 586 qApp->processEvents();
585 bool ok = image.load(filename, 0); 587 bool ok = image.load(filename, 0);
586 if ( ok ) { 588 if ( ok ) {
587 ok = reconvertImage(); 589 ok = reconvertImage();
588 updateImageInfo(filename); 590 updateImageInfo(filename);
@@ -597,16 +599,16 @@ void ImageViewer::loadImage( const char *fileName )
597// fastLoad ? ", Fast" : "", 599// fastLoad ? ", Fast" : "",
598// fastLoad ? QMAX(imagewidth/maxsize, imageheight/maxsize) : 1); 600// fastLoad ? QMAX(imagewidth/maxsize, imageheight/maxsize) : 1);
599 601
600 602
601// matrix.reset(); 603// matrix.reset();
602 rotated90 = FALSE; 604 rotated90 = FALSE;
603 605
604 if (rotateOnLoad) { 606 if (rotateOnLoad) {
605 rotated90 = TRUE; 607 rotated90 = TRUE;
606 rot90(); 608 rot90();
607// matrix.rotate( -90.0 ); 609// matrix.rotate( -90.0 );
608 } 610 }
609 611
610 switchToImageView(); 612 switchToImageView();
611 updateImage(); 613 updateImage();
612 614
@@ -625,10 +627,10 @@ bool ImageViewer::loadSelected()
625 updateCaption( link->name() ); 627 updateCaption( link->name() );
626 filename = link->file(); 628 filename = link->file();
627 qApp->processEvents(); 629 qApp->processEvents();
628 ok = image.load(filename, 0); 630 ok = image.load(filename, 0);
629 if ( ok ) 631 if ( ok )
630 { 632 {
631 updateImageInfo(filename); 633 updateImageInfo(filename);
632 ok = reconvertImage(); 634 ok = reconvertImage();
633 } 635 }
634 if ( !ok ) 636 if ( !ok )
@@ -727,7 +729,7 @@ void ImageViewer::resizeEvent( QResizeEvent * )
727void ImageViewer::hFlip() 729void ImageViewer::hFlip()
728{ 730{
729// matrix.scale( -1.0, 1.0 ); 731// matrix.scale( -1.0, 1.0 );
730 732
731 setImage(image.mirror(TRUE,FALSE)); 733 setImage(image.mirror(TRUE,FALSE));
732} 734}
733 735
@@ -807,7 +809,7 @@ void ImageViewer::normalView()
807 809
808 isFullScreen = FALSE; 810 isFullScreen = FALSE;
809 stack->addWidget( imagePanel, 1 ); 811 stack->addWidget( imagePanel, 1 );
810 switchToImageView(); 812 switchToImageView();
811 if ( isSized ) 813 if ( isSized )
812 scale(); 814 scale();
813 815
@@ -842,7 +844,7 @@ void ImageViewer::setImage(const QImage& newimage)
842{ 844{
843 image = newimage; 845 image = newimage;
844 reconvertImage(); 846 reconvertImage();
845 updateImage(); 847 updateImage();
846} 848}
847 849
848void ImageViewer::updateImageInfo(QString &filePath) 850void ImageViewer::updateImageInfo(QString &filePath)
@@ -855,7 +857,7 @@ void ImageViewer::updateImageInfo(QString &filePath)
855 857
856 imageInfo[FORMAT]=QImage::imageFormat (filePath ); 858 imageInfo[FORMAT]=QImage::imageFormat (filePath );
857 QFileInfo fi(filePath); 859 QFileInfo fi(filePath);
858 imageInfo[PATH]=fi.fileName(); 860 imageInfo[PATH]=fi.fileName();
859 imageInfo[FILE_SIZE]=QString::number(fi.size())+" (bytes)"; 861 imageInfo[FILE_SIZE]=QString::number(fi.size())+" (bytes)";
860 QString message("%1x%2"); 862 QString message("%1x%2");
861 imageInfo[SIZE]=QString("%1x%2"); 863 imageInfo[SIZE]=QString("%1x%2");
diff --git a/noncore/multimedia/showimg/showimg.h b/noncore/multimedia/showimg/showimg.h
index 8555ff0..abbd976 100644
--- a/noncore/multimedia/showimg/showimg.h
+++ b/noncore/multimedia/showimg/showimg.h
@@ -158,6 +158,7 @@ class ImageViewer : public QMainWindow
158{ 158{
159 Q_OBJECT 159 Q_OBJECT
160public: 160public:
161 static QString appName() { return QString::fromLatin1("showimg"); }
161 ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 ); 162 ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 );
162 ~ImageViewer(); 163 ~ImageViewer();
163 164
diff --git a/noncore/multimedia/showimg/showimg.pro b/noncore/multimedia/showimg/showimg.pro
index d369e62..e8d753b 100644
--- a/noncore/multimedia/showimg/showimg.pro
+++ b/noncore/multimedia/showimg/showimg.pro
@@ -1,6 +1,4 @@
1TEMPLATE = app 1CONFIG += qt warn_on release quick-app
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/bin
4HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h 2HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h
5SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp 3SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp
6TARGET = showimg 4TARGET = showimg