summaryrefslogtreecommitdiff
authorzecke <zecke>2005-06-14 21:29:17 (UTC)
committer zecke <zecke>2005-06-14 21:29:17 (UTC)
commit1c8aab0c489b9d469646a0e0ab08f500f1bbb507 (patch) (unidiff)
tree899752b16b9c00029ffd76696e6d87096a1e6d2e
parentdc9c09480660793768851e36d089e0c36e7f3eae (diff)
downloadopie-1c8aab0c489b9d469646a0e0ab08f500f1bbb507.zip
opie-1c8aab0c489b9d469646a0e0ab08f500f1bbb507.tar.gz
opie-1c8aab0c489b9d469646a0e0ab08f500f1bbb507.tar.bz2
Opie Eye:
-Change the keyboard shortcut configuration to not blacklist keys found on the joypad (up,down,left,right,enter). This was done on request of Gints Polis
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp5
-rw-r--r--noncore/graphics/opie-eye/gui/imageinfoui.cpp6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp4
3 files changed, 0 insertions, 15 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 9365932..ca5746d 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -200,133 +200,128 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
200 m_mode = 0; 200 m_mode = 0;
201 m_iconsize = 32; 201 m_iconsize = 32;
202 m_internalReset = false; 202 m_internalReset = false;
203 m_customWidget = 0; 203 m_customWidget = 0;
204 m_setDocCalled = false; 204 m_setDocCalled = false;
205 205
206 m_hbox = new QHBox( this ); 206 m_hbox = new QHBox( this );
207 QLabel* lbl = new QLabel( m_hbox ); 207 QLabel* lbl = new QLabel( m_hbox );
208 lbl->setText( tr("View as" ) ); 208 lbl->setText( tr("View as" ) );
209 209
210 m_views = new QComboBox( m_hbox, "View As" ); 210 m_views = new QComboBox( m_hbox, "View As" );
211 211
212 m_view= new QIconView( this ); 212 m_view= new QIconView( this );
213 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 213 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
214 this, SLOT(slotClicked(QIconViewItem*)) ); 214 this, SLOT(slotClicked(QIconViewItem*)) );
215 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), 215 connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
216 this, SLOT(slotClicked(QIconViewItem*)) ); 216 this, SLOT(slotClicked(QIconViewItem*)) );
217 217
218 m_view->setArrangement( QIconView::LeftToRight ); 218 m_view->setArrangement( QIconView::LeftToRight );
219 219
220 m_mode = m_cfg->readNumEntry("ListViewMode", 1); 220 m_mode = m_cfg->readNumEntry("ListViewMode", 1);
221 if (m_mode < 1 || m_mode>3) m_mode = 1; 221 if (m_mode < 1 || m_mode>3) m_mode = 1;
222 m_view->setItemTextPos( QIconView::Right ); 222 m_view->setItemTextPos( QIconView::Right );
223 if (m_mode >1) { 223 if (m_mode >1) {
224 m_view->setResizeMode(QIconView::Adjust); 224 m_view->setResizeMode(QIconView::Adjust);
225 } else { 225 } else {
226 m_view->setResizeMode(QIconView::Fixed); 226 m_view->setResizeMode(QIconView::Fixed);
227 } 227 }
228 m_iconsize = m_cfg->readNumEntry("iconsize", 32); 228 m_iconsize = m_cfg->readNumEntry("iconsize", 32);
229 if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; 229 if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE;
230 if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; 230 if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE;
231 231
232 calculateGrid(); 232 calculateGrid();
233 initKeys(); 233 initKeys();
234 loadViews(); 234 loadViews();
235} 235}
236 236
237void PIconView::setDoccalled(bool how) 237void PIconView::setDoccalled(bool how)
238{ 238{
239 m_setDocCalled = how; 239 m_setDocCalled = how;
240} 240}
241 241
242/* 242/*
243 * Unref the slave and save the keyboard manager 243 * Unref the slave and save the keyboard manager
244 */ 244 */
245PIconView::~PIconView() { 245PIconView::~PIconView() {
246 { 246 {
247 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 247 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
248 } 248 }
249 m_viewManager->save(); 249 m_viewManager->save();
250 delete m_viewManager; 250 delete m_viewManager;
251} 251}
252 252
253Opie::Core::OKeyConfigManager* PIconView::manager() { 253Opie::Core::OKeyConfigManager* PIconView::manager() {
254 return m_viewManager; 254 return m_viewManager;
255} 255}
256 256
257 257
258/* 258/*
259 * init the KeyBoard Shortcuts 259 * init the KeyBoard Shortcuts
260 * called from the c'tor 260 * called from the c'tor
261 */ 261 */
262void PIconView::initKeys() { 262void PIconView::initKeys() {
263 Opie::Core::OKeyPair::List lst; 263 Opie::Core::OKeyPair::List lst;
264 lst.append( Opie::Core::OKeyPair::upArrowKey() );
265 lst.append( Opie::Core::OKeyPair::downArrowKey() );
266 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
267 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
268 lst.append( Opie::Core::OKeyPair::returnKey() );
269 264
270 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", 265 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
271 lst, false,this, "keyconfig name" ); 266 lst, false,this, "keyconfig name" );
272 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", 267 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
273 Opie::Core::OResource::loadPixmap("beam", Opie::Core::OResource::SmallIcon), 268 Opie::Core::OResource::loadPixmap("beam", Opie::Core::OResource::SmallIcon),
274 BeamItem, Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), 269 BeamItem, Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton),
275 this, SLOT(slotBeam())) ); 270 this, SLOT(slotBeam())) );
276 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", 271 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
277 Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon), 272 Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
278 DeleteItem, Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), 273 DeleteItem, Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton),
279 this, SLOT(slotTrash())) ); 274 this, SLOT(slotTrash())) );
280 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", 275 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
281 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), 276 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
282 ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 277 ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
283 this, SLOT(slotShowImage()))); 278 this, SLOT(slotShowImage())));
284 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info", 279 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
285 Opie::Core::OResource::loadPixmap("DocumentTypeWord", Opie::Core::OResource::SmallIcon), 280 Opie::Core::OResource::loadPixmap("DocumentTypeWord", Opie::Core::OResource::SmallIcon),
286 InfoItem, Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ), 281 InfoItem, Opie::Core::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
287 this, SLOT(slotImageInfo()) ) ); 282 this, SLOT(slotImageInfo()) ) );
288 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow", 283 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Start slideshow"), "slideshow",
289 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), 284 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
290 SlideItem, Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton), 285 SlideItem, Opie::Core::OKeyPair(Qt::Key_S, Qt::ShiftButton),
291 this, SLOT(slotStartSlide()))); 286 this, SLOT(slotStartSlide())));
292 m_viewManager->load(); 287 m_viewManager->load();
293 m_viewManager->handleWidget( m_view ); 288 m_viewManager->handleWidget( m_view );
294} 289}
295 290
296 291
297/* 292/*
298 * change one dir up 293 * change one dir up
299 */ 294 */
300void PIconView::slotDirUp() 295void PIconView::slotDirUp()
301{ 296{
302 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) ); 297 slotChangeDir( currentView()->dirLister()->dirUp( m_path ) );
303} 298}
304 299
305/* 300/*
306 * change the dir 301 * change the dir
307 */ 302 */
308void PIconView::slotChangeDir(const QString& path) { 303void PIconView::slotChangeDir(const QString& path) {
309 if ( !currentView() ) 304 if ( !currentView() )
310 return; 305 return;
311 306
312 PDirLister *lister = currentView()->dirLister(); 307 PDirLister *lister = currentView()->dirLister();
313 if (!lister ) 308 if (!lister )
314 return; 309 return;
315 310
316 /* 311 /*
317 * Say what we want and take what we get 312 * Say what we want and take what we get
318 */ 313 */
319 lister->setStartPath( path ); 314 lister->setStartPath( path );
320 m_path = lister->currentPath(); 315 m_path = lister->currentPath();
321 316
322 m_view->viewport()->setUpdatesEnabled( false ); 317 m_view->viewport()->setUpdatesEnabled( false );
323 m_view->clear(); 318 m_view->clear();
324 319
325 // Also invalidate the cache. We can't cancel the operations anyway 320 // Also invalidate the cache. We can't cancel the operations anyway
326 g_stringPix.clear(); 321 g_stringPix.clear();
327 g_stringInf.clear(); 322 g_stringInf.clear();
328 323
329 /* 324 /*
330 * add files and folders 325 * add files and folders
331 */ 326 */
332 addFolders( lister->folders() ); 327 addFolders( lister->folders() );
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
index 8f70602..8e31521 100644
--- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp
+++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp
@@ -2,134 +2,128 @@
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#include <opie2/oresource.h> 22#include <opie2/oresource.h>
23 23
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.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(Opie::Core::OConfig *cfg,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 m_cfg = cfg;
35 init(name); 35 init(name);
36 initKeys(); 36 initKeys();
37} 37}
38 38
39imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl ) 39imageinfo::imageinfo(const QString&_path, QWidget* parent, const char* name, WFlags fl )
40 : QWidget( parent, name, fl ),currentFile(_path) 40 : QWidget( parent, name, fl ),currentFile(_path)
41{ 41{
42 m_viewManager = 0; 42 m_viewManager = 0;
43 m_cfg = 0; 43 m_cfg = 0;
44 init(name); 44 init(name);
45 initKeys(); 45 initKeys();
46 slotChangeName(_path); 46 slotChangeName(_path);
47} 47}
48 48
49Opie::Core::OKeyConfigManager* imageinfo::manager() 49Opie::Core::OKeyConfigManager* imageinfo::manager()
50{ 50{
51 if (!m_viewManager) { 51 if (!m_viewManager) {
52 initKeys(); 52 initKeys();
53 } 53 }
54 return m_viewManager; 54 return m_viewManager;
55} 55}
56 56
57void imageinfo::initKeys() 57void imageinfo::initKeys()
58{ 58{
59#if 0 59#if 0
60 if (!m_cfg) { 60 if (!m_cfg) {
61 m_cfg = new Opie::Core::OConfig("phunkview"); 61 m_cfg = new Opie::Core::OConfig("phunkview");
62 m_cfg->setGroup("imageinfo_keys" ); 62 m_cfg->setGroup("imageinfo_keys" );
63 } 63 }
64#endif 64#endif
65 Opie::Core::OKeyPair::List lst; 65 Opie::Core::OKeyPair::List lst;
66 lst.append( Opie::Core::OKeyPair::upArrowKey() );
67 lst.append( Opie::Core::OKeyPair::downArrowKey() );
68 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
69 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
70 lst.append( Opie::Core::OKeyPair::returnKey() );
71
72 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "imageinfo_keys", 66 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "imageinfo_keys",
73 lst, false,this, "keyconfig name" ); 67 lst, false,this, "keyconfig name" );
74 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Full Image"), "infoview", 68 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Full Image"), "infoview",
75 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), 69 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
76 ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), 70 ViewItem, Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton),
77 this, SLOT(slotShowImage()))); 71 this, SLOT(slotShowImage())));
78 m_viewManager->load(); 72 m_viewManager->load();
79 m_viewManager->handleWidget( this ); 73 m_viewManager->handleWidget( this );
80 m_viewManager->handleWidget( TextView1 ); 74 m_viewManager->handleWidget( TextView1 );
81} 75}
82 76
83void imageinfo::slotShowImage() 77void imageinfo::slotShowImage()
84{ 78{
85 emit dispImage(currentFile); 79 emit dispImage(currentFile);
86} 80}
87 81
88void imageinfo::init(const char* name) { 82void imageinfo::init(const char* name) {
89 { 83 {
90 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 84 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
91 } 85 }
92 if ( !name ) 86 if ( !name )
93 setName( "imageinfo" ); 87 setName( "imageinfo" );
94 resize( 289, 335 ); 88 resize( 289, 335 );
95 setCaption( tr( "Image info" ) ); 89 setCaption( tr( "Image info" ) );
96 imageinfoLayout = new QVBoxLayout( this ); 90 imageinfoLayout = new QVBoxLayout( this );
97 imageinfoLayout->setSpacing(2); 91 imageinfoLayout->setSpacing(2);
98 imageinfoLayout->setMargin(4); 92 imageinfoLayout->setMargin(4);
99 93
100 PixmapLabel1 = new QLabel( this, "PixmapLabel1" ); 94 PixmapLabel1 = new QLabel( this, "PixmapLabel1" );
101 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) ); 95 PixmapLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, PixmapLabel1->sizePolicy().hasHeightForWidth() ) );
102 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") ); 96 QWhatsThis::add( PixmapLabel1, tr("Displays an thumbnail of the image") );
103 97
104 imageinfoLayout->addWidget( PixmapLabel1 ); 98 imageinfoLayout->addWidget( PixmapLabel1 );
105 99
106 Line1 = new QFrame( this, "Line1" ); 100 Line1 = new QFrame( this, "Line1" );
107 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 101 Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
108 imageinfoLayout->addWidget( Line1 ); 102 imageinfoLayout->addWidget( Line1 );
109 103
110 fnameLabel = new QLabel( this, "FnameLabel" ); 104 fnameLabel = new QLabel( this, "FnameLabel" );
111 imageinfoLayout->addWidget( fnameLabel); 105 imageinfoLayout->addWidget( fnameLabel);
112 106
113 TextView1 = new QTextView( this, "TextView1" ); 107 TextView1 = new QTextView( this, "TextView1" );
114 TextView1->setFrameShadow( QTextView::Sunken ); 108 TextView1->setFrameShadow( QTextView::Sunken );
115 TextView1->setResizePolicy( QTextView::AutoOneFit ); 109 TextView1->setResizePolicy( QTextView::AutoOneFit );
116 TextView1->setBackgroundOrigin( QTextView::ParentOrigin ); 110 TextView1->setBackgroundOrigin( QTextView::ParentOrigin );
117 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) ); 111 TextView1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, TextView1->sizePolicy().hasHeightForWidth() ) );
118// TextView1->setVScrollBarMode(QScrollView::AlwaysOn); 112// TextView1->setVScrollBarMode(QScrollView::AlwaysOn);
119 QWhatsThis::add( TextView1, tr("Displays info of selected image") ); 113 QWhatsThis::add( TextView1, tr("Displays info of selected image") );
120 imageinfoLayout->addWidget( TextView1 ); 114 imageinfoLayout->addWidget( TextView1 );
121 115
122 SlaveMaster* master = SlaveMaster::self(); 116 SlaveMaster* master = SlaveMaster::self();
123 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)), 117 connect( master, SIGNAL(sig_fullInfo(const QString&, const QString&)),
124 this, SLOT(slot_fullInfo(const QString&, const QString&)) ); 118 this, SLOT(slot_fullInfo(const QString&, const QString&)) );
125 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)), 119 connect(master, SIGNAL( sig_thumbNail(const QString&, const QPixmap&)),
126 this, SLOT(slotThumbNail(const QString&, const QPixmap&))); 120 this, SLOT(slotThumbNail(const QString&, const QPixmap&)));
127} 121}
128 122
129void imageinfo::slotChangeName(const QString&_path) 123void imageinfo::slotChangeName(const QString&_path)
130{ 124{
131 currentFile=_path; 125 currentFile=_path;
132 QFileInfo fi(_path); 126 QFileInfo fi(_path);
133 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>"); 127 fnameLabel->setText("<qt><center><b>"+fi.fileName()+"</b></center></qt>");
134 SlaveMaster::self()->imageInfo( currentFile ); 128 SlaveMaster::self()->imageInfo( currentFile );
135 129
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index cda1a96..ec891a8 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -84,132 +84,128 @@ void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, Q
84 m_hGroup = hGroup; 84 m_hGroup = hGroup;
85 m_gBright = brightGroup; 85 m_gBright = brightGroup;
86} 86}
87 87
88ImageView::~ImageView() 88ImageView::~ImageView()
89{ 89{
90 odebug << "Destructor imageview" << oendl; 90 odebug << "Destructor imageview" << oendl;
91 delete m_viewManager; 91 delete m_viewManager;
92} 92}
93 93
94Opie::Core::OKeyConfigManager* ImageView::manager() 94Opie::Core::OKeyConfigManager* ImageView::manager()
95{ 95{
96 if (!m_viewManager) { 96 if (!m_viewManager) {
97 initKeys(); 97 initKeys();
98 } 98 }
99 return m_viewManager; 99 return m_viewManager;
100} 100}
101 101
102void ImageView::startSlide(int value) 102void ImageView::startSlide(int value)
103{ 103{
104 if (!m_slideTimer) { 104 if (!m_slideTimer) {
105 m_slideTimer = new QTimer(this); 105 m_slideTimer = new QTimer(this);
106 } 106 }
107 m_slideValue=value; 107 m_slideValue=value;
108 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); 108 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
109 /* this "+1" is one millisecond. with that we can setup a slideshowvalue 109 /* this "+1" is one millisecond. with that we can setup a slideshowvalue
110 of 0. eg "as fast as possible". 110 of 0. eg "as fast as possible".
111 */ 111 */
112 m_slideTimer->start(m_slideValue*1000+1,true); 112 m_slideTimer->start(m_slideValue*1000+1,true);
113} 113}
114 114
115void ImageView::stopSlide() 115void ImageView::stopSlide()
116{ 116{
117 if (!m_slideTimer) { 117 if (!m_slideTimer) {
118 return; 118 return;
119 } 119 }
120 m_slideTimer->stop(); 120 m_slideTimer->stop();
121 delete m_slideTimer; 121 delete m_slideTimer;
122 m_slideTimer = 0; 122 m_slideTimer = 0;
123} 123}
124 124
125void ImageView::nextSlide() 125void ImageView::nextSlide()
126{ 126{
127 if (!m_slideTimer) { 127 if (!m_slideTimer) {
128 return; 128 return;
129 } 129 }
130#if 0 130#if 0
131 if (isHidden()) { 131 if (isHidden()) {
132 delete m_slideTimer; 132 delete m_slideTimer;
133 m_slideTimer = 0; 133 m_slideTimer = 0;
134 return; 134 return;
135 } 135 }
136#endif 136#endif
137 emit dispNext(); 137 emit dispNext();
138 m_slideTimer->start(m_slideValue*1000,true); 138 m_slideTimer->start(m_slideValue*1000,true);
139} 139}
140void ImageView::initKeys() 140void ImageView::initKeys()
141{ 141{
142 odebug << "init imageview keys" << oendl; 142 odebug << "init imageview keys" << oendl;
143 if (!m_cfg) { 143 if (!m_cfg) {
144 m_cfg = new Opie::Core::OConfig("opie-eye"); 144 m_cfg = new Opie::Core::OConfig("opie-eye");
145 m_cfg->setGroup("image_view_keys" ); 145 m_cfg->setGroup("image_view_keys" );
146 } 146 }
147 Opie::Core::OKeyPair::List lst; 147 Opie::Core::OKeyPair::List lst;
148 lst.append( Opie::Core::OKeyPair::upArrowKey() );
149 lst.append( Opie::Core::OKeyPair::downArrowKey() );
150 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
151 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
152 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); 148 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
153 149
154 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 150 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
155 lst, false,this, "image_view_keys" ); 151 lst, false,this, "image_view_keys" );
156 152
157 /** 153 /**
158 * Handle KeyEvents when they're pressed. This avoids problems 154 * Handle KeyEvents when they're pressed. This avoids problems
159 * with 'double next' on Return. 155 * with 'double next' on Return.
160 * The Return press would switch to this view and the return 156 * The Return press would switch to this view and the return
161 * release would emit the dispNext Signal. 157 * release would emit the dispNext Signal.
162 */ 158 */
163 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); 159 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed );
164 160
165 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 161 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
166 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), 162 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
167 ViewInfo, Opie::Core::OKeyPair(Qt::Key_I,0), 163 ViewInfo, Opie::Core::OKeyPair(Qt::Key_I,0),
168 this, SLOT(slotShowImageInfo()))); 164 this, SLOT(slotShowImageInfo())));
169 165
170 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", 166 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
171 Opie::Core::OResource::loadPixmap("rotate", Opie::Core::OResource::SmallIcon), 167 Opie::Core::OResource::loadPixmap("rotate", Opie::Core::OResource::SmallIcon),
172 Autorotate, Opie::Core::OKeyPair(Qt::Key_R,0), 168 Autorotate, Opie::Core::OKeyPair(Qt::Key_R,0),
173 this, SIGNAL(toggleAutorotate()))); 169 this, SIGNAL(toggleAutorotate())));
174 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", 170 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
175 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon), 171 Opie::Core::OResource::loadPixmap("1to1", Opie::Core::OResource::SmallIcon),
176 Autoscale, Opie::Core::OKeyPair(Qt::Key_S,0), 172 Autoscale, Opie::Core::OKeyPair(Qt::Key_S,0),
177 this, SIGNAL(toggleAutoscale()))); 173 this, SIGNAL(toggleAutoscale())));
178 174
179 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", 175 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
180 Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon), 176 Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon),
181 ShowNext, Opie::Core::OKeyPair(Qt::Key_Return,0), 177 ShowNext, Opie::Core::OKeyPair(Qt::Key_Return,0),
182 this, SIGNAL(dispNext()))); 178 this, SIGNAL(dispNext())));
183 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", 179 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
184 Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon), 180 Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
185 ShowPrevious, Opie::Core::OKeyPair(Qt::Key_P,0), 181 ShowPrevious, Opie::Core::OKeyPair(Qt::Key_P,0),
186 this, SIGNAL(dispPrev()))); 182 this, SIGNAL(dispPrev())));
187 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", 183 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
188 Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon), 184 Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon),
189 FullScreen, Opie::Core::OKeyPair(Qt::Key_F,0), 185 FullScreen, Opie::Core::OKeyPair(Qt::Key_F,0),
190 this, SIGNAL(toggleFullScreen()))); 186 this, SIGNAL(toggleFullScreen())));
191 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", 187 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
192 Opie::Core::OResource::loadPixmap("mag", Opie::Core::OResource::SmallIcon), 188 Opie::Core::OResource::loadPixmap("mag", Opie::Core::OResource::SmallIcon),
193 Zoomer, Opie::Core::OKeyPair(Qt::Key_T,0), 189 Zoomer, Opie::Core::OKeyPair(Qt::Key_T,0),
194 this, SIGNAL(toggleZoomer()))); 190 this, SIGNAL(toggleZoomer())));
195 191
196 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness", 192 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness",
197 Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon), 193 Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon),
198 Incbrightness, Opie::Core::OKeyPair(Qt::Key_B,0), 194 Incbrightness, Opie::Core::OKeyPair(Qt::Key_B,0),
199 this, SIGNAL(incBrightness()))); 195 this, SIGNAL(incBrightness())));
200 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Decrease brightness"), "decbrightness", 196 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Decrease brightness"), "decbrightness",
201 Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon), 197 Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon),
202 Decbrightness, Opie::Core::OKeyPair(Qt::Key_D,0), 198 Decbrightness, Opie::Core::OKeyPair(Qt::Key_D,0),
203 this, SIGNAL(decBrightness()))); 199 this, SIGNAL(decBrightness())));
204 m_viewManager->handleWidget( this ); 200 m_viewManager->handleWidget( this );
205 m_viewManager->load(); 201 m_viewManager->load();
206} 202}
207 203
208void ImageView::keyReleaseEvent(QKeyEvent * e) 204void ImageView::keyReleaseEvent(QKeyEvent * e)
209{ 205{
210 if (!e || e->state()!=0) { 206 if (!e || e->state()!=0) {
211 return; 207 return;
212 } 208 }
213 if (e->key()==Qt::Key_Escape) { 209 if (e->key()==Qt::Key_Escape) {
214 if (fullScreen()) { 210 if (fullScreen()) {
215 emit hideMe(); 211 emit hideMe();