summaryrefslogtreecommitdiff
path: root/noncore/unsupported/showimg/ImageFileSelector.h
Unidiff
Diffstat (limited to 'noncore/unsupported/showimg/ImageFileSelector.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/showimg/ImageFileSelector.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/noncore/unsupported/showimg/ImageFileSelector.h b/noncore/unsupported/showimg/ImageFileSelector.h
new file mode 100644
index 0000000..798ebcc
--- a/dev/null
+++ b/noncore/unsupported/showimg/ImageFileSelector.h
@@ -0,0 +1,134 @@
1#ifndef IMAGEFILE_SELECTOR_H
2#define IMAGEFILE_SELECTOR_H
3
4
5#include <qtoolbutton.h>
6#include <qlistview.h>
7#include <qwidgetstack.h>
8#include <qlayout.h>
9
10#include "qpe/filemanager.h"
11#include "qpe/applnk.h"
12
13class QScrollView;
14class QLabel;
15//class QValueList;
16
17class ThumbWidget : public QWidget
18{
19 Q_OBJECT
20public:
21 ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent=0,int width=-1);
22 ~ThumbWidget() { }
23
24 DocLnk file() const {
25 return fl;
26 }
27
28
29 signals:
30 void clicked(const DocLnk &);
31
32protected:
33 void paintEvent( QPaintEvent * );
34 void resizeEvent(QResizeEvent *);
35
36 void mouseReleaseEvent(QMouseEvent* event);
37
38private:
39 QPixmap pixmap;
40 QLabel *description;
41 DocLnk fl;
42};
43
44
45
46
47class ImageFileSelectorItem : public QListViewItem
48{
49public:
50 ImageFileSelectorItem( QListView *parent, const DocLnk& f );
51 ~ImageFileSelectorItem();
52
53 DocLnk file() const {
54 return fl;
55 }
56private:
57 DocLnk fl;
58};
59
60class ImageFileSelector : public QWidgetStack
61{
62 Q_OBJECT
63
64public:
65
66 enum CURRENT_VIEW {
67 THUMBNAIL,
68 DETAILED,
69 UNKNOWN
70 };
71
72
73 ImageFileSelector(CURRENT_VIEW scv=DETAILED, QWidget *parent=0, const char *name=0 );
74 ~ImageFileSelector();
75
76 void reread(bool purgeCache=false);
77 int fileCount();
78 const DocLnk *selected();
79
80 void setView(CURRENT_VIEW v);
81
82 CURRENT_VIEW view() {
83 return cView;
84 }
85
86 QValueList<DocLnk> fileList() const {
87 ((ImageFileSelector*)this)->fileCount(); // ensure all loaded when this is extended
88 QValueList<DocLnk> list;
89 ImageFileSelectorItem *item = (ImageFileSelectorItem *)detailed->firstChild();
90 while (item) {
91 list.append(item->file());
92 item = (ImageFileSelectorItem *)item->nextSibling();
93 }
94 return list;
95 }
96
97public slots:
98
99 void switchView();
100
101signals:
102 void fileSelected( const DocLnk & );
103 void closeMe();
104
105protected:
106
107 void resizeEvent(QResizeEvent *);
108
109
110private slots:
111 void fileClicked( int, QListViewItem *, const QPoint &, int );
112 // pressed to get 'right down'
113 void filePressed( int, QListViewItem *, const QPoint &, int );
114 void fileClicked( QListViewItem *);
115 void thumbClicked(const DocLnk &);
116
117private:
118
119 void updateSizes();
120
121
122 CURRENT_VIEW cView;
123 int count;
124
125 QListView *detailed;
126 QScrollView *thumb;
127 QList<ThumbWidget> tList;
128 QWidget *background;
129 QGridLayout *gl;
130
131};
132#endif // IMAGEFILE_SELECTOR_H
133
134