-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 ) connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(slotClicked(QIconViewItem*)) ); m_view->setArrangement( QIconView::LeftToRight ); - m_view->setItemTextPos( QIconView::Right ); - int dw = QApplication::desktop()->width(); - int viewerWidth = dw-style().scrollBarExtent().width(); - m_view->setGridX( viewerWidth-3*m_view->spacing()); - m_view->setGridY( fontMetrics().height()*2+40 ); + m_mode = cfg->readNumEntry("ListViewMode", 1); + if (m_mode < 1 || m_mode>3) m_mode = 1; + + m_view->setItemTextPos( QIconView::Right ); + + calculateGrid(); initKeys(); loadViews(); @@ -564,21 +565,9 @@ void PIconView::slotImageInfo( const QString& name) { void PIconView::slotChangeMode( int mode ) { if ( mode >= 1 && mode <= 3 ) m_mode = mode; - QIconView::ItemTextPos pos; - switch( m_mode ) { - case 2: - pos = QIconView::Bottom; - break; - case 3: - case 1: - default: - pos = QIconView::Right; - break; - } - m_view->setItemTextPos( pos ); - + m_cfg->writeEntry("ListViewMode", m_mode); calculateGrid(); slotReloadDir(); } @@ -591,24 +580,38 @@ void PIconView::resizeEvent( QResizeEvent* re ) { void PIconView::calculateGrid() { odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; odebug << "Size of view: " << m_view->size() << oendl; + int dw = QApplication::desktop()->width(); + int viewerWidth = dw-style().scrollBarExtent().width(); + QIconView::ItemTextPos pos; + switch( m_mode ) { + case 2: + pos = QIconView::Bottom; + break; + case 3: + case 1: + default: + pos = QIconView::Right; + break; + } + m_view->setItemTextPos( pos ); switch (m_mode) { case 2: m_view->setGridX(50); m_view->setGridY(20); PPixmapCache::self()->setMaxImages(40); break; case 3: - m_view->setGridX(m_view->width()); + m_view->setGridX( fontMetrics().width("testimage.jpg")+20); m_view->setGridY(8); PPixmapCache::self()->setMaxImages(2); break; case 1: default: - m_view->setGridX(m_view->width()); - m_view->setGridY(80); + m_view->setGridX( viewerWidth-3*m_view->spacing()); + m_view->setGridY( fontMetrics().height()*2+40 ); PPixmapCache::self()->setMaxImages(20); break; } } 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) connect( btn, SIGNAL(clicked() ), m_view, SLOT(slotTrash() ) ); - viewModeButton = new ViewModeButton( bar ); + int mode = m_cfg->readNumEntry("ListViewMode", 1); + if (mode < 1 || mode>3) mode = 1; + viewModeButton = new ViewModeButton( bar,mode ); connect( viewModeButton, SIGNAL(changeMode(int)), m_view, SLOT(slotChangeMode(int))); 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 @@ #include <qtoolbar.h> #include <qpopupmenu.h> -ViewModeButton::ViewModeButton( QToolBar* bar ) +ViewModeButton::ViewModeButton( QToolBar* bar,int def ) : QToolButton( bar ) { - slotChange( 1 ); + slotChange( def ); QPopupMenu *pop= new QPopupMenu( this ); pop->setCheckable( true ); pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); 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 @@ class ViewModeButton : public QToolButton { Q_OBJECT public: - ViewModeButton( QToolBar* ); + ViewModeButton( QToolBar*,int def=1 ); ~ViewModeButton(); signals: void changeMode( int ); |