author | alwin <alwin> | 2004-04-07 11:10:21 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-07 11:10:21 (UTC) |
commit | 6095b1f70bcac407208e7473598f2bbf53339810 (patch) (side-by-side diff) | |
tree | e76d8ad85b79de56a7aa7dd95c824da485901c6f | |
parent | 364971c08f3d761102daab01889b9fab394f8f08 (diff) | |
download | opie-6095b1f70bcac407208e7473598f2bbf53339810.zip opie-6095b1f70bcac407208e7473598f2bbf53339810.tar.gz opie-6095b1f70bcac407208e7473598f2bbf53339810.tar.bz2 |
the ImageScrollView wrapped with another class where just the
opie-eye specifics are implemented. So we can move that into the
MM lib and use it in other programs.
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 1 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 55 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 40 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 13 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 6 |
6 files changed, 111 insertions, 8 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index d56d65a..822fd88 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp @@ -1,52 +1,51 @@ #include "imageinfoui.h" #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qtextview.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h> #include <qstring.h> #include <qfileinfo.h> #include "lib/slavemaster.h" #include "lib/imagecache.h" #include <opie2/oconfig.h> -#include <opie2/oconfig.h> #include <opie2/okeyconfigwidget.h> #include <opie2/odebug.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> static const int THUMBSIZE = 128; using namespace Opie::Core; imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { m_viewManager = 0; init(name); initKeys(); } imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ),currentFile(_path) { m_viewManager = 0; init(name); initKeys(); slotChangeName(_path); } Opie::Ui::OKeyConfigManager* imageinfo::manager() { if (!m_viewManager) { initKeys(); } diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp new file mode 100644 index 0000000..8fc258e --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -0,0 +1,55 @@ +#include "imageview.h" + +#include <opie2/odebug.h> +#include <opie2/oconfig.h> +#include <opie2/okeyconfigwidget.h> + +#include <qpe/resource.h> + +using namespace Opie::Core; + +ImageView::ImageView( QWidget* parent, const char* name, WFlags fl ) + : ImageScrollView(parent,name,fl) +{ + m_viewManager = 0; + initKeys(); +} + +ImageView::~ImageView() +{ +} + +Opie::Ui::OKeyConfigManager* ImageView::manager() +{ + if (!m_viewManager) { + initKeys(); + } + return m_viewManager; +} + +void ImageView::initKeys() +{ + odebug << "init imageview keys" << oendl; + m_cfg = new Opie::Core::OConfig("phunkview"); + m_cfg->setGroup("Zecke_view" ); + Opie::Ui::OKeyPair::List lst; + lst.append( Opie::Ui::OKeyPair::upArrowKey() ); + lst.append( Opie::Ui::OKeyPair::downArrowKey() ); + lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); + lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); + lst.append( Opie::Ui::OKeyPair::returnKey() ); + + m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageview-KeyBoard-Config", + lst, false,this, "keyconfig name" ); + m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Image Info"), "view", + Resource::loadPixmap("1to1"), ViewInfo, + Opie::Ui::OKeyPair(Qt::Key_I,Qt::ShiftButton), + this, SLOT(slotShowImageInfo()))); + m_viewManager->load(); + m_viewManager->handleWidget( this ); +} + +void ImageView::slotShowImageInfo() +{ + emit dispImageInfo(m_lastName); +} diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h new file mode 100644 index 0000000..5ee0d7d --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -0,0 +1,40 @@ +#ifndef _IMAGE_VIEW_H +#define _IMAGE_VIEW_H + +/* must be changed when it will moved to Opie::MM */ +#include "imagescrollview.h" + +namespace Opie { + namespace Core { + class OConfig; + } + namespace Ui { + class OKeyConfigManager; + } +} + +class ImageView:public ImageScrollView +{ + Q_OBJECT + + enum ActionIds { + ViewInfo + }; + +public: + ImageView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); + virtual ~ImageView(); + Opie::Ui::OKeyConfigManager* manager(); + +signals: + void dispImageInfo(const QString&); + void sig_return(); + +protected: + Opie::Core::OConfig * m_cfg; + Opie::Ui::OKeyConfigManager*m_viewManager; + void initKeys(); +protected slots: + virtual void slotShowImageInfo(); +}; +#endif diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 5e94f93..529bee4 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp @@ -1,42 +1,42 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #include "mainwindow.h" #include "iconview.h" #include "filesystem.h" #include "imageinfoui.h" -#include "imagescrollview.h" +#include "imageview.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> #include <qpe/ir.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qdialog.h> #include <qmap.h> #include <qtimer.h> OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) { setCaption( QObject::tr("Opie Eye Caramba" ) ); m_cfg = new Opie::Core::OConfig("phunkview"); m_cfg->setGroup("Zecke_view" ); @@ -133,123 +133,130 @@ void PMainWindow::slotScaleToggled(bool how) void PMainWindow::slotConfig() { /* * have a tab with the possible views * a tab for globals image cache size.. scaled loading * and one tab for the KeyConfigs */ QDialog dlg(this, 0, true); dlg.setCaption( tr("Phunk View - Config" ) ); QHBoxLayout *lay = new QHBoxLayout(&dlg); Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); lay->addWidget( wid ); ViewMap *vM = viewMap(); ViewMap::Iterator _it = vM->begin(); QMap<PDirView*, QWidget*> lst; for( ; _it != vM->end(); ++_it ) { PDirView *view = (_it.data())(*m_cfg); PInterfaceInfo *inf = view->interfaceInfo(); QWidget *_wid = inf->configWidget( *m_cfg ); _wid->reparent(wid, QPoint() ); lst.insert( view, _wid ); wid->addTab( _wid, "fileopen", inf->name() ); } /* * Add the KeyConfigWidget */ Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); + if ( !m_info ) { initInfo(); } keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); + + if ( !m_disp ) { + initDisp(); + } + keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); + keyWid->load(); wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); /* * clean up *apply changes */ QMap<PDirView*, QWidget*>::Iterator it; for ( it = lst.begin(); it != lst.end(); ++it ) { if ( act ) it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); delete it.key(); } if ( act ) { m_view->resetView(); keyWid->save(); } } /* * create a new image info component * and detach the current one * we will make the other delete on exit */ template<class T> void PMainWindow::initT( const char* name, T** ptr, int id) { if ( *ptr ) { (*ptr)->disconnect(this, SLOT(slotReturn())); (*ptr)->setDestructiveClose(); m_stack->removeWidget( *ptr ); } *ptr = new T( m_stack, name ); m_stack->addWidget( *ptr, id ); connect(*ptr, SIGNAL(sig_return()), this,SLOT(slotReturn())); } void PMainWindow::initInfo() { initT<imageinfo>( "Image Info", &m_info, ImageInfo ); connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); } void PMainWindow::initDisp() { - initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay ); + initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); if (m_disp) { m_disp->setAutoScale(autoScale); m_disp->setAutoRotate(autoRotate); + connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); } - } /** * With big Screen the plan could be to 'detach' the image * window if visible and to create a ne wone * init* already supports it but I make no use of it for * now. We set filename and raise * * ### FIXME and talk to alwin */ void PMainWindow::slotShowInfo( const QString& inf ) { if ( !m_info ) { initInfo(); } m_info->setPath( inf ); m_stack->raiseWidget( ImageInfo ); } void PMainWindow::slotDisplay( const QString& inf ) { if ( !m_disp ) { initDisp(); } m_disp->setImage( inf ); m_stack->raiseWidget( ImageDisplay ); } void PMainWindow::slotReturn() { raiseIconView(); } void PMainWindow::closeEvent( QCloseEvent* ev ) { diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 6debf7f..5de2f42 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -1,67 +1,67 @@ /* * GPLv2 zecke@handhelds.org * No WArranty... */ #ifndef PHUNK_MAIN_WINDOW_H #define PHUNK_MAIN_WINDOW_H #include <opie2/oconfig.h> #include <qmainwindow.h> namespace Opie { namespace Ui{ class OKeyConfigManager; class OWidgetStack; } } class PIconView; class imageinfo; -class ImageScrollView; +class ImageView; class PMainWindow : public QMainWindow { Q_OBJECT enum Views { IconView, ImageInfo, ImageDisplay }; public: static QString appName() { return QString::fromLatin1("opie-eye" ); } PMainWindow(QWidget*, const char*, WFlags ); ~PMainWindow(); signals: void configChanged(); public slots: void slotShowInfo( const QString& inf ); void slotDisplay( const QString& inf ); void slotReturn(); void slotRotateToggled(bool); void slotScaleToggled(bool); protected: void raiseIconView(); void closeEvent( QCloseEvent* ); private: template<class T> void initT( const char* name, T**, int ); void initInfo(); void initDisp(); private: Opie::Core::OConfig *m_cfg; Opie::Ui::OWidgetStack *m_stack; PIconView* m_view; imageinfo *m_info; - ImageScrollView *m_disp; + ImageView *m_disp; bool autoRotate; bool autoScale; QToolButton*rotateButton; private slots: void slotConfig(); }; #endif diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index 21fd59c..a825580 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro @@ -1,36 +1,38 @@ CONFIG += qt warn_on quick-app 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/imageinfoui.h gui/imagescrollview.h \ + gui/imageview.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/imageinfoui.cpp gui/imagescrollview.cpp \ + gui/imageview.cpp # A list of source files INTERFACES = # list of ui files INCLUDEPATH += . $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 include ( $(OPIEDIR)/include.pro ) |