summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp19
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.h2
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp20
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h2
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp6
5 files changed, 31 insertions, 18 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
index 822fd88..0b3250c 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
@@ -1,202 +1,205 @@
1#include "imageinfoui.h" 1#include "imageinfoui.h"
2 2
3#include <qframe.h> 3#include <qframe.h>
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qtextview.h> 6#include <qtextview.h>
7#include <qlayout.h> 7#include <qlayout.h>
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/okeyconfigwidget.h> 20#include <opie2/okeyconfigwidget.h>
21#include <opie2/odebug.h> 21#include <opie2/odebug.h>
22 22
23#include <qpe/qcopenvelope_qws.h> 23#include <qpe/qcopenvelope_qws.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25 25
26static const int THUMBSIZE = 128; 26static const int THUMBSIZE = 128;
27 27
28using namespace Opie::Core; 28using namespace Opie::Core;
29 29
30imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) 30imageinfo::imageinfo(Opie::Core::OConfig *cfg,QWidget* parent, const char* name, WFlags fl )
31 : QWidget( parent, name, fl ) 31 : QWidget( parent, name, fl )
32{ 32{
33 m_viewManager = 0; 33 m_viewManager = 0;
34 m_cfg = cfg;
34 init(name); 35 init(name);
35 initKeys(); 36 initKeys();
36} 37}
37 38
38imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) 39imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl )
39 : QWidget( parent, name, fl ),currentFile(_path) 40 : QWidget( parent, name, fl ),currentFile(_path)
40{ 41{
41 m_viewManager = 0; 42 m_viewManager = 0;
43 m_cfg = 0;
42 init(name); 44 init(name);
43 initKeys(); 45 initKeys();
44 slotChangeName(_path); 46 slotChangeName(_path);
45} 47}
46 48
47Opie::Ui::OKeyConfigManager* imageinfo::manager() 49Opie::Ui::OKeyConfigManager* imageinfo::manager()
48{ 50{
49 if (!m_viewManager) { 51 if (!m_viewManager) {
50 initKeys(); 52 initKeys();
51 } 53 }
52 return m_viewManager; 54 return m_viewManager;
53} 55}
54 56
55void imageinfo::initKeys() 57void imageinfo::initKeys()
56{ 58{
57 odebug << "init imageinfo keys" << oendl; 59 odebug << "init imageinfo keys" << oendl;
58 m_cfg = new Opie::Core::OConfig("phunkview"); 60#if 0
59 m_cfg->setGroup("Zecke_view" ); 61 if (!m_cfg) {
62 m_cfg = new Opie::Core::OConfig("phunkview");
63 m_cfg->setGroup("imageinfo_keys" );
64 }
65#endif
60 Opie::Ui::OKeyPair::List lst; 66 Opie::Ui::OKeyPair::List lst;
61 lst.append( Opie::Ui::OKeyPair::upArrowKey() ); 67 lst.append( Opie::Ui::OKeyPair::upArrowKey() );
62 lst.append( Opie::Ui::OKeyPair::downArrowKey() ); 68 lst.append( Opie::Ui::OKeyPair::downArrowKey() );
63 lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); 69 lst.append( Opie::Ui::OKeyPair::leftArrowKey() );
64 lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); 70 lst.append( Opie::Ui::OKeyPair::rightArrowKey() );
65 lst.append( Opie::Ui::OKeyPair::returnKey() ); 71 lst.append( Opie::Ui::OKeyPair::returnKey() );
66 72
67 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", 73 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "imageinfo_keys",
68 lst, false,this, "keyconfig name" ); 74 lst, false,this, "keyconfig name" );
69 m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", 75 m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "infoview",
70 Resource::loadPixmap("1to1"), ViewItem, 76 Resource::loadPixmap("1to1"), ViewItem,
71 Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), 77 Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton),
72 this, SLOT(slotShowImage()))); 78 this, SLOT(slotShowImage())));
73 m_viewManager->load(); 79 m_viewManager->load();
74 m_viewManager->handleWidget( this ); 80 m_viewManager->handleWidget( this );
75 m_viewManager->handleWidget( TextView1 ); 81 m_viewManager->handleWidget( TextView1 );
76} 82}
77 83
78void imageinfo::slotShowImage() 84void imageinfo::slotShowImage()
79{ 85{
80 emit dispImage(currentFile); 86 emit dispImage(currentFile);
81} 87}
82 88
83void imageinfo::init(const char* name) { 89void imageinfo::init(const char* name) {
84 { 90 {
85 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 91 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
86 } 92 }
87 if ( !name ) 93 if ( !name )
88 setName( "imageinfo" ); 94 setName( "imageinfo" );
89 resize( 289, 335 ); 95 resize( 289, 335 );
90 setCaption( tr( "Image info" ) ); 96 setCaption( tr( "Image info" ) );
91 imageinfoLayout = new QVBoxLayout( this ); 97 imageinfoLayout = new QVBoxLayout( this );
92 imageinfoLayout->setSpacing(2); 98 imageinfoLayout->setSpacing(2);
93 imageinfoLayout->setMargin(4); 99 imageinfoLayout->setMargin(4);
94 100
95 PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); 101 PixmapLabel1 = new QLabel( this, "PixmapLabel1" );
96 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); 102 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) );
97 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); 103 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") );
98 104
99 imageinfoLayout->addWidget( PixmapLabel1 ); 105 imageinfoLayout->addWidget( PixmapLabel1 );
100 106
101 Line1 = new QFrame( this, "Line1" ); 107 Line1 = new QFrame( this, "Line1" );
102 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 108 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
103 imageinfoLayout->addWidget( Line1 ); 109 imageinfoLayout->addWidget( Line1 );
104 110
105 fnameLabel = new QLabel( this, "FnameLabel" ); 111 fnameLabel = new QLabel( this, "FnameLabel" );
106 imageinfoLayout->addWidget( fnameLabel); 112 imageinfoLayout->addWidget( fnameLabel);
107 113
108 TextView1 = new QTextView( this, "TextView1" ); 114 TextView1 = new QTextView( this, "TextView1" );
109 TextView1->setFrameShadow( QTextView::Sunken ); 115 TextView1->setFrameShadow( QTextView::Sunken );
110 TextView1->setResizePolicy( QTextView::AutoOneFit ); 116 TextView1->setResizePolicy( QTextView::AutoOneFit );
111 TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); 117 TextView1->setBackgroundOrigin( QTextView::ParentOrigin );
112 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); 118 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) );
113// TextView1->setVScrollBarMode(QScrollView::AlwaysOn); 119// TextView1->setVScrollBarMode(QScrollView::AlwaysOn);
114 QWhatsThis::add( TextView1, tr("Displays info of selected image") ); 120 QWhatsThis::add( TextView1, tr("Displays info of selected image") );
115 imageinfoLayout->addWidget( TextView1 ); 121 imageinfoLayout->addWidget( TextView1 );
116 122
117 SlaveMaster* master = SlaveMaster::self(); 123 SlaveMaster* master = SlaveMaster::self();
118 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), 124 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
119 this, SLOT(slot_fullInfo(const QString&, const QString&)) ); 125 this, SLOT(slot_fullInfo(const QString&, const QString&)) );
120 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 126 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
121 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 127 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
122} 128}
123 129
124void imageinfo::slotChangeName(const QString&_path) 130void imageinfo::slotChangeName(const QString&_path)
125{ 131{
126 currentFile=_path; 132 currentFile=_path;
127 QFileInfo fi(_path); 133 QFileInfo fi(_path);
128 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); 134 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>");
129 SlaveMaster::self()->imageInfo( currentFile ); 135 SlaveMaster::self()->imageInfo( currentFile );
130 136
131 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); 137 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE );
132 if (!m_pix) { 138 if (!m_pix) {
133 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); 139 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" )));
134 SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); 140 SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE);
135 } else { 141 } else {
136 PixmapLabel1->setPixmap(*m_pix); 142 PixmapLabel1->setPixmap(*m_pix);
137 } 143 }
138} 144}
139 145
140imageinfo::~imageinfo() 146imageinfo::~imageinfo()
141{ 147{
142 { 148 {
143 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 149 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
144 } 150 }
145 if (m_viewManager) { 151 if (m_viewManager) {
146 m_viewManager->save();
147 delete m_viewManager; 152 delete m_viewManager;
148 } 153 }
149} 154}
150 155
151void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) 156void imageinfo::slot_fullInfo(const QString&_path, const QString&_t)
152{ 157{
153 if (_path == currentFile) { 158 if (_path == currentFile) {
154 qDebug(_t); 159 qDebug(_t);
155 QString t = _t; 160 QString t = _t;
156 t.replace(QRegExp("\n"),"<br>"); 161 t.replace(QRegExp("\n"),"<br>");
157/* t.replace(QRegeExp("<qt>","");
158 t.replace(QRegeExp("</qt>","");*/
159 TextView1->setText(t); 162 TextView1->setText(t);
160 } 163 }
161} 164}
162 165
163void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) 166void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix)
164{ 167{
165 if (_path == currentFile) { 168 if (_path == currentFile) {
166 if (_pix.width()>0) { 169 if (_pix.width()>0) {
167 PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); 170 PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE );
168 PixmapLabel1->setPixmap( _pix ); 171 PixmapLabel1->setPixmap( _pix );
169 PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); 172 PixmapLabel1->resize(QSize(_pix.width(),_pix.height()));
170 } 173 }
171 } 174 }
172} 175}
173 176
174void imageinfo::setPath( const QString& str ) { 177void imageinfo::setPath( const QString& str ) {
175 slotChangeName( str ); 178 slotChangeName( str );
176} 179}
177 180
178void imageinfo::setDestructiveClose() { 181void imageinfo::setDestructiveClose() {
179 WFlags fl = getWFlags(); 182 WFlags fl = getWFlags();
180 /* clear it just in case */ 183 /* clear it just in case */
181 fl &= ~WDestructiveClose; 184 fl &= ~WDestructiveClose;
182 fl |= WDestructiveClose; 185 fl |= WDestructiveClose;
183 setWFlags( fl ); 186 setWFlags( fl );
184} 187}
185 188
186 189
187/* for testing */ 190/* for testing */
188infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) 191infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name)
189 :QDialog(parent,name,true,WStyle_ContextHelp) 192 :QDialog(parent,name,true,WStyle_ContextHelp)
190{ 193{
191 QVBoxLayout*dlglayout = new QVBoxLayout(this); 194 QVBoxLayout*dlglayout = new QVBoxLayout(this);
192 dlglayout->setSpacing(2); 195 dlglayout->setSpacing(2);
193 dlglayout->setMargin(1); 196 dlglayout->setMargin(1);
194 imageinfo*inf = new imageinfo(fname,this); 197 imageinfo*inf = new imageinfo(fname,this);
195 dlglayout->addWidget(inf); 198 dlglayout->addWidget(inf);
196} 199}
197 200
198infoDlg::~infoDlg() 201infoDlg::~infoDlg()
199{ 202{
200} 203}
201 204
202 205
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.h b/noncore/graphics/opie-eye/gui/imageinfoui.h
index 0ffa423..c9b83a1 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.h
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.h
@@ -1,78 +1,78 @@
1#ifndef IMAGEINFO_H 1#ifndef IMAGEINFO_H
2#define IMAGEINFO_H 2#define IMAGEINFO_H
3 3
4#include <qvariant.h> 4#include <qvariant.h>
5#include <qwidget.h> 5#include <qwidget.h>
6#include <qdialog.h> 6#include <qdialog.h>
7 7
8class QVBoxLayout; 8class QVBoxLayout;
9class QHBoxLayout; 9class QHBoxLayout;
10class QGridLayout; 10class QGridLayout;
11class QFrame; 11class QFrame;
12class QLabel; 12class QLabel;
13class QTextView; 13class QTextView;
14 14
15namespace Opie { 15namespace Opie {
16 namespace Core { 16 namespace Core {
17 class OConfig; 17 class OConfig;
18 } 18 }
19 namespace Ui { 19 namespace Ui {
20 class OKeyConfigManager; 20 class OKeyConfigManager;
21 } 21 }
22} 22}
23 23
24class imageinfo : public QWidget 24class imageinfo : public QWidget
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 enum ActionIds { 27 enum ActionIds {
28 ViewItem 28 ViewItem
29 }; 29 };
30 30
31public: 31public:
32 imageinfo( QWidget* parent = 0, const char* name = 0, WFlags fl =0); 32 imageinfo(Opie::Core::OConfig *cfg, QWidget* parent = 0, const char* name = 0, WFlags fl =0);
33 imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 33 imageinfo(const QString&_path, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
34 virtual ~imageinfo(); 34 virtual ~imageinfo();
35 35
36 void setDestructiveClose(); 36 void setDestructiveClose();
37 Opie::Ui::OKeyConfigManager* manager(); 37 Opie::Ui::OKeyConfigManager* manager();
38 38
39signals: 39signals:
40 void dispImage(const QString&); 40 void dispImage(const QString&);
41 void sig_return(); 41 void sig_return();
42 42
43public slots: 43public slots:
44 virtual void setPath( const QString& path ); 44 virtual void setPath( const QString& path );
45 virtual void slotShowImage(); 45 virtual void slotShowImage();
46 46
47private: 47private:
48 void init(const char* name); 48 void init(const char* name);
49 49
50protected: 50protected:
51 QLabel* PixmapLabel1; 51 QLabel* PixmapLabel1;
52 QLabel* fnameLabel; 52 QLabel* fnameLabel;
53 QFrame* Line1; 53 QFrame* Line1;
54 QTextView* TextView1; 54 QTextView* TextView1;
55 QVBoxLayout* imageinfoLayout; 55 QVBoxLayout* imageinfoLayout;
56 QString currentFile; 56 QString currentFile;
57 57
58 Opie::Core::OConfig * m_cfg; 58 Opie::Core::OConfig * m_cfg;
59 Opie::Ui::OKeyConfigManager*m_viewManager; 59 Opie::Ui::OKeyConfigManager*m_viewManager;
60 void initKeys(); 60 void initKeys();
61 61
62protected slots: 62protected slots:
63 virtual void slot_fullInfo(const QString&, const QString&); 63 virtual void slot_fullInfo(const QString&, const QString&);
64 virtual void slotThumbNail(const QString&, const QPixmap&); 64 virtual void slotThumbNail(const QString&, const QPixmap&);
65 65
66 virtual void slotChangeName(const QString&); 66 virtual void slotChangeName(const QString&);
67}; 67};
68 68
69/* for testing purpose */ 69/* for testing purpose */
70class infoDlg:public QDialog 70class infoDlg:public QDialog
71{ 71{
72 Q_OBJECT 72 Q_OBJECT
73public: 73public:
74 infoDlg(const QString&,QWidget * parent=0, const char * name=0); 74 infoDlg(const QString&,QWidget * parent=0, const char * name=0);
75 virtual ~infoDlg(); 75 virtual ~infoDlg();
76}; 76};
77 77
78#endif // IMAGEINFO_H 78#endif // IMAGEINFO_H
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 8fc258e..e43bbff 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,55 +1,61 @@
1#include "imageview.h" 1#include "imageview.h"
2 2
3#include <opie2/odebug.h> 3#include <opie2/odebug.h>
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5#include <opie2/okeyconfigwidget.h> 5#include <opie2/okeyconfigwidget.h>
6 6
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8 8
9using namespace Opie::Core; 9using namespace Opie::Core;
10 10
11ImageView::ImageView( QWidget* parent, const char* name, WFlags fl ) 11ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
12 : ImageScrollView(parent,name,fl) 12 : ImageScrollView(parent,name,fl)
13{ 13{
14 m_viewManager = 0; 14 m_viewManager = 0;
15 m_cfg = cfg;
15 initKeys(); 16 initKeys();
16} 17}
17 18
18ImageView::~ImageView() 19ImageView::~ImageView()
19{ 20{
21 if (m_viewManager) {
22 delete m_viewManager;
23 }
20} 24}
21 25
22Opie::Ui::OKeyConfigManager* ImageView::manager() 26Opie::Ui::OKeyConfigManager* ImageView::manager()
23{ 27{
24 if (!m_viewManager) { 28 if (!m_viewManager) {
25 initKeys(); 29 initKeys();
26 } 30 }
27 return m_viewManager; 31 return m_viewManager;
28} 32}
29 33
30void ImageView::initKeys() 34void ImageView::initKeys()
31{ 35{
32 odebug << "init imageview keys" << oendl; 36 odebug << "init imageview keys" << oendl;
33 m_cfg = new Opie::Core::OConfig("phunkview"); 37 if (!m_cfg) {
34 m_cfg->setGroup("Zecke_view" ); 38 m_cfg = new Opie::Core::OConfig("phunkview");
39 m_cfg->setGroup("image_view_keys" );
40 }
35 Opie::Ui::OKeyPair::List lst; 41 Opie::Ui::OKeyPair::List lst;
36 lst.append( Opie::Ui::OKeyPair::upArrowKey() ); 42 lst.append( Opie::Ui::OKeyPair::upArrowKey() );
37 lst.append( Opie::Ui::OKeyPair::downArrowKey() ); 43 lst.append( Opie::Ui::OKeyPair::downArrowKey() );
38 lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); 44 lst.append( Opie::Ui::OKeyPair::leftArrowKey() );
39 lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); 45 lst.append( Opie::Ui::OKeyPair::rightArrowKey() );
40 lst.append( Opie::Ui::OKeyPair::returnKey() ); 46 lst.append( Opie::Ui::OKeyPair::returnKey() );
41 47
42 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageview-KeyBoard-Config", 48 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "image_view_keys",
43 lst, false,this, "keyconfig name" ); 49 lst, false,this, "image_view_keys" );
44 m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Image Info"), "view", 50 m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
45 Resource::loadPixmap("1to1"), ViewInfo, 51 Resource::loadPixmap("1to1"), ViewInfo,
46 Opie::Ui::OKeyPair(Qt::Key_I,Qt::ShiftButton), 52 Opie::Ui::OKeyPair(Qt::Key_I,Qt::ShiftButton),
47 this, SLOT(slotShowImageInfo()))); 53 this, SLOT(slotShowImageInfo())));
48 m_viewManager->load();
49 m_viewManager->handleWidget( this ); 54 m_viewManager->handleWidget( this );
55 m_viewManager->load();
50} 56}
51 57
52void ImageView::slotShowImageInfo() 58void ImageView::slotShowImageInfo()
53{ 59{
54 emit dispImageInfo(m_lastName); 60 emit dispImageInfo(m_lastName);
55} 61}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 5ee0d7d..f61c93f 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -1,40 +1,40 @@
1#ifndef _IMAGE_VIEW_H 1#ifndef _IMAGE_VIEW_H
2#define _IMAGE_VIEW_H 2#define _IMAGE_VIEW_H
3 3
4/* must be changed when it will moved to Opie::MM */ 4/* must be changed when it will moved to Opie::MM */
5#include "imagescrollview.h" 5#include "imagescrollview.h"
6 6
7namespace Opie { 7namespace Opie {
8 namespace Core { 8 namespace Core {
9 class OConfig; 9 class OConfig;
10 } 10 }
11 namespace Ui { 11 namespace Ui {
12 class OKeyConfigManager; 12 class OKeyConfigManager;
13 } 13 }
14} 14}
15 15
16class ImageView:public ImageScrollView 16class ImageView:public ImageScrollView
17{ 17{
18 Q_OBJECT 18 Q_OBJECT
19 19
20 enum ActionIds { 20 enum ActionIds {
21 ViewInfo 21 ViewInfo
22 }; 22 };
23 23
24public: 24public:
25 ImageView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); 25 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 );
26 virtual ~ImageView(); 26 virtual ~ImageView();
27 Opie::Ui::OKeyConfigManager* manager(); 27 Opie::Ui::OKeyConfigManager* manager();
28 28
29signals: 29signals:
30 void dispImageInfo(const QString&); 30 void dispImageInfo(const QString&);
31 void sig_return(); 31 void sig_return();
32 32
33protected: 33protected:
34 Opie::Core::OConfig * m_cfg; 34 Opie::Core::OConfig * m_cfg;
35 Opie::Ui::OKeyConfigManager*m_viewManager; 35 Opie::Ui::OKeyConfigManager*m_viewManager;
36 void initKeys(); 36 void initKeys();
37protected slots: 37protected slots:
38 virtual void slotShowImageInfo(); 38 virtual void slotShowImageInfo();
39}; 39};
40#endif 40#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 529bee4..21a668a 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,279 +1,283 @@
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 "imageview.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>
23#include <qpe/ir.h> 23#include <qpe/ir.h>
24 24
25#include <qtoolbar.h> 25#include <qtoolbar.h>
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qmap.h> 29#include <qmap.h>
30#include <qtimer.h> 30#include <qtimer.h>
31 31
32 32
33 33
34 34
35OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 35OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
36 36
37PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 37PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
38 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 38 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
39{ 39{
40 setCaption( QObject::tr("Opie Eye Caramba" ) ); 40 setCaption( QObject::tr("Opie Eye Caramba" ) );
41 m_cfg = new Opie::Core::OConfig("phunkview"); 41 m_cfg = new Opie::Core::OConfig("phunkview");
42 m_cfg->setGroup("Zecke_view" ); 42 m_cfg->setGroup("Zecke_view" );
43// qDebug( "Process-wide OApplication object @ %0x", oApp ); 43// qDebug( "Process-wide OApplication object @ %0x", oApp );
44 /* 44 /*
45 * Initialize ToolBar and IconView 45 * Initialize ToolBar and IconView
46 * And Connect Them 46 * And Connect Them
47 */ 47 */
48 QToolBar *bar = new QToolBar( this ); 48 QToolBar *bar = new QToolBar( this );
49 bar->setHorizontalStretchable( true ); 49 bar->setHorizontalStretchable( true );
50 setToolBarsMovable( false ); 50 setToolBarsMovable( false );
51 51
52 m_stack = new Opie::Ui::OWidgetStack( this ); 52 m_stack = new Opie::Ui::OWidgetStack( this );
53 setCentralWidget( m_stack ); 53 setCentralWidget( m_stack );
54 54
55 m_view = new PIconView( m_stack, m_cfg ); 55 m_view = new PIconView( m_stack, m_cfg );
56 m_stack->addWidget( m_view, IconView ); 56 m_stack->addWidget( m_view, IconView );
57 m_stack->raiseWidget( IconView ); 57 m_stack->raiseWidget( IconView );
58 connect(m_view, SIGNAL(sig_display(const QString&)), 58 connect(m_view, SIGNAL(sig_display(const QString&)),
59 this, SLOT(slotDisplay(const QString&))); 59 this, SLOT(slotDisplay(const QString&)));
60 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 60 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
61 this, SLOT(slotShowInfo(const QString&)) ); 61 this, SLOT(slotShowInfo(const QString&)) );
62 62
63 QToolButton *btn = new QToolButton( bar ); 63 QToolButton *btn = new QToolButton( bar );
64 btn->setIconSet( Resource::loadIconSet( "up" ) ); 64 btn->setIconSet( Resource::loadIconSet( "up" ) );
65 connect( btn, SIGNAL(clicked()), 65 connect( btn, SIGNAL(clicked()),
66 m_view, SLOT(slotDirUp()) ); 66 m_view, SLOT(slotDirUp()) );
67 67
68 btn = new PFileSystem( bar ); 68 btn = new PFileSystem( bar );
69 connect( btn, SIGNAL( changeDir( const QString& ) ), 69 connect( btn, SIGNAL( changeDir( const QString& ) ),
70 m_view, SLOT(slotChangeDir( const QString& ) ) ); 70 m_view, SLOT(slotChangeDir( const QString& ) ) );
71 71
72 btn = new QToolButton( bar ); 72 btn = new QToolButton( bar );
73 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 73 btn->setIconSet( Resource::loadIconSet( "edit" ) );
74 connect( btn, SIGNAL(clicked()), 74 connect( btn, SIGNAL(clicked()),
75 m_view, SLOT(slotRename()) ); 75 m_view, SLOT(slotRename()) );
76 76
77 if ( Ir::supported() ) { 77 if ( Ir::supported() ) {
78 btn = new QToolButton( bar ); 78 btn = new QToolButton( bar );
79 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 79 btn->setIconSet( Resource::loadIconSet( "beam" ) );
80 connect( btn, SIGNAL(clicked()), 80 connect( btn, SIGNAL(clicked()),
81 m_view, SLOT(slotBeam()) ); 81 m_view, SLOT(slotBeam()) );
82 } 82 }
83 83
84 btn = new QToolButton( bar ); 84 btn = new QToolButton( bar );
85 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 85 btn->setIconSet( Resource::loadIconSet( "trash" ) );
86 connect( btn, SIGNAL(clicked() ), 86 connect( btn, SIGNAL(clicked() ),
87 m_view, SLOT(slotTrash() ) ); 87 m_view, SLOT(slotTrash() ) );
88 88
89 btn = new QToolButton( bar ); 89 btn = new QToolButton( bar );
90 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 90 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
91 connect( btn, SIGNAL(clicked() ), 91 connect( btn, SIGNAL(clicked() ),
92 this, SLOT(slotConfig() ) ); 92 this, SLOT(slotConfig() ) );
93 93
94 rotateButton = new QToolButton(bar); 94 rotateButton = new QToolButton(bar);
95 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 95 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
96 rotateButton->setToggleButton(true); 96 rotateButton->setToggleButton(true);
97 rotateButton->setOn(true); 97 rotateButton->setOn(true);
98 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 98 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
99 autoRotate = true; 99 autoRotate = true;
100 100
101 btn = new QToolButton(bar); 101 btn = new QToolButton(bar);
102 btn->setIconSet( Resource::loadIconSet( "1to1" ) ); 102 btn->setIconSet( Resource::loadIconSet( "1to1" ) );
103 btn->setToggleButton(true); 103 btn->setToggleButton(true);
104 btn->setOn(false); 104 btn->setOn(false);
105 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 105 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
106 autoScale = true; 106 autoScale = true;
107 107
108} 108}
109 109
110PMainWindow::~PMainWindow() { 110PMainWindow::~PMainWindow() {
111 odebug << "Shutting down" << oendl; 111 odebug << "Shutting down" << oendl;
112} 112}
113 113
114void PMainWindow::slotRotateToggled(bool how) 114void PMainWindow::slotRotateToggled(bool how)
115{ 115{
116 autoRotate = how; 116 autoRotate = how;
117 if (m_disp) { 117 if (m_disp) {
118 m_disp->setAutoRotate(how); 118 m_disp->setAutoRotate(how);
119 } 119 }
120} 120}
121 121
122void PMainWindow::slotScaleToggled(bool how) 122void PMainWindow::slotScaleToggled(bool how)
123{ 123{
124 autoScale = !how; 124 autoScale = !how;
125 if (m_disp) { 125 if (m_disp) {
126 m_disp->setAutoScale(autoScale); 126 m_disp->setAutoScale(autoScale);
127 } 127 }
128 if (!autoScale && autoRotate) { 128 if (!autoScale && autoRotate) {
129 rotateButton->setOn(false); 129 rotateButton->setOn(false);
130 } 130 }
131 rotateButton->setEnabled(!how); 131 rotateButton->setEnabled(!how);
132} 132}
133 133
134void PMainWindow::slotConfig() { 134void PMainWindow::slotConfig() {
135 /* 135 /*
136 * have a tab with the possible views 136 * have a tab with the possible views
137 * a tab for globals image cache size.. scaled loading 137 * a tab for globals image cache size.. scaled loading
138 * and one tab for the KeyConfigs 138 * and one tab for the KeyConfigs
139 */ 139 */
140 QDialog dlg(this, 0, true); 140 QDialog dlg(this, 0, true);
141 dlg.setCaption( tr("Phunk View - Config" ) ); 141 dlg.setCaption( tr("Phunk View - Config" ) );
142 142
143 QHBoxLayout *lay = new QHBoxLayout(&dlg); 143 QHBoxLayout *lay = new QHBoxLayout(&dlg);
144 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 144 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
145 lay->addWidget( wid ); 145 lay->addWidget( wid );
146 ViewMap *vM = viewMap(); 146 ViewMap *vM = viewMap();
147 ViewMap::Iterator _it = vM->begin(); 147 ViewMap::Iterator _it = vM->begin();
148 QMap<PDirView*, QWidget*> lst; 148 QMap<PDirView*, QWidget*> lst;
149 149
150 for( ; _it != vM->end(); ++_it ) { 150 for( ; _it != vM->end(); ++_it ) {
151 PDirView *view = (_it.data())(*m_cfg); 151 PDirView *view = (_it.data())(*m_cfg);
152 PInterfaceInfo *inf = view->interfaceInfo(); 152 PInterfaceInfo *inf = view->interfaceInfo();
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
166 if ( !m_info ) { 166 if ( !m_info ) {
167 initInfo(); 167 initInfo();
168 } 168 }
169 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 169 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
170 170
171 if ( !m_disp ) { 171 if ( !m_disp ) {
172 initDisp(); 172 initDisp();
173 } 173 }
174 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 174 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
175 175
176 keyWid->load(); 176 keyWid->load();
177 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 177 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
178 178
179 179
180 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 180 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
181 181
182/* 182/*
183 * clean up 183 * clean up
184 *apply changes 184 *apply changes
185 */ 185 */
186 186
187 QMap<PDirView*, QWidget*>::Iterator it; 187 QMap<PDirView*, QWidget*>::Iterator it;
188 for ( it = lst.begin(); it != lst.end(); ++it ) { 188 for ( it = lst.begin(); it != lst.end(); ++it ) {
189 if ( act ) 189 if ( act )
190 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 190 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
191 delete it.key(); 191 delete it.key();
192 } 192 }
193 193
194 194
195 if ( act ) { 195 if ( act ) {
196 m_view->resetView(); 196 m_view->resetView();
197 keyWid->save(); 197 keyWid->save();
198 m_disp->manager()->save();
199 m_info->manager()->save();
200 m_view->manager()->save();
198 } 201 }
202 delete keyWid;
199} 203}
200 204
201/* 205/*
202 * create a new image info component 206 * create a new image info component
203 * and detach the current one 207 * and detach the current one
204 * we will make the other delete on exit 208 * we will make the other delete on exit
205 */ 209 */
206template<class T> 210template<class T>
207void PMainWindow::initT( const char* name, T** ptr, int id) { 211void PMainWindow::initT( const char* name, T** ptr, int id) {
208 if ( *ptr ) { 212 if ( *ptr ) {
209 (*ptr)->disconnect(this, SLOT(slotReturn())); 213 (*ptr)->disconnect(this, SLOT(slotReturn()));
210 (*ptr)->setDestructiveClose(); 214 (*ptr)->setDestructiveClose();
211 m_stack->removeWidget( *ptr ); 215 m_stack->removeWidget( *ptr );
212 } 216 }
213 *ptr = new T( m_stack, name ); 217 *ptr = new T(m_cfg, m_stack, name );
214 m_stack->addWidget( *ptr, id ); 218 m_stack->addWidget( *ptr, id );
215 219
216 connect(*ptr, SIGNAL(sig_return()), 220 connect(*ptr, SIGNAL(sig_return()),
217 this,SLOT(slotReturn())); 221 this,SLOT(slotReturn()));
218 222
219} 223}
220void PMainWindow::initInfo() { 224void PMainWindow::initInfo() {
221 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 225 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
222 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 226 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
223} 227}
224void PMainWindow::initDisp() { 228void PMainWindow::initDisp() {
225 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 229 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
226 if (m_disp) { 230 if (m_disp) {
227 m_disp->setAutoScale(autoScale); 231 m_disp->setAutoScale(autoScale);
228 m_disp->setAutoRotate(autoRotate); 232 m_disp->setAutoRotate(autoRotate);
229 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 233 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
230 } 234 }
231} 235}
232 236
233/** 237/**
234 * With big Screen the plan could be to 'detach' the image 238 * With big Screen the plan could be to 'detach' the image
235 * window if visible and to create a ne wone 239 * window if visible and to create a ne wone
236 * init* already supports it but I make no use of it for 240 * init* already supports it but I make no use of it for
237 * now. We set filename and raise 241 * now. We set filename and raise
238 * 242 *
239 * ### FIXME and talk to alwin 243 * ### FIXME and talk to alwin
240 */ 244 */
241void PMainWindow::slotShowInfo( const QString& inf ) { 245void PMainWindow::slotShowInfo( const QString& inf ) {
242 if ( !m_info ) { 246 if ( !m_info ) {
243 initInfo(); 247 initInfo();
244 } 248 }
245 m_info->setPath( inf ); 249 m_info->setPath( inf );
246 m_stack->raiseWidget( ImageInfo ); 250 m_stack->raiseWidget( ImageInfo );
247} 251}
248 252
249void PMainWindow::slotDisplay( const QString& inf ) { 253void PMainWindow::slotDisplay( const QString& inf ) {
250 if ( !m_disp ) { 254 if ( !m_disp ) {
251 initDisp(); 255 initDisp();
252 } 256 }
253 m_disp->setImage( inf ); 257 m_disp->setImage( inf );
254 m_stack->raiseWidget( ImageDisplay ); 258 m_stack->raiseWidget( ImageDisplay );
255} 259}
256 260
257void PMainWindow::slotReturn() { 261void PMainWindow::slotReturn() {
258 raiseIconView(); 262 raiseIconView();
259} 263}
260 264
261 265
262void PMainWindow::closeEvent( QCloseEvent* ev ) { 266void PMainWindow::closeEvent( QCloseEvent* ev ) {
263 /* 267 /*
264 * return from view 268 * return from view
265 * or properly quit 269 * or properly quit
266 */ 270 */
267 if ( m_stack->visibleWidget() == m_info || 271 if ( m_stack->visibleWidget() == m_info ||
268 m_stack->visibleWidget() == m_disp ) { 272 m_stack->visibleWidget() == m_disp ) {
269 raiseIconView(); 273 raiseIconView();
270 ev->ignore(); 274 ev->ignore();
271 return; 275 return;
272 } 276 }
273 ev->accept(); 277 ev->accept();
274 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 278 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
275} 279}
276 280
277void PMainWindow::raiseIconView() { 281void PMainWindow::raiseIconView() {
278 m_stack->raiseWidget( IconView ); 282 m_stack->raiseWidget( IconView );
279} 283}