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 | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index b2443e8..59091a8 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -33,12 +33,16 @@ | |||
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | #include <qstyle.h> | 34 | #include <qstyle.h> |
35 | 35 | ||
36 | 36 | ||
37 | using Opie::Core::OKeyConfigItem; | 37 | using Opie::Core::OKeyConfigItem; |
38 | 38 | ||
39 | const int PIconView::sMAX_ICON_SIZE = 128; | ||
40 | const int PIconView::sMIN_ICON_SIZE = 12; | ||
41 | const int PIconView::sDEF_ICON_SIZE = 64; | ||
42 | |||
39 | /* | 43 | /* |
40 | * The Icons, Request Cache and IconViewItem for the IconView | 44 | * The Icons, Request Cache and IconViewItem for the IconView |
41 | */ | 45 | */ |
42 | namespace { | 46 | namespace { |
43 | static QPixmap* _dirPix = 0; | 47 | static QPixmap* _dirPix = 0; |
44 | static QPixmap* _unkPix = 0; | 48 | static QPixmap* _unkPix = 0; |
@@ -219,14 +223,14 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | |||
219 | if (m_mode >1) { | 223 | if (m_mode >1) { |
220 | m_view->setResizeMode(QIconView::Adjust); | 224 | m_view->setResizeMode(QIconView::Adjust); |
221 | } else { | 225 | } else { |
222 | m_view->setResizeMode(QIconView::Fixed); | 226 | m_view->setResizeMode(QIconView::Fixed); |
223 | } | 227 | } |
224 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); | 228 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); |
225 | if (m_iconsize<12)m_iconsize = 12; | 229 | if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; |
226 | if (m_iconsize>64)m_iconsize = 64; | 230 | if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; |
227 | 231 | ||
228 | calculateGrid(); | 232 | calculateGrid(); |
229 | initKeys(); | 233 | initKeys(); |
230 | loadViews(); | 234 | loadViews(); |
231 | } | 235 | } |
232 | 236 | ||
@@ -405,27 +409,27 @@ void PIconView::resetView() { | |||
405 | // Also invalidate the cache. We can't cancel the operations anyway | 409 | // Also invalidate the cache. We can't cancel the operations anyway |
406 | g_stringPix.clear(); | 410 | g_stringPix.clear(); |
407 | g_stringInf.clear(); | 411 | g_stringInf.clear(); |
408 | if (m_mode>1) { | 412 | if (m_mode>1) { |
409 | int osize = m_iconsize; | 413 | int osize = m_iconsize; |
410 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); | 414 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); |
411 | if (m_iconsize<12)m_iconsize = 12; | 415 | if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; |
412 | if (m_iconsize>64)m_iconsize = 64; | 416 | if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; |
413 | if (osize != m_iconsize) { | 417 | if (osize != m_iconsize) { |
414 | if (_dirPix){ | 418 | if (_dirPix){ |
415 | delete _dirPix; | 419 | delete _dirPix; |
416 | _dirPix = 0; | 420 | _dirPix = 0; |
417 | } | 421 | } |
418 | if (_cpyPix){ | 422 | if (_cpyPix){ |
419 | delete _cpyPix; | 423 | delete _cpyPix; |
420 | _cpyPix = 0; | 424 | _cpyPix = 0; |
421 | } | 425 | } |
422 | calculateGrid(); | 426 | calculateGrid(); |
423 | } | 427 | } |
424 | } else { | 428 | } else { |
425 | m_iconsize = 64; | 429 | m_iconsize = sDEF_ICON_SIZE; |
426 | } | 430 | } |
427 | slotViewChanged(m_views->currentItem()); | 431 | slotViewChanged(m_views->currentItem()); |
428 | m_internalReset = false; | 432 | m_internalReset = false; |
429 | } | 433 | } |
430 | 434 | ||
431 | void PIconView::polish() | 435 | void PIconView::polish() |
@@ -830,17 +834,17 @@ void PIconView::slotChangeMode( int mode ) { | |||
830 | if (m_mode >1) { | 834 | if (m_mode >1) { |
831 | m_view->setResizeMode(QIconView::Adjust); | 835 | m_view->setResizeMode(QIconView::Adjust); |
832 | } else { | 836 | } else { |
833 | m_view->setResizeMode(QIconView::Fixed); | 837 | m_view->setResizeMode(QIconView::Fixed); |
834 | } | 838 | } |
835 | if (m_mode==1) { | 839 | if (m_mode==1) { |
836 | m_iconsize = 64; | 840 | m_iconsize = sDEF_ICON_SIZE; |
837 | } else { | 841 | } else { |
838 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); | 842 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); |
839 | if (m_iconsize<12)m_iconsize = 12; | 843 | if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; |
840 | if (m_iconsize>64)m_iconsize = 64; | 844 | if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; |
841 | } | 845 | } |
842 | if (_dirPix){ | 846 | if (_dirPix){ |
843 | delete _dirPix; | 847 | delete _dirPix; |
844 | _dirPix = 0; | 848 | _dirPix = 0; |
845 | } | 849 | } |
846 | if (_cpyPix){ | 850 | if (_cpyPix){ |
@@ -885,13 +889,13 @@ void PIconView::calculateGrid(QResizeEvent* re) | |||
885 | m_view->setItemTextPos( pos ); | 889 | m_view->setItemTextPos( pos ); |
886 | switch (m_mode) { | 890 | switch (m_mode) { |
887 | case 2: | 891 | case 2: |
888 | m_view->setSpacing(2); | 892 | m_view->setSpacing(2); |
889 | m_view->setGridX(m_iconsize); | 893 | m_view->setGridX(m_iconsize); |
890 | m_view->setGridY(-1); | 894 | m_view->setGridY(-1); |
891 | cache = (int)((double)64/(double)m_iconsize*40.0); | 895 | cache = (int)((double)sDEF_ICON_SIZE/(double)m_iconsize*80.0); |
892 | odebug << "cache size: " << cache << oendl; | 896 | odebug << "cache size: " << cache << oendl; |
893 | PPixmapCache::self()->setMaxImages(cache); | 897 | PPixmapCache::self()->setMaxImages(cache); |
894 | break; | 898 | break; |
895 | case 3: | 899 | case 3: |
896 | m_view->setSpacing(10); | 900 | m_view->setSpacing(10); |
897 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); | 901 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); |