-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 | |||
@@ -471,21 +471,33 @@ void PIconView::slotImageInfo( const QString& name) { | |||
471 | 471 | ||
472 | 472 | ||
473 | void PIconView::slotChangeMode( int mode ) { | 473 | void PIconView::slotChangeMode( int mode ) { |
474 | if ( mode >= 0 && mode <= 3 ) | 474 | if ( mode >= 1 && mode <= 3 ) |
475 | m_mode = mode; | 475 | m_mode = mode; |
476 | 476 | ||
477 | QIconView::ItemTextPos pos; | 477 | QIconView::ItemTextPos pos; |
478 | switch( m_mode ) { | 478 | switch( m_mode ) { |
479 | case 1: | 479 | case 2: |
480 | pos = QIconView::Bottom; | 480 | pos = QIconView::Bottom; |
481 | break; | 481 | break; |
482 | case 2: | 482 | case 3: |
483 | case 0: | 483 | case 1: |
484 | default: | 484 | default: |
485 | pos = QIconView::Right; | 485 | pos = QIconView::Right; |
486 | break; | 486 | break; |
487 | } | 487 | } |
488 | m_view->setItemTextPos( pos ); | 488 | m_view->setItemTextPos( pos ); |
489 | 489 | ||
490 | calculateGrid(); | ||
490 | slotReloadDir(); | 491 | slotReloadDir(); |
491 | } | 492 | } |
493 | |||
494 | |||
495 | void PIconView::resizeEvent( QResizeEvent* re ) { | ||
496 | QVBox::resizeEvent( re ); | ||
497 | calculateGrid(); | ||
498 | } | ||
499 | |||
500 | |||
501 | void PIconView::calculateGrid() { | ||
502 | |||
503 | } | ||
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 | |||
@@ -39,10 +39,14 @@ signals: | |||
39 | void sig_showInfo( const QString& ); | 39 | void sig_showInfo( const QString& ); |
40 | void sig_display( const QString& ); | 40 | void sig_display( const QString& ); |
41 | 41 | ||
42 | protected: | ||
43 | void resizeEvent( QResizeEvent* ); | ||
44 | |||
42 | private: | 45 | private: |
43 | void initKeys(); | 46 | void initKeys(); |
44 | QString currentFileName(bool &isDir)const; | 47 | QString currentFileName(bool &isDir)const; |
45 | void loadViews(); | 48 | void loadViews(); |
49 | void calculateGrid(); | ||
46 | 50 | ||
47 | private slots: | 51 | private slots: |
48 | void slotDirUp(); | 52 | void slotDirUp(); |
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,24 +1,45 @@ | |||
1 | #include "viewmodebutton.h" | 1 | #include "viewmodebutton.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | ||
4 | |||
3 | #include <qtoolbar.h> | 5 | #include <qtoolbar.h> |
4 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
5 | 7 | ||
6 | ViewModeButton::ViewModeButton( QToolBar* bar ) | 8 | ViewModeButton::ViewModeButton( QToolBar* bar ) |
7 | : QToolButton( bar ) | 9 | : QToolButton( bar ) |
8 | { | 10 | { |
9 | setIconSet( Resource::loadIconSet( "toys" ) ); | 11 | slotChange( 1 ); |
10 | QPopupMenu *pop= new QPopupMenu( this ); | 12 | QPopupMenu *pop= new QPopupMenu( this ); |
11 | pop->setCheckable( true ); | 13 | pop->setCheckable( true ); |
12 | pop->insertItem( tr("Thumbnail and Imageinfo"), 0 ); | 14 | pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); |
13 | pop->insertItem( tr("Thumbnail and Name" ), 1 ); | 15 | pop->insertItem( tr("Thumbnail and Name" ), 2 ); |
14 | pop->insertItem( tr("Name Only" ), 2 ); | 16 | pop->insertItem( tr("Name Only" ), 3 ); |
15 | connect(pop, SIGNAL(activated(int)), | 17 | connect(pop, SIGNAL(activated(int)), |
16 | this, SIGNAL(changeMode(int)) ); | 18 | this, SIGNAL(changeMode(int)) ); |
19 | connect(pop, SIGNAL(activated(int)), | ||
20 | this, SLOT(slotChange(int)) ); | ||
17 | 21 | ||
18 | 22 | ||
19 | setPopup( pop ); | 23 | setPopup( pop ); |
20 | } | 24 | } |
21 | 25 | ||
22 | ViewModeButton::~ViewModeButton() { | 26 | ViewModeButton::~ViewModeButton() { |
27 | } | ||
28 | |||
29 | void ViewModeButton::slotChange( int i ) { | ||
30 | QString name; | ||
31 | switch( i ) { | ||
32 | case 1: | ||
33 | name = "opie-eye/opie-eye-thumb"; | ||
34 | break; | ||
35 | case 2: | ||
36 | name = "opie-eye/opie-eye-thumbonly"; | ||
37 | break; | ||
38 | case 3: | ||
39 | name = "opie-eye/opie-eye-textview"; | ||
40 | break; | ||
41 | } | ||
23 | 42 | ||
43 | qWarning("foo %d" +name, i ); | ||
44 | setIconSet( Resource::loadIconSet( name ) ); | ||
24 | } | 45 | } |
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 | |||
@@ -18,6 +18,8 @@ public: | |||
18 | 18 | ||
19 | signals: | 19 | signals: |
20 | void changeMode( int ); | 20 | void changeMode( int ); |
21 | private slots: | ||
22 | void slotChange( int i ); | ||
21 | }; | 23 | }; |
22 | 24 | ||
23 | #endif | 25 | #endif |
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 | |||
@@ -173,6 +173,15 @@ void OImageZoomer::drawContents( QPainter* p ) { | |||
173 | QRect c( contentsRect() ); | 173 | QRect c( contentsRect() ); |
174 | p->setPen( Qt::red ); | 174 | p->setPen( Qt::red ); |
175 | 175 | ||
176 | /* | ||
177 | * the contentRect is set equal to the size of the image | ||
178 | * Rect/Original = NewRectORWidth/OriginalVisibleStuff and then simply we | ||
179 | * need to add the c.y/x due usage of QFrame | ||
180 | * For x and y we use the visiblePoint | ||
181 | * For height and width we use the size of the viewport | ||
182 | * if width/height would be bigger than our widget we use this width/height | ||
183 | * | ||
184 | */ | ||
176 | int len = m_imgSize.width(); | 185 | int len = m_imgSize.width(); |
177 | int x = (c.width()*m_visPt.x())/len + c.x(); | 186 | int x = (c.width()*m_visPt.x())/len + c.x(); |
178 | int w = (c.width()*m_visSize.width() )/len + c.x(); | 187 | int w = (c.width()*m_visSize.width() )/len + c.x(); |