author | alwin <alwin> | 2004-11-07 15:08:59 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-07 15:08:59 (UTC) |
commit | cf8bdb2fe272ca0ecf96aae479df9e1d357ae8a4 (patch) (unidiff) | |
tree | 6c55d20ded81c17b5ed772776f333cc7c3ac36bc | |
parent | e11d189bfd48ab072da4753240a4ab0bbf81296f (diff) | |
download | opie-cf8bdb2fe272ca0ecf96aae479df9e1d357ae8a4.zip opie-cf8bdb2fe272ca0ecf96aae479df9e1d357ae8a4.tar.gz opie-cf8bdb2fe272ca0ecf96aae479df9e1d357ae8a4.tar.bz2 |
fixed up the icon display, imagecache size depends on size of icons
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index c037d0d..f173ecc 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -97,8 +97,4 @@ namespace { | |||
97 | m_iconsize = a_iconsize; | 97 | m_iconsize = a_iconsize; |
98 | if ( isDir ) { | 98 | if ( isDir ) { |
99 | if (_dirPix && _dirPix->width()!=m_iconsize) { | ||
100 | delete _dirPix; | ||
101 | _dirPix = 0; | ||
102 | } | ||
103 | if (!_dirPix ) { | 99 | if (!_dirPix ) { |
104 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); | 100 | _dirPix = new QPixmap( Resource::loadPixmap("advancedfm/FileBrowser")); |
@@ -114,8 +110,4 @@ namespace { | |||
114 | inline void IconViewItem::check_pix()const | 110 | inline void IconViewItem::check_pix()const |
115 | { | 111 | { |
116 | if (_cpyPix && _cpyPix->width()!=m_iconsize) { | ||
117 | delete _cpyPix; | ||
118 | _cpyPix = 0; | ||
119 | } | ||
120 | if (_dirPix && _dirPix->width()>m_iconsize) { | 112 | if (_dirPix && _dirPix->width()>m_iconsize) { |
121 | QPixmap*Pix = new QPixmap(*_dirPix); | 113 | QPixmap*Pix = new QPixmap(*_dirPix); |
@@ -424,7 +416,19 @@ void PIconView::resetView() { | |||
424 | g_stringInf.clear(); | 416 | g_stringInf.clear(); |
425 | if (m_mode>1) { | 417 | if (m_mode>1) { |
418 | int osize = m_iconsize; | ||
426 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); | 419 | m_iconsize = m_cfg->readNumEntry("iconsize", 32); |
427 | if (m_iconsize<12)m_iconsize = 12; | 420 | if (m_iconsize<12)m_iconsize = 12; |
428 | if (m_iconsize>64)m_iconsize = 64; | 421 | if (m_iconsize>64)m_iconsize = 64; |
422 | if (osize != m_iconsize) { | ||
423 | if (_dirPix){ | ||
424 | delete _dirPix; | ||
425 | _dirPix = 0; | ||
426 | } | ||
427 | if (_cpyPix){ | ||
428 | delete _cpyPix; | ||
429 | _cpyPix = 0; | ||
430 | } | ||
431 | calculateGrid(); | ||
432 | } | ||
429 | } else { | 433 | } else { |
430 | m_iconsize = 64; | 434 | m_iconsize = 64; |
@@ -808,5 +812,12 @@ void PIconView::slotChangeMode( int mode ) { | |||
808 | if (m_iconsize>64)m_iconsize = 64; | 812 | if (m_iconsize>64)m_iconsize = 64; |
809 | } | 813 | } |
810 | 814 | if (_dirPix){ | |
815 | delete _dirPix; | ||
816 | _dirPix = 0; | ||
817 | } | ||
818 | if (_cpyPix){ | ||
819 | delete _cpyPix; | ||
820 | _cpyPix = 0; | ||
821 | } | ||
811 | calculateGrid(); | 822 | calculateGrid(); |
812 | slotReloadDir(); | 823 | slotReloadDir(); |
@@ -843,12 +854,17 @@ void PIconView::calculateGrid(QResizeEvent* re) | |||
843 | break; | 854 | break; |
844 | } | 855 | } |
856 | int cache = 0; | ||
845 | m_view->setItemTextPos( pos ); | 857 | m_view->setItemTextPos( pos ); |
846 | switch (m_mode) { | 858 | switch (m_mode) { |
847 | case 2: | 859 | case 2: |
860 | m_view->setSpacing(2); | ||
848 | m_view->setGridX(m_iconsize); | 861 | m_view->setGridX(m_iconsize); |
849 | m_view->setGridY(-1); | 862 | m_view->setGridY(-1); |
850 | PPixmapCache::self()->setMaxImages(40); | 863 | cache = (int)((double)64/(double)m_iconsize*40.0); |
864 | odebug << "cache size: " << cache << oendl; | ||
865 | PPixmapCache::self()->setMaxImages(cache); | ||
851 | break; | 866 | break; |
852 | case 3: | 867 | case 3: |
868 | m_view->setSpacing(10); | ||
853 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); | 869 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); |
854 | m_view->setGridY(8); | 870 | m_view->setGridY(8); |
@@ -857,4 +873,5 @@ void PIconView::calculateGrid(QResizeEvent* re) | |||
857 | case 1: | 873 | case 1: |
858 | default: | 874 | default: |
875 | m_view->setSpacing(10); | ||
859 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | 876 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
860 | m_view->setGridY( fontMetrics().height()*2+40 ); | 877 | m_view->setGridY( fontMetrics().height()*2+40 ); |
@@ -862,4 +879,3 @@ void PIconView::calculateGrid(QResizeEvent* re) | |||
862 | break; | 879 | break; |
863 | } | 880 | } |
864 | m_view->setSpacing(10); | ||
865 | } | 881 | } |