author | zecke <zecke> | 2004-04-13 22:21:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-13 22:21:20 (UTC) |
commit | 79558e549b0ce1fa17fe79fc437859d137ad821f (patch) (side-by-side diff) | |
tree | f8a504778d5a95abaed9f1cf3e451e31c94c5681 | |
parent | e61f3d63c310e4e560bc38f41c1390f246b5f670 (diff) | |
download | opie-79558e549b0ce1fa17fe79fc437859d137ad821f.zip opie-79558e549b0ce1fa17fe79fc437859d137ad821f.tar.gz opie-79558e549b0ce1fa17fe79fc437859d137ad821f.tar.bz2 |
First bits of different IconView Views
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 36 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 6 |
4 files changed, 47 insertions, 3 deletions
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 @@ -32,39 +32,51 @@ #include <qtimer.h> #include <qstyle.h> using Opie::Core::OKeyConfigItem; /* * The Icons, Request Cache and IconViewItem for the IconView */ 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); QPixmap* pixmap()const; QString path()const { return m_path; } 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& ); + }; /* * If we request an Image or String * we add it to the map */ static QMap<QString, IconViewItem*> g_stringInf; static QMap<QString, IconViewItem*> g_stringPix; IconViewItem::IconViewItem( QIconView* view,const QString& path, const QString& name, bool isDir ) : QIconViewItem( view, name ), m_path( path ), m_isDir( isDir ), @@ -106,24 +118,25 @@ namespace { /* * Set up the GUI.. initialize the slave set up gui * and also load a dir */ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) { { QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); } m_path = QDir::homeDirPath(); + m_mode = 0; QHBox *hbox = new QHBox( this ); QLabel* lbl = new QLabel( hbox ); lbl->setText( tr("View as" ) ); m_views = new QComboBox( hbox, "View As" ); connect( m_views, SIGNAL(activated(int)), this, SLOT(slotViewChanged(int)) ); m_view= new QIconView( this ); connect(m_view, SIGNAL(clicked(QIconViewItem*) ), this, SLOT(slotClicked(QIconViewItem*)) ); @@ -446,12 +459,33 @@ void PIconView::slotShowImage( const QString& 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 ) + 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 @@ -61,22 +61,25 @@ private slots: void slotStart(); void slotEnd(); /* for performance reasons make it inline in the future */ void addFolders( const QStringList& ); void addFiles( const QStringList& ); void slotClicked(QIconViewItem* ); /**/ 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; QComboBox* m_views; 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 @@ -1,22 +1,23 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #include "mainwindow.h" #include "iconview.h" #include "filesystem.h" #include "imageinfoui.h" #include "imageview.h" +#include "viewmodebutton.h" #include <iface/ifaceinfo.h> #include <iface/dirview.h> #include <opie2/odebug.h> #include <opie2/owidgetstack.h> #include <opie2/oapplicationfactory.h> #include <opie2/otabwidget.h> #include <opie2/okeyconfigwidget.h> #include <qpe/resource.h> #include <qpe/config.h> @@ -78,24 +79,28 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) if ( Ir::supported() ) { btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "beam" ) ); connect( btn, SIGNAL(clicked()), m_view, SLOT(slotBeam()) ); } btn = new QToolButton( bar ); btn->setIconSet( Resource::loadIconSet( "trash" ) ); 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() ), this, SLOT(slotConfig() ) ); rotateButton = new QToolButton(bar); rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); rotateButton->setToggleButton(true); rotateButton->setOn(true); connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); autoRotate = true; 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 @@ -3,37 +3,39 @@ DESTDIR = $(OPIEDIR)/bin TEMPLATE = app TARGET = opie-eye # the name of the resulting object HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ lib/imagecache.h impl/dir/dir_dirview.h \ iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ lib/slavemaster.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 SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ lib/imagecache.cpp lib/viewmap.cpp \ impl/dir/dir_dirview.cpp iface/dirlister.cpp \ iface/dirview.cpp impl/dir/dir_lister.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 = # list of ui files INCLUDEPATH += . $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 |