author | zecke <zecke> | 2004-04-05 20:01:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-05 20:01:22 (UTC) |
commit | ecdd2845abeb5f3d00f58540e9b222799d6610e8 (patch) (unidiff) | |
tree | 7199007b1dc296bb4572f2c96178d47d2f36bc02 /noncore/graphics/opie-eye/gui/iconview.cpp | |
parent | cb3097d5249b6bd576d0212394ab57e885f9e9da (diff) | |
download | opie-ecdd2845abeb5f3d00f58540e9b222799d6610e8.zip opie-ecdd2845abeb5f3d00f58540e9b222799d6610e8.tar.gz opie-ecdd2845abeb5f3d00f58540e9b222799d6610e8.tar.bz2 |
Make use of OWidgetStack
Diffstat (limited to 'noncore/graphics/opie-eye/gui/iconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index de2cdf0..4ced52d 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -35,9 +35,12 @@ | |||
35 | 35 | ||
36 | using Opie::Ui::OKeyConfigItem; | 36 | using Opie::Ui::OKeyConfigItem; |
37 | 37 | ||
38 | /* | ||
39 | * The Icons, Request Cache and IconViewItem for the IconView | ||
40 | */ | ||
38 | namespace { | 41 | namespace { |
39 | QPixmap* _dirPix = 0; | 42 | static QPixmap* _dirPix = 0; |
40 | QPixmap* _unkPix = 0; | 43 | static QPixmap* _unkPix = 0; |
41 | class IconViewItem : public QIconViewItem { | 44 | class IconViewItem : public QIconViewItem { |
42 | public: | 45 | public: |
43 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); | 46 | IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); |
@@ -59,8 +62,8 @@ namespace { | |||
59 | * If we request an Image or String | 62 | * If we request an Image or String |
60 | * we add it to the map | 63 | * we add it to the map |
61 | */ | 64 | */ |
62 | QMap<QString, IconViewItem*> g_stringInf; | 65 | static QMap<QString, IconViewItem*> g_stringInf; |
63 | QMap<QString, IconViewItem*> g_stringPix; | 66 | static QMap<QString, IconViewItem*> g_stringPix; |
64 | 67 | ||
65 | IconViewItem::IconViewItem( QIconView* view,const QString& path, | 68 | IconViewItem::IconViewItem( QIconView* view,const QString& path, |
66 | const QString& name, bool isDir ) | 69 | const QString& name, bool isDir ) |
@@ -101,6 +104,10 @@ namespace { | |||
101 | } | 104 | } |
102 | 105 | ||
103 | 106 | ||
107 | /* | ||
108 | * Set up the GUI.. initialize the slave set up gui | ||
109 | * and also load a dir | ||
110 | */ | ||
104 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 111 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
105 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 112 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
106 | { | 113 | { |
@@ -136,6 +143,9 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | |||
136 | slotViewChanged( m_views->currentItem() ); | 143 | slotViewChanged( m_views->currentItem() ); |
137 | } | 144 | } |
138 | 145 | ||
146 | /* | ||
147 | * Unref the slave and save the keyboard manager | ||
148 | */ | ||
139 | PIconView::~PIconView() { | 149 | PIconView::~PIconView() { |
140 | { | 150 | { |
141 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 151 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
@@ -148,6 +158,11 @@ Opie::Ui::OKeyConfigManager* PIconView::manager() { | |||
148 | return m_viewManager; | 158 | return m_viewManager; |
149 | } | 159 | } |
150 | 160 | ||
161 | |||
162 | /* | ||
163 | * init the KeyBoard Shortcuts | ||
164 | * called from the c'tor | ||
165 | */ | ||
151 | void PIconView::initKeys() { | 166 | void PIconView::initKeys() { |
152 | Opie::Ui::OKeyPair::List lst; | 167 | Opie::Ui::OKeyPair::List lst; |
153 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | 168 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); |
@@ -178,6 +193,10 @@ void PIconView::initKeys() { | |||
178 | m_viewManager->handleWidget( m_view ); | 193 | m_viewManager->handleWidget( m_view ); |
179 | } | 194 | } |
180 | 195 | ||
196 | |||
197 | /* | ||
198 | * change one dir up | ||
199 | */ | ||
181 | void PIconView::slotDirUp() { | 200 | void PIconView::slotDirUp() { |
182 | QDir dir( m_path ); | 201 | QDir dir( m_path ); |
183 | dir.cdUp(); | 202 | dir.cdUp(); |
@@ -185,6 +204,9 @@ void PIconView::slotDirUp() { | |||
185 | 204 | ||
186 | } | 205 | } |
187 | 206 | ||
207 | /* | ||
208 | * change the dir | ||
209 | */ | ||
188 | void PIconView::slotChangeDir(const QString& path) { | 210 | void PIconView::slotChangeDir(const QString& path) { |
189 | if ( !currentView() ) | 211 | if ( !currentView() ) |
190 | return; | 212 | return; |
@@ -284,9 +306,9 @@ void PIconView::slotReloadDir() { | |||
284 | void PIconView::addFolders( const QStringList& lst) { | 306 | void PIconView::addFolders( const QStringList& lst) { |
285 | QStringList::ConstIterator it; | 307 | QStringList::ConstIterator it; |
286 | 308 | ||
287 | for(it=lst.begin(); it != lst.end(); ++it ) { | 309 | for(it=lst.begin(); it != lst.end(); ++it ) |
288 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); | 310 | (void)new IconViewItem( m_view, m_path+"/"+(*it), (*it), true ); |
289 | } | 311 | |
290 | 312 | ||
291 | } | 313 | } |
292 | 314 | ||
@@ -305,7 +327,7 @@ void PIconView::slotClicked(QIconViewItem* _it) { | |||
305 | if( it->isDir() ) | 327 | if( it->isDir() ) |
306 | slotChangeDir( it->path() ); | 328 | slotChangeDir( it->path() ); |
307 | else // view image | 329 | else // view image |
308 | ; | 330 | slotShowImage(); |
309 | } | 331 | } |
310 | 332 | ||
311 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { | 333 | void PIconView::slotThumbInfo( const QString& _path, const QString& str ) { |
@@ -360,37 +382,36 @@ void PIconView::slotBeamDone( Ir* ir) { | |||
360 | 382 | ||
361 | void PIconView::slotStart() { | 383 | void PIconView::slotStart() { |
362 | m_view->viewport()->setUpdatesEnabled( false ); | 384 | m_view->viewport()->setUpdatesEnabled( false ); |
363 | qWarning( "Sig Start" ); | ||
364 | } | 385 | } |
365 | 386 | ||
366 | void PIconView::slotEnd() { | 387 | void PIconView::slotEnd() { |
367 | qWarning( "SLot End" ); | ||
368 | if ( m_updatet ) | 388 | if ( m_updatet ) |
369 | m_view->arrangeItemsInGrid( ); | 389 | m_view->arrangeItemsInGrid( ); |
370 | m_view->viewport()->setUpdatesEnabled( true ); | 390 | m_view->viewport()->setUpdatesEnabled( true ); |
371 | m_updatet = false; | 391 | m_updatet = false; |
372 | } | 392 | } |
373 | 393 | ||
374 | void PIconView::slotShowImage() { | 394 | void PIconView::slotShowImage() |
375 | qDebug("image show"); | 395 | { |
396 | qWarning( "SLotShowImage" ); | ||
376 | bool isDir = false; | 397 | bool isDir = false; |
377 | QString name = currentFileName(isDir); | 398 | QString name = currentFileName(isDir); |
378 | if (isDir) return; | 399 | if (isDir) return; |
379 | ImageDlg dlg(name); | ||
380 | QPEApplication::execDialog(&dlg); | ||
381 | } | ||
382 | void PIconView::slotShowImage( const QString& ) { | ||
383 | 400 | ||
401 | slotShowImage( name ); | ||
402 | } | ||
403 | void PIconView::slotShowImage( const QString& name) { | ||
404 | emit sig_display( name ); | ||
384 | } | 405 | } |
385 | void PIconView::slotImageInfo() { | 406 | void PIconView::slotImageInfo() { |
386 | qDebug("image info"); | 407 | qWarning( "SlotImageInfo" ); |
387 | bool isDir = false; | 408 | bool isDir = false; |
388 | QString name = currentFileName(isDir); | 409 | QString name = currentFileName(isDir); |
389 | if (isDir) return; | 410 | if (isDir) return; |
390 | infoDlg dlg(name); | 411 | |
391 | QPEApplication::execDialog(&dlg); | 412 | slotImageInfo( name ); |
392 | } | 413 | } |
393 | 414 | ||
394 | void PIconView::slotImageInfo( const QString& ) { | 415 | void PIconView::slotImageInfo( const QString& name) { |
395 | 416 | emit sig_showInfo( name ); | |
396 | } | 417 | } |