-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 20 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/viewmodebutton.cpp | 29 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/viewmodebutton.h | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/oimagezoomer.cpp | 9 |
5 files changed, 56 insertions, 8 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index a06844a..e61f9d9 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -472,14 +472,14 @@ void PIconView::slotImageInfo( const QString& name) { void PIconView::slotChangeMode( int mode ) { - if ( mode >= 0 && mode <= 3 ) + if ( mode >= 1 && mode <= 3 ) m_mode = mode; QIconView::ItemTextPos pos; switch( m_mode ) { - case 1: + case 2: pos = QIconView::Bottom; break; - case 2: - case 0: + case 3: + case 1: default: pos = QIconView::Right; @@ -488,4 +488,16 @@ void PIconView::slotChangeMode( int mode ) { m_view->setItemTextPos( pos ); + calculateGrid(); slotReloadDir(); } + + +void PIconView::resizeEvent( QResizeEvent* re ) { + QVBox::resizeEvent( re ); + calculateGrid(); +} + + +void PIconView::calculateGrid() { + +} diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index af41aef..903c4fd 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -40,8 +40,12 @@ signals: void sig_display( const QString& ); +protected: + void resizeEvent( QResizeEvent* ); + private: void initKeys(); QString currentFileName(bool &isDir)const; void loadViews(); + void calculateGrid(); private slots: diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp index fdf4e77..0e4a7cb 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp @@ -1,4 +1,6 @@ #include "viewmodebutton.h" +#include <opie2/odebug.h> + #include <qtoolbar.h> #include <qpopupmenu.h> @@ -7,12 +9,14 @@ ViewModeButton::ViewModeButton( QToolBar* bar ) : QToolButton( bar ) { - setIconSet( Resource::loadIconSet( "toys" ) ); + slotChange( 1 ); QPopupMenu *pop= new QPopupMenu( this ); pop->setCheckable( true ); - pop->insertItem( tr("Thumbnail and Imageinfo"), 0 ); - pop->insertItem( tr("Thumbnail and Name" ), 1 ); - pop->insertItem( tr("Name Only" ), 2 ); + pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); + pop->insertItem( tr("Thumbnail and Name" ), 2 ); + pop->insertItem( tr("Name Only" ), 3 ); connect(pop, SIGNAL(activated(int)), this, SIGNAL(changeMode(int)) ); + connect(pop, SIGNAL(activated(int)), + this, SLOT(slotChange(int)) ); @@ -21,4 +25,21 @@ ViewModeButton::ViewModeButton( QToolBar* bar ) ViewModeButton::~ViewModeButton() { +} + +void ViewModeButton::slotChange( int i ) { + QString name; + switch( i ) { + case 1: + name = "opie-eye/opie-eye-thumb"; + break; + case 2: + name = "opie-eye/opie-eye-thumbonly"; + break; + case 3: + name = "opie-eye/opie-eye-textview"; + break; + } + qWarning("foo %d" +name, i ); + setIconSet( Resource::loadIconSet( name ) ); } diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h index 44f2228..3247114 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.h +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.h @@ -19,4 +19,6 @@ public: signals: void changeMode( int ); +private slots: + void slotChange( int i ); }; diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp index 4df5dcc..00b93e2 100644 --- a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp +++ b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp @@ -174,4 +174,13 @@ void OImageZoomer::drawContents( QPainter* p ) { p->setPen( Qt::red ); + /* + * the contentRect is set equal to the size of the image + * Rect/Original = NewRectORWidth/OriginalVisibleStuff and then simply we + * need to add the c.y/x due usage of QFrame + * For x and y we use the visiblePoint + * For height and width we use the size of the viewport + * if width/height would be bigger than our widget we use this width/height + * + */ int len = m_imgSize.width(); int x = (c.width()*m_visPt.x())/len + c.x(); |