summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/iconview.cpp
Unidiff
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.cpp22
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
@@ -36,6 +36,10 @@
36 36
37using Opie::Core::OKeyConfigItem; 37using Opie::Core::OKeyConfigItem;
38 38
39const int PIconView::sMAX_ICON_SIZE = 128;
40const int PIconView::sMIN_ICON_SIZE = 12;
41const 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 */
@@ -222,8 +226,8 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
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();
@@ -408,8 +412,8 @@ void PIconView::resetView() {
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;
@@ -422,7 +426,7 @@ void PIconView::resetView() {
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;
@@ -833,11 +837,11 @@ void PIconView::slotChangeMode( int mode ) {
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;
@@ -888,7 +892,7 @@ void PIconView::calculateGrid(QResizeEvent* re)
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;