Diffstat (limited to 'noncore/multimedia/showimg/ImageFileSelector.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/showimg/ImageFileSelector.h | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/noncore/multimedia/showimg/ImageFileSelector.h b/noncore/multimedia/showimg/ImageFileSelector.h index 2c346c4..798ebcc 100644 --- a/noncore/multimedia/showimg/ImageFileSelector.h +++ b/noncore/multimedia/showimg/ImageFileSelector.h @@ -3,85 +3,105 @@ #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 QValueList; class ThumbWidget : public QWidget { Q_OBJECT public: ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent=0,int width=-1); - ~ThumbWidget() - { - - } + ~ThumbWidget() { } - DocLnk file() const - { + 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 ImageFileSelectorItem : public QListViewItem +{ +public: + ImageFileSelectorItem( QListView *parent, const DocLnk& f ); + ~ImageFileSelectorItem(); + + DocLnk file() const { + return fl; + } +private: + DocLnk fl; +}; + class ImageFileSelector : public QWidgetStack { Q_OBJECT public: - enum CURRENT_VIEW - { + 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() - { + CURRENT_VIEW view() { return cView; } + QValueList<DocLnk> fileList() const { + ((ImageFileSelector*)this)->fileCount(); // ensure all loaded when this is extended + QValueList<DocLnk> list; + ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->firstChild(); + while (item) { + list.append(item->file()); + item = (ImageFileSelectorItem *)item->nextSibling(); + } + return list; + } public slots: void switchView(); signals: void fileSelected( const DocLnk & ); void closeMe(); protected: void resizeEvent(QResizeEvent *); @@ -100,36 +120,15 @@ private: 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 |