summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-14 18:38:37 (UTC)
committer zecke <zecke>2004-04-14 18:38:37 (UTC)
commit0b83b10334da449fb9304c9b89a4175f3728d377 (patch) (side-by-side diff)
tree465cdb61d1fa032de425761ef0074ee58bad7cd2
parentb671d282c25e86429727b6b52a674d1d8cd3f1a7 (diff)
downloadopie-0b83b10334da449fb9304c9b89a4175f3728d377.zip
opie-0b83b10334da449fb9304c9b89a4175f3728d377.tar.gz
opie-0b83b10334da449fb9304c9b89a4175f3728d377.tar.bz2
-comments on imagezoomer
recalculateGrid Alwin please fill in the blank
Diffstat (more/less context) (show 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
@@ -458,34 +458,46 @@ void PIconView::slotShowImage( const QString& name) {
emit sig_display( name );
}
void PIconView::slotImageInfo() {
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
slotImageInfo( name );
}
void PIconView::slotImageInfo( const QString& name) {
emit sig_showInfo( 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
@@ -26,36 +26,40 @@ namespace Core{
class PIconView : public QVBox {
Q_OBJECT
friend class PIconViewItem;
enum ActionIds {
BeamItem, DeleteItem, ViewItem, InfoItem
};
public:
PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
~PIconView();
void resetView();
Opie::Core::OKeyConfigManager* manager();
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();
void slotChangeDir(const QString&);
void slotTrash();
void slotViewChanged( int );
void slotReloadDir();
void slotRename();
void slotBeam();
void slotBeamDone( Ir* );
void slotShowImage();
void slotShowImage( const QString& );
void slotImageInfo();
void slotImageInfo( const QString& );
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
@@ -5,19 +5,21 @@
#ifndef PHUNK_VIEW_MODE_BUTTON_H
#define PHUNK_VIEW_MODE_BUTTON_H
#include <qpe/resource.h>
#include <qtoolbutton.h>
class ViewModeButton : public QToolButton {
Q_OBJECT
public:
ViewModeButton( QToolBar* );
~ViewModeButton();
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
@@ -160,32 +160,41 @@ void OImageZoomer::drawContents( QPainter* p ) {
/*
* if the page size
*/
if ( m_imgSize.isEmpty() )
return;
/*
* paint a red rect which represents the visible size
*
* We need to recalculate x,y and width and height of the
* rect. So image size relates to contentRect
*
*/
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();
if ( w > c.width() ) w = c.width();
len = m_imgSize.height();
int y = (c.height()*m_visPt.y() )/len + c.y();
int h = (c.height()*m_visSize.height() )/len + c.y();
if ( h > c.height() ) h = c.height();
p->drawRect( x, y, w, h );
}
void OImageZoomer::mousePressEvent( QMouseEvent* ) {
m_mouseX = m_mouseY = -1;
}