-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 45 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/viewmodebutton.cpp | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/viewmodebutton.h | 2 |
4 files changed, 30 insertions, 25 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index d546b64..660c4fa 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -169,15 +169,16 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | |||
169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
170 | this, SLOT(slotClicked(QIconViewItem*)) ); | 170 | this, SLOT(slotClicked(QIconViewItem*)) ); |
171 | 171 | ||
172 | m_view->setArrangement( QIconView::LeftToRight ); | 172 | m_view->setArrangement( QIconView::LeftToRight ); |
173 | m_view->setItemTextPos( QIconView::Right ); | ||
174 | 173 | ||
175 | int dw = QApplication::desktop()->width(); | 174 | m_mode = cfg->readNumEntry("ListViewMode", 1); |
176 | int viewerWidth = dw-style().scrollBarExtent().width(); | ||
177 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | ||
178 | m_view->setGridY( fontMetrics().height()*2+40 ); | ||
179 | 175 | ||
176 | if (m_mode < 1 || m_mode>3) m_mode = 1; | ||
177 | |||
178 | m_view->setItemTextPos( QIconView::Right ); | ||
179 | |||
180 | calculateGrid(); | ||
180 | 181 | ||
181 | initKeys(); | 182 | initKeys(); |
182 | 183 | ||
183 | loadViews(); | 184 | loadViews(); |
@@ -564,21 +565,9 @@ void PIconView::slotImageInfo( const QString& name) { | |||
564 | void PIconView::slotChangeMode( int mode ) { | 565 | void PIconView::slotChangeMode( int mode ) { |
565 | if ( mode >= 1 && mode <= 3 ) | 566 | if ( mode >= 1 && mode <= 3 ) |
566 | m_mode = mode; | 567 | m_mode = mode; |
567 | 568 | ||
568 | QIconView::ItemTextPos pos; | 569 | m_cfg->writeEntry("ListViewMode", m_mode); |
569 | switch( m_mode ) { | ||
570 | case 2: | ||
571 | pos = QIconView::Bottom; | ||
572 | break; | ||
573 | case 3: | ||
574 | case 1: | ||
575 | default: | ||
576 | pos = QIconView::Right; | ||
577 | break; | ||
578 | } | ||
579 | m_view->setItemTextPos( pos ); | ||
580 | |||
581 | calculateGrid(); | 570 | calculateGrid(); |
582 | slotReloadDir(); | 571 | slotReloadDir(); |
583 | } | 572 | } |
584 | 573 | ||
@@ -591,24 +580,38 @@ void PIconView::resizeEvent( QResizeEvent* re ) { | |||
591 | 580 | ||
592 | void PIconView::calculateGrid() { | 581 | void PIconView::calculateGrid() { |
593 | odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; | 582 | odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; |
594 | odebug << "Size of view: " << m_view->size() << oendl; | 583 | odebug << "Size of view: " << m_view->size() << oendl; |
584 | int dw = QApplication::desktop()->width(); | ||
585 | int viewerWidth = dw-style().scrollBarExtent().width(); | ||
595 | 586 | ||
587 | QIconView::ItemTextPos pos; | ||
588 | switch( m_mode ) { | ||
589 | case 2: | ||
590 | pos = QIconView::Bottom; | ||
591 | break; | ||
592 | case 3: | ||
593 | case 1: | ||
594 | default: | ||
595 | pos = QIconView::Right; | ||
596 | break; | ||
597 | } | ||
598 | m_view->setItemTextPos( pos ); | ||
596 | switch (m_mode) { | 599 | switch (m_mode) { |
597 | case 2: | 600 | case 2: |
598 | m_view->setGridX(50); | 601 | m_view->setGridX(50); |
599 | m_view->setGridY(20); | 602 | m_view->setGridY(20); |
600 | PPixmapCache::self()->setMaxImages(40); | 603 | PPixmapCache::self()->setMaxImages(40); |
601 | break; | 604 | break; |
602 | case 3: | 605 | case 3: |
603 | m_view->setGridX(m_view->width()); | 606 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); |
604 | m_view->setGridY(8); | 607 | m_view->setGridY(8); |
605 | PPixmapCache::self()->setMaxImages(2); | 608 | PPixmapCache::self()->setMaxImages(2); |
606 | break; | 609 | break; |
607 | case 1: | 610 | case 1: |
608 | default: | 611 | default: |
609 | m_view->setGridX(m_view->width()); | 612 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
610 | m_view->setGridY(80); | 613 | m_view->setGridY( fontMetrics().height()*2+40 ); |
611 | PPixmapCache::self()->setMaxImages(20); | 614 | PPixmapCache::self()->setMaxImages(20); |
612 | break; | 615 | break; |
613 | } | 616 | } |
614 | } | 617 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index ef6e6df..a90231b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -90,9 +90,11 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
90 | connect( btn, SIGNAL(clicked() ), | 90 | connect( btn, SIGNAL(clicked() ), |
91 | m_view, SLOT(slotTrash() ) ); | 91 | m_view, SLOT(slotTrash() ) ); |
92 | 92 | ||
93 | 93 | ||
94 | viewModeButton = new ViewModeButton( bar ); | 94 | int mode = m_cfg->readNumEntry("ListViewMode", 1); |
95 | if (mode < 1 || mode>3) mode = 1; | ||
96 | viewModeButton = new ViewModeButton( bar,mode ); | ||
95 | connect( viewModeButton, SIGNAL(changeMode(int)), | 97 | connect( viewModeButton, SIGNAL(changeMode(int)), |
96 | m_view, SLOT(slotChangeMode(int))); | 98 | m_view, SLOT(slotChangeMode(int))); |
97 | 99 | ||
98 | btn = new QToolButton( bar ); | 100 | btn = new QToolButton( bar ); |
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp index 0e4a7cb..36e5dcf 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp | |||
@@ -4,12 +4,12 @@ | |||
4 | 4 | ||
5 | #include <qtoolbar.h> | 5 | #include <qtoolbar.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | 7 | ||
8 | ViewModeButton::ViewModeButton( QToolBar* bar ) | 8 | ViewModeButton::ViewModeButton( QToolBar* bar,int def ) |
9 | : QToolButton( bar ) | 9 | : QToolButton( bar ) |
10 | { | 10 | { |
11 | slotChange( 1 ); | 11 | slotChange( def ); |
12 | QPopupMenu *pop= new QPopupMenu( this ); | 12 | QPopupMenu *pop= new QPopupMenu( this ); |
13 | pop->setCheckable( true ); | 13 | pop->setCheckable( true ); |
14 | pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); | 14 | pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); |
15 | pop->insertItem( tr("Thumbnail and Name" ), 2 ); | 15 | pop->insertItem( tr("Thumbnail and Name" ), 2 ); |
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h index 3247114..48f0e67 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.h +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.h | |||
@@ -12,9 +12,9 @@ | |||
12 | 12 | ||
13 | class ViewModeButton : public QToolButton { | 13 | class ViewModeButton : public QToolButton { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | ViewModeButton( QToolBar* ); | 16 | ViewModeButton( QToolBar*,int def=1 ); |
17 | ~ViewModeButton(); | 17 | ~ViewModeButton(); |
18 | 18 | ||
19 | signals: | 19 | signals: |
20 | void changeMode( int ); | 20 | void changeMode( int ); |