author | warmi <warmi> | 2002-08-15 03:16:42 (UTC) |
---|---|---|
committer | warmi <warmi> | 2002-08-15 03:16:42 (UTC) |
commit | 92640e4094075342138796065040441210348c76 (patch) (side-by-side diff) | |
tree | 852d55ce130c9e2222b0c5456ca1640d592428c8 /noncore/multimedia/showimg/ImageFileSelector.h | |
parent | 43b6d43015dc2a28035a2d914815c8eb2b93a798 (diff) | |
download | opie-92640e4094075342138796065040441210348c76.zip opie-92640e4094075342138796065040441210348c76.tar.gz opie-92640e4094075342138796065040441210348c76.tar.bz2 |
FileSelector with the optional thumbnail preview for images.
Work in progress...
Diffstat (limited to 'noncore/multimedia/showimg/ImageFileSelector.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/showimg/ImageFileSelector.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/noncore/multimedia/showimg/ImageFileSelector.h b/noncore/multimedia/showimg/ImageFileSelector.h new file mode 100644 index 0000000..2c346c4 --- a/dev/null +++ b/noncore/multimedia/showimg/ImageFileSelector.h @@ -0,0 +1,135 @@ +#ifndef IMAGEFILE_SELECTOR_H +#define IMAGEFILE_SELECTOR_H + + +#include <qtoolbutton.h> +#include <qlistview.h> +#include <qwidgetstack.h> +#include <qlayout.h> + +#include "qpe/filemanager.h" +#include "qpe/applnk.h" + +class QScrollView; +class QLabel; + +class ThumbWidget : public QWidget +{ + Q_OBJECT + public: + ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent=0,int width=-1); + ~ThumbWidget() + { + + } + + DocLnk file() const + { + return fl; + } + + + signals: + void clicked(const DocLnk &); + +protected: + void paintEvent( QPaintEvent * ); + void resizeEvent(QResizeEvent *); + + void mouseReleaseEvent(QMouseEvent* event); + +private: + QPixmap pixmap; + QLabel *description; + DocLnk fl; +}; + + +class ImageFileSelector : public QWidgetStack +{ + Q_OBJECT + + public: + + enum CURRENT_VIEW + { + THUMBNAIL, + DETAILED, + UNKNOWN + }; + + + ImageFileSelector(CURRENT_VIEW scv=DETAILED, QWidget *parent=0, const char *name=0 ); + ~ImageFileSelector(); + + void reread(bool purgeCache=false); + int fileCount(); + const DocLnk *selected(); + + void setView(CURRENT_VIEW v); + + CURRENT_VIEW view() + { + return cView; + } + + +public slots: + + void switchView(); + +signals: + void fileSelected( const DocLnk & ); + void closeMe(); + +protected: + + void resizeEvent(QResizeEvent *); + + +private slots: + void fileClicked( int, QListViewItem *, const QPoint &, int ); + // pressed to get 'right down' + void filePressed( int, QListViewItem *, const QPoint &, int ); + void fileClicked( QListViewItem *); + void thumbClicked(const DocLnk &); + +private: + + void updateSizes(); + + + CURRENT_VIEW cView; + int count; + + QListView *detailed; + QScrollView *thumb; + QList<ThumbWidget> tList; + QWidget *background; + QGridLayout *gl; + +}; + + +class ImageFileSelectorItem : public QListViewItem +{ +public: + ImageFileSelectorItem( QListView *parent, const DocLnk& f ); + ~ImageFileSelectorItem(); + + DocLnk file() const + { + return fl; + } + + +private: + DocLnk fl; +}; + + + + +#endif // IMAGEFILE_SELECTOR_H + + |