-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,23 +1,25 @@ | |||
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); |
@@ -146,25 +148,25 @@ void ImageFileSelector::resizeEvent(QResizeEvent *) | |||
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; |
@@ -212,25 +214,25 @@ void ImageFileSelector::reread(bool) | |||
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; |
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 | |||
@@ -17,41 +17,43 @@ | |||
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 | ||
@@ -277,25 +279,25 @@ ImageViewer::ImageViewer( QWidget *parent, const char *name, int /*wFlags*/ ) | |||
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&) ) ); |
@@ -404,25 +406,25 @@ void ImageViewer::help() { | |||
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 | ||
@@ -496,25 +498,25 @@ 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 | ||
@@ -526,25 +528,25 @@ void ImageViewer::openFile() { | |||
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 | } |
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 ) |