summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp45
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h11
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp3
3 files changed, 19 insertions, 40 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 5b00dea..03f3c1c 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,185 +1,168 @@
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#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12 12
13ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) 13ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
14 : Opie::MM::OImageScrollView(parent,name,fl) 14 : Opie::MM::OImageScrollView(parent,name,fl)
15{ 15{
16 m_viewManager = 0; 16 m_viewManager = 0;
17 m_focus_out = false; 17 focus_in_count = 0;
18 block_next_focus = true;
19 m_cfg = cfg; 18 m_cfg = cfg;
20 m_isFullScreen = false; 19 m_isFullScreen = false;
20 m_ignore_next_in = false;
21 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); 21 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
22 initKeys(); 22 initKeys();
23} 23}
24 24
25ImageView::~ImageView() 25ImageView::~ImageView()
26{ 26{
27 odebug << "Delete Imageview" << oendl; 27 odebug << "Delete Imageview" << oendl;
28 if (m_viewManager) { 28 if (m_viewManager) {
29 delete m_viewManager; 29 delete m_viewManager;
30 } 30 }
31} 31}
32 32
33Opie::Core::OKeyConfigManager* ImageView::manager() 33Opie::Core::OKeyConfigManager* ImageView::manager()
34{ 34{
35 if (!m_viewManager) { 35 if (!m_viewManager) {
36 initKeys(); 36 initKeys();
37 } 37 }
38 return m_viewManager; 38 return m_viewManager;
39} 39}
40 40
41void ImageView::initKeys() 41void ImageView::initKeys()
42{ 42{
43 odebug << "init imageview keys" << oendl; 43 odebug << "init imageview keys" << oendl;
44 if (!m_cfg) { 44 if (!m_cfg) {
45 m_cfg = new Opie::Core::OConfig("phunkview"); 45 m_cfg = new Opie::Core::OConfig("phunkview");
46 m_cfg->setGroup("image_view_keys" ); 46 m_cfg->setGroup("image_view_keys" );
47 } 47 }
48 Opie::Core::OKeyPair::List lst; 48 Opie::Core::OKeyPair::List lst;
49 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 49 lst.append( Opie::Core::OKeyPair::upArrowKey() );
50 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 50 lst.append( Opie::Core::OKeyPair::downArrowKey() );
51 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 51 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
52 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 52 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
53 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); 53 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
54 54
55 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 55 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
56 lst, false,this, "image_view_keys" ); 56 lst, false,this, "image_view_keys" );
57 57
58 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 58 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
59 Resource::loadPixmap("1to1"), ViewInfo, 59 Resource::loadPixmap("1to1"), ViewInfo,
60 Opie::Core::OKeyPair(Qt::Key_I,0), 60 Opie::Core::OKeyPair(Qt::Key_I,0),
61 this, SLOT(slotShowImageInfo()))); 61 this, SLOT(slotShowImageInfo())));
62 62
63 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", 63 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
64 Resource::loadPixmap("rotate"), Autorotate, 64 Resource::loadPixmap("rotate"), Autorotate,
65 Opie::Core::OKeyPair(Qt::Key_R,0), 65 Opie::Core::OKeyPair(Qt::Key_R,0),
66 this, SIGNAL(toggleAutorotate()))); 66 this, SIGNAL(toggleAutorotate())));
67 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", 67 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
68 Resource::loadPixmap("1to1"), Autoscale, 68 Resource::loadPixmap("1to1"), Autoscale,
69 Opie::Core::OKeyPair(Qt::Key_S,0), 69 Opie::Core::OKeyPair(Qt::Key_S,0),
70 this, SIGNAL(toggleAutoscale()))); 70 this, SIGNAL(toggleAutoscale())));
71 71
72 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", 72 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
73 Resource::loadPixmap("forward"), ShowNext, 73 Resource::loadPixmap("forward"), ShowNext,
74 Opie::Core::OKeyPair(Qt::Key_Return,0), 74 Opie::Core::OKeyPair(Qt::Key_Return,0),
75 this, SIGNAL(dispNext()))); 75 this, SIGNAL(dispNext())));
76 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", 76 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
77 Resource::loadPixmap("back"), ShowPrevious, 77 Resource::loadPixmap("back"), ShowPrevious,
78 Opie::Core::OKeyPair(Qt::Key_P,0), 78 Opie::Core::OKeyPair(Qt::Key_P,0),
79 this, SIGNAL(dispPrev()))); 79 this, SIGNAL(dispPrev())));
80 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", 80 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
81 Resource::loadPixmap("fullscreen"), FullScreen, 81 Resource::loadPixmap("fullscreen"), FullScreen,
82 Opie::Core::OKeyPair(Qt::Key_F,0), 82 Opie::Core::OKeyPair(Qt::Key_F,0),
83 this, SIGNAL(toggleFullScreen()))); 83 this, SIGNAL(toggleFullScreen())));
84 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", 84 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
85 Resource::loadPixmap("mag"), Zoomer, 85 Resource::loadPixmap("mag"), Zoomer,
86 Opie::Core::OKeyPair(Qt::Key_T,0), 86 Opie::Core::OKeyPair(Qt::Key_T,0),
87 this, SIGNAL(toggleZoomer()))); 87 this, SIGNAL(toggleZoomer())));
88 m_viewManager->handleWidget( this ); 88 m_viewManager->handleWidget( this );
89 m_viewManager->load(); 89 m_viewManager->load();
90} 90}
91 91
92void ImageView::keyReleaseEvent(QKeyEvent * e) 92void ImageView::keyReleaseEvent(QKeyEvent * e)
93{ 93{
94 if (!e || e->state()!=0) { 94 if (!e || e->state()!=0) {
95 return; 95 return;
96 } 96 }
97 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); 97 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe();
98} 98}
99 99
100void ImageView::slotShowImageInfo() 100void ImageView::slotShowImageInfo()
101{ 101{
102 emit dispImageInfo(m_lastName); 102 emit dispImageInfo(m_lastName);
103} 103}
104 104
105void ImageView::contentsMousePressEvent ( QMouseEvent * e) 105void ImageView::contentsMousePressEvent ( QMouseEvent * e)
106{ 106{
107 if (e->button()==1) { 107 if (e->button()==1) {
108 return OImageScrollView::contentsMousePressEvent(e); 108 return OImageScrollView::contentsMousePressEvent(e);
109 } 109 }
110// if (!fullScreen()) return;
111 odebug << "Popup " << oendl; 110 odebug << "Popup " << oendl;
112 QPopupMenu *m = new QPopupMenu(0); 111 QPopupMenu *m = new QPopupMenu(0);
113 if (!m) return; 112 if (!m) return;
114 bool old = fullScreen(); 113 bool old = fullScreen();
115 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen())); 114 m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
116 if (fullScreen()) { 115 if (fullScreen()) {
117 m->insertSeparator(); 116 m->insertSeparator();
118 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev())); 117 m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev()));
119 m->insertItem(tr("Next image"),this,SIGNAL(dispNext())); 118 m->insertItem(tr("Next image"),this,SIGNAL(dispNext()));
120 m->insertSeparator(); 119 m->insertSeparator();
121 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale())); 120 m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale()));
122 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate())); 121 m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate()));
123 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer())); 122 m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer()));
124 } 123 }
125 m->setFocus(); 124 m->setFocus();
126 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 125 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
127 delete m; 126 delete m;
128 /* if we were fullScreen() and must overlap the taskbar again */
129 if (fullScreen() && old) {
130 enableFullscreen();
131 }
132} 127}
133 128
134void ImageView::setFullScreen(bool how) 129void ImageView::setFullScreen(bool how)
135{ 130{
136 m_isFullScreen = how; 131 m_isFullScreen = how;
137} 132}
138 133
139void ImageView::focusInEvent(QFocusEvent *) 134void ImageView::focusInEvent(QFocusEvent *)
140{ 135{
141 // Always do it here, no matter the size. 136 // Always do it here, no matter the size.
142 odebug << "Focus in" << oendl; 137 odebug << "Focus in (view)" << oendl;
143} 138 //if (fullScreen()) parentWidget()->showNormal();
144 139 if (m_ignore_next_in){m_ignore_next_in=false;return;}
145void ImageView::focusOutEvent(QFocusEvent *) 140 if (fullScreen()) enableFullscreen();
146{
147 odebug << "Focus out" << oendl;
148} 141}
149 142
150void ImageView::enableFullscreen() 143void ImageView::enableFullscreen()
151{ 144{
152 // This call is needed because showFullScreen won't work 145 // This call is needed because showFullScreen won't work
153 // correctly if the widget already considers itself to be fullscreen. 146 // correctly if the widget already considers itself to be fullscreen.
147 if (!fullScreen()) return;
148 if (m_ignore_next_in) {m_ignore_next_in = false;return;}
149
154 setUpdatesEnabled(false); 150 setUpdatesEnabled(false);
155 odebug << "showNormal();" << oendl;
156 parentWidget()->showNormal(); 151 parentWidget()->showNormal();
157 odebug << "showNormal(); done " << oendl;
158 // This is needed because showNormal() forcefully changes the window 152 // This is needed because showNormal() forcefully changes the window
159 // style to WSTyle_TopLevel. 153 // style to WSTyle_TopLevel.
160 odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));" << oendl;
161 parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 154 parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
162 odebug << " reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); done" << oendl;
163 // Enable fullscreen. 155 // Enable fullscreen.
164 odebug << "showFullScreen();" << oendl; 156 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
157 * so we must block it here! */
158 m_ignore_next_in = true;
165 parentWidget()->showFullScreen(); 159 parentWidget()->showFullScreen();
166 odebug << "showFullScreen(); done" << oendl;
167 setUpdatesEnabled(true); 160 setUpdatesEnabled(true);
168} 161}
169 162
170void ImageWidget::show()
171{
172 QWidget::show();
173}
174
175void ImageWidget::hide()
176{
177 QWidget::hide();
178}
179
180ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f) 163ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f)
181 : QWidget(parent,name,f) 164 : QWidget(parent,name,f)
182{ 165{
183 // Make sure size is correct 166 // Make sure size is correct
184 setFixedSize(qApp->desktop()->size()); 167 setFixedSize(qApp->desktop()->size());
185} 168}
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index 5f15bc9..f3c37b5 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -1,80 +1,77 @@
1#ifndef _IMAGE_VIEW_H 1#ifndef _IMAGE_VIEW_H
2#define _IMAGE_VIEW_H 2#define _IMAGE_VIEW_H
3 3
4#include <opie2/oimagescrollview.h> 4#include <opie2/oimagescrollview.h>
5 5
6#include <qwidget.h> 6#include <qwidget.h>
7 7
8namespace Opie { 8namespace Opie {
9 namespace Core { 9 namespace Core {
10 class OConfig; 10 class OConfig;
11 class OKeyConfigManager; 11 class OKeyConfigManager;
12 } 12 }
13} 13}
14 14
15class ImageView:public Opie::MM::OImageScrollView 15class ImageView:public Opie::MM::OImageScrollView
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19 enum ActionIds { 19 enum ActionIds {
20 ViewInfo, 20 ViewInfo,
21 FullScreen, 21 FullScreen,
22 ShowNext, 22 ShowNext,
23 ShowPrevious, 23 ShowPrevious,
24 Zoomer, 24 Zoomer,
25 Autorotate, 25 Autorotate,
26 Autoscale 26 Autoscale
27 }; 27 };
28 28
29public: 29public:
30 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 ); 30 ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name = 0, WFlags fl = 0 );
31 virtual ~ImageView(); 31 virtual ~ImageView();
32 Opie::Core::OKeyConfigManager* manager(); 32 Opie::Core::OKeyConfigManager* manager();
33 void setFullScreen(bool how); 33 void setFullScreen(bool how);
34 virtual void enableFullscreen();
35 bool fullScreen(){return m_isFullScreen;} 34 bool fullScreen(){return m_isFullScreen;}
35 virtual void enableFullscreen();
36 36
37signals: 37signals:
38 void dispImageInfo(const QString&); 38 void dispImageInfo(const QString&);
39 void dispNext(); 39 void dispNext();
40 void dispPrev(); 40 void dispPrev();
41 void toggleFullScreen(); 41 void toggleFullScreen();
42 void hideMe(); 42 void hideMe();
43 void toggleZoomer(); 43 void toggleZoomer();
44 void toggleAutoscale(); 44 void toggleAutoscale();
45 void toggleAutorotate(); 45 void toggleAutorotate();
46 46
47protected: 47protected:
48 Opie::Core::OConfig * m_cfg; 48 Opie::Core::OConfig * m_cfg;
49 Opie::Core::OKeyConfigManager*m_viewManager; 49 Opie::Core::OKeyConfigManager*m_viewManager;
50 void initKeys(); 50 void initKeys();
51 bool m_isFullScreen:1; 51 bool m_isFullScreen:1;
52 bool m_focus_out:1; 52 bool m_ignore_next_in:1;
53 bool block_next_focus:1; 53 int focus_in_count;
54
55 virtual void focusInEvent ( QFocusEvent * ); 54 virtual void focusInEvent ( QFocusEvent * );
56 virtual void focusOutEvent ( QFocusEvent * ); 55
57 56
58protected slots: 57protected slots:
59 virtual void slotShowImageInfo(); 58 virtual void slotShowImageInfo();
60 virtual void keyReleaseEvent(QKeyEvent * e); 59 virtual void keyReleaseEvent(QKeyEvent * e);
61 virtual void contentsMousePressEvent ( QMouseEvent * e); 60 virtual void contentsMousePressEvent ( QMouseEvent * e);
62}; 61};
63 62
64class ImageWidget:public QWidget 63class ImageWidget:public QWidget
65{ 64{
66 Q_OBJECT 65 Q_OBJECT
67public: 66public:
68 ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder); 67 ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder);
69 virtual ~ImageWidget(){}; 68 virtual ~ImageWidget(){};
70 69
71protected: 70protected:
72 71
73public slots: 72public slots:
74 virtual void show();
75 virtual void hide();
76 73
77protected slots: 74protected slots:
78}; 75};
79 76
80#endif 77#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index fa1680c..cdaf34c 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -17,441 +17,440 @@
17#include <opie2/owidgetstack.h> 17#include <opie2/owidgetstack.h>
18#include <opie2/oapplicationfactory.h> 18#include <opie2/oapplicationfactory.h>
19#include <opie2/otabwidget.h> 19#include <opie2/otabwidget.h>
20#include <opie2/okeyconfigwidget.h> 20#include <opie2/okeyconfigwidget.h>
21 21
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/ir.h> 24#include <qpe/ir.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qtoolbar.h> 27#include <qtoolbar.h>
28#include <qtoolbutton.h> 28#include <qtoolbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qdialog.h> 30#include <qdialog.h>
31#include <qmap.h> 31#include <qmap.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qframe.h> 33#include <qframe.h>
34 34
35 35
36 36
37//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 37//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
38OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 38OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
39 39
40PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 40PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
41 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 41 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
42{ 42{
43 setCaption( QObject::tr("Opie Eye Caramba" ) ); 43 setCaption( QObject::tr("Opie Eye Caramba" ) );
44 m_cfg = new Opie::Core::OConfig("phunkview"); 44 m_cfg = new Opie::Core::OConfig("phunkview");
45 m_cfg->setGroup("Zecke_view" ); 45 m_cfg->setGroup("Zecke_view" );
46 tFrame = 0; 46 tFrame = 0;
47// qDebug( "Process-wide OApplication object @ %0x", oApp ); 47// qDebug( "Process-wide OApplication object @ %0x", oApp );
48 /* 48 /*
49 * Initialize ToolBar and IconView 49 * Initialize ToolBar and IconView
50 * And Connect Them 50 * And Connect Them
51 */ 51 */
52 QToolBar *bar = new QToolBar( this ); 52 QToolBar *bar = new QToolBar( this );
53 bar->setHorizontalStretchable( true ); 53 bar->setHorizontalStretchable( true );
54 setToolBarsMovable( false ); 54 setToolBarsMovable( false );
55 55
56 m_stack = new Opie::Ui::OWidgetStack( this ); 56 m_stack = new Opie::Ui::OWidgetStack( this );
57 setCentralWidget( m_stack ); 57 setCentralWidget( m_stack );
58 58
59 m_view = new PIconView( m_stack, m_cfg ); 59 m_view = new PIconView( m_stack, m_cfg );
60 m_stack->addWidget( m_view, IconView ); 60 m_stack->addWidget( m_view, IconView );
61 m_stack->raiseWidget( IconView ); 61 m_stack->raiseWidget( IconView );
62 connect(m_view, SIGNAL(sig_display(const QString&)), 62 connect(m_view, SIGNAL(sig_display(const QString&)),
63 this, SLOT(slotDisplay(const QString&))); 63 this, SLOT(slotDisplay(const QString&)));
64 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 64 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
65 this, SLOT(slotShowInfo(const QString&)) ); 65 this, SLOT(slotShowInfo(const QString&)) );
66 66
67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
68 68
69 upButton = new QToolButton( bar ); 69 upButton = new QToolButton( bar );
70 upButton->setIconSet( Resource::loadIconSet( "up" ) ); 70 upButton->setIconSet( Resource::loadIconSet( "up" ) );
71 connect( upButton, SIGNAL(clicked()), 71 connect( upButton, SIGNAL(clicked()),
72 m_view, SLOT(slotDirUp()) ); 72 m_view, SLOT(slotDirUp()) );
73 73
74 fsButton = new PFileSystem( bar ); 74 fsButton = new PFileSystem( bar );
75 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 75 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
76 m_view, SLOT(slotChangeDir( const QString& ) ) ); 76 m_view, SLOT(slotChangeDir( const QString& ) ) );
77 77
78 QToolButton*btn = new QToolButton( bar ); 78 QToolButton*btn = new QToolButton( bar );
79 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 79 btn->setIconSet( Resource::loadIconSet( "edit" ) );
80 connect( btn, SIGNAL(clicked()), 80 connect( btn, SIGNAL(clicked()),
81 m_view, SLOT(slotRename()) ); 81 m_view, SLOT(slotRename()) );
82 82
83 if ( Ir::supported() ) { 83 if ( Ir::supported() ) {
84 btn = new QToolButton( bar ); 84 btn = new QToolButton( bar );
85 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 85 btn->setIconSet( Resource::loadIconSet( "beam" ) );
86 connect( btn, SIGNAL(clicked()), 86 connect( btn, SIGNAL(clicked()),
87 m_view, SLOT(slotBeam()) ); 87 m_view, SLOT(slotBeam()) );
88 } 88 }
89 89
90 btn = new QToolButton( bar ); 90 btn = new QToolButton( bar );
91 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 91 btn->setIconSet( Resource::loadIconSet( "trash" ) );
92 connect( btn, SIGNAL(clicked() ), 92 connect( btn, SIGNAL(clicked() ),
93 m_view, SLOT(slotTrash() ) ); 93 m_view, SLOT(slotTrash() ) );
94 94
95 95
96 int mode = m_cfg->readNumEntry("ListViewMode", 1); 96 int mode = m_cfg->readNumEntry("ListViewMode", 1);
97 if (mode < 1 || mode>3) mode = 1; 97 if (mode < 1 || mode>3) mode = 1;
98 viewModeButton = new ViewModeButton( bar,mode ); 98 viewModeButton = new ViewModeButton( bar,mode );
99 connect( viewModeButton, SIGNAL(changeMode(int)), 99 connect( viewModeButton, SIGNAL(changeMode(int)),
100 m_view, SLOT(slotChangeMode(int))); 100 m_view, SLOT(slotChangeMode(int)));
101 101
102 btn = new QToolButton( bar ); 102 btn = new QToolButton( bar );
103 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 103 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
104 connect( btn, SIGNAL(clicked() ), 104 connect( btn, SIGNAL(clicked() ),
105 this, SLOT(slotConfig() ) ); 105 this, SLOT(slotConfig() ) );
106 106
107 107
108 108
109 prevButton = new QToolButton(bar); 109 prevButton = new QToolButton(bar);
110 prevButton->setIconSet( Resource::loadIconSet( "back" ) ); 110 prevButton->setIconSet( Resource::loadIconSet( "back" ) );
111 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); 111 connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev()));
112 112
113 nextButton = new QToolButton(bar); 113 nextButton = new QToolButton(bar);
114 nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); 114 nextButton->setIconSet( Resource::loadIconSet( "forward" ) );
115 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); 115 connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext()));
116 116
117 rotateButton = new QToolButton(bar); 117 rotateButton = new QToolButton(bar);
118 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); 118 rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) );
119 rotateButton->setToggleButton(true); 119 rotateButton->setToggleButton(true);
120 120
121 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 121 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
122 rotateButton->setOn(true); 122 rotateButton->setOn(true);
123 autoRotate = true; 123 autoRotate = true;
124 prevButton->hide(); 124 prevButton->hide();
125 nextButton->hide(); 125 nextButton->hide();
126 } else { 126 } else {
127 rotateButton->setOn(false); 127 rotateButton->setOn(false);
128 autoRotate = false; 128 autoRotate = false;
129 } 129 }
130 130
131 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 131 connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
132 132
133 scaleButton = new QToolButton(bar); 133 scaleButton = new QToolButton(bar);
134 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); 134 scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
135 scaleButton->setToggleButton(true); 135 scaleButton->setToggleButton(true);
136 scaleButton->setOn(false); 136 scaleButton->setOn(false);
137 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 137 connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
138 autoScale = true; 138 autoScale = true;
139 139
140 zoomButton = new QToolButton(bar); 140 zoomButton = new QToolButton(bar);
141 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) ); 141 zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
142 zoomButton->setToggleButton(true); 142 zoomButton->setToggleButton(true);
143 zoomButton->setOn(true); 143 zoomButton->setOn(true);
144 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 144 connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
145 zoomerOn = true; 145 zoomerOn = true;
146} 146}
147 147
148PMainWindow::~PMainWindow() { 148PMainWindow::~PMainWindow() {
149 odebug << "Shutting down" << oendl; 149 odebug << "Shutting down" << oendl;
150 if (tFrame) delete tFrame; 150 if (tFrame) delete tFrame;
151 odebug << "Shutting down done" << oendl; 151 odebug << "Shutting down done" << oendl;
152} 152}
153 153
154void PMainWindow::slotToggleZoomer() 154void PMainWindow::slotToggleZoomer()
155{ 155{
156 if (!m_disp) return; 156 if (!m_disp) return;
157 bool cur = zoomButton->isOn(); 157 bool cur = zoomButton->isOn();
158 zoomButton->setOn(!cur); 158 zoomButton->setOn(!cur);
159} 159}
160 160
161void PMainWindow::slotZoomerToggled(bool how) 161void PMainWindow::slotZoomerToggled(bool how)
162{ 162{
163 zoomerOn = how; 163 zoomerOn = how;
164 if (m_disp) { 164 if (m_disp) {
165 m_disp->setShowZoomer(zoomerOn); 165 m_disp->setShowZoomer(zoomerOn);
166 } 166 }
167} 167}
168 168
169void PMainWindow::slotToggleAutorotate() 169void PMainWindow::slotToggleAutorotate()
170{ 170{
171 if (!m_disp) return; 171 if (!m_disp) return;
172 if (!rotateButton->isEnabled()) return; 172 if (!rotateButton->isEnabled()) return;
173 bool cur = rotateButton->isOn(); 173 bool cur = rotateButton->isOn();
174 rotateButton->setOn(!cur); 174 rotateButton->setOn(!cur);
175} 175}
176 176
177void PMainWindow::slotToggleAutoscale() 177void PMainWindow::slotToggleAutoscale()
178{ 178{
179 if (!m_disp) return; 179 if (!m_disp) return;
180 bool cur = scaleButton->isOn(); 180 bool cur = scaleButton->isOn();
181 scaleButton->setOn(!cur); 181 scaleButton->setOn(!cur);
182} 182}
183 183
184void PMainWindow::slotRotateToggled(bool how) 184void PMainWindow::slotRotateToggled(bool how)
185{ 185{
186 autoRotate = how; 186 autoRotate = how;
187 if (m_disp) { 187 if (m_disp) {
188 m_disp->setAutoRotate(how); 188 m_disp->setAutoRotate(how);
189 } 189 }
190} 190}
191 191
192void PMainWindow::slotScaleToggled(bool how) 192void PMainWindow::slotScaleToggled(bool how)
193{ 193{
194 autoScale = !how; 194 autoScale = !how;
195 if (!how) { 195 if (!how) {
196 autoRotate = how; 196 autoRotate = how;
197 } 197 }
198 if (m_disp) { 198 if (m_disp) {
199 m_disp->setAutoScaleRotate(autoScale,autoRotate); 199 m_disp->setAutoScaleRotate(autoScale,autoRotate);
200 } 200 }
201 if (!autoScale) { 201 if (!autoScale) {
202 rotateButton->setOn(false); 202 rotateButton->setOn(false);
203 } 203 }
204 rotateButton->setEnabled(!how); 204 rotateButton->setEnabled(!how);
205} 205}
206 206
207void PMainWindow::slotConfig() { 207void PMainWindow::slotConfig() {
208 /* 208 /*
209 * have a tab with the possible views 209 * have a tab with the possible views
210 * a tab for globals image cache size.. scaled loading 210 * a tab for globals image cache size.. scaled loading
211 * and one tab for the KeyConfigs 211 * and one tab for the KeyConfigs
212 */ 212 */
213 QDialog dlg(this, 0, true); 213 QDialog dlg(this, 0, true);
214 dlg.setCaption( tr("Phunk View - Config" ) ); 214 dlg.setCaption( tr("Phunk View - Config" ) );
215 215
216 QHBoxLayout *lay = new QHBoxLayout(&dlg); 216 QHBoxLayout *lay = new QHBoxLayout(&dlg);
217 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 217 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
218 lay->addWidget( wid ); 218 lay->addWidget( wid );
219 ViewMap *vM = viewMap(); 219 ViewMap *vM = viewMap();
220 ViewMap::Iterator _it = vM->begin(); 220 ViewMap::Iterator _it = vM->begin();
221 QMap<PDirView*, QWidget*> lst; 221 QMap<PDirView*, QWidget*> lst;
222 222
223 for( ; _it != vM->end(); ++_it ) { 223 for( ; _it != vM->end(); ++_it ) {
224 PDirView *view = (_it.data())(*m_cfg); 224 PDirView *view = (_it.data())(*m_cfg);
225 PInterfaceInfo *inf = view->interfaceInfo(); 225 PInterfaceInfo *inf = view->interfaceInfo();
226 QWidget *_wid = inf->configWidget( *m_cfg ); 226 QWidget *_wid = inf->configWidget( *m_cfg );
227 if (!_wid) continue; 227 if (!_wid) continue;
228 _wid->reparent(wid, QPoint() ); 228 _wid->reparent(wid, QPoint() );
229 lst.insert( view, _wid ); 229 lst.insert( view, _wid );
230 wid->addTab( _wid, "fileopen", inf->name() ); 230 wid->addTab( _wid, "fileopen", inf->name() );
231 } 231 }
232 232
233/* 233/*
234 * Add the KeyConfigWidget 234 * Add the KeyConfigWidget
235 */ 235 */
236 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 236 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
237 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 237 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
238 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 238 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
239 239
240 if ( !m_info ) { 240 if ( !m_info ) {
241 initInfo(); 241 initInfo();
242 } 242 }
243 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 243 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
244 244
245 if ( !m_disp ) { 245 if ( !m_disp ) {
246 initDisp(); 246 initDisp();
247 } 247 }
248 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 248 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
249 249
250 keyWid->load(); 250 keyWid->load();
251 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 251 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
252 252
253 253
254 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 254 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
255 255
256/* 256/*
257 * clean up 257 * clean up
258 *apply changes 258 *apply changes
259 */ 259 */
260 260
261 QMap<PDirView*, QWidget*>::Iterator it; 261 QMap<PDirView*, QWidget*>::Iterator it;
262 for ( it = lst.begin(); it != lst.end(); ++it ) { 262 for ( it = lst.begin(); it != lst.end(); ++it ) {
263 if ( act ) 263 if ( act )
264 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 264 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
265 delete it.key(); 265 delete it.key();
266 } 266 }
267 267
268 268
269 if ( act ) { 269 if ( act ) {
270 m_view->resetView(); 270 m_view->resetView();
271 keyWid->save(); 271 keyWid->save();
272 m_disp->manager()->save(); 272 m_disp->manager()->save();
273 m_info->manager()->save(); 273 m_info->manager()->save();
274 m_view->manager()->save(); 274 m_view->manager()->save();
275 } 275 }
276 delete keyWid; 276 delete keyWid;
277} 277}
278 278
279/* 279/*
280 * create a new image info component 280 * create a new image info component
281 * and detach the current one 281 * and detach the current one
282 * we will make the other delete on exit 282 * we will make the other delete on exit
283 */ 283 */
284template<class T> 284template<class T>
285void PMainWindow::initT( const char* name, T** ptr, int id) { 285void PMainWindow::initT( const char* name, T** ptr, int id) {
286 if ( *ptr ) { 286 if ( *ptr ) {
287 (*ptr)->disconnect(this, SLOT(slotReturn())); 287 (*ptr)->disconnect(this, SLOT(slotReturn()));
288 (*ptr)->setDestructiveClose(); 288 (*ptr)->setDestructiveClose();
289 m_stack->removeWidget( *ptr ); 289 m_stack->removeWidget( *ptr );
290 } 290 }
291 *ptr = new T(m_cfg, m_stack, name ); 291 *ptr = new T(m_cfg, m_stack, name );
292 m_stack->addWidget( *ptr, id ); 292 m_stack->addWidget( *ptr, id );
293 293
294 connect(*ptr, SIGNAL(sig_return()), 294 connect(*ptr, SIGNAL(sig_return()),
295 this,SLOT(slotReturn())); 295 this,SLOT(slotReturn()));
296 296
297} 297}
298void PMainWindow::initInfo() { 298void PMainWindow::initInfo() {
299 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 299 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
300 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 300 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
301} 301}
302void PMainWindow::initDisp() { 302void PMainWindow::initDisp() {
303 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 303 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
304 if (m_disp) { 304 if (m_disp) {
305 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 305 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
306 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 306 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
307 } 307 }
308 m_disp->setAutoScale(autoScale); 308 m_disp->setAutoScale(autoScale);
309 m_disp->setAutoRotate(autoRotate); 309 m_disp->setAutoRotate(autoRotate);
310 m_disp->setShowZoomer(zoomerOn); 310 m_disp->setShowZoomer(zoomerOn);
311 m_disp->setBackgroundColor(white); 311 m_disp->setBackgroundColor(white);
312 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 312 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
313 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 313 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
314 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 314 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
315 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 315 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
316 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 316 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
317 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 317 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
318 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 318 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
319 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 319 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
320 } 320 }
321} 321}
322 322
323void PMainWindow::slotToggleFullScreen() 323void PMainWindow::slotToggleFullScreen()
324{ 324{
325 odebug << "Toggle full " << oendl; 325 odebug << "Toggle full " << oendl;
326 if (!m_disp) return; 326 if (!m_disp) return;
327 bool current = !m_disp->fullScreen(); 327 bool current = !m_disp->fullScreen();
328 m_disp->setFullScreen(current); 328 m_disp->setFullScreen(current);
329 odebug << "Current = " << current << oendl; 329 odebug << "Current = " << current << oendl;
330 if (current) { 330 if (current) {
331 odebug << "full" << oendl; 331 odebug << "full" << oendl;
332 m_disp->setBackgroundColor(black); 332 m_disp->setBackgroundColor(black);
333 if (!tFrame) { 333 if (!tFrame) {
334 tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder); 334 tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder);
335 tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); 335 tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height());
336 tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); 336 tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height());
337 } 337 }
338 m_disp->reparent(tFrame,QPoint(0,0)); 338 m_disp->reparent(tFrame,QPoint(0,0));
339 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 339 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
340 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 340 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
341 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 341 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
342 tFrame->showFullScreen(); 342 tFrame->showFullScreen();
343 } else { 343 } else {
344 setUpdatesEnabled(false); 344 setUpdatesEnabled(false);
345 odebug << "window" << oendl; 345 odebug << "window" << oendl;
346 m_disp->reparent(0,QPoint(0,0)); 346 m_disp->reparent(0,QPoint(0,0));
347 m_disp->showNormal(); 347 m_disp->showNormal();
348 /* don't forget it! */ 348 /* don't forget it! */
349 tFrame->hide(); 349 tFrame->hide();
350 m_disp->setBackgroundColor(white); 350 m_disp->setBackgroundColor(white);
351 m_stack->addWidget(m_disp,ImageDisplay); 351 m_stack->addWidget(m_disp,ImageDisplay);
352 m_disp->setVScrollBarMode(QScrollView::Auto); 352 m_disp->setVScrollBarMode(QScrollView::Auto);
353 m_disp->setHScrollBarMode(QScrollView::Auto); 353 m_disp->setHScrollBarMode(QScrollView::Auto);
354 m_stack->raiseWidget(m_disp); 354 m_stack->raiseWidget(m_disp);
355 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 355 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
356 m_disp->resize(m_disp->minimumSize()); 356 m_disp->resize(m_disp->minimumSize());
357 } 357 }
358 setUpdatesEnabled(true); 358 setUpdatesEnabled(true);
359 } 359 }
360} 360}
361 361
362/** 362/**
363 * With big Screen the plan could be to 'detach' the image 363 * With big Screen the plan could be to 'detach' the image
364 * window if visible and to create a ne wone 364 * window if visible and to create a ne wone
365 * init* already supports it but I make no use of it for 365 * init* already supports it but I make no use of it for
366 * now. We set filename and raise 366 * now. We set filename and raise
367 * 367 *
368 * ### FIXME and talk to alwin 368 * ### FIXME and talk to alwin
369 */ 369 */
370void PMainWindow::slotShowInfo( const QString& inf ) { 370void PMainWindow::slotShowInfo( const QString& inf ) {
371 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 371 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
372 return; 372 return;
373 } 373 }
374 if ( !m_info ) { 374 if ( !m_info ) {
375 initInfo(); 375 initInfo();
376 } 376 }
377 m_info->setPath( inf ); 377 m_info->setPath( inf );
378 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 378 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
379 prevButton->hide(); 379 prevButton->hide();
380 nextButton->hide(); 380 nextButton->hide();
381 upButton->hide(); 381 upButton->hide();
382 fsButton->hide(); 382 fsButton->hide();
383 viewModeButton->hide(); 383 viewModeButton->hide();
384 } 384 }
385 m_stack->raiseWidget( ImageInfo ); 385 m_stack->raiseWidget( ImageInfo );
386} 386}
387 387
388void PMainWindow::slotDisplay( const QString& inf ) { 388void PMainWindow::slotDisplay( const QString& inf ) {
389 if ( !m_disp ) { 389 if ( !m_disp ) {
390 initDisp(); 390 initDisp();
391 } 391 }
392 m_disp->setImage( inf ); 392 m_disp->setImage( inf );
393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 393 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
394 prevButton->show(); 394 prevButton->show();
395 nextButton->show(); 395 nextButton->show();
396 upButton->hide(); 396 upButton->hide();
397 fsButton->hide(); 397 fsButton->hide();
398 viewModeButton->hide(); 398 viewModeButton->hide();
399 } 399 }
400 if (m_disp->fullScreen()) { 400 if (m_disp->fullScreen()) {
401// tFrame->showFullScreen(); 401 tFrame->show();//FullScreen();
402 m_disp->enableFullscreen();
403 } else { 402 } else {
404 m_stack->raiseWidget( ImageDisplay ); 403 m_stack->raiseWidget( ImageDisplay );
405 } 404 }
406} 405}
407 406
408void PMainWindow::slotReturn() { 407void PMainWindow::slotReturn() {
409 raiseIconView(); 408 raiseIconView();
410} 409}
411 410
412 411
413void PMainWindow::closeEvent( QCloseEvent* ev ) { 412void PMainWindow::closeEvent( QCloseEvent* ev ) {
414 /* 413 /*
415 * return from view 414 * return from view
416 * or properly quit 415 * or properly quit
417 */ 416 */
418 if ( m_stack->visibleWidget() == m_info || 417 if ( m_stack->visibleWidget() == m_info ||
419 m_stack->visibleWidget() == m_disp ) { 418 m_stack->visibleWidget() == m_disp ) {
420 ev->ignore(); 419 ev->ignore();
421 raiseIconView(); 420 raiseIconView();
422 return; 421 return;
423 } 422 }
424 if (m_disp && m_disp->fullScreen()) { 423 if (m_disp && m_disp->fullScreen()) {
425 /* otherwise opie-eye crashes in bigscreen mode! */ 424 /* otherwise opie-eye crashes in bigscreen mode! */
426 m_disp->reparent(0,QPoint(0,0)); 425 m_disp->reparent(0,QPoint(0,0));
427 m_stack->addWidget(m_disp,ImageDisplay); 426 m_stack->addWidget(m_disp,ImageDisplay);
428 } 427 }
429 ev->accept(); 428 ev->accept();
430 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 429 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
431} 430}
432 431
433void PMainWindow::raiseIconView() { 432void PMainWindow::raiseIconView() {
434 setUpdatesEnabled(false); 433 setUpdatesEnabled(false);
435 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 434 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
436 prevButton->hide(); 435 prevButton->hide();
437 nextButton->hide(); 436 nextButton->hide();
438 upButton->show(); 437 upButton->show();
439 fsButton->show(); 438 fsButton->show();
440 viewModeButton->show(); 439 viewModeButton->show();
441 } 440 }
442 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 441 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
443 tFrame->hide(); 442 tFrame->hide();
444 } 443 }
445 m_stack->raiseWidget( IconView ); 444 m_stack->raiseWidget( IconView );
446 setUpdatesEnabled(true); 445 setUpdatesEnabled(true);
447 repaint(); 446 repaint();
448} 447}
449 448
450void PMainWindow::setDocument( const QString& showImg ) { 449void PMainWindow::setDocument( const QString& showImg ) {
451 QString file = showImg; 450 QString file = showImg;
452 DocLnk lnk(showImg); 451 DocLnk lnk(showImg);
453 if (lnk.isValid() ) 452 if (lnk.isValid() )
454 file = lnk.file(); 453 file = lnk.file();
455 454
456 slotDisplay( file ); 455 slotDisplay( file );
457} 456}