summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp20
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h4
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.cpp29
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.h2
-rw-r--r--noncore/graphics/opie-eye/lib/oimagezoomer.cpp9
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) {
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;
break;
}
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
@@ -39,10 +39,14 @@ signals:
void sig_showInfo( const QString& );
void sig_display( const QString& );
+protected:
+ void resizeEvent( QResizeEvent* );
+
private:
void initKeys();
QString currentFileName(bool &isDir)const;
void loadViews();
+ void calculateGrid();
private slots:
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 @@
#include "viewmodebutton.h"
+#include <opie2/odebug.h>
+
#include <qtoolbar.h>
#include <qpopupmenu.h>
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)) );
setPopup( pop );
}
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
@@ -18,6 +18,8 @@ public:
signals:
void changeMode( int );
+private slots:
+ void slotChange( int i );
};
#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 ) {
QRect c( contentsRect() );
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();
int w = (c.width()*m_visSize.width() )/len + c.x();