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