author | warmi <warmi> | 2002-08-15 03:16:42 (UTC) |
---|---|---|
committer | warmi <warmi> | 2002-08-15 03:16:42 (UTC) |
commit | 92640e4094075342138796065040441210348c76 (patch) (unidiff) | |
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) (ignore 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 @@ | |||
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 | |||
13 | class QScrollView; | ||
14 | class QLabel; | ||
15 | |||
16 | class ThumbWidget : public QWidget | ||
17 | { | ||
18 | Q_OBJECT | ||
19 | public: | ||
20 | ThumbWidget(QPixmap p,QString text,const DocLnk& f,QWidget *parent=0,int width=-1); | ||
21 | ~ThumbWidget() | ||
22 | { | ||
23 | |||
24 | } | ||
25 | |||
26 | DocLnk file() const | ||
27 | { | ||
28 | return fl; | ||
29 | } | ||
30 | |||
31 | |||
32 | signals: | ||
33 | void clicked(const DocLnk &); | ||
34 | |||
35 | protected: | ||
36 | void paintEvent( QPaintEvent * ); | ||
37 | void resizeEvent(QResizeEvent *); | ||
38 | |||
39 | void mouseReleaseEvent(QMouseEvent* event); | ||
40 | |||
41 | private: | ||
42 | QPixmap pixmap; | ||
43 | QLabel *description; | ||
44 | DocLnk fl; | ||
45 | }; | ||
46 | |||
47 | |||
48 | class ImageFileSelector : public QWidgetStack | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | |||
52 | public: | ||
53 | |||
54 | enum CURRENT_VIEW | ||
55 | { | ||
56 | THUMBNAIL, | ||
57 | DETAILED, | ||
58 | UNKNOWN | ||
59 | }; | ||
60 | |||
61 | |||
62 | ImageFileSelector(CURRENT_VIEW scv=DETAILED, QWidget *parent=0, const char *name=0 ); | ||
63 | ~ImageFileSelector(); | ||
64 | |||
65 | void reread(bool purgeCache=false); | ||
66 | int fileCount(); | ||
67 | const DocLnk *selected(); | ||
68 | |||
69 | void setView(CURRENT_VIEW v); | ||
70 | |||
71 | CURRENT_VIEW view() | ||
72 | { | ||
73 | return cView; | ||
74 | } | ||
75 | |||
76 | |||
77 | public slots: | ||
78 | |||
79 | void switchView(); | ||
80 | |||
81 | signals: | ||
82 | void fileSelected( const DocLnk & ); | ||
83 | void closeMe(); | ||
84 | |||
85 | protected: | ||
86 | |||
87 | void resizeEvent(QResizeEvent *); | ||
88 | |||
89 | |||
90 | private slots: | ||
91 | void fileClicked( int, QListViewItem *, const QPoint &, int ); | ||
92 | // pressed to get 'right down' | ||
93 | void filePressed( int, QListViewItem *, const QPoint &, int ); | ||
94 | void fileClicked( QListViewItem *); | ||
95 | void thumbClicked(const DocLnk &); | ||
96 | |||
97 | private: | ||
98 | |||
99 | void updateSizes(); | ||
100 | |||
101 | |||
102 | CURRENT_VIEW cView; | ||
103 | int count; | ||
104 | |||
105 | QListView *detailed; | ||
106 | QScrollView *thumb; | ||
107 | QList<ThumbWidget> tList; | ||
108 | QWidget *background; | ||
109 | QGridLayout *gl; | ||
110 | |||
111 | }; | ||
112 | |||
113 | |||
114 | class ImageFileSelectorItem : public QListViewItem | ||
115 | { | ||
116 | public: | ||
117 | ImageFileSelectorItem( QListView *parent, const DocLnk& f ); | ||
118 | ~ImageFileSelectorItem(); | ||
119 | |||
120 | DocLnk file() const | ||
121 | { | ||
122 | return fl; | ||
123 | } | ||
124 | |||
125 | |||
126 | private: | ||
127 | DocLnk fl; | ||
128 | }; | ||
129 | |||
130 | |||
131 | |||
132 | |||
133 | #endif // IMAGEFILE_SELECTOR_H | ||
134 | |||
135 | |||