-rw-r--r-- | noncore/multimedia/showimg/ImageFileSelector.cpp | 20 | ||||
-rw-r--r-- | noncore/multimedia/showimg/showimg.cpp | 20 | ||||
-rw-r--r-- | noncore/multimedia/showimg/showimg.pro | 2 |
3 files changed, 23 insertions, 19 deletions
diff --git a/noncore/multimedia/showimg/ImageFileSelector.cpp b/noncore/multimedia/showimg/ImageFileSelector.cpp index 79ee925..53cc883 100644 --- a/noncore/multimedia/showimg/ImageFileSelector.cpp +++ b/noncore/multimedia/showimg/ImageFileSelector.cpp | |||
@@ -1,35 +1,37 @@ | |||
1 | #include "ImageFileSelector.h" | ||
1 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | #include <qpe/qpeapplication.h> | ||
6 | using namespace Opie::Core; | ||
2 | 7 | ||
3 | #include "qpe/qpeapplication.h" | 8 | /* QT */ |
4 | 9 | #include <qlabel.h> | |
5 | #include <stdlib.h> | ||
6 | |||
7 | #include <qlabel.h> | ||
8 | #include <qfileinfo.h> | 10 | #include <qfileinfo.h> |
9 | 11 | ||
10 | #include "ImageFileSelector.h" | 12 | /* STD */ |
11 | 13 | #include <stdlib.h> | |
12 | 14 | ||
13 | ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) | 15 | ThumbWidget::ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent,int w) |
14 | : QWidget( parent ),fl(f) | 16 | : QWidget( parent ),fl(f) |
15 | { | 17 | { |
16 | setBackgroundMode(NoBackground); | 18 | setBackgroundMode(NoBackground); |
17 | if ( w!=-1 ) | 19 | if ( w!=-1 ) |
18 | setMinimumSize(w,p.height()+24); | 20 | setMinimumSize(w,p.height()+24); |
19 | else | 21 | else |
20 | setMinimumSize(p.width(),p.height()+24); | 22 | setMinimumSize(p.width(),p.height()+24); |
21 | description=new QLabel(text,this); | 23 | description=new QLabel(text,this); |
22 | description->setBackgroundColor(colorGroup().base()); | 24 | description->setBackgroundColor(colorGroup().base()); |
23 | description->setAlignment(AlignCenter); | 25 | description->setAlignment(AlignCenter); |
24 | description->setGeometry(0,height()-24,width(),24); | 26 | description->setGeometry(0,height()-24,width(),24); |
25 | pixmap=p; | 27 | pixmap=p; |
26 | } | 28 | } |
27 | 29 | ||
28 | void ThumbWidget::resizeEvent(QResizeEvent *) | 30 | void ThumbWidget::resizeEvent(QResizeEvent *) |
29 | { | 31 | { |
30 | description->setGeometry(0,height()-24,width(),24); | 32 | description->setGeometry(0,height()-24,width(),24); |
31 | } | 33 | } |
32 | 34 | ||
33 | void ThumbWidget::paintEvent( QPaintEvent *e ) | 35 | void ThumbWidget::paintEvent( QPaintEvent *e ) |
34 | { | 36 | { |
35 | QPainter painter(this); | 37 | QPainter painter(this); |
@@ -134,49 +136,49 @@ void ImageFileSelector::setView(CURRENT_VIEW v) | |||
134 | raiseWidget(detailed); | 136 | raiseWidget(detailed); |
135 | updateSizes(); | 137 | updateSizes(); |
136 | } | 138 | } |
137 | 139 | ||
138 | 140 | ||
139 | } | 141 | } |
140 | 142 | ||
141 | void ImageFileSelector::resizeEvent(QResizeEvent *) | 143 | void ImageFileSelector::resizeEvent(QResizeEvent *) |
142 | { | 144 | { |
143 | updateSizes(); | 145 | updateSizes(); |
144 | } | 146 | } |
145 | 147 | ||
146 | void ImageFileSelector::updateSizes() | 148 | void ImageFileSelector::updateSizes() |
147 | { | 149 | { |
148 | int ww=(detailed->width()-detailed->frameWidth()*2); | 150 | int ww=(detailed->width()-detailed->frameWidth()*2); |
149 | double w=(double)ww*0.70; | 151 | double w=(double)ww*0.70; |
150 | detailed->setColumnWidth(0,(int)w); | 152 | detailed->setColumnWidth(0,(int)w); |
151 | detailed->setColumnWidth(1,ww-(int)w); | 153 | detailed->setColumnWidth(1,ww-(int)w); |
152 | background->setMinimumWidth(thumb->visibleWidth()); | 154 | background->setMinimumWidth(thumb->visibleWidth()); |
153 | thumb->updateScrollBars(); | 155 | thumb->updateScrollBars(); |
154 | } | 156 | } |
155 | 157 | ||
156 | void ImageFileSelector::reread(bool) | 158 | void ImageFileSelector::reread(bool) |
157 | { | 159 | { |
158 | // qDebug("reread"); | 160 | // odebug << "reread" << oendl; |
159 | ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); | 161 | ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->selectedItem(); |
160 | QString oldFile; | 162 | QString oldFile; |
161 | if ( item ) | 163 | if ( item ) |
162 | oldFile = item->file().file(); | 164 | oldFile = item->file().file(); |
163 | detailed->clear(); | 165 | detailed->clear(); |
164 | tList.clear(); | 166 | tList.clear(); |
165 | DocLnkSet files; | 167 | DocLnkSet files; |
166 | Global::findDocuments(&files, "image/*"); | 168 | Global::findDocuments(&files, "image/*"); |
167 | count = files.children().count(); | 169 | count = files.children().count(); |
168 | QListIterator<DocLnk> dit( files.children() ); | 170 | QListIterator<DocLnk> dit( files.children() ); |
169 | // int y=0; | 171 | // int y=0; |
170 | // int x=4; | 172 | // int x=4; |
171 | // int totalHeight=4; | 173 | // int totalHeight=4; |
172 | ThumbWidget *l=0; | 174 | ThumbWidget *l=0; |
173 | int width=80; | 175 | int width=80; |
174 | gl->expand(dit.count()/2,2); | 176 | gl->expand(dit.count()/2,2); |
175 | int i,j; | 177 | int i,j; |
176 | i=j=0; | 178 | i=j=0; |
177 | detailed->setUpdatesEnabled(false); | 179 | detailed->setUpdatesEnabled(false); |
178 | thumb->setUpdatesEnabled(false); | 180 | thumb->setUpdatesEnabled(false); |
179 | 181 | ||
180 | for ( ; dit.current(); ++dit ) { | 182 | for ( ; dit.current(); ++dit ) { |
181 | item = new ImageFileSelectorItem( detailed, **dit ); | 183 | item = new ImageFileSelectorItem( detailed, **dit ); |
182 | if ( item->file().file() == oldFile ) | 184 | if ( item->file().file() == oldFile ) |
@@ -200,49 +202,49 @@ void ImageFileSelector::reread(bool) | |||
200 | if ( i==2 ) { | 202 | if ( i==2 ) { |
201 | i=0; | 203 | i=0; |
202 | j++; | 204 | j++; |
203 | } | 205 | } |
204 | tList.append(l); | 206 | tList.append(l); |
205 | connect(l,SIGNAL(clicked(const DocLnk&)),this,SLOT(thumbClicked(const DocLnk&))); | 207 | connect(l,SIGNAL(clicked(const DocLnk&)),this,SLOT(thumbClicked(const DocLnk&))); |
206 | } | 208 | } |
207 | } | 209 | } |
208 | 210 | ||
209 | if ( !detailed->selectedItem() ) | 211 | if ( !detailed->selectedItem() ) |
210 | detailed->setCurrentItem( detailed->firstChild() ); | 212 | detailed->setCurrentItem( detailed->firstChild() ); |
211 | 213 | ||
212 | detailed->setUpdatesEnabled(true); | 214 | detailed->setUpdatesEnabled(true); |
213 | thumb->setUpdatesEnabled(true); | 215 | thumb->setUpdatesEnabled(true); |
214 | detailed->update(); | 216 | detailed->update(); |
215 | thumb->update(); | 217 | thumb->update(); |
216 | } | 218 | } |
217 | 219 | ||
218 | int ImageFileSelector::fileCount() | 220 | int ImageFileSelector::fileCount() |
219 | { | 221 | { |
220 | return count; | 222 | return count; |
221 | } | 223 | } |
222 | const DocLnk * ImageFileSelector::selected() | 224 | const DocLnk * ImageFileSelector::selected() |
223 | { | 225 | { |
224 | qDebug("image selected"); | 226 | odebug << "image selected" << oendl; |
225 | ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); | 227 | ImageFileSelectorItem *item = (ImageFileSelectorItem *) detailed->selectedItem(); |
226 | if ( item ) | 228 | if ( item ) |
227 | return new DocLnk( item->file() ); | 229 | return new DocLnk( item->file() ); |
228 | return 0; | 230 | return 0; |
229 | } | 231 | } |
230 | 232 | ||
231 | 233 | ||
232 | 234 | ||
233 | void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) | 235 | void ImageFileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) |
234 | { | 236 | { |
235 | if ( !i ) | 237 | if ( !i ) |
236 | return; | 238 | return; |
237 | if ( button == Qt::LeftButton ) | 239 | if ( button == Qt::LeftButton ) |
238 | { | 240 | { |
239 | fileClicked( i ); | 241 | fileClicked( i ); |
240 | } | 242 | } |
241 | } | 243 | } |
242 | // pressed to get 'right down' | 244 | // pressed to get 'right down' |
243 | void ImageFileSelector::filePressed( int, QListViewItem *, const QPoint &, int ) | 245 | void ImageFileSelector::filePressed( int, QListViewItem *, const QPoint &, int ) |
244 | { | 246 | { |
245 | 247 | ||
246 | } | 248 | } |
247 | void ImageFileSelector::fileClicked( QListViewItem *i) | 249 | void ImageFileSelector::fileClicked( QListViewItem *i) |
248 | { | 250 | { |
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp index 696a57b..24377ed 100644 --- a/noncore/multimedia/showimg/showimg.cpp +++ b/noncore/multimedia/showimg/showimg.cpp | |||
@@ -5,65 +5,67 @@ | |||
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 | /* OPIE */ | |
30 | #include <opie2/odebug.h> | ||
30 | #include <opie2/ofiledialog.h> | 31 | #include <opie2/ofiledialog.h> |
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 <qtoolbar.h> | 35 | using namespace Opie::Core; |
36 | using namespace Opie::Ui; | ||
36 | 37 | ||
38 | /* QT */ | ||
39 | #include <qtoolbar.h> | ||
37 | #include <qaction.h> | 40 | #include <qaction.h> |
38 | #include <qfiledialog.h> | 41 | #include <qfiledialog.h> |
39 | #include <qmenubar.h> | 42 | #include <qmenubar.h> |
40 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
41 | 44 | ||
45 | /* STD */ | ||
42 | #include <math.h> | 46 | #include <math.h> |
43 | 47 | ||
44 | |||
45 | using namespace Opie::Ui; | ||
46 | ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) | 48 | ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent) |
47 | : QDialog(parent,0,true) | 49 | : QDialog(parent,0,true) |
48 | { | 50 | { |
49 | setCaption(caption); | 51 | setCaption(caption); |
50 | 52 | ||
51 | if ( parent ) { | 53 | if ( parent ) { |
52 | setPalette(parent->palette()); | 54 | setPalette(parent->palette()); |
53 | } | 55 | } |
54 | 56 | ||
55 | b=brightness; | 57 | b=brightness; |
56 | img=image; | 58 | img=image; |
57 | 59 | ||
58 | setMinimumSize(140,80); | 60 | setMinimumSize(140,80); |
59 | 61 | ||
60 | QGridLayout *gl= new QGridLayout(this,2,2,4,4); | 62 | QGridLayout *gl= new QGridLayout(this,2,2,4,4); |
61 | 63 | ||
62 | pixmap =new ImageWidget(this);; | 64 | pixmap =new ImageWidget(this);; |
63 | QPixmap pm; | 65 | QPixmap pm; |
64 | pm.convertFromImage(img); | 66 | pm.convertFromImage(img); |
65 | pixmap->setPixmap(pm); | 67 | pixmap->setPixmap(pm); |
66 | pixmap->setMinimumSize(pm.width(),pm.height()); | 68 | pixmap->setMinimumSize(pm.width(),pm.height()); |
67 | gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter); | 69 | gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter); |
68 | QLabel *l=new QLabel(tr("Brightness")+":",this); | 70 | QLabel *l=new QLabel(tr("Brightness")+":",this); |
69 | gl->addWidget(l,1,0,AlignLeft); | 71 | gl->addWidget(l,1,0,AlignLeft); |
@@ -265,49 +267,49 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ ) | |||
265 | fileMenuView->insertSeparator(); | 267 | fileMenuView->insertSeparator(); |
266 | 268 | ||
267 | viewMenuView = new QPopupMenu(this ); | 269 | viewMenuView = new QPopupMenu(this ); |
268 | viewMenuView->setCheckable ( true ); | 270 | viewMenuView->setCheckable ( true ); |
269 | 271 | ||
270 | //menubarView->insertItem( tr("View"),viewMenu ); | 272 | //menubarView->insertItem( tr("View"),viewMenu ); |
271 | viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0); | 273 | viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0); |
272 | viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0); | 274 | viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0); |
273 | 275 | ||
274 | stack = new QWidgetStack( this ); | 276 | stack = new QWidgetStack( this ); |
275 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 277 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
276 | setCentralWidget( stack ); | 278 | setCentralWidget( stack ); |
277 | 279 | ||
278 | 280 | ||
279 | imagePanel = new ImagePane( stack ); | 281 | imagePanel = new ImagePane( stack ); |
280 | connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); | 282 | connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView())); |
281 | 283 | ||
282 | 284 | ||
283 | ImageFileSelector::CURRENT_VIEW cv; | 285 | ImageFileSelector::CURRENT_VIEW cv; |
284 | if(showThumbView) | 286 | if(showThumbView) |
285 | cv=ImageFileSelector::THUMBNAIL; | 287 | cv=ImageFileSelector::THUMBNAIL; |
286 | else | 288 | else |
287 | cv=ImageFileSelector::DETAILED; | 289 | cv=ImageFileSelector::DETAILED; |
288 | 290 | ||
289 | qDebug("cv = %d",cv); | 291 | odebug << "cv = " << cv << "" << oendl; |
290 | 292 | ||
291 | fileSelector = new ImageFileSelector( cv,stack, "fs"); | 293 | fileSelector = new ImageFileSelector( cv,stack, "fs"); |
292 | 294 | ||
293 | //switchThumbView(); | 295 | //switchThumbView(); |
294 | 296 | ||
295 | 297 | ||
296 | //fileSelector = new ImageFileSelector("image/*", stack, "fs"); | 298 | //fileSelector = new ImageFileSelector("image/*", stack, "fs"); |
297 | //fileSelector->setNewVisible(FALSE); | 299 | //fileSelector->setNewVisible(FALSE); |
298 | //fileSelector->setCloseVisible(FALSE); | 300 | //fileSelector->setCloseVisible(FALSE); |
299 | connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); | 301 | connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) ); |
300 | connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), | 302 | connect( fileSelector, SIGNAL( fileSelected(const DocLnk&) ), |
301 | this, SLOT( openFile(const DocLnk&) ) ); | 303 | this, SLOT( openFile(const DocLnk&) ) ); |
302 | 304 | ||
303 | imageList = fileSelector->fileList(); | 305 | imageList = fileSelector->fileList(); |
304 | slideAction->setEnabled( imageList.count() != 0); | 306 | slideAction->setEnabled( imageList.count() != 0); |
305 | 307 | ||
306 | iconToolBar = new QToolBar(this); | 308 | iconToolBar = new QToolBar(this); |
307 | 309 | ||
308 | QAction *a; | 310 | QAction *a; |
309 | 311 | ||
310 | a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 312 | a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); |
311 | connect( a, SIGNAL( activated() ), this, SLOT( open() ) ); | 313 | connect( a, SIGNAL( activated() ), this, SLOT( open() ) ); |
312 | a->addTo( fileMenuView); | 314 | a->addTo( fileMenuView); |
313 | a->addTo( iconToolBar ); | 315 | a->addTo( iconToolBar ); |
@@ -392,49 +394,49 @@ ImageViewer::~ImageViewer() | |||
392 | cfg.writeEntry("Reverse", slideReverse); | 394 | cfg.writeEntry("Reverse", slideReverse); |
393 | 395 | ||
394 | cfg.setGroup("Default"); | 396 | cfg.setGroup("Default"); |
395 | cfg.writeEntry("Rotate", rotateOnLoad); | 397 | cfg.writeEntry("Rotate", rotateOnLoad); |
396 | cfg.writeEntry("FastLoad", fastLoad); | 398 | cfg.writeEntry("FastLoad", fastLoad); |
397 | 399 | ||
398 | delete imagePanel; // in case it is fullscreen | 400 | delete imagePanel; // in case it is fullscreen |
399 | } | 401 | } |
400 | 402 | ||
401 | void ImageViewer::help() { | 403 | void ImageViewer::help() { |
402 | 404 | ||
403 | } | 405 | } |
404 | 406 | ||
405 | 407 | ||
406 | void ImageViewer::settings() | 408 | void ImageViewer::settings() |
407 | { | 409 | { |
408 | SettingsDialog dlg( this, 0, TRUE ); | 410 | SettingsDialog dlg( this, 0, TRUE ); |
409 | dlg.setDelay( slideDelay ); | 411 | dlg.setDelay( slideDelay ); |
410 | dlg.setRepeat( slideRepeat ); | 412 | dlg.setRepeat( slideRepeat ); |
411 | dlg.setReverse( slideReverse ); | 413 | dlg.setReverse( slideReverse ); |
412 | dlg.setRotate(rotateOnLoad); | 414 | dlg.setRotate(rotateOnLoad); |
413 | dlg.setFastLoad(fastLoad); | 415 | dlg.setFastLoad(fastLoad); |
414 | 416 | ||
415 | if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) { | 417 | if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) { |
416 | qDebug("<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>"); | 418 | odebug << "<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>" << oendl; |
417 | slideDelay = dlg.delay(); | 419 | slideDelay = dlg.delay(); |
418 | slideRepeat = dlg.repeat(); | 420 | slideRepeat = dlg.repeat(); |
419 | slideReverse = dlg.reverse(); | 421 | slideReverse = dlg.reverse(); |
420 | rotateOnLoad = dlg.rotate(); | 422 | rotateOnLoad = dlg.rotate(); |
421 | fastLoad = dlg.fastLoad(); | 423 | fastLoad = dlg.fastLoad(); |
422 | 424 | ||
423 | Config config( "ImageViewer" ); | 425 | Config config( "ImageViewer" ); |
424 | config.setGroup( "SlideShow" ); | 426 | config.setGroup( "SlideShow" ); |
425 | config.writeEntry( "Delay", slideDelay ); | 427 | config.writeEntry( "Delay", slideDelay ); |
426 | config.writeEntry( "Repeat", slideRepeat ); | 428 | config.writeEntry( "Repeat", slideRepeat ); |
427 | config.writeEntry("Reverse", slideReverse); | 429 | config.writeEntry("Reverse", slideReverse); |
428 | 430 | ||
429 | config.setGroup("Default"); | 431 | config.setGroup("Default"); |
430 | config.writeEntry("Rotate", rotateOnLoad); | 432 | config.writeEntry("Rotate", rotateOnLoad); |
431 | config.writeEntry("FastLoad", fastLoad); | 433 | config.writeEntry("FastLoad", fastLoad); |
432 | } | 434 | } |
433 | } | 435 | } |
434 | 436 | ||
435 | void ImageViewer::switchSizeToScreen() | 437 | void ImageViewer::switchSizeToScreen() |
436 | { | 438 | { |
437 | isSized=!isSized; | 439 | isSized=!isSized; |
438 | sss->setOn(isSized); | 440 | sss->setOn(isSized); |
439 | updateImage(); | 441 | updateImage(); |
440 | } | 442 | } |
@@ -484,79 +486,79 @@ void ImageViewer::switchToImageView() | |||
484 | 486 | ||
485 | } | 487 | } |
486 | 488 | ||
487 | 489 | ||
488 | void ImageViewer::setDocument(const QString& fileref) | 490 | void ImageViewer::setDocument(const QString& fileref) |
489 | { | 491 | { |
490 | delayLoad = fileref; | 492 | delayLoad = fileref; |
491 | switchToImageView(); | 493 | switchToImageView(); |
492 | QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); | 494 | QTimer::singleShot( 0, this, SLOT(doDelayedLoad()) ); |
493 | } | 495 | } |
494 | 496 | ||
495 | void ImageViewer::doDelayedLoad() | 497 | void ImageViewer::doDelayedLoad() |
496 | { | 498 | { |
497 | show(delayLoad); | 499 | show(delayLoad); |
498 | } | 500 | } |
499 | 501 | ||
500 | void ImageViewer::show() | 502 | void ImageViewer::show() |
501 | { | 503 | { |
502 | normalView(); | 504 | normalView(); |
503 | QMainWindow::show(); | 505 | QMainWindow::show(); |
504 | } | 506 | } |
505 | 507 | ||
506 | void ImageViewer::show(const QString& fileref) | 508 | void ImageViewer::show(const QString& fileref) |
507 | { | 509 | { |
508 | // qDebug("Show "+fileref); | 510 | // odebug << "Show "+fileref << oendl; |
509 | bFromDocView = TRUE; | 511 | bFromDocView = TRUE; |
510 | closeFileSelector(); | 512 | closeFileSelector(); |
511 | DocLnk link(fileref); | 513 | DocLnk link(fileref); |
512 | if ( link.isValid() ) { | 514 | if ( link.isValid() ) { |
513 | openFile(link); | 515 | openFile(link); |
514 | } else { | 516 | } else { |
515 | filename = fileref; | 517 | filename = fileref; |
516 | updateCaption( fileref ); | 518 | updateCaption( fileref ); |
517 | loadImage( fileref ); | 519 | loadImage( fileref ); |
518 | } | 520 | } |
519 | } | 521 | } |
520 | 522 | ||
521 | void ImageViewer::openFile() { | 523 | void ImageViewer::openFile() { |
522 | MimeTypes types; | 524 | MimeTypes types; |
523 | QStringList image; | 525 | QStringList image; |
524 | image << "image/*"; | 526 | image << "image/*"; |
525 | types.insert("Images", image); | 527 | types.insert("Images", image); |
526 | 528 | ||
527 | QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); | 529 | QString str = OFileDialog::getOpenFileName( 1,QPEApplication::documentDir(),"", types, 0 ); |
528 | DocLnk link(str); | 530 | DocLnk link(str); |
529 | // if ( link.isValid() ) | 531 | // if ( link.isValid() ) |
530 | openFile(link); | 532 | openFile(link); |
531 | 533 | ||
532 | } | 534 | } |
533 | 535 | ||
534 | void ImageViewer::openFile( const DocLnk &link ) | 536 | void ImageViewer::openFile( const DocLnk &link ) |
535 | { | 537 | { |
536 | closeFileSelector(); | 538 | closeFileSelector(); |
537 | // DocLnk link(file); | 539 | // DocLnk link(file); |
538 | qDebug("open "+link.name()); | 540 | odebug << "open "+link.name() << oendl; |
539 | updateCaption( link.name() ); | 541 | updateCaption( link.name() ); |
540 | loadImage( link.file() ); | 542 | loadImage( link.file() ); |
541 | if (slideTimer->isActive()) { | 543 | if (slideTimer->isActive()) { |
542 | slideTimer->start(slideDelay * 1000, FALSE); | 544 | slideTimer->start(slideDelay * 1000, FALSE); |
543 | } | 545 | } |
544 | 546 | ||
545 | } | 547 | } |
546 | 548 | ||
547 | void ImageViewer::open() | 549 | void ImageViewer::open() |
548 | { | 550 | { |
549 | switchToFileSelector(); | 551 | switchToFileSelector(); |
550 | } | 552 | } |
551 | 553 | ||
552 | void ImageViewer::closeFileSelector() | 554 | void ImageViewer::closeFileSelector() |
553 | { | 555 | { |
554 | switchToImageView(); | 556 | switchToImageView(); |
555 | } | 557 | } |
556 | 558 | ||
557 | void ImageViewer::updateCaption( QString name ) | 559 | void ImageViewer::updateCaption( QString name ) |
558 | { | 560 | { |
559 | int sep = name.findRev( '/' ); | 561 | int sep = name.findRev( '/' ); |
560 | if ( sep >= 0 ) | 562 | if ( sep >= 0 ) |
561 | name = name.mid( sep+1 ); | 563 | name = name.mid( sep+1 ); |
562 | setCaption( name + tr(" - Image Viewer") ); | 564 | setCaption( name + tr(" - Image Viewer") ); |
diff --git a/noncore/multimedia/showimg/showimg.pro b/noncore/multimedia/showimg/showimg.pro index 6fd019e..c905da8 100644 --- a/noncore/multimedia/showimg/showimg.pro +++ b/noncore/multimedia/showimg/showimg.pro | |||
@@ -1,9 +1,9 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h | 2 | HEADERS = showimg.h ImageFileSelector.h settingsdialog.h settingsdialogbase.h |
3 | SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp | 3 | SOURCES = main.cpp showimg.cpp ImageFileSelector.cpp settingsdialog.cpp settingsdialogbase.cpp |
4 | TARGET = showimg | 4 | TARGET = showimg |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiecore2 -lopieui2 | 7 | LIBS += -lqpe -lopiecore2 -lopieui2 |
8 | 8 | ||
9 | include ( $(OPIEDIR)/include.pro ) | 9 | include ( $(OPIEDIR)/include.pro ) |