author | zecke <zecke> | 2004-04-03 00:02:12 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-03 00:02:12 (UTC) |
commit | cc5b13ad3cd093239e004f1b92bca9f6d88073a9 (patch) (unidiff) | |
tree | 0af3af7a913b12ef357d0b20764df6300aca5226 | |
parent | 02bb854283a7b0abecf3d3e9dd4c9ece0c5ef6a9 (diff) | |
download | opie-cc5b13ad3cd093239e004f1b92bca9f6d88073a9.zip opie-cc5b13ad3cd093239e004f1b92bca9f6d88073a9.tar.gz opie-cc5b13ad3cd093239e004f1b92bca9f6d88073a9.tar.bz2 |
- remove qWarning
- pixmaps for the keyboard actions
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 4a20648..f415d39 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -1,383 +1,383 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "iconview.h" | 6 | #include "iconview.h" |
7 | 7 | ||
8 | #include <lib/imagecache.h> | 8 | #include <lib/imagecache.h> |
9 | 9 | ||
10 | #include <iface/dirview.h> | 10 | #include <iface/dirview.h> |
11 | #include <iface/dirlister.h> | 11 | #include <iface/dirlister.h> |
12 | 12 | ||
13 | #include <opie2/oconfig.h> | 13 | #include <opie2/oconfig.h> |
14 | #include <opie2/okeyconfigwidget.h> | 14 | #include <opie2/okeyconfigwidget.h> |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | 16 | ||
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/qpemessagebox.h> | 18 | #include <qpe/qpemessagebox.h> |
19 | #include <qpe/ir.h> | 19 | #include <qpe/ir.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
21 | 21 | ||
22 | 22 | ||
23 | #include <qiconview.h> | 23 | #include <qiconview.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | #include <qcombobox.h> | 26 | #include <qcombobox.h> |
27 | #include <qdir.h> | 27 | #include <qdir.h> |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | #include <qmainwindow.h> | 29 | #include <qmainwindow.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qstyle.h> | 31 | #include <qstyle.h> |
32 | 32 | ||
33 | 33 | ||
34 | using Opie::Ui::OKeyConfigItem; | 34 | using Opie::Ui::OKeyConfigItem; |
35 | 35 | ||
36 | namespace { | 36 | namespace { |
37 | QPixmap* _dirPix = 0; | 37 | QPixmap* _dirPix = 0; |
38 | QPixmap* _unkPix = 0; | 38 | QPixmap* _unkPix = 0; |
39 | class IconViewItem : public QIconViewItem { | 39 | class IconViewItem : public QIconViewItem { |
40 | public: | 40 | public: |
41 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); | 41 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); |
42 | QPixmap* pixmap()const; | 42 | QPixmap* pixmap()const; |
43 | QString path()const { return m_path; } | 43 | QString path()const { return m_path; } |
44 | bool isDir()const { return m_isDir; } | 44 | bool isDir()const { return m_isDir; } |
45 | void setText( const QString& ); | 45 | void setText( const QString& ); |
46 | 46 | ||
47 | 47 | ||
48 | private: | 48 | private: |
49 | mutable QPixmap* m_pix; | 49 | mutable QPixmap* m_pix; |
50 | QString m_path; | 50 | QString m_path; |
51 | bool m_isDir : 1; | 51 | bool m_isDir : 1; |
52 | bool m_noInfo :1; | 52 | bool m_noInfo :1; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | 55 | ||
56 | /* | 56 | /* |
57 | * If we request an Image or String | 57 | * If we request an Image or String |
58 | * we add it to the map | 58 | * we add it to the map |
59 | */ | 59 | */ |
60 | QMap<QString, IconViewItem*> g_stringInf; | 60 | QMap<QString, IconViewItem*> g_stringInf; |
61 | QMap<QString, IconViewItem*> g_stringPix; | 61 | QMap<QString, IconViewItem*> g_stringPix; |
62 | 62 | ||
63 | IconViewItem::IconViewItem( QIconView* view,const QString& path, | 63 | IconViewItem::IconViewItem( QIconView* view,const QString& path, |
64 | const QString& name, bool isDir ) | 64 | const QString& name, bool isDir ) |
65 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), | 65 | : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), |
66 | m_noInfo( false ) | 66 | m_noInfo( false ) |
67 | { | 67 | { |
68 | if ( isDir && !_dirPix ) | 68 | if ( isDir && !_dirPix ) |
69 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); | 69 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); |
70 | else if ( !isDir && !_unkPix ) | 70 | else if ( !isDir && !_unkPix ) |
71 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); | 71 | _unkPix = new QPixmap( Resource::loadPixmap( "UnknownDocument" ) ); |
72 | } | 72 | } |
73 | inline QPixmap* IconViewItem::pixmap()const { | 73 | inline QPixmap* IconViewItem::pixmap()const { |
74 | qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", | 74 | // qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", |
75 | rect().x(),rect().y(),rect().width(),rect().height(), | 75 | // rect().x(),rect().y(),rect().width(),rect().height(), |
76 | iconView()->contentsX(), iconView()->contentsY()); | 76 | // iconView()->contentsX(), iconView()->contentsY()); |
77 | 77 | ||
78 | if ( m_isDir ) | 78 | if ( m_isDir ) |
79 | return _dirPix; | 79 | return _dirPix; |
80 | else{ | 80 | else{ |
81 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { | 81 | if (!m_noInfo && !g_stringInf.contains( m_path ) ) { |
82 | currentView()->dirLister()->imageInfo( m_path ); | 82 | currentView()->dirLister()->imageInfo( m_path ); |
83 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); | 83 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); |
84 | } | 84 | } |
85 | 85 | ||
86 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); | 86 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); |
87 | if ( !m_pix && !g_stringPix.contains( m_path )) { | 87 | if ( !m_pix && !g_stringPix.contains( m_path )) { |
88 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); | 88 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); |
89 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); | 89 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); |
90 | } | 90 | } |
91 | return m_pix ? m_pix : _unkPix; | 91 | return m_pix ? m_pix : _unkPix; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | inline void IconViewItem::setText( const QString& str ) { | 94 | inline void IconViewItem::setText( const QString& str ) { |
95 | QString text = QIconViewItem::text()+"\n"+str; | 95 | QString text = QIconViewItem::text()+"\n"+str; |
96 | m_noInfo = true; | 96 | m_noInfo = true; |
97 | QIconViewItem::setText( text ); | 97 | QIconViewItem::setText( text ); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 102 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
103 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 103 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
104 | { | 104 | { |
105 | { | 105 | { |
106 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 106 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
107 | } | 107 | } |
108 | m_path = QDir::homeDirPath(); | 108 | m_path = QDir::homeDirPath(); |
109 | 109 | ||
110 | QHBox *hbox = new QHBox( this ); | 110 | QHBox *hbox = new QHBox( this ); |
111 | QLabel* lbl = new QLabel( hbox ); | 111 | QLabel* lbl = new QLabel( hbox ); |
112 | lbl->setText( tr("View as" ) ); | 112 | lbl->setText( tr("View as" ) ); |
113 | 113 | ||
114 | m_views = new QComboBox( hbox, "View As" ); | 114 | m_views = new QComboBox( hbox, "View As" ); |
115 | connect( m_views, SIGNAL(activated(int)), | 115 | connect( m_views, SIGNAL(activated(int)), |
116 | this, SLOT(slotViewChanged(int)) ); | 116 | this, SLOT(slotViewChanged(int)) ); |
117 | 117 | ||
118 | m_view= new QIconView( this ); | 118 | m_view= new QIconView( this ); |
119 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 119 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
120 | this, SLOT(slotClicked(QIconViewItem*)) ); | 120 | this, SLOT(slotClicked(QIconViewItem*)) ); |
121 | 121 | ||
122 | m_view->setArrangement( QIconView::LeftToRight ); | 122 | m_view->setArrangement( QIconView::LeftToRight ); |
123 | m_view->setItemTextPos( QIconView::Right ); | 123 | m_view->setItemTextPos( QIconView::Right ); |
124 | 124 | ||
125 | int dw = QApplication::desktop()->width(); | 125 | int dw = QApplication::desktop()->width(); |
126 | int viewerWidth = dw-style().scrollBarExtent().width(); | 126 | int viewerWidth = dw-style().scrollBarExtent().width(); |
127 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | 127 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
128 | m_view->setGridY( fontMetrics().height()*2+40 ); | 128 | m_view->setGridY( fontMetrics().height()*2+40 ); |
129 | 129 | ||
130 | 130 | ||
131 | initKeys(); | 131 | initKeys(); |
132 | 132 | ||
133 | loadViews(); | 133 | loadViews(); |
134 | slotViewChanged( m_views->currentItem() ); | 134 | slotViewChanged( m_views->currentItem() ); |
135 | } | 135 | } |
136 | 136 | ||
137 | PIconView::~PIconView() { | 137 | PIconView::~PIconView() { |
138 | { | 138 | { |
139 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 139 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
140 | } | 140 | } |
141 | m_viewManager->save(); | 141 | m_viewManager->save(); |
142 | delete m_viewManager; | 142 | delete m_viewManager; |
143 | } | 143 | } |
144 | 144 | ||
145 | Opie::Ui::OKeyConfigManager* PIconView::manager() { | 145 | Opie::Ui::OKeyConfigManager* PIconView::manager() { |
146 | return m_viewManager; | 146 | return m_viewManager; |
147 | } | 147 | } |
148 | 148 | ||
149 | void PIconView::initKeys() { | 149 | void PIconView::initKeys() { |
150 | Opie::Ui::OKeyPair::List lst; | 150 | Opie::Ui::OKeyPair::List lst; |
151 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | 151 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); |
152 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | 152 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); |
153 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | 153 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); |
154 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | 154 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); |
155 | lst.append( Opie::Ui::OKeyPair::returnKey() ); | 155 | lst.append( Opie::Ui::OKeyPair::returnKey() ); |
156 | 156 | ||
157 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 157 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
158 | lst, false,this, "keyconfig name" ); | 158 | lst, false,this, "keyconfig name" ); |
159 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 159 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
160 | QString::fromLatin1("beam"), BeamItem, | 160 | Resource::loadPixmap("beam"), BeamItem, |
161 | Opie::Ui::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 161 | Opie::Ui::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
162 | this, SLOT(slotBeam())) ); | 162 | this, SLOT(slotBeam())) ); |
163 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", | 163 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", |
164 | QString::fromLatin1("trash"), DeleteItem, | 164 | Resource::loadPixmap("trash"), DeleteItem, |
165 | Opie::Ui::OKeyPair(Qt::Key_D, Qt::ShiftButton), | 165 | Opie::Ui::OKeyPair(Qt::Key_D, Qt::ShiftButton), |
166 | this, SLOT(slotTrash())) ); | 166 | this, SLOT(slotTrash())) ); |
167 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", | 167 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", |
168 | QString::fromLatin1("1to1"), ViewItem, | 168 | Resource::loadPixmap("1to1"), ViewItem, |
169 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 169 | Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
170 | this, SLOT(slotShowImage()))); | 170 | this, SLOT(slotShowImage()))); |
171 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", | 171 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", |
172 | QString::fromLatin1("DocumentTypeWord"), InfoItem, | 172 | Resource::loadPixmap("DocumentTypeWord"), InfoItem, |
173 | Opie::Ui::OKeyPair(Qt::Key_I, Qt::ShiftButton ), | 173 | Opie::Ui::OKeyPair(Qt::Key_I, Qt::ShiftButton ), |
174 | this, SLOT(slotImageInfo()) ) ); | 174 | this, SLOT(slotImageInfo()) ) ); |
175 | m_viewManager->load(); | 175 | m_viewManager->load(); |
176 | m_viewManager->handleWidget( m_view ); | 176 | m_viewManager->handleWidget( m_view ); |
177 | } | 177 | } |
178 | 178 | ||
179 | void PIconView::slotDirUp() { | 179 | void PIconView::slotDirUp() { |
180 | QDir dir( m_path ); | 180 | QDir dir( m_path ); |
181 | dir.cdUp(); | 181 | dir.cdUp(); |
182 | slotChangeDir( dir.absPath() ); | 182 | slotChangeDir( dir.absPath() ); |
183 | 183 | ||
184 | } | 184 | } |
185 | 185 | ||
186 | void PIconView::slotChangeDir(const QString& path) { | 186 | void PIconView::slotChangeDir(const QString& path) { |
187 | if ( !currentView() ) | 187 | if ( !currentView() ) |
188 | return; | 188 | return; |
189 | 189 | ||
190 | PDirLister *lister = currentView()->dirLister(); | 190 | PDirLister *lister = currentView()->dirLister(); |
191 | if (!lister ) | 191 | if (!lister ) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | lister->setStartPath( path ); | 194 | lister->setStartPath( path ); |
195 | m_path = lister->currentPath(); | 195 | m_path = lister->currentPath(); |
196 | 196 | ||
197 | m_view->viewport()->setUpdatesEnabled( false ); | 197 | m_view->viewport()->setUpdatesEnabled( false ); |
198 | m_view->clear(); | 198 | m_view->clear(); |
199 | addFolders( lister->folders() ); | 199 | addFolders( lister->folders() ); |
200 | addFiles( lister->files() ); | 200 | addFiles( lister->files() ); |
201 | m_view->viewport()->setUpdatesEnabled( true ); | 201 | m_view->viewport()->setUpdatesEnabled( true ); |
202 | 202 | ||
203 | // Also invalidate the cache. We can't cancel the operations anyway | 203 | // Also invalidate the cache. We can't cancel the operations anyway |
204 | g_stringPix.clear(); | 204 | g_stringPix.clear(); |
205 | g_stringInf.clear(); | 205 | g_stringInf.clear(); |
206 | 206 | ||
207 | // looks ugly | 207 | // looks ugly |
208 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); | 208 | static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); |
209 | } | 209 | } |
210 | 210 | ||
211 | QString PIconView::currentFileName(bool &isDir)const { | 211 | QString PIconView::currentFileName(bool &isDir)const { |
212 | isDir = false; | 212 | isDir = false; |
213 | QIconViewItem* _it = m_view->currentItem(); | 213 | QIconViewItem* _it = m_view->currentItem(); |
214 | if ( !_it ) | 214 | if ( !_it ) |
215 | return QString::null; | 215 | return QString::null; |
216 | 216 | ||
217 | IconViewItem* it = static_cast<IconViewItem*>( _it ); | 217 | IconViewItem* it = static_cast<IconViewItem*>( _it ); |
218 | isDir = it->isDir(); | 218 | isDir = it->isDir(); |
219 | return it->path(); | 219 | return it->path(); |
220 | } | 220 | } |
221 | 221 | ||
222 | void PIconView::slotTrash() { | 222 | void PIconView::slotTrash() { |
223 | bool isDir; | 223 | bool isDir; |
224 | QString pa = currentFileName( isDir ); | 224 | QString pa = currentFileName( isDir ); |
225 | if ( isDir && pa.isEmpty() ) | 225 | if ( isDir && pa.isEmpty() ) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | if (!QPEMessageBox::confirmDelete( this, | 228 | if (!QPEMessageBox::confirmDelete( this, |
229 | tr("Delete Image" ), | 229 | tr("Delete Image" ), |
230 | tr("the Image %1" ).arg(pa))) | 230 | tr("the Image %1" ).arg(pa))) |
231 | return | 231 | return |
232 | 232 | ||
233 | 233 | ||
234 | currentView()->dirLister()->deleteImage( pa ); | 234 | currentView()->dirLister()->deleteImage( pa ); |
235 | delete m_view->currentItem(); | 235 | delete m_view->currentItem(); |
236 | } | 236 | } |
237 | void PIconView::loadViews() { | 237 | void PIconView::loadViews() { |
238 | ViewMap::Iterator it; | 238 | ViewMap::Iterator it; |
239 | ViewMap* map = viewMap(); | 239 | ViewMap* map = viewMap(); |
240 | for ( it = map->begin(); it != map->end(); ++it ) | 240 | for ( it = map->begin(); it != map->end(); ++it ) |
241 | m_views->insertItem( QObject::tr(it.key() ) ); | 241 | m_views->insertItem( QObject::tr(it.key() ) ); |
242 | } | 242 | } |
243 | 243 | ||
244 | void PIconView::resetView() { | 244 | void PIconView::resetView() { |
245 | slotViewChanged(m_views->currentItem()); | 245 | slotViewChanged(m_views->currentItem()); |
246 | } | 246 | } |
247 | 247 | ||
248 | void PIconView::slotViewChanged( int i) { | 248 | void PIconView::slotViewChanged( int i) { |
249 | if (!m_views->count() ) { | 249 | if (!m_views->count() ) { |
250 | setCurrentView( 0l); | 250 | setCurrentView( 0l); |
251 | return; | 251 | return; |
252 | } | 252 | } |
253 | 253 | ||
254 | PDirView* cur = currentView(); | 254 | PDirView* cur = currentView(); |
255 | delete cur; | 255 | delete cur; |
256 | QString str = m_views->text(i); | 256 | QString str = m_views->text(i); |
257 | cur = (*(*viewMap())[str])(*m_cfg); | 257 | cur = (*(*viewMap())[str])(*m_cfg); |
258 | setCurrentView( cur ); | 258 | setCurrentView( cur ); |
259 | 259 | ||
260 | /* connect to the signals of the lister */ | 260 | /* connect to the signals of the lister */ |
261 | PDirLister* lis = cur->dirLister(); | 261 | PDirLister* lis = cur->dirLister(); |
262 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), | 262 | connect(lis, SIGNAL(sig_thumbInfo(const QString&, const QString& )), |
263 | this, SLOT( slotThumbInfo(const QString&, const QString&))); | 263 | this, SLOT( slotThumbInfo(const QString&, const QString&))); |
264 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), | 264 | connect(lis, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), |
265 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); | 265 | this, SLOT(slotThumbNail(const QString&, const QPixmap&))); |
266 | connect(lis, SIGNAL(sig_start()), | 266 | connect(lis, SIGNAL(sig_start()), |
267 | this, SLOT(slotStart())); | 267 | this, SLOT(slotStart())); |
268 | connect(lis, SIGNAL(sig_end()) , | 268 | connect(lis, SIGNAL(sig_end()) , |
269 | this, SLOT(slotEnd()) ); | 269 | this, SLOT(slotEnd()) ); |
270 | 270 | ||
271 | 271 | ||
272 | /* reload now */ | 272 | /* reload now */ |
273 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); | 273 | QTimer::singleShot( 0, this, SLOT(slotReloadDir())); |
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | void PIconView::slotReloadDir() { | 277 | void PIconView::slotReloadDir() { |
278 | slotChangeDir( m_path ); | 278 | slotChangeDir( m_path ); |
279 | } | 279 | } |
280 | 280 | ||
281 | 281 | ||
282 | void PIconView::addFolders( const QStringList& lst) { | 282 | void PIconView::addFolders( const QStringList& lst) { |
283 | QStringList::ConstIterator it; | 283 | QStringList::ConstIterator it; |
284 | 284 | ||
285 | for(it=lst.begin(); it != lst.end(); ++it ) { | 285 | for(it=lst.begin(); it != lst.end(); ++it ) { |
286 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); | 286 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); |
287 | } | 287 | } |
288 | 288 | ||
289 | } | 289 | } |
290 | 290 | ||
291 | void PIconView::addFiles( const QStringList& lst) { | 291 | void PIconView::addFiles( const QStringList& lst) { |
292 | QStringList::ConstIterator it; | 292 | QStringList::ConstIterator it; |
293 | for (it=lst.begin(); it!= lst.end(); ++it ) | 293 | for (it=lst.begin(); it!= lst.end(); ++it ) |
294 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); | 294 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it) ); |
295 | 295 | ||
296 | } | 296 | } |
297 | 297 | ||
298 | void PIconView::slotClicked(QIconViewItem* _it) { | 298 | void PIconView::slotClicked(QIconViewItem* _it) { |
299 | if(!_it ) | 299 | if(!_it ) |
300 | return; | 300 | return; |
301 | 301 | ||
302 | IconViewItem* it = static_cast<IconViewItem*>(_it); | 302 | IconViewItem* it = static_cast<IconViewItem*>(_it); |
303 | if( it->isDir() ) | 303 | if( it->isDir() ) |
304 | slotChangeDir( it->path() ); | 304 | slotChangeDir( it->path() ); |
305 | else // view image | 305 | else // view image |
306 | ; | 306 | ; |
307 | } | 307 | } |
308 | 308 | ||
309 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | 309 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { |
310 | IconViewItem* item = g_stringInf[_path]; | 310 | IconViewItem* item = g_stringInf[_path]; |
311 | if (!item ) | 311 | if (!item ) |
312 | return; | 312 | return; |
313 | 313 | ||
314 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 314 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
315 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 315 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
316 | m_updatet = true; | 316 | m_updatet = true; |
317 | 317 | ||
318 | item->setText( str ); | 318 | item->setText( str ); |
319 | g_stringInf.remove( _path ); | 319 | g_stringInf.remove( _path ); |
320 | } | 320 | } |
321 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { | 321 | void PIconView::slotThumbNail(const QString& _path, const QPixmap &pix) { |
322 | IconViewItem* item = g_stringPix[_path]; | 322 | IconViewItem* item = g_stringPix[_path]; |
323 | if (!item ) | 323 | if (!item ) |
324 | return; | 324 | return; |
325 | 325 | ||
326 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), | 326 | if ( item->intersects(QRect( m_view->contentsX(),m_view->contentsY(), |
327 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) | 327 | m_view->contentsWidth(), m_view->contentsHeight() ) ) ) |
328 | m_updatet = true; | 328 | m_updatet = true; |
329 | 329 | ||
330 | if (pix.width()>0) | 330 | if (pix.width()>0) |
331 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); | 331 | PPixmapCache::self()->insertImage( _path, pix, 64, 64 ); |
332 | 332 | ||
333 | 333 | ||
334 | g_stringPix.remove( _path ); | 334 | g_stringPix.remove( _path ); |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | void PIconView::slotRename() { | 338 | void PIconView::slotRename() { |
339 | 339 | ||
340 | } | 340 | } |
341 | 341 | ||
342 | void PIconView::slotBeam() { | 342 | void PIconView::slotBeam() { |
343 | bool isDir; | 343 | bool isDir; |
344 | QString pa = currentFileName( isDir ); | 344 | QString pa = currentFileName( isDir ); |
345 | if ( isDir && pa.isEmpty() ) | 345 | if ( isDir && pa.isEmpty() ) |
346 | return; | 346 | return; |
347 | 347 | ||
348 | Ir* ir = new Ir( this ); | 348 | Ir* ir = new Ir( this ); |
349 | connect( ir, SIGNAL(done(Ir*)), | 349 | connect( ir, SIGNAL(done(Ir*)), |
350 | this, SLOT(slotBeamDone(Ir*))); | 350 | this, SLOT(slotBeamDone(Ir*))); |
351 | ir->send(pa, tr( "Image" ) ); | 351 | ir->send(pa, tr( "Image" ) ); |
352 | 352 | ||
353 | } | 353 | } |
354 | 354 | ||
355 | void PIconView::slotBeamDone( Ir* ir) { | 355 | void PIconView::slotBeamDone( Ir* ir) { |
356 | delete ir; | 356 | delete ir; |
357 | } | 357 | } |
358 | 358 | ||
359 | void PIconView::slotStart() { | 359 | void PIconView::slotStart() { |
360 | m_view->viewport()->setUpdatesEnabled( false ); | 360 | m_view->viewport()->setUpdatesEnabled( false ); |
361 | qWarning( "Sig Start" ); | 361 | qWarning( "Sig Start" ); |
362 | } | 362 | } |
363 | 363 | ||
364 | void PIconView::slotEnd() { | 364 | void PIconView::slotEnd() { |
365 | qWarning( "SLot End" ); | 365 | qWarning( "SLot End" ); |
366 | if ( m_updatet ) | 366 | if ( m_updatet ) |
367 | m_view->arrangeItemsInGrid( ); | 367 | m_view->arrangeItemsInGrid( ); |
368 | m_view->viewport()->setUpdatesEnabled( true ); | 368 | m_view->viewport()->setUpdatesEnabled( true ); |
369 | m_updatet = false; | 369 | m_updatet = false; |
370 | } | 370 | } |
371 | 371 | ||
372 | void PIconView::slotShowImage() { | 372 | void PIconView::slotShowImage() { |
373 | 373 | ||
374 | } | 374 | } |
375 | void PIconView::slotShowImage( const QString& ) { | 375 | void PIconView::slotShowImage( const QString& ) { |
376 | 376 | ||
377 | } | 377 | } |
378 | void PIconView::slotImageInfo() { | 378 | void PIconView::slotImageInfo() { |
379 | 379 | ||
380 | } | 380 | } |
381 | void PIconView::slotImageInfo( const QString& ) { | 381 | void PIconView::slotImageInfo( const QString& ) { |
382 | 382 | ||
383 | } | 383 | } |