summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp1
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp55
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h40
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp13
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h4
-rw-r--r--noncore/graphics/opie-eye/phunk_view.pro6
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,203 +1,202 @@
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/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
27static const int THUMBSIZE = 128; 26static const int THUMBSIZE = 128;
28 27
29using namespace Opie::Core; 28using namespace Opie::Core;
30 29
31imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl ) 30imageinfo::imageinfo(QWidget* parent, const char* name, WFlags fl )
32 : QWidget( parent, name, fl ) 31 : QWidget( parent, name, fl )
33{ 32{
34 m_viewManager = 0; 33 m_viewManager = 0;
35 init(name); 34 init(name);
36 initKeys(); 35 initKeys();
37} 36}
38 37
39imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) 38imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl )
40 : QWidget( parent, name, fl ),currentFile(_path) 39 : QWidget( parent, name, fl ),currentFile(_path)
41{ 40{
42 m_viewManager = 0; 41 m_viewManager = 0;
43 init(name); 42 init(name);
44 initKeys(); 43 initKeys();
45 slotChangeName(_path); 44 slotChangeName(_path);
46} 45}
47 46
48Opie::Ui::OKeyConfigManager* imageinfo::manager() 47Opie::Ui::OKeyConfigManager* imageinfo::manager()
49{ 48{
50 if (!m_viewManager) { 49 if (!m_viewManager) {
51 initKeys(); 50 initKeys();
52 } 51 }
53 return m_viewManager; 52 return m_viewManager;
54} 53}
55 54
56void imageinfo::initKeys() 55void imageinfo::initKeys()
57{ 56{
58 odebug << "init imageinfo keys" << oendl; 57 odebug << "init imageinfo keys" << oendl;
59 m_cfg = new Opie::Core::OConfig("phunkview"); 58 m_cfg = new Opie::Core::OConfig("phunkview");
60 m_cfg->setGroup("Zecke_view" ); 59 m_cfg->setGroup("Zecke_view" );
61 Opie::Ui::OKeyPair::List lst; 60 Opie::Ui::OKeyPair::List lst;
62 lst.append( Opie::Ui::OKeyPair::upArrowKey() ); 61 lst.append( Opie::Ui::OKeyPair::upArrowKey() );
63 lst.append( Opie::Ui::OKeyPair::downArrowKey() ); 62 lst.append( Opie::Ui::OKeyPair::downArrowKey() );
64 lst.append( Opie::Ui::OKeyPair::leftArrowKey() ); 63 lst.append( Opie::Ui::OKeyPair::leftArrowKey() );
65 lst.append( Opie::Ui::OKeyPair::rightArrowKey() ); 64 lst.append( Opie::Ui::OKeyPair::rightArrowKey() );
66 lst.append( Opie::Ui::OKeyPair::returnKey() ); 65 lst.append( Opie::Ui::OKeyPair::returnKey() );
67 66
68 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config", 67 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "Imageinfo-KeyBoard-Config",
69 lst, false,this, "keyconfig name" ); 68 lst, false,this, "keyconfig name" );
70 m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view", 69 m_viewManager->addKeyConfig( Opie::Ui::OKeyConfigItem(tr("View Full Image"), "view",
71 Resource::loadPixmap("1to1"), ViewItem, 70 Resource::loadPixmap("1to1"), ViewItem,
72 Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton), 71 Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton),
73 this, SLOT(slotShowImage()))); 72 this, SLOT(slotShowImage())));
74 m_viewManager->load(); 73 m_viewManager->load();
75 m_viewManager->handleWidget( this ); 74 m_viewManager->handleWidget( this );
76 m_viewManager->handleWidget( TextView1 ); 75 m_viewManager->handleWidget( TextView1 );
77} 76}
78 77
79void imageinfo::slotShowImage() 78void imageinfo::slotShowImage()
80{ 79{
81 emit dispImage(currentFile); 80 emit dispImage(currentFile);
82} 81}
83 82
84void imageinfo::init(const char* name) { 83void imageinfo::init(const char* name) {
85 { 84 {
86 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 85 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
87 } 86 }
88 if ( !name ) 87 if ( !name )
89 setName( "imageinfo" ); 88 setName( "imageinfo" );
90 resize( 289, 335 ); 89 resize( 289, 335 );
91 setCaption( tr( "Image info" ) ); 90 setCaption( tr( "Image info" ) );
92 imageinfoLayout = new QVBoxLayout( this ); 91 imageinfoLayout = new QVBoxLayout( this );
93 imageinfoLayout->setSpacing(2); 92 imageinfoLayout->setSpacing(2);
94 imageinfoLayout->setMargin(4); 93 imageinfoLayout->setMargin(4);
95 94
96 PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); 95 PixmapLabel1 = new QLabel( this, "PixmapLabel1" );
97 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); 96 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) );
98 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); 97 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") );
99 98
100 imageinfoLayout->addWidget( PixmapLabel1 ); 99 imageinfoLayout->addWidget( PixmapLabel1 );
101 100
102 Line1 = new QFrame( this, "Line1" ); 101 Line1 = new QFrame( this, "Line1" );
103 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 102 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
104 imageinfoLayout->addWidget( Line1 ); 103 imageinfoLayout->addWidget( Line1 );
105 104
106 fnameLabel = new QLabel( this, "FnameLabel" ); 105 fnameLabel = new QLabel( this, "FnameLabel" );
107 imageinfoLayout->addWidget( fnameLabel); 106 imageinfoLayout->addWidget( fnameLabel);
108 107
109 TextView1 = new QTextView( this, "TextView1" ); 108 TextView1 = new QTextView( this, "TextView1" );
110 TextView1->setFrameShadow( QTextView::Sunken ); 109 TextView1->setFrameShadow( QTextView::Sunken );
111 TextView1->setResizePolicy( QTextView::AutoOneFit ); 110 TextView1->setResizePolicy( QTextView::AutoOneFit );
112 TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); 111 TextView1->setBackgroundOrigin( QTextView::ParentOrigin );
113 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); 112 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) );
114// TextView1->setVScrollBarMode(QScrollView::AlwaysOn); 113// TextView1->setVScrollBarMode(QScrollView::AlwaysOn);
115 QWhatsThis::add( TextView1, tr("Displays info of selected image") ); 114 QWhatsThis::add( TextView1, tr("Displays info of selected image") );
116 imageinfoLayout->addWidget( TextView1 ); 115 imageinfoLayout->addWidget( TextView1 );
117 116
118 SlaveMaster* master = SlaveMaster::self(); 117 SlaveMaster* master = SlaveMaster::self();
119 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), 118 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
120 this, SLOT(slot_fullInfo(const QString&, const QString&)) ); 119 this, SLOT(slot_fullInfo(const QString&, const QString&)) );
121 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 120 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
122 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 121 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
123} 122}
124 123
125void imageinfo::slotChangeName(const QString&_path) 124void imageinfo::slotChangeName(const QString&_path)
126{ 125{
127 currentFile=_path; 126 currentFile=_path;
128 QFileInfo fi(_path); 127 QFileInfo fi(_path);
129 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); 128 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>");
130 SlaveMaster::self()->imageInfo( currentFile ); 129 SlaveMaster::self()->imageInfo( currentFile );
131 130
132 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); 131 QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE );
133 if (!m_pix) { 132 if (!m_pix) {
134 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); 133 PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" )));
135 SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); 134 SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE);
136 } else { 135 } else {
137 PixmapLabel1->setPixmap(*m_pix); 136 PixmapLabel1->setPixmap(*m_pix);
138 } 137 }
139} 138}
140 139
141imageinfo::~imageinfo() 140imageinfo::~imageinfo()
142{ 141{
143 { 142 {
144 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 143 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
145 } 144 }
146 if (m_viewManager) { 145 if (m_viewManager) {
147 m_viewManager->save(); 146 m_viewManager->save();
148 delete m_viewManager; 147 delete m_viewManager;
149 } 148 }
150} 149}
151 150
152void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) 151void imageinfo::slot_fullInfo(const QString&_path, const QString&_t)
153{ 152{
154 if (_path == currentFile) { 153 if (_path == currentFile) {
155 qDebug(_t); 154 qDebug(_t);
156 QString t = _t; 155 QString t = _t;
157 t.replace(QRegExp("\n"),"<br>"); 156 t.replace(QRegExp("\n"),"<br>");
158/* t.replace(QRegeExp("<qt>",""); 157/* t.replace(QRegeExp("<qt>","");
159 t.replace(QRegeExp("</qt>","");*/ 158 t.replace(QRegeExp("</qt>","");*/
160 TextView1->setText(t); 159 TextView1->setText(t);
161 } 160 }
162} 161}
163 162
164void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) 163void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix)
165{ 164{
166 if (_path == currentFile) { 165 if (_path == currentFile) {
167 if (_pix.width()>0) { 166 if (_pix.width()>0) {
168 PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); 167 PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE );
169 PixmapLabel1->setPixmap( _pix ); 168 PixmapLabel1->setPixmap( _pix );
170 PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); 169 PixmapLabel1->resize(QSize(_pix.width(),_pix.height()));
171 } 170 }
172 } 171 }
173} 172}
174 173
175void imageinfo::setPath( const QString& str ) { 174void imageinfo::setPath( const QString& str ) {
176 slotChangeName( str ); 175 slotChangeName( str );
177} 176}
178 177
179void imageinfo::setDestructiveClose() { 178void imageinfo::setDestructiveClose() {
180 WFlags fl = getWFlags(); 179 WFlags fl = getWFlags();
181 /* clear it just in case */ 180 /* clear it just in case */
182 fl &= ~WDestructiveClose; 181 fl &= ~WDestructiveClose;
183 fl |= WDestructiveClose; 182 fl |= WDestructiveClose;
184 setWFlags( fl ); 183 setWFlags( fl );
185} 184}
186 185
187 186
188/* for testing */ 187/* for testing */
189infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name) 188infoDlg::infoDlg(const QString&fname,QWidget * parent, const char * name)
190 :QDialog(parent,name,true,WStyle_ContextHelp) 189 :QDialog(parent,name,true,WStyle_ContextHelp)
191{ 190{
192 QVBoxLayout*dlglayout = new QVBoxLayout(this); 191 QVBoxLayout*dlglayout = new QVBoxLayout(this);
193 dlglayout->setSpacing(2); 192 dlglayout->setSpacing(2);
194 dlglayout->setMargin(1); 193 dlglayout->setMargin(1);
195 imageinfo*inf = new imageinfo(fname,this); 194 imageinfo*inf = new imageinfo(fname,this);
196 dlglayout->addWidget(inf); 195 dlglayout->addWidget(inf);
197} 196}
198 197
199infoDlg::~infoDlg() 198infoDlg::~infoDlg()
200{ 199{
201} 200}
202 201
203 202
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
9using namespace Opie::Core;
10
11ImageView::ImageView( QWidget* parent, const char* name, WFlags fl )
12 : ImageScrollView(parent,name,fl)
13{
14 m_viewManager = 0;
15 initKeys();
16}
17
18ImageView::~ImageView()
19{
20}
21
22Opie::Ui::OKeyConfigManager* ImageView::manager()
23{
24 if (!m_viewManager) {
25 initKeys();
26 }
27 return m_viewManager;
28}
29
30void 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
52void 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
7namespace Opie {
8 namespace Core {
9 class OConfig;
10 }
11 namespace Ui {
12 class OKeyConfigManager;
13 }
14}
15
16class ImageView:public ImageScrollView
17{
18 Q_OBJECT
19
20 enum ActionIds {
21 ViewInfo
22 };
23
24public:
25 ImageView( QWidget* parent, const char* name = 0, WFlags fl = 0 );
26 virtual ~ImageView();
27 Opie::Ui::OKeyConfigManager* manager();
28
29signals:
30 void dispImageInfo(const QString&);
31 void sig_return();
32
33protected:
34 Opie::Core::OConfig * m_cfg;
35 Opie::Ui::OKeyConfigManager*m_viewManager;
36 void initKeys();
37protected 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,272 +1,279 @@
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>
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 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;
181 for ( it = lst.begin(); it != lst.end(); ++it ) { 188 for ( it = lst.begin(); it != lst.end(); ++it ) {
182 if ( act ) 189 if ( act )
183 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 190 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
184 delete it.key(); 191 delete it.key();
185 } 192 }
186 193
187 194
188 if ( act ) { 195 if ( act ) {
189 m_view->resetView(); 196 m_view->resetView();
190 keyWid->save(); 197 keyWid->save();
191 } 198 }
192} 199}
193 200
194/* 201/*
195 * create a new image info component 202 * create a new image info component
196 * and detach the current one 203 * and detach the current one
197 * we will make the other delete on exit 204 * we will make the other delete on exit
198 */ 205 */
199template<class T> 206template<class T>
200void PMainWindow::initT( const char* name, T** ptr, int id) { 207void PMainWindow::initT( const char* name, T** ptr, int id) {
201 if ( *ptr ) { 208 if ( *ptr ) {
202 (*ptr)->disconnect(this, SLOT(slotReturn())); 209 (*ptr)->disconnect(this, SLOT(slotReturn()));
203 (*ptr)->setDestructiveClose(); 210 (*ptr)->setDestructiveClose();
204 m_stack->removeWidget( *ptr ); 211 m_stack->removeWidget( *ptr );
205 } 212 }
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}
213void PMainWindow::initInfo() { 220void 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}
217void PMainWindow::initDisp() { 224void 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 */
234void PMainWindow::slotShowInfo( const QString& inf ) { 241void PMainWindow::slotShowInfo( const QString& inf ) {
235 if ( !m_info ) { 242 if ( !m_info ) {
236 initInfo(); 243 initInfo();
237 } 244 }
238 m_info->setPath( inf ); 245 m_info->setPath( inf );
239 m_stack->raiseWidget( ImageInfo ); 246 m_stack->raiseWidget( ImageInfo );
240} 247}
241 248
242void PMainWindow::slotDisplay( const QString& inf ) { 249void PMainWindow::slotDisplay( const QString& inf ) {
243 if ( !m_disp ) { 250 if ( !m_disp ) {
244 initDisp(); 251 initDisp();
245 } 252 }
246 m_disp->setImage( inf ); 253 m_disp->setImage( inf );
247 m_stack->raiseWidget( ImageDisplay ); 254 m_stack->raiseWidget( ImageDisplay );
248} 255}
249 256
250void PMainWindow::slotReturn() { 257void PMainWindow::slotReturn() {
251 raiseIconView(); 258 raiseIconView();
252} 259}
253 260
254 261
255void PMainWindow::closeEvent( QCloseEvent* ev ) { 262void PMainWindow::closeEvent( QCloseEvent* ev ) {
256 /* 263 /*
257 * return from view 264 * return from view
258 * or properly quit 265 * or properly quit
259 */ 266 */
260 if ( m_stack->visibleWidget() == m_info || 267 if ( m_stack->visibleWidget() == m_info ||
261 m_stack->visibleWidget() == m_disp ) { 268 m_stack->visibleWidget() == m_disp ) {
262 raiseIconView(); 269 raiseIconView();
263 ev->ignore(); 270 ev->ignore();
264 return; 271 return;
265 } 272 }
266 ev->accept(); 273 ev->accept();
267 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 274 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
268} 275}
269 276
270void PMainWindow::raiseIconView() { 277void PMainWindow::raiseIconView() {
271 m_stack->raiseWidget( IconView ); 278 m_stack->raiseWidget( IconView );
272} 279}
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 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_MAIN_WINDOW_H 6#ifndef PHUNK_MAIN_WINDOW_H
7#define PHUNK_MAIN_WINDOW_H 7#define PHUNK_MAIN_WINDOW_H
8 8
9#include <opie2/oconfig.h> 9#include <opie2/oconfig.h>
10 10
11#include <qmainwindow.h> 11#include <qmainwindow.h>
12 12
13 13
14 14
15namespace Opie { 15namespace Opie {
16namespace Ui{ 16namespace Ui{
17 class OKeyConfigManager; 17 class OKeyConfigManager;
18 class OWidgetStack; 18 class OWidgetStack;
19} 19}
20} 20}
21 21
22class PIconView; 22class PIconView;
23class imageinfo; 23class imageinfo;
24class ImageScrollView; 24class ImageView;
25class PMainWindow : public QMainWindow { 25class PMainWindow : public QMainWindow {
26 Q_OBJECT 26 Q_OBJECT
27 enum Views { IconView, ImageInfo, ImageDisplay }; 27 enum Views { IconView, ImageInfo, ImageDisplay };
28public: 28public:
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
33signals: 33signals:
34 void configChanged(); 34 void configChanged();
35 35
36public slots: 36public slots:
37 void slotShowInfo( const QString& inf ); 37 void slotShowInfo( const QString& inf );
38 void slotDisplay( const QString& inf ); 38 void slotDisplay( const QString& inf );
39 void slotReturn(); 39 void slotReturn();
40 void slotRotateToggled(bool); 40 void slotRotateToggled(bool);
41 void slotScaleToggled(bool); 41 void slotScaleToggled(bool);
42 42
43protected: 43protected:
44 void raiseIconView(); 44 void raiseIconView();
45 void closeEvent( QCloseEvent* ); 45 void closeEvent( QCloseEvent* );
46 46
47private: 47private:
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
52private: 52private:
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
63private slots: 63private 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,36 +1,38 @@
1CONFIG += qt warn_on quick-app 1CONFIG += qt warn_on quick-app
2DESTDIR = $(OPIEDIR)/bin 2DESTDIR = $(OPIEDIR)/bin
3TEMPLATE = app 3TEMPLATE = app
4TARGET = opie-eye 4TARGET = opie-eye
5# the name of the resulting object 5# the name of the resulting object
6 6
7HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ 7HEADERS = 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
18SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ 19SOURCES = 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
26INTERFACES = 28INTERFACES =
27# list of ui files 29# list of ui files
28 30
29INCLUDEPATH += . $(OPIEDIR)/include 31INCLUDEPATH += . $(OPIEDIR)/include
30DEPENDPATH += $(OPIEDIR)/include 32DEPENDPATH += $(OPIEDIR)/include
31 33
32 34
33 35
34LIBS += -lqpe -lopiecore2 -lopieui2 36LIBS += -lqpe -lopiecore2 -lopieui2
35 37
36include ( $(OPIEDIR)/include.pro ) 38include ( $(OPIEDIR)/include.pro )