summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -450,42 +450,54 @@ void PIconView::slotShowImage()
{
bool isDir = false;
QString name = currentFileName(isDir);
if (isDir) return;
slotShowImage( name );
}
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
@@ -18,52 +18,56 @@ class Ir;
namespace Opie {
namespace Core{
class OConfig;
class OKeyConfigManager;
}
}
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& );
void slotStart();
void slotEnd();
/* for performance reasons make it inline in the future */
void addFolders( const QStringList& );
void addFiles( const QStringList& );
void slotClicked(QIconViewItem* );
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
@@ -1,23 +1,25 @@
/*
* GPLv2 only
* zecke@handhelds.org
*/
#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
@@ -152,48 +152,57 @@ void OImageZoomer::resizeEvent( QResizeEvent* ev ) {
QFrame::resizeEvent( ev );
setBackgroundOrigin( QWidget::WidgetOrigin );
// TODO Qt3 use PalettePixmap and use size
QPixmap pix; pix.convertFromImage( m_img.smoothScale( size().width(), size().height() ) );
setBackgroundPixmap( pix);
}
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;
}
void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) {
int mx, my;
mx = ev->x();
my = ev->y();
if ( m_mouseX != -1 && m_mouseY != -1 ) {
int diffx = ( mx - m_mouseX ) * m_imgSize.width() / width();