author | alwin <alwin> | 2004-04-07 11:10:21 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-07 11:10:21 (UTC) |
commit | 6095b1f70bcac407208e7473598f2bbf53339810 (patch) (unidiff) | |
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 | |||
@@ -8,25 +8,24 @@ | |||
8 | #include <qvariant.h> | 8 | #include <qvariant.h> |
9 | #include <qtooltip.h> | 9 | #include <qtooltip.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | #include <qimage.h> | 11 | #include <qimage.h> |
12 | #include <qpixmap.h> | 12 | #include <qpixmap.h> |
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | 15 | ||
16 | #include "lib/slavemaster.h" | 16 | #include "lib/slavemaster.h" |
17 | #include "lib/imagecache.h" | 17 | #include "lib/imagecache.h" |
18 | 18 | ||
19 | #include <opie2/oconfig.h> | 19 | #include <opie2/oconfig.h> |
20 | #include <opie2/oconfig.h> | ||
21 | #include <opie2/okeyconfigwidget.h> | 20 | #include <opie2/okeyconfigwidget.h> |
22 | #include <opie2/odebug.h> | 21 | #include <opie2/odebug.h> |
23 | 22 | ||
24 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
26 | 25 | ||
27 | static const int THUMBSIZE = 128; | 26 | static const int THUMBSIZE = 128; |
28 | 27 | ||
29 | using namespace Opie::Core; | 28 | using namespace Opie::Core; |
30 | 29 | ||
31 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) | 30 | imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) |
32 | : QWidget( parent, name, fl ) | 31 | : QWidget( parent, name, fl ) |
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 @@ | |||
1 | #include "imageview.h" | ||
2 | |||
3 | #include <opie2/odebug.h> | ||
4 | #include <opie2/oconfig.h> | ||
5 | #include <opie2/okeyconfigwidget.h> | ||
6 | |||
7 | #include <qpe/resource.h> | ||
8 | |||
9 | using namespace Opie::Core; | ||
10 | |||
11 | ImageView::ImageView( QWidget* parent, const char* name, WFlags fl ) | ||
12 | : ImageScrollView(parent,name,fl) | ||
13 | { | ||
14 | m_viewManager = 0; | ||
15 | initKeys(); | ||
16 | } | ||
17 | |||
18 | ImageView::~ImageView() | ||
19 | { | ||
20 | } | ||
21 | |||
22 | Opie::Ui::OKeyConfigManager* ImageView::manager() | ||
23 | { | ||
24 | if (!m_viewManager) { | ||
25 | initKeys(); | ||
26 | } | ||
27 | return m_viewManager; | ||
28 | } | ||
29 | |||
30 | void ImageView::initKeys() | ||
31 | { | ||
32 | odebug << "init imageview keys" << oendl; | ||
33 | m_cfg = new Opie::Core::OConfig("phunkview"); | ||
34 | m_cfg->setGroup("Zecke_view" ); | ||
35 | Opie::Ui::OKeyPair::List lst; | ||
36 | lst.append( Opie::Ui::OKeyPair::upArrowKey() ); | ||
37 | lst.append( Opie::Ui::OKeyPair::downArrowKey() ); | ||
38 | lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); | ||
39 | lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); | ||
40 | lst.append( Opie::Ui::OKeyPair::returnKey() ); | ||
41 | |||
42 | m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageview-KeyBoard-Config", | ||
43 | lst, false,this, "keyconfig name" ); | ||
44 | m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Image Info"), "view", | ||
45 | Resource::loadPixmap("1to1"), ViewInfo, | ||
46 | Opie::Ui::OKeyPair(Qt::Key_I,Qt::ShiftButton), | ||
47 | this, SLOT(slotShowImageInfo()))); | ||
48 | m_viewManager->load(); | ||
49 | m_viewManager->handleWidget( this ); | ||
50 | } | ||
51 | |||
52 | void ImageView::slotShowImageInfo() | ||
53 | { | ||
54 | emit dispImageInfo(m_lastName); | ||
55 | } | ||
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 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | ||
2 | #define _IMAGE_VIEW_H | ||
3 | |||
4 | /* must be changed when it will moved to Opie::MM */ | ||
5 | #include "imagescrollview.h" | ||
6 | |||
7 | namespace Opie { | ||
8 | namespace Core { | ||
9 | class OConfig; | ||
10 | } | ||
11 | namespace Ui { | ||
12 | class OKeyConfigManager; | ||
13 | } | ||
14 | } | ||
15 | |||
16 | class ImageView:public ImageScrollView | ||
17 | { | ||
18 | Q_OBJECT | ||
19 | |||
20 | enum ActionIds { | ||
21 | ViewInfo | ||
22 | }; | ||
23 | |||
24 | public: | ||
25 | ImageView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | ||
26 | virtual ~ImageView(); | ||
27 | Opie::Ui::OKeyConfigManager* manager(); | ||
28 | |||
29 | signals: | ||
30 | void dispImageInfo(const QString&); | ||
31 | void sig_return(); | ||
32 | |||
33 | protected: | ||
34 | Opie::Core::OConfig * m_cfg; | ||
35 | Opie::Ui::OKeyConfigManager*m_viewManager; | ||
36 | void initKeys(); | ||
37 | protected slots: | ||
38 | virtual void slotShowImageInfo(); | ||
39 | }; | ||
40 | #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,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | 6 | ||
7 | #include "iconview.h" | 7 | #include "iconview.h" |
8 | #include "filesystem.h" | 8 | #include "filesystem.h" |
9 | #include "imageinfoui.h" | 9 | #include "imageinfoui.h" |
10 | #include "imagescrollview.h" | 10 | #include "imageview.h" |
11 | 11 | ||
12 | #include <iface/ifaceinfo.h> | 12 | #include <iface/ifaceinfo.h> |
13 | #include <iface/dirview.h> | 13 | #include <iface/dirview.h> |
14 | 14 | ||
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <opie2/owidgetstack.h> | 16 | #include <opie2/owidgetstack.h> |
17 | #include <opie2/oapplicationfactory.h> | 17 | #include <opie2/oapplicationfactory.h> |
18 | #include <opie2/otabwidget.h> | 18 | #include <opie2/otabwidget.h> |
19 | #include <opie2/okeyconfigwidget.h> | 19 | #include <opie2/okeyconfigwidget.h> |
20 | 20 | ||
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
@@ -153,28 +153,35 @@ void PMainWindow::slotConfig() { | |||
153 | QWidget *_wid = inf->configWidget( *m_cfg ); | 153 | QWidget *_wid = inf->configWidget( *m_cfg ); |
154 | _wid->reparent(wid, QPoint() ); | 154 | _wid->reparent(wid, QPoint() ); |
155 | lst.insert( view, _wid ); | 155 | lst.insert( view, _wid ); |
156 | wid->addTab( _wid, "fileopen", inf->name() ); | 156 | wid->addTab( _wid, "fileopen", inf->name() ); |
157 | } | 157 | } |
158 | 158 | ||
159 | /* | 159 | /* |
160 | * Add the KeyConfigWidget | 160 | * Add the KeyConfigWidget |
161 | */ | 161 | */ |
162 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 162 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
163 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 163 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
164 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 164 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
165 | |||
165 | if ( !m_info ) { | 166 | if ( !m_info ) { |
166 | initInfo(); | 167 | initInfo(); |
167 | } | 168 | } |
168 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | 169 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); |
170 | |||
171 | if ( !m_disp ) { | ||
172 | initDisp(); | ||
173 | } | ||
174 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); | ||
175 | |||
169 | keyWid->load(); | 176 | keyWid->load(); |
170 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 177 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
171 | 178 | ||
172 | 179 | ||
173 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 180 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
174 | 181 | ||
175 | /* | 182 | /* |
176 | * clean up | 183 | * clean up |
177 | *apply changes | 184 | *apply changes |
178 | */ | 185 | */ |
179 | 186 | ||
180 | QMap<PDirView*, QWidget*>::Iterator it; | 187 | QMap<PDirView*, QWidget*>::Iterator it; |
@@ -206,30 +213,30 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { | |||
206 | *ptr = new T( m_stack, name ); | 213 | *ptr = new T( m_stack, name ); |
207 | m_stack->addWidget( *ptr, id ); | 214 | m_stack->addWidget( *ptr, id ); |
208 | 215 | ||
209 | connect(*ptr, SIGNAL(sig_return()), | 216 | connect(*ptr, SIGNAL(sig_return()), |
210 | this,SLOT(slotReturn())); | 217 | this,SLOT(slotReturn())); |
211 | 218 | ||
212 | } | 219 | } |
213 | void PMainWindow::initInfo() { | 220 | void PMainWindow::initInfo() { |
214 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 221 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
215 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 222 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
216 | } | 223 | } |
217 | void PMainWindow::initDisp() { | 224 | void PMainWindow::initDisp() { |
218 | initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay ); | 225 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
219 | if (m_disp) { | 226 | if (m_disp) { |
220 | m_disp->setAutoScale(autoScale); | 227 | m_disp->setAutoScale(autoScale); |
221 | m_disp->setAutoRotate(autoRotate); | 228 | m_disp->setAutoRotate(autoRotate); |
229 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | ||
222 | } | 230 | } |
223 | |||
224 | } | 231 | } |
225 | 232 | ||
226 | /** | 233 | /** |
227 | * With big Screen the plan could be to 'detach' the image | 234 | * With big Screen the plan could be to 'detach' the image |
228 | * window if visible and to create a ne wone | 235 | * window if visible and to create a ne wone |
229 | * init* already supports it but I make no use of it for | 236 | * init* already supports it but I make no use of it for |
230 | * now. We set filename and raise | 237 | * now. We set filename and raise |
231 | * | 238 | * |
232 | * ### FIXME and talk to alwin | 239 | * ### FIXME and talk to alwin |
233 | */ | 240 | */ |
234 | void PMainWindow::slotShowInfo( const QString& inf ) { | 241 | void PMainWindow::slotShowInfo( const QString& inf ) { |
235 | if ( !m_info ) { | 242 | if ( !m_info ) { |
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 | |||
@@ -12,25 +12,25 @@ | |||
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | namespace Opie { | 15 | namespace Opie { |
16 | namespace Ui{ | 16 | namespace Ui{ |
17 | class OKeyConfigManager; | 17 | class OKeyConfigManager; |
18 | class OWidgetStack; | 18 | class OWidgetStack; |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | class PIconView; | 22 | class PIconView; |
23 | class imageinfo; | 23 | class imageinfo; |
24 | class ImageScrollView; | 24 | class ImageView; |
25 | class PMainWindow : public QMainWindow { | 25 | class PMainWindow : public QMainWindow { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | enum Views { IconView, ImageInfo, ImageDisplay }; | 27 | enum Views { IconView, ImageInfo, ImageDisplay }; |
28 | public: | 28 | public: |
29 | static QString appName() { return QString::fromLatin1("opie-eye" ); } | 29 | static QString appName() { return QString::fromLatin1("opie-eye" ); } |
30 | PMainWindow(QWidget*, const char*, WFlags ); | 30 | PMainWindow(QWidget*, const char*, WFlags ); |
31 | ~PMainWindow(); | 31 | ~PMainWindow(); |
32 | 32 | ||
33 | signals: | 33 | signals: |
34 | void configChanged(); | 34 | void configChanged(); |
35 | 35 | ||
36 | public slots: | 36 | public slots: |
@@ -45,23 +45,23 @@ protected: | |||
45 | void closeEvent( QCloseEvent* ); | 45 | void closeEvent( QCloseEvent* ); |
46 | 46 | ||
47 | private: | 47 | private: |
48 | template<class T> void initT( const char* name, T**, int ); | 48 | template<class T> void initT( const char* name, T**, int ); |
49 | void initInfo(); | 49 | void initInfo(); |
50 | void initDisp(); | 50 | void initDisp(); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | Opie::Core::OConfig *m_cfg; | 53 | Opie::Core::OConfig *m_cfg; |
54 | Opie::Ui::OWidgetStack *m_stack; | 54 | Opie::Ui::OWidgetStack *m_stack; |
55 | PIconView* m_view; | 55 | PIconView* m_view; |
56 | imageinfo *m_info; | 56 | imageinfo *m_info; |
57 | ImageScrollView *m_disp; | 57 | ImageView *m_disp; |
58 | bool autoRotate; | 58 | bool autoRotate; |
59 | bool autoScale; | 59 | bool autoScale; |
60 | QToolButton*rotateButton; | 60 | QToolButton*rotateButton; |
61 | 61 | ||
62 | 62 | ||
63 | private slots: | 63 | private slots: |
64 | void slotConfig(); | 64 | void slotConfig(); |
65 | }; | 65 | }; |
66 | 66 | ||
67 | #endif | 67 | #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,35 +1,37 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | DESTDIR = $(OPIEDIR)/bin | 2 | DESTDIR = $(OPIEDIR)/bin |
3 | TEMPLATE = app | 3 | TEMPLATE = app |
4 | TARGET = opie-eye | 4 | TARGET = opie-eye |
5 | # the name of the resulting object | 5 | # the name of the resulting object |
6 | 6 | ||
7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ | 7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ |
8 | lib/imagecache.h impl/dir/dir_dirview.h \ | 8 | lib/imagecache.h impl/dir/dir_dirview.h \ |
9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ | 9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ |
10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ | 10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ |
11 | lib/slavemaster.h \ | 11 | lib/slavemaster.h \ |
12 | iface/slaveiface.h \ | 12 | iface/slaveiface.h \ |
13 | gui/imageinfoui.h gui/imagescrollview.h | 13 | gui/imageinfoui.h gui/imagescrollview.h \ |
14 | gui/imageview.h | ||
14 | 15 | ||
15 | # A list header files | 16 | # A list header files |
16 | 17 | ||
17 | 18 | ||
18 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | 19 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ |
19 | lib/imagecache.cpp lib/viewmap.cpp \ | 20 | lib/imagecache.cpp lib/viewmap.cpp \ |
20 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | 21 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ |
21 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 22 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
22 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ | 23 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ |
23 | gui/imageinfoui.cpp gui/imagescrollview.cpp | 24 | gui/imageinfoui.cpp gui/imagescrollview.cpp \ |
25 | gui/imageview.cpp | ||
24 | # A list of source files | 26 | # A list of source files |
25 | 27 | ||
26 | INTERFACES = | 28 | INTERFACES = |
27 | # list of ui files | 29 | # list of ui files |
28 | 30 | ||
29 | INCLUDEPATH += . $(OPIEDIR)/include | 31 | INCLUDEPATH += . $(OPIEDIR)/include |
30 | DEPENDPATH += $(OPIEDIR)/include | 32 | DEPENDPATH += $(OPIEDIR)/include |
31 | 33 | ||
32 | 34 | ||
33 | 35 | ||
34 | LIBS += -lqpe -lopiecore2 -lopieui2 | 36 | LIBS += -lqpe -lopiecore2 -lopieui2 |
35 | 37 | ||