From 79558e549b0ce1fa17fe79fc437859d137ad821f Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 13 Apr 2004 22:21:20 +0000 Subject: First bits of different IconView Views --- diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 2a49786..a06844a 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -41,6 +41,7 @@ using Opie::Core::OKeyConfigItem; namespace { static QPixmap* _dirPix = 0; static QPixmap* _unkPix = 0; + static QPixmap* _picPix = 0; class IconViewItem : public QIconViewItem { public: IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); @@ -49,13 +50,24 @@ namespace { bool isDir()const { return m_isDir; } void setText( const QString& ); + protected: + mutable QPixmap* m_pix; private: - mutable QPixmap* m_pix; QString m_path; bool m_isDir : 1; bool m_noInfo :1; }; + class TextViewItem : public IconViewItem { + TextViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); + QPixmap *pixmap()const; + void setText( const QString& ); + }; + class ThumbViewItem : public IconViewItem { + ThumbViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false ); + QPixmap *pixmap()const; + void setText( const QString& ); + }; /* @@ -115,6 +127,7 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } m_path = QDir::homeDirPath(); + m_mode = 0; QHBox *hbox = new QHBox( this ); QLabel* lbl = new QLabel( hbox ); @@ -455,3 +468,24 @@ void PIconView::slotImageInfo() { void PIconView::slotImageInfo( const QString& name) { emit sig_showInfo( name ); } + + +void PIconView::slotChangeMode( int mode ) { + if ( mode >= 0 && mode <= 3 ) + m_mode = mode; + + QIconView::ItemTextPos pos; + switch( m_mode ) { + case 1: + pos = QIconView::Bottom; + break; + case 2: + case 0: + default: + pos = QIconView::Right; + break; + } + m_view->setItemTextPos( pos ); + + slotReloadDir(); +} diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 9cf7b3e..af41aef 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -70,6 +70,8 @@ private slots: /**/ void slotThumbInfo(const QString&, const QString&); void slotThumbNail(const QString&, const QPixmap&); + + void slotChangeMode( int ); private: Opie::Core::OKeyConfigManager *m_viewManager; Opie::Core::OConfig *m_cfg; @@ -77,6 +79,7 @@ private: QIconView* m_view; QString m_path; bool m_updatet : 1; + int m_mode; }; #endif diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index ef23f79..dd9cced 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -8,6 +8,7 @@ #include "filesystem.h" #include "imageinfoui.h" #include "imageview.h" +#include "viewmodebutton.h" #include #include @@ -87,6 +88,10 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) connect( btn, SIGNAL(clicked() ), m_view, SLOT(slotTrash() ) ); + btn = new ViewModeButton( bar ); + connect( btn, SIGNAL(changeMode(int)), + m_view, SLOT(slotChangeMode(int))); + btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); connect( btn, SIGNAL(clicked() ), diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index e9abe72..e9459ad 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro @@ -12,7 +12,8 @@ HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ iface/slaveiface.h \ gui/imageinfoui.h gui/imagescrollview.h \ gui/imageview.h \ - lib/oimagezoomer.h + lib/oimagezoomer.h \ + gui/viewmodebutton.h # A list header files @@ -24,7 +25,8 @@ SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ gui/imageinfoui.cpp gui/imagescrollview.cpp \ gui/imageview.cpp \ - lib/oimagezoomer.cpp + lib/oimagezoomer.cpp \ + gui/viewmodebutton.cpp # A list of source files INTERFACES = -- cgit v0.9.0.2