author | mickeyl <mickeyl> | 2003-10-27 20:26:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 20:26:56 (UTC) |
commit | 1fed961e25a6afd4070d8873b431aba8342406c3 (patch) (unidiff) | |
tree | 8ef9a1b3ad5cf50406ac500ccfb77cff60b77796 | |
parent | 651d29249946e7221fc85580453750d9e4be4fb0 (diff) | |
download | opie-1fed961e25a6afd4070d8873b431aba8342406c3.zip opie-1fed961e25a6afd4070d8873b431aba8342406c3.tar.gz opie-1fed961e25a6afd4070d8873b431aba8342406c3.tar.bz2 |
merge noncore/multimedia/showimg
- opieplayer2 and opierec generate lots of conflicts in merge
I'll gladly leave that to the experts ljp and Harlekin ;)
-rw-r--r-- | noncore/multimedia/showimg/main.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/showimg/showimg.cpp | 90 | ||||
-rw-r--r-- | noncore/multimedia/showimg/showimg.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/showimg/showimg.pro | 4 |
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 | |||
@@ -19,15 +19,9 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "showimg.h" | 21 | #include "showimg.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | int 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(); | 27 | OPIE_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 | |||
@@ -23,13 +23,13 @@ | |||
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 <opie/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 <qpe/fileselector.h> | 35 | #include <qpe/fileselector.h> |
@@ -72,17 +72,17 @@ ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightne | |||
72 | 72 | ||
73 | pixmap =new ImageWidget(this);; | 73 | pixmap =new ImageWidget(this);; |
74 | QPixmap pm; | 74 | QPixmap pm; |
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 | ||
86 | connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int))); | 86 | connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int))); |
87 | 87 | ||
88 | } | 88 | } |
@@ -99,13 +99,13 @@ void ControlsDialog::bValueChanged(int value) | |||
99 | 99 | ||
100 | 100 | ||
101 | } | 101 | } |
102 | 102 | ||
103 | void ControlsDialog::accept() | 103 | void ControlsDialog::accept() |
104 | { | 104 | { |
105 | *b=spb->value(); | 105 | *b=spb->value(); |
106 | done(1); | 106 | done(1); |
107 | } | 107 | } |
108 | 108 | ||
109 | //=========================================================================== | 109 | //=========================================================================== |
110 | 110 | ||
111 | InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *parent) | 111 | InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *parent) |
@@ -115,13 +115,15 @@ InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *p | |||
115 | 115 | ||
116 | if ( parent ) | 116 | if ( parent ) |
117 | { | 117 | { |
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; |
125 | if ( text[ImageViewer::ALPHA].isEmpty() ) | 127 | if ( text[ImageViewer::ALPHA].isEmpty() ) |
126 | num--; | 128 | num--; |
127 | QGridLayout *gl= new QGridLayout(this,num,2,4,2); | 129 | QGridLayout *gl= new QGridLayout(this,num,2,4,2); |
@@ -130,33 +132,33 @@ InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *p | |||
130 | for ( int i=0;i<num;i++ ) | 132 | for ( int i=0;i<num;i++ ) |
131 | { | 133 | { |
132 | if ( i==1 ) | 134 | if ( i==1 ) |
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 | ||
151 | void InfoDialog::displayInfo(const QString &caption, const QStringList text, QWidget *parent) | 153 | void InfoDialog::displayInfo(const QString &caption, const QStringList text, QWidget *parent) |
152 | { | 154 | { |
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 | ||
160 | 162 | ||
161 | ImagePane::ImagePane( QWidget *parent ) : QWidget( parent ) | 163 | ImagePane::ImagePane( QWidget *parent ) : QWidget( parent ) |
162 | { | 164 | { |
@@ -207,13 +209,13 @@ void ImageWidget::mouseReleaseEvent(QMouseEvent *) | |||
207 | emit clicked(); | 209 | emit clicked(); |
208 | } | 210 | } |
209 | 211 | ||
210 | //=========================================================================== | 212 | //=========================================================================== |
211 | 213 | ||
212 | ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) | 214 | ImageViewer::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" ) ); |
217 | 219 | ||
218 | 220 | ||
219 | Config cfg("Image Viewer"); | 221 | Config cfg("Image Viewer"); |
@@ -238,17 +240,17 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) | |||
238 | fileMenuFile = new QPopupMenu(this); | 240 | fileMenuFile = new QPopupMenu(this); |
239 | //menuBarmenubarFile->insertItem( tr("File"), fileMenu ); | 241 | //menuBarmenubarFile->insertItem( tr("File"), fileMenu ); |
240 | fileMenuFile->insertItem(tr("Open"), | 242 | fileMenuFile->insertItem(tr("Open"), |
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 | ||
252 | 254 | ||
253 | optionsMenuFile = new QPopupMenu( this); | 255 | optionsMenuFile = new QPopupMenu( this); |
254 | //menubarFile->insertItem( tr("Options"),optionsMenu ); | 256 | //menubarFile->insertItem( tr("Options"),optionsMenu ); |
@@ -266,44 +268,44 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) | |||
266 | // optionsMenuFile->insertItem( tr("Help"), this, SLOT(help()), 0); | 268 | // optionsMenuFile->insertItem( tr("Help"), this, SLOT(help()), 0); |
267 | 269 | ||
268 | QStrList fmt = QImage::outputFormats(); | 270 | QStrList fmt = QImage::outputFormats(); |
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 | ||
283 | stack = new QWidgetStack( this ); | 285 | stack = new QWidgetStack( this ); |
284 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 286 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
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 | ||
292 | ImageFileSelector::CURRENT_VIEW cv; | 294 | ImageFileSelector::CURRENT_VIEW cv; |
293 | if(showThumbView) | 295 | if(showThumbView) |
294 | cv=ImageFileSelector::THUMBNAIL; | 296 | cv=ImageFileSelector::THUMBNAIL; |
295 | else | 297 | else |
296 | cv=ImageFileSelector::DETAILED; | 298 | cv=ImageFileSelector::DETAILED; |
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); |
307 | //fileSelector->setCloseVisible(FALSE); | 309 | //fileSelector->setCloseVisible(FALSE); |
308 | connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); | 310 | connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); |
309 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), | 311 | connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), |
@@ -316,13 +318,13 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) | |||
316 | 318 | ||
317 | QAction *a; | 319 | QAction *a; |
318 | 320 | ||
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); |
326 | connect( a, SIGNAL( activated() ), this, SLOT( rot90() ) ); | 328 | connect( a, SIGNAL( activated() ), this, SLOT( rot90() ) ); |
327 | a->addTo( iconToolBar ); | 329 | a->addTo( iconToolBar ); |
328 | a->addTo( viewMenuView ); | 330 | a->addTo( viewMenuView ); |
@@ -348,13 +350,13 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) | |||
348 | 350 | ||
349 | sss = new QAction( tr( "Scale to Screen"), Resource::loadPixmap( "scale" ), QString::null, 0, this, 0,true); | 351 | sss = new QAction( tr( "Scale to Screen"), Resource::loadPixmap( "scale" ), QString::null, 0, this, 0,true); |
350 | connect( sss, SIGNAL( activated() ), this, SLOT( switchSizeToScreen() ) ); | 352 | connect( sss, SIGNAL( activated() ), this, SLOT( switchSizeToScreen() ) ); |
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 | ||
358 | a = new QAction( tr( "Fullscreen" ), Resource::loadPixmap( "fullscreen" ), | 360 | a = new QAction( tr( "Fullscreen" ), Resource::loadPixmap( "fullscreen" ), |
359 | QString::null, 0, this, 0 ); | 361 | QString::null, 0, this, 0 ); |
360 | connect( a, SIGNAL( activated() ), this, SLOT( fullScreen() ) ); | 362 | connect( a, SIGNAL( activated() ), this, SLOT( fullScreen() ) ); |
@@ -379,22 +381,22 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) | |||
379 | fastLoad = config.readBoolEntry("FastLoad", TRUE); | 381 | fastLoad = config.readBoolEntry("FastLoad", TRUE); |
380 | slideTimer = new QTimer( this ); | 382 | slideTimer = new QTimer( this ); |
381 | connect( slideTimer, SIGNAL(timeout()), this, SLOT(slideUpdate()) ); | 383 | connect( slideTimer, SIGNAL(timeout()), this, SLOT(slideUpdate()) ); |
382 | 384 | ||
383 | switchToFileSelector(); | 385 | switchToFileSelector(); |
384 | 386 | ||
385 | setMouseTracking( TRUE ); | 387 | setMouseTracking( TRUE ); |
388 | |||
386 | 389 | ||
387 | |||
388 | } | 390 | } |
389 | 391 | ||
390 | ImageViewer::~ImageViewer() | 392 | ImageViewer::~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 | ||
398 | cfg.setGroup( "SlideShow" ); | 400 | cfg.setGroup( "SlideShow" ); |
399 | cfg.writeEntry( "Delay", slideDelay); | 401 | cfg.writeEntry( "Delay", slideDelay); |
400 | cfg.writeEntry( "Repeat", slideRepeat ); | 402 | cfg.writeEntry( "Repeat", slideRepeat ); |
@@ -460,13 +462,13 @@ void ImageViewer::updateImage() | |||
460 | void ImageViewer::switchThumbView() | 462 | void ImageViewer::switchThumbView() |
461 | { | 463 | { |
462 | 464 | ||
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 | ||
469 | void ImageViewer::switchToFileSelector() | 471 | void ImageViewer::switchToFileSelector() |
470 | { | 472 | { |
471 | stack->raiseWidget(fileSelector); | 473 | stack->raiseWidget(fileSelector); |
472 | menuBar->clear(); | 474 | menuBar->clear(); |
@@ -494,13 +496,13 @@ void ImageViewer::switchToImageView() | |||
494 | } | 496 | } |
495 | 497 | ||
496 | 498 | ||
497 | void ImageViewer::setDocument(const QString& fileref) | 499 | void 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 | ||
504 | void ImageViewer::doDelayedLoad() | 506 | void ImageViewer::doDelayedLoad() |
505 | { | 507 | { |
506 | show(delayLoad); | 508 | show(delayLoad); |
@@ -529,13 +531,13 @@ void ImageViewer::show(const QString& fileref) | |||
529 | 531 | ||
530 | void ImageViewer::openFile() { | 532 | void ImageViewer::openFile() { |
531 | MimeTypes types; | 533 | MimeTypes types; |
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() ) |
539 | openFile(link); | 541 | openFile(link); |
540 | 542 | ||
541 | } | 543 | } |
@@ -547,23 +549,23 @@ void ImageViewer::openFile( const DocLnk &link ) | |||
547 | qDebug("open "+link.name()); | 549 | qDebug("open "+link.name()); |
548 | updateCaption( link.name() ); | 550 | updateCaption( link.name() ); |
549 | loadImage( link.file() ); | 551 | loadImage( link.file() ); |
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 | ||
556 | void ImageViewer::open() | 558 | void ImageViewer::open() |
557 | { | 559 | { |
558 | switchToFileSelector(); | 560 | switchToFileSelector(); |
559 | } | 561 | } |
560 | 562 | ||
561 | void ImageViewer::closeFileSelector() | 563 | void ImageViewer::closeFileSelector() |
562 | { | 564 | { |
563 | switchToImageView(); | 565 | switchToImageView(); |
564 | } | 566 | } |
565 | 567 | ||
566 | void ImageViewer::updateCaption( QString name ) | 568 | void ImageViewer::updateCaption( QString name ) |
567 | { | 569 | { |
568 | int sep = name.findRev( '/' ); | 570 | int sep = name.findRev( '/' ); |
569 | if ( sep >= 0 ) | 571 | if ( sep >= 0 ) |
@@ -579,13 +581,13 @@ void ImageViewer::loadImage( const char *fileName ) | |||
579 | { | 581 | { |
580 | filename = fileName; | 582 | filename = fileName; |
581 | if ( filename ) { | 583 | if ( 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); |
589 | } | 591 | } |
590 | if ( !ok ) { | 592 | if ( !ok ) { |
591 | pm.resize(0,0); // couldn't load image | 593 | pm.resize(0,0); // couldn't load image |
@@ -594,22 +596,22 @@ void ImageViewer::loadImage( const char *fileName ) | |||
594 | QApplication::restoreOverrideCursor(); // restore original cursor | 596 | QApplication::restoreOverrideCursor(); // restore original cursor |
595 | } | 597 | } |
596 | 598 | ||
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 | ||
613 | } | 615 | } |
614 | 616 | ||
615 | bool ImageViewer::loadSelected() | 617 | bool ImageViewer::loadSelected() |
@@ -622,16 +624,16 @@ bool ImageViewer::loadSelected() | |||
622 | { | 624 | { |
623 | if ( link->file() != filename ) | 625 | if ( link->file() != filename ) |
624 | { | 626 | { |
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 ) |
635 | pm.resize(0,0); | 637 | pm.resize(0,0); |
636 | } | 638 | } |
637 | } | 639 | } |
@@ -724,13 +726,13 @@ void ImageViewer::resizeEvent( QResizeEvent * ) | |||
724 | } | 726 | } |
725 | 727 | ||
726 | 728 | ||
727 | void ImageViewer::hFlip() | 729 | void 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 | ||
734 | void ImageViewer::vFlip() | 736 | void ImageViewer::vFlip() |
735 | { | 737 | { |
736 | // matrix.scale( 1.0, -1.0 ); | 738 | // matrix.scale( 1.0, -1.0 ); |
@@ -804,13 +806,13 @@ void ImageViewer::normalView() | |||
804 | { | 806 | { |
805 | if ( !imagePanel->parentWidget() ) | 807 | if ( !imagePanel->parentWidget() ) |
806 | { | 808 | { |
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 | ||
814 | updateImage(); | 816 | updateImage(); |
815 | 817 | ||
816 | } | 818 | } |
@@ -839,26 +841,26 @@ void ImageViewer::fullScreen() | |||
839 | } | 841 | } |
840 | 842 | ||
841 | void ImageViewer::setImage(const QImage& newimage) | 843 | 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 | ||
848 | void ImageViewer::updateImageInfo(QString &filePath) | 850 | void ImageViewer::updateImageInfo(QString &filePath) |
849 | { | 851 | { |
850 | 852 | ||
851 | for ( int i=0;i<LAST;i++ ) | 853 | for ( int i=0;i<LAST;i++ ) |
852 | { | 854 | { |
853 | imageInfo[i]=""; | 855 | imageInfo[i]=""; |
854 | } | 856 | } |
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"); |
862 | imageInfo[SIZE]=imageInfo[SIZE].arg(image.width()).arg(image.height()); | 864 | imageInfo[SIZE]=imageInfo[SIZE].arg(image.width()).arg(image.height()); |
863 | if ( image.numColors() > 0 ) | 865 | if ( image.numColors() > 0 ) |
864 | { | 866 | { |
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 | |||
@@ -155,12 +155,13 @@ private slots: | |||
155 | 155 | ||
156 | 156 | ||
157 | class ImageViewer : public QMainWindow | 157 | class ImageViewer : public QMainWindow |
158 | { | 158 | { |
159 | Q_OBJECT | 159 | Q_OBJECT |
160 | public: | 160 | public: |
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 | ||
164 | void loadImage( const char *fileName ); | 165 | void loadImage( const char *fileName ); |
165 | void show(const QString& fileref); | 166 | void show(const QString& fileref); |
166 | void show(); | 167 | void show(); |
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,9 +1,7 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h | 2 | HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h |
5 | SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp | 3 | SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp |
6 | TARGET = showimg | 4 | TARGET = showimg |
7 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopie | 7 | LIBS += -lqpe -lopie |