summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.cpp18
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp128
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h7
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp12
6 files changed, 115 insertions, 62 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp
index 1a354a5..20dda5a 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.cpp
+++ b/noncore/graphics/opie-eye/gui/basesetup.cpp
@@ -1,56 +1,60 @@
1#include "basesetup.h" 1#include "basesetup.h"
2 2
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qlayout.h> 4#include <qlayout.h>
5#include <qspinbox.h> 5#include <qspinbox.h>
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7 7
8BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f) 8BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f)
9 :QWidget(parent,name,f) 9 :QFrame(parent,name,f)
10{ 10{
11 setFrameStyle(Box|Raised);
11 m_cfg = a_cfg; 12 m_cfg = a_cfg;
12 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout"); 13 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout");
13 14
14 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout"); 15 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout");
15 16
16 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" ); 17 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" );
17 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 18 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
18 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus ); 19 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus );
19 m_SlideShowTime->setMaxValue( 60 ); 20 m_SlideShowTime->setMaxValue( 60 );
20 m_SlideShowTime->setMinValue(1); 21 m_SlideShowTime->setMinValue(0);
21 m_SlideShowTime->setValue( 2 ); 22 m_SlideShowTime->setValue( 2 );
22 m_SlideShowTime->setSuffix(tr(" seconds")); 23 m_SlideShowTime->setSuffix(tr(" seconds"));
23 24
24 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 ); 25 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 );
25 26
26 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" ); 27 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" );
27 m_SlidetimeLabel->setText(tr("Slideshow timeout:")); 28 m_SlidetimeLabel->setText(tr("Slideshow timeout:"));
28 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 ); 29 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 );
29 m_MainLayout->addLayout( m_SlidetimeLayout ); 30 m_MainLayout->addLayout( m_SlidetimeLayout );
30 31
32#if 0
31 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" ); 33 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" );
32 m_ShowToolBar->setText(tr("Show toolbar on startup")); 34 m_ShowToolBar->setText(tr("Show toolbar on startup"));
33 m_MainLayout->addWidget( m_ShowToolBar ); 35 m_MainLayout->addWidget( m_ShowToolBar );
36#endif
37 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" );
38 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate"));
39 m_MainLayout->addWidget( m_SaveStateAuto );
34 40
35 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); 41 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
36 m_MainLayout->addItem( spacer1 ); 42 m_MainLayout->addItem( spacer1 );
37 43
38 int stime = m_cfg->readNumEntry("base_slideshowtimeout",2); 44 int stime = m_cfg->readNumEntry("base_slideshowtimeout",2);
39 if (stime<1) stime=2; 45 if (stime<0) stime=2;
40 if (stime>60) stime=60; 46 if (stime>60) stime=60;
41 m_SlideShowTime->setValue(stime); 47 m_SlideShowTime->setValue(stime);
42 48 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("base_savestatus",false));
43 bool stoolbar = m_cfg->readBoolEntry("base_showtoolbar",true);
44 m_ShowToolBar->setChecked(stoolbar);
45} 49}
46 50
47BaseSetup::~BaseSetup() 51BaseSetup::~BaseSetup()
48{ 52{
49} 53}
50 54
51void BaseSetup::save_values() 55void BaseSetup::save_values()
52{ 56{
53 if (!m_cfg) return; 57 if (!m_cfg) return;
54 m_cfg->writeEntry("base_slideshowtimeout",m_SlideShowTime->value()); 58 m_cfg->writeEntry("base_slideshowtimeout",m_SlideShowTime->value());
55 m_cfg->writeEntry("base_showtoolbar",m_ShowToolBar->isChecked()); 59 m_cfg->writeEntry("base_savestatus",m_SaveStateAuto->isChecked());
56} 60}
diff --git a/noncore/graphics/opie-eye/gui/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h
index c13e2af..c343f88 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.h
+++ b/noncore/graphics/opie-eye/gui/basesetup.h
@@ -1,35 +1,35 @@
1#ifndef _BASESETUP_H 1#ifndef _BASESETUP_H
2#define _BASESETUP_H 2#define _BASESETUP_H
3 3
4#include <opie2/oconfig.h> 4#include <opie2/oconfig.h>
5 5
6#include <qwidget.h> 6#include <qframe.h>
7 7
8class QVBoxLayout; 8class QVBoxLayout;
9class QGridLayout; 9class QGridLayout;
10class QSpinBox; 10class QSpinBox;
11class QLabel; 11class QLabel;
12class QCheckBox; 12class QCheckBox;
13class QSpacerItem; 13class QSpacerItem;
14 14
15class BaseSetup:public QWidget 15class BaseSetup:public QFrame
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0); 19 BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0);
20 virtual ~BaseSetup(); 20 virtual ~BaseSetup();
21 21
22public slots: 22public slots:
23 virtual void save_values(); 23 virtual void save_values();
24 24
25protected: 25protected:
26 Opie::Core::OConfig *m_cfg; 26 Opie::Core::OConfig *m_cfg;
27 QVBoxLayout * m_MainLayout; 27 QVBoxLayout * m_MainLayout;
28 QGridLayout * m_SlidetimeLayout; 28 QGridLayout * m_SlidetimeLayout;
29 QSpinBox * m_SlideShowTime; 29 QSpinBox * m_SlideShowTime;
30 QLabel * m_SlidetimeLabel; 30 QLabel * m_SlidetimeLabel;
31 QCheckBox *m_ShowToolBar; 31 QCheckBox *m_SaveStateAuto;
32 QSpacerItem *spacer1; 32 QSpacerItem *spacer1;
33}; 33};
34 34
35#endif 35#endif
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 86db732..be58c72 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -1,237 +1,239 @@
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#include <qtimer.h> 10#include <qtimer.h>
11#include <qaction.h> 11#include <qaction.h>
12 12
13using namespace Opie::Core; 13using namespace Opie::Core;
14 14
15ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) 15ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
16 : Opie::MM::OImageScrollView(parent,name,fl) 16 : Opie::MM::OImageScrollView(parent,name,fl)
17{ 17{
18 m_viewManager = 0; 18 m_viewManager = 0;
19 focus_in_count = 0; 19 focus_in_count = 0;
20 m_cfg = cfg; 20 m_cfg = cfg;
21 m_isFullScreen = false; 21 m_isFullScreen = false;
22 m_ignore_next_in = false; 22 m_ignore_next_in = false;
23 m_slideTimer = 0; 23 m_slideTimer = 0;
24 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); 24 QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
25 initKeys(); 25 initKeys();
26 m_slideValue = 5; 26 m_slideValue = 5;
27 m_gDisplayType = 0; 27 m_gDisplayType = 0;
28 m_gPrevNext = 0; 28 m_gPrevNext = 0;
29 m_hGroup = 0; 29 m_hGroup = 0;
30} 30}
31 31
32void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) 32void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup)
33{ 33{
34 m_gDisplayType = disptypeGroup; 34 m_gDisplayType = disptypeGroup;
35 m_gPrevNext = nextprevGroup; 35 m_gPrevNext = nextprevGroup;
36 m_hGroup = hGroup; 36 m_hGroup = hGroup;
37} 37}
38 38
39ImageView::~ImageView() 39ImageView::~ImageView()
40{ 40{
41 odebug << "Delete Imageview" << oendl;
42 delete m_viewManager; 41 delete m_viewManager;
43} 42}
44 43
45Opie::Core::OKeyConfigManager* ImageView::manager() 44Opie::Core::OKeyConfigManager* ImageView::manager()
46{ 45{
47 if (!m_viewManager) { 46 if (!m_viewManager) {
48 initKeys(); 47 initKeys();
49 } 48 }
50 return m_viewManager; 49 return m_viewManager;
51} 50}
52 51
53void ImageView::startSlide(int value) 52void ImageView::startSlide(int value)
54{ 53{
55 if (!m_slideTimer) { 54 if (!m_slideTimer) {
56 m_slideTimer = new QTimer(this); 55 m_slideTimer = new QTimer(this);
57 } 56 }
58 m_slideValue=value; 57 m_slideValue=value;
59 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); 58 connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
60 m_slideTimer->start(m_slideValue*1000,true); 59 /* this "+1" is one millisecond. with that we can setup a slideshowvalue
60 of 0. eg "as fast as possible".
61 */
62 m_slideTimer->start(m_slideValue*1000+1,true);
61} 63}
62 64
63void ImageView::stopSlide() 65void ImageView::stopSlide()
64{ 66{
65 if (!m_slideTimer) { 67 if (!m_slideTimer) {
66 return; 68 return;
67 } 69 }
68 m_slideTimer->stop(); 70 m_slideTimer->stop();
69 delete m_slideTimer; 71 delete m_slideTimer;
70 m_slideTimer = 0; 72 m_slideTimer = 0;
71} 73}
72 74
73void ImageView::nextSlide() 75void ImageView::nextSlide()
74{ 76{
75 if (!m_slideTimer) { 77 if (!m_slideTimer) {
76 return; 78 return;
77 } 79 }
78 if (isHidden()) { 80 if (isHidden()) {
79 delete m_slideTimer; 81 delete m_slideTimer;
80 m_slideTimer = 0; 82 m_slideTimer = 0;
81 return; 83 return;
82 } 84 }
83 emit dispNext(); 85 emit dispNext();
84 m_slideTimer->start(m_slideValue*1000,true); 86 m_slideTimer->start(m_slideValue*1000,true);
85} 87}
86void ImageView::initKeys() 88void ImageView::initKeys()
87{ 89{
88 odebug << "init imageview keys" << oendl; 90 odebug << "init imageview keys" << oendl;
89 if (!m_cfg) { 91 if (!m_cfg) {
90 m_cfg = new Opie::Core::OConfig("opie-eye"); 92 m_cfg = new Opie::Core::OConfig("opie-eye");
91 m_cfg->setGroup("image_view_keys" ); 93 m_cfg->setGroup("image_view_keys" );
92 } 94 }
93 Opie::Core::OKeyPair::List lst; 95 Opie::Core::OKeyPair::List lst;
94 lst.append( Opie::Core::OKeyPair::upArrowKey() ); 96 lst.append( Opie::Core::OKeyPair::upArrowKey() );
95 lst.append( Opie::Core::OKeyPair::downArrowKey() ); 97 lst.append( Opie::Core::OKeyPair::downArrowKey() );
96 lst.append( Opie::Core::OKeyPair::leftArrowKey() ); 98 lst.append( Opie::Core::OKeyPair::leftArrowKey() );
97 lst.append( Opie::Core::OKeyPair::rightArrowKey() ); 99 lst.append( Opie::Core::OKeyPair::rightArrowKey() );
98 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); 100 lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0));
99 101
100 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", 102 m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys",
101 lst, false,this, "image_view_keys" ); 103 lst, false,this, "image_view_keys" );
102 104
103 /** 105 /**
104 * Handle KeyEvents when they're pressed. This avoids problems 106 * Handle KeyEvents when they're pressed. This avoids problems
105 * with 'double next' on Return. 107 * with 'double next' on Return.
106 * The Return press would switch to this view and the return 108 * The Return press would switch to this view and the return
107 * release would emit the dispNext Signal. 109 * release would emit the dispNext Signal.
108 */ 110 */
109 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); 111 m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed );
110 112
111 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", 113 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo",
112 Resource::loadPixmap("1to1"), ViewInfo, 114 Resource::loadPixmap("1to1"), ViewInfo,
113 Opie::Core::OKeyPair(Qt::Key_I,0), 115 Opie::Core::OKeyPair(Qt::Key_I,0),
114 this, SLOT(slotShowImageInfo()))); 116 this, SLOT(slotShowImageInfo())));
115 117
116 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", 118 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate",
117 Resource::loadPixmap("rotate"), Autorotate, 119 Resource::loadPixmap("rotate"), Autorotate,
118 Opie::Core::OKeyPair(Qt::Key_R,0), 120 Opie::Core::OKeyPair(Qt::Key_R,0),
119 this, SIGNAL(toggleAutorotate()))); 121 this, SIGNAL(toggleAutorotate())));
120 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", 122 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
121 Resource::loadPixmap("1to1"), Autoscale, 123 Resource::loadPixmap("1to1"), Autoscale,
122 Opie::Core::OKeyPair(Qt::Key_S,0), 124 Opie::Core::OKeyPair(Qt::Key_S,0),
123 this, SIGNAL(toggleAutoscale()))); 125 this, SIGNAL(toggleAutoscale())));
124 126
125 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", 127 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
126 Resource::loadPixmap("forward"), ShowNext, 128 Resource::loadPixmap("forward"), ShowNext,
127 Opie::Core::OKeyPair(Qt::Key_Return,0), 129 Opie::Core::OKeyPair(Qt::Key_Return,0),
128 this, SIGNAL(dispNext()))); 130 this, SIGNAL(dispNext())));
129 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", 131 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
130 Resource::loadPixmap("back"), ShowPrevious, 132 Resource::loadPixmap("back"), ShowPrevious,
131 Opie::Core::OKeyPair(Qt::Key_P,0), 133 Opie::Core::OKeyPair(Qt::Key_P,0),
132 this, SIGNAL(dispPrev()))); 134 this, SIGNAL(dispPrev())));
133 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", 135 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
134 Resource::loadPixmap("fullscreen"), FullScreen, 136 Resource::loadPixmap("fullscreen"), FullScreen,
135 Opie::Core::OKeyPair(Qt::Key_F,0), 137 Opie::Core::OKeyPair(Qt::Key_F,0),
136 this, SIGNAL(toggleFullScreen()))); 138 this, SIGNAL(toggleFullScreen())));
137 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", 139 m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer",
138 Resource::loadPixmap("mag"), Zoomer, 140 Resource::loadPixmap("mag"), Zoomer,
139 Opie::Core::OKeyPair(Qt::Key_T,0), 141 Opie::Core::OKeyPair(Qt::Key_T,0),
140 this, SIGNAL(toggleZoomer()))); 142 this, SIGNAL(toggleZoomer())));
141 m_viewManager->handleWidget( this ); 143 m_viewManager->handleWidget( this );
142 m_viewManager->load(); 144 m_viewManager->load();
143} 145}
144 146
145void ImageView::keyReleaseEvent(QKeyEvent * e) 147void ImageView::keyReleaseEvent(QKeyEvent * e)
146{ 148{
147 if (!e || e->state()!=0) { 149 if (!e || e->state()!=0) {
148 return; 150 return;
149 } 151 }
150 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe(); 152 if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe();
151} 153}
152 154
153void ImageView::slotShowImageInfo() 155void ImageView::slotShowImageInfo()
154{ 156{
155 emit dispImageInfo(m_lastName); 157 emit dispImageInfo(m_lastName);
156} 158}
157 159
158void ImageView::contentsMousePressEvent ( QMouseEvent * e) 160void ImageView::contentsMousePressEvent ( QMouseEvent * e)
159{ 161{
160 if (e->button()==1) { 162 if (e->button()==1) {
161 return OImageScrollView::contentsMousePressEvent(e); 163 return OImageScrollView::contentsMousePressEvent(e);
162 } 164 }
163 odebug << "Popup " << oendl; 165 odebug << "Popup " << oendl;
164 QPopupMenu *m = new QPopupMenu(0); 166 QPopupMenu *m = new QPopupMenu(0);
165 if (!m) return; 167 if (!m) return;
166 if (m_hGroup) { 168 if (m_hGroup) {
167 m_hGroup->addTo(m); 169 m_hGroup->addTo(m);
168 } 170 }
169 if (fullScreen()) { 171 if (fullScreen()) {
170 if (m_gPrevNext) { 172 if (m_gPrevNext) {
171 m->insertSeparator(); 173 m->insertSeparator();
172 m_gPrevNext->addTo(m); 174 m_gPrevNext->addTo(m);
173 } 175 }
174 if (m_gDisplayType) { 176 if (m_gDisplayType) {
175 m->insertSeparator(); 177 m->insertSeparator();
176 m_gDisplayType->addTo(m); 178 m_gDisplayType->addTo(m);
177 } 179 }
178 } 180 }
179 m->setFocus(); 181 m->setFocus();
180 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 182 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
181 if (m_hGroup) { 183 if (m_hGroup) {
182 m_hGroup->removeFrom(m); 184 m_hGroup->removeFrom(m);
183 } 185 }
184 if (m_gPrevNext) { 186 if (m_gPrevNext) {
185 m_gPrevNext->removeFrom(m); 187 m_gPrevNext->removeFrom(m);
186 } 188 }
187 if (m_gDisplayType) { 189 if (m_gDisplayType) {
188 m_gDisplayType->removeFrom(m); 190 m_gDisplayType->removeFrom(m);
189 } 191 }
190 delete m; 192 delete m;
191} 193}
192 194
193void ImageView::setFullScreen(bool how,bool force) 195void ImageView::setFullScreen(bool how,bool force)
194{ 196{
195 m_isFullScreen = how; 197 m_isFullScreen = how;
196 if (how) { 198 if (how) {
197 m_ignore_next_in = true; 199 m_ignore_next_in = true;
198 setFixedSize(qApp->desktop()->size()); 200 setFixedSize(qApp->desktop()->size());
199 if (force) showFullScreen(); 201 if (force) showFullScreen();
200 } else { 202 } else {
201 setMinimumSize(10,10); 203 setMinimumSize(10,10);
202 } 204 }
203} 205}
204 206
205void ImageView::focusInEvent(QFocusEvent *) 207void ImageView::focusInEvent(QFocusEvent *)
206{ 208{
207 // Always do it here, no matter the size. 209 // Always do it here, no matter the size.
208 odebug << "Focus in (view)" << oendl; 210 odebug << "Focus in (view)" << oendl;
209 //if (fullScreen()) parentWidget()->showNormal(); 211 //if (fullScreen()) parentWidget()->showNormal();
210 if (m_ignore_next_in){m_ignore_next_in=false;return;} 212 if (m_ignore_next_in){m_ignore_next_in=false;return;}
211 if (fullScreen()) enableFullscreen(); 213 if (fullScreen()) enableFullscreen();
212} 214}
213 215
214void ImageView::hide() 216void ImageView::hide()
215{ 217{
216 if (fullScreen()) { 218 if (fullScreen()) {
217 m_ignore_next_in = true; 219 m_ignore_next_in = true;
218 showNormal(); 220 showNormal();
219 } 221 }
220 QWidget::hide(); 222 QWidget::hide();
221} 223}
222void ImageView::enableFullscreen() 224void ImageView::enableFullscreen()
223{ 225{
224 if (!fullScreen()) return; 226 if (!fullScreen()) return;
225 if (m_ignore_next_in) {m_ignore_next_in = false;return;} 227 if (m_ignore_next_in) {m_ignore_next_in = false;return;}
226 228
227 setUpdatesEnabled(false); 229 setUpdatesEnabled(false);
228 // This is needed because showNormal() forcefully changes the window 230 // This is needed because showNormal() forcefully changes the window
229 // style to WSTyle_TopLevel. 231 // style to WSTyle_TopLevel.
230 reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 232 reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
231 // Enable fullscreen. 233 // Enable fullscreen.
232 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus 234 /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
233 * so we must block it here! */ 235 * so we must block it here! */
234 m_ignore_next_in = true; 236 m_ignore_next_in = true;
235 showFullScreen(); 237 showFullScreen();
236 setUpdatesEnabled(true); 238 setUpdatesEnabled(true);
237} 239}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ece51a1..5eb065f 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -1,660 +1,700 @@
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#include "basesetup.h" 12#include "basesetup.h"
13 13
14#include <iface/ifaceinfo.h> 14#include <iface/ifaceinfo.h>
15#include <iface/dirview.h> 15#include <iface/dirview.h>
16 16
17#include <opie2/odebug.h> 17#include <opie2/odebug.h>
18#include <opie2/owidgetstack.h> 18#include <opie2/owidgetstack.h>
19#include <opie2/oapplicationfactory.h> 19#include <opie2/oapplicationfactory.h>
20#include <opie2/otabwidget.h> 20#include <opie2/otabwidget.h>
21#include <opie2/okeyconfigwidget.h> 21#include <opie2/okeyconfigwidget.h>
22 22
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qpe/ir.h> 25#include <qpe/ir.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28 28
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qmap.h> 33#include <qmap.h>
34#include <qtimer.h> 34#include <qtimer.h>
35#include <qframe.h> 35#include <qframe.h>
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qaction.h> 37#include <qaction.h>
38 38
39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) 39//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) 40OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
41 41
42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 42PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) 43 : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
44{ 44{
45 setCaption( QObject::tr("Opie Eye Caramba" ) ); 45 setCaption( QObject::tr("Opie Eye Caramba" ) );
46 m_cfg = new Opie::Core::OConfig("opie-eye"); 46 m_cfg = new Opie::Core::OConfig("opie-eye");
47 m_cfg->setGroup("main" ); 47 m_cfg->setGroup("main" );
48 readConfig();
48 49
49 m_storage = new StorageInfo(); 50 m_storage = new StorageInfo();
50 connect(m_storage, SIGNAL(disksChanged() ), 51 connect(m_storage, SIGNAL(disksChanged() ),
51 this, SLOT( dirChanged() ) ); 52 this, SLOT( dirChanged() ) );
52 53
53 m_stack = new Opie::Ui::OWidgetStack( this ); 54 m_stack = new Opie::Ui::OWidgetStack( this );
54 setCentralWidget( m_stack ); 55 setCentralWidget( m_stack );
55 56
56 m_view = new PIconView( m_stack, m_cfg ); 57 m_view = new PIconView( m_stack, m_cfg );
57 m_stack->addWidget( m_view, IconView ); 58 m_stack->addWidget( m_view, IconView );
58 m_stack->raiseWidget( IconView ); 59 m_stack->raiseWidget( IconView );
59 60
60 connect(m_view, SIGNAL(sig_display(const QString&)), 61 connect(m_view, SIGNAL(sig_display(const QString&)),
61 this, SLOT(slotDisplay(const QString&))); 62 this, SLOT(slotDisplay(const QString&)));
62 connect(m_view, SIGNAL(sig_showInfo(const QString&)), 63 connect(m_view, SIGNAL(sig_showInfo(const QString&)),
63 this, SLOT(slotShowInfo(const QString&)) ); 64 this, SLOT(slotShowInfo(const QString&)) );
64 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int))); 65 connect(this,SIGNAL(changeListMode(int)),m_view,SLOT(slotChangeMode(int)));
65 66
66 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); 67 m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
67 68
68 listviewMenu = 0; 69 listviewMenu = 0;
69 /* setup menu and toolbar */ 70 /* setup menu and toolbar */
70 setupActions(); 71 setupActions();
71 setupToolbar(); 72 setupToolbar();
72 setupMenu(); 73 setupMenu();
73 m_aHideToolbar->setOn(m_cfg->readBoolEntry("base_showtoolbar",true)); 74 m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
75 m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
74} 76}
75 77
76PMainWindow::~PMainWindow() { 78PMainWindow::~PMainWindow() {
77} 79}
78 80
79void PMainWindow::slotToggleZoomer() 81void PMainWindow::slotToggleZoomer()
80{ 82{
81 if (!m_disp) return; 83 m_aZoomer->setOn(!m_aZoomer->isOn());
82 bool cur = m_aZoomer->isOn();
83 m_aZoomer->setOn(!cur);
84} 84}
85 85
86void PMainWindow::slotZoomerToggled(bool how) 86void PMainWindow::slotZoomerToggled(bool how)
87{ 87{
88 zoomerOn = how;
89 if (m_disp) { 88 if (m_disp) {
90 m_disp->setShowZoomer(zoomerOn); 89 m_disp->setShowZoomer(how);
90 }
91 if (autoSave) {
92 m_cfg->writeEntry("zoomeron",how);
91 } 93 }
92} 94}
93 95
94void PMainWindow::slotToggleAutorotate() 96void PMainWindow::slotToggleAutorotate()
95{ 97{
96 if (!m_disp) return;
97 if (!m_aAutoRotate->isEnabled()) return; 98 if (!m_aAutoRotate->isEnabled()) return;
98 bool cur = m_aAutoRotate->isOn(); 99 m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
99 m_aAutoRotate->setOn(!cur);
100} 100}
101 101
102void PMainWindow::slotToggleAutoscale() 102void PMainWindow::slotToggleAutoscale()
103{ 103{
104 if (!m_disp) return; 104 m_aUnscaled->setOn(!m_aUnscaled->isOn());
105 bool cur = m_aAutoScale->isOn();
106 m_aAutoScale->setOn(!cur);
107} 105}
108 106
109void PMainWindow::slotRotateToggled(bool how) 107void PMainWindow::slotRotateToggled(bool how)
110{ 108{
111 autoRotate = how; 109 if (autoSave) {
110 m_cfg->writeEntry("autorotate",how);
111 }
112 if (m_disp) { 112 if (m_disp) {
113 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); 113 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
114 } 114 }
115} 115}
116 116
117void PMainWindow::slotScaleToggled(bool how) 117void PMainWindow::slotScaleToggled(bool how)
118{ 118{
119 autoScale = !how; 119 if (autoSave) {
120 if (!how) { 120 m_cfg->writeEntry("unscaled",how);
121 autoRotate = how;
122 } 121 }
123 if (!autoScale) { 122 odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
123 odebug << "How: " << how << oendl;
124 if (how) {
124 m_aAutoRotate->setOn(false); 125 m_aAutoRotate->setOn(false);
125 } 126 }
126 if (m_disp) { 127 if (m_disp) {
127 m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn()); 128 m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
128 } 129 }
129 m_aAutoRotate->setEnabled(!how); 130 m_aAutoRotate->setEnabled(!how);
131 odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
130} 132}
131 133
132void PMainWindow::slotConfig() { 134void PMainWindow::slotConfig() {
133 /* 135 /*
134 * have a tab with the possible views 136 * have a tab with the possible views
135 * a tab for globals image cache size.. scaled loading 137 * a tab for globals image cache size.. scaled loading
136 * and one tab for the KeyConfigs 138 * and one tab for the KeyConfigs
137 */ 139 */
138 QDialog dlg(this, 0, true); 140 QDialog dlg(this, 0, true);
139 dlg.setCaption( tr("Phunk View - Config" ) ); 141 dlg.setCaption( tr("Opie Eye - Config" ) );
140 142
141 QHBoxLayout *lay = new QHBoxLayout(&dlg); 143 QHBoxLayout *lay = new QHBoxLayout(&dlg);
142 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 144 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
143 lay->addWidget( wid ); 145 lay->addWidget( wid );
144 146
145 BaseSetup*bSetup = new BaseSetup(m_cfg,wid); 147 BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
146 wid->addTab(bSetup,"SettingsIcon","Basics setup"); 148 wid->addTab(bSetup,"SettingsIcon","Basics setup");
147 149
148 ViewMap *vM = viewMap(); 150 ViewMap *vM = viewMap();
149 ViewMap::Iterator _it = vM->begin(); 151 ViewMap::Iterator _it = vM->begin();
150 QMap<PDirView*, QWidget*> lst; 152 QMap<PDirView*, QWidget*> lst;
151 153
152 for( ; _it != vM->end(); ++_it ) { 154 for( ; _it != vM->end(); ++_it ) {
153 PDirView *view = (_it.data())(*m_cfg); 155 PDirView *view = (_it.data())(*m_cfg);
154 PInterfaceInfo *inf = view->interfaceInfo(); 156 PInterfaceInfo *inf = view->interfaceInfo();
155 QWidget *_wid = inf->configWidget( *m_cfg ); 157 QWidget *_wid = inf->configWidget( *m_cfg );
156 if (!_wid) continue; 158 if (!_wid) continue;
157 _wid->reparent(wid, QPoint() ); 159 _wid->reparent(wid, QPoint() );
158 lst.insert( view, _wid ); 160 lst.insert( view, _wid );
159 wid->addTab( _wid, "fileopen", inf->name() ); 161 wid->addTab( _wid, "fileopen", inf->name() );
160 } 162 }
161 163
162/* 164/*
163 * Add the KeyConfigWidget 165 * Add the KeyConfigWidget
164 */ 166 */
165 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); 167 Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
166 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); 168 keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
167 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); 169 keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
170 QWidget*w = m_stack->visibleWidget();
168 171
172 bool reminfo = false;
169 if ( !m_info ) { 173 if ( !m_info ) {
174 reminfo = true;
170 initInfo(); 175 initInfo();
171 } 176 }
172 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); 177 keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
173 178
179 bool remdisp = false;
174 if ( !m_disp ) { 180 if ( !m_disp ) {
181 remdisp = true;
175 initDisp(); 182 initDisp();
176 } 183 }
177 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); 184 keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
178 185
179 keyWid->load(); 186 keyWid->load();
180 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); 187 wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
181 188 wid->setCurrentTab(0);
182
183 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 189 bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
184 190
185/* 191/*
186 * clean up 192 * clean up
187 *apply changes 193 *apply changes
188 */ 194 */
189 195
190 QMap<PDirView*, QWidget*>::Iterator it; 196 QMap<PDirView*, QWidget*>::Iterator it;
191 for ( it = lst.begin(); it != lst.end(); ++it ) { 197 for ( it = lst.begin(); it != lst.end(); ++it ) {
192 if ( act ) 198 if ( act )
193 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); 199 it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg);
194 delete it.key(); 200 delete it.key();
195 } 201 }
196 202
197 203
198 if ( act ) { 204 if ( act ) {
199 m_view->resetView(); 205 m_view->resetView();
200 keyWid->save(); 206 keyWid->save();
201 m_disp->manager()->save(); 207 m_disp->manager()->save();
202 m_info->manager()->save(); 208 m_info->manager()->save();
203 m_view->manager()->save(); 209 m_view->manager()->save();
204 bSetup->save_values(); 210 bSetup->save_values();
211 readConfig();
205 } 212 }
206 delete keyWid; 213 delete keyWid;
214
215 m_stack->raiseWidget(w);
216 if (remdisp) {
217 m_disp->disconnect(this, SLOT(slotReturn()));
218 m_disp->setDestructiveClose();
219 m_stack->removeWidget(m_disp);
220 m_disp = 0;
221 }
222 if (reminfo) {
223 m_info->disconnect(this, SLOT(slotReturn()));
224 m_info->setDestructiveClose();
225 m_stack->removeWidget(m_info);
226 m_info = 0;
227 }
207} 228}
208 229
209/* 230/*
210 * create a new image info component 231 * create a new image info component
211 * and detach the current one 232 * and detach the current one
212 * we will make the other delete on exit 233 * we will make the other delete on exit
213 */ 234 */
214template<class T> 235template<class T>
215void PMainWindow::initT( const char* name, T** ptr, int id) { 236void PMainWindow::initT( const char* name, T** ptr, int id) {
216 if ( *ptr ) { 237 if ( *ptr ) {
217 (*ptr)->disconnect(this, SLOT(slotReturn())); 238 (*ptr)->disconnect(this, SLOT(slotReturn()));
218 (*ptr)->setDestructiveClose(); 239 (*ptr)->setDestructiveClose();
219 m_stack->removeWidget( *ptr ); 240 m_stack->removeWidget( *ptr );
220 } 241 }
221 *ptr = new T(m_cfg, m_stack, name ); 242 *ptr = new T(m_cfg, m_stack, name );
222 m_stack->addWidget( *ptr, id ); 243 m_stack->addWidget( *ptr, id );
223 244
224 connect(*ptr, SIGNAL(sig_return()), 245 connect(*ptr, SIGNAL(sig_return()),
225 this,SLOT(slotReturn())); 246 this,SLOT(slotReturn()));
226 247
227} 248}
228 249
229void PMainWindow::initInfo() { 250void PMainWindow::initInfo() {
230 initT<imageinfo>( "Image Info", &m_info, ImageInfo ); 251 initT<imageinfo>( "Image Info", &m_info, ImageInfo );
231 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); 252 connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
232} 253}
233 254
234void PMainWindow::initDisp() { 255void PMainWindow::initDisp() {
235 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); 256 initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
236 if (m_disp) { 257 if (m_disp) {
237 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 258 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
238 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 259 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
239 } 260 }
240 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); 261 m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType);
241 m_disp->setAutoScale(!m_aAutoScale->isOn()); 262 m_disp->setAutoScale(!m_aUnscaled->isOn());
242 m_disp->setAutoRotate(m_aAutoRotate->isOn()); 263 m_disp->setAutoRotate(m_aAutoRotate->isOn());
243 m_disp->setShowZoomer(m_aZoomer->isOn()); 264 m_disp->setShowZoomer(m_aZoomer->isOn());
244 m_disp->setBackgroundColor(white); 265 m_disp->setBackgroundColor(white);
245 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 266 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
246 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); 267 connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
247 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); 268 connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
248 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); 269 connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
249 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); 270 connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
250 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); 271 connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
251 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); 272 connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
252 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 273 connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
253 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); 274 connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int)));
254 slotFullScreenToggled(m_aFullScreen->isOn()); 275 slotFullScreenToggled(m_aFullScreen->isOn());
255 } 276 }
256} 277}
257 278
258void PMainWindow::slotToggleFullScreen() 279void PMainWindow::slotToggleFullScreen()
259{ 280{
260 bool current = !m_aFullScreen->isOn(); 281 bool current = !m_aFullScreen->isOn();
261 m_aFullScreen->setOn(current); 282 m_aFullScreen->setOn(current);
262} 283}
263 284
264void PMainWindow::slotFullScreenButton(bool current) 285void PMainWindow::slotFullScreenButton(bool current)
265{ 286{
266 if (m_disp) odebug << "Disp fenster ist hidden: "<<m_disp->isHidden()<<oendl; 287 if (autoSave) {
288 m_cfg->writeEntry("fullscreen",current);
289 }
267 if (!m_disp) return; 290 if (!m_disp) return;
268 291
269 /* I can not solve this effects here - it seems that we require some 292 if (m_disp->isHidden()) {
270 status variable, too. so we will live with some interesting effects 293 /* it must get some setups for switch we can just do if the window is visible.
271 meanwhile */ 294 so we must delete the imageview window and re-create it when displaying new
272#if 0 295 image */
273 bool th = m_disp->isHidden(); 296 return;
274 setupViewWindow(current, false); 297 }
275 /* realy - after setting up the fullscreenmode while the window is hidden
276 it is unvisibile not hidden!!!!! Hell. */
277 if (th) m_disp->hide();
278#endif
279 setupViewWindow(current, true); 298 setupViewWindow(current, true);
280} 299}
281 300
282void PMainWindow::setupViewWindow(bool current, bool forceDisplay) 301void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
283{ 302{
284 if (!m_disp) return; 303 if (!m_disp) return;
285 if (current) { 304 if (current) {
286 m_disp->setBackgroundColor(black); 305 m_disp->setBackgroundColor(black);
287 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); 306 m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
288 m_disp->setVScrollBarMode(QScrollView::AlwaysOff); 307 m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
289 m_disp->setHScrollBarMode(QScrollView::AlwaysOff); 308 m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
290 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); 309 m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
291 } else { 310 } else {
292 setUpdatesEnabled(false); 311 setUpdatesEnabled(false);
293 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 312 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
294 m_disp->setMinimumSize(QApplication::desktop()->size()/2); 313 m_disp->setMinimumSize(QApplication::desktop()->size()/2);
295 } else { 314 } else {
296 m_disp->setMinimumSize(10,10); 315 m_disp->setMinimumSize(10,10);
297 } 316 }
298 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 317 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
299 m_disp->reparent(0,QPoint(50,50)); 318 m_disp->reparent(0,QPoint(50,50));
300 } else { 319 } else {
301 m_disp->reparent(0,QPoint(0,0)); 320 m_disp->reparent(0,QPoint(0,0));
302 } 321 }
303 m_disp->setBackgroundColor(white); 322 m_disp->setBackgroundColor(white);
304 m_stack->addWidget(m_disp,ImageDisplay); 323 m_stack->addWidget(m_disp,ImageDisplay);
305 m_disp->setVScrollBarMode(QScrollView::Auto); 324 m_disp->setVScrollBarMode(QScrollView::Auto);
306 m_disp->setHScrollBarMode(QScrollView::Auto); 325 m_disp->setHScrollBarMode(QScrollView::Auto);
307 if (forceDisplay || m_disp->isVisible()) 326 if (forceDisplay || m_disp->isVisible())
308 m_stack->raiseWidget(m_disp); 327 m_stack->raiseWidget(m_disp);
309 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 328 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
310 m_disp->resize(m_disp->minimumSize()); 329 m_disp->resize(m_disp->minimumSize());
311 } 330 }
312 setUpdatesEnabled(true); 331 setUpdatesEnabled(true);
313 } 332 }
314 m_disp->setFullScreen(current,forceDisplay); 333 m_disp->setFullScreen(current,forceDisplay);
315} 334}
316 335
317void PMainWindow::slotFullScreenToggled(bool current) 336void PMainWindow::slotFullScreenToggled(bool current)
318{ 337{
319 setupViewWindow(current,true); 338 setupViewWindow(current,true);
320} 339}
321 340
322/** 341/**
323 * With big Screen the plan could be to 'detach' the image 342 * With big Screen the plan could be to 'detach' the image
324 * window if visible and to create a ne wone 343 * window if visible and to create a ne wone
325 * init* already supports it but I make no use of it for 344 * init* already supports it but I make no use of it for
326 * now. We set filename and raise 345 * now. We set filename and raise
327 * 346 *
328 * ### FIXME and talk to alwin 347 * ### FIXME and talk to alwin
329 */ 348 */
330void PMainWindow::slotShowInfo( const QString& inf ) { 349void PMainWindow::slotShowInfo( const QString& inf ) {
331 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 350 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
332 return; 351 return;
333 } 352 }
334 if ( !m_info ) { 353 if ( !m_info ) {
335 initInfo(); 354 initInfo();
336 } 355 }
337 m_info->setPath( inf ); 356 m_info->setPath( inf );
338 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 357 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
339 m_aNext->removeFrom(toolBar); 358 m_aNext->removeFrom(toolBar);
340 m_aPrevious->removeFrom(toolBar); 359 m_aPrevious->removeFrom(toolBar);
341 m_aNext->setEnabled(false); 360 m_aNext->setEnabled(false);
342 m_aPrevious->setEnabled(false); 361 m_aPrevious->setEnabled(false);
343 m_aDirUp->setEnabled(false); 362 m_aDirUp->setEnabled(false);
344 m_aShowInfo->setEnabled(false); 363 m_aShowInfo->setEnabled(false);
345 m_aViewfile->setEnabled(true); 364 m_aViewfile->setEnabled(true);
346 m_aStartSlide->setEnabled(false); 365 m_aStartSlide->setEnabled(false);
347 fsButton->hide(); 366 fsButton->hide();
348 } 367 }
349 m_stack->raiseWidget( ImageInfo ); 368 m_stack->raiseWidget( ImageInfo );
350} 369}
351 370
352void PMainWindow::slotDisplay( const QString& inf ) { 371void PMainWindow::slotDisplay( const QString& inf ) {
353 if ( !m_disp ) { 372 if ( !m_disp ) {
354 initDisp(); 373 initDisp();
355 } 374 }
356 m_disp->setImage( inf ); 375 m_disp->setImage( inf );
357 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 376 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
358 if (m_gPrevNext->isEnabled()==false) { 377 if (m_gPrevNext->isEnabled()==false) {
359 m_gPrevNext->addTo(toolBar); 378 m_gPrevNext->addTo(toolBar);
360 m_gPrevNext->setEnabled(true); 379 m_gPrevNext->setEnabled(true);
361 380
362 m_aDirUp->setEnabled(false); 381 m_aDirUp->setEnabled(false);
363 m_aShowInfo->setEnabled(true); 382 m_aShowInfo->setEnabled(true);
364 m_aViewfile->setEnabled(false); 383 m_aViewfile->setEnabled(false);
365 m_aStartSlide->setEnabled(false); 384 m_aStartSlide->setEnabled(false);
366 fsButton->hide(); 385 fsButton->hide();
367 } 386 }
368 } 387 }
369 if (m_disp->fullScreen()) { 388 if (m_disp->fullScreen()) {
370 qwsDisplay()->requestFocus( m_disp->winId(), TRUE); 389 qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
371 } else { 390 } else {
372 m_stack->raiseWidget( ImageDisplay ); 391 m_stack->raiseWidget( ImageDisplay );
373 } 392 }
374} 393}
375 394
376void PMainWindow::raiseIconView() { 395void PMainWindow::raiseIconView() {
377 setUpdatesEnabled(false); 396 setUpdatesEnabled(false);
378 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 397 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
379 m_gPrevNext->removeFrom(toolBar); 398 m_gPrevNext->removeFrom(toolBar);
380 m_gPrevNext->setEnabled(false); 399 m_gPrevNext->setEnabled(false);
381 m_aDirUp->setEnabled(true); 400 m_aDirUp->setEnabled(true);
382 m_aShowInfo->setEnabled(true); 401 m_aShowInfo->setEnabled(true);
383 m_aViewfile->setEnabled(true); 402 m_aViewfile->setEnabled(true);
384 m_aStartSlide->setEnabled(true); 403 m_aStartSlide->setEnabled(true);
385 fsButton->show(); 404 fsButton->show();
386 } 405 }
387 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { 406 if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
388 m_disp->stopSlide(); 407 m_disp->stopSlide();
389 m_disp->hide(); 408 m_disp->hide();
390 } 409 }
391 m_stack->raiseWidget( IconView ); 410 m_stack->raiseWidget( IconView );
392 setUpdatesEnabled(true); 411 setUpdatesEnabled(true);
393 repaint(); 412 repaint();
394} 413}
395 414
396void PMainWindow::slotReturn() { 415void PMainWindow::slotReturn() {
397 raiseIconView(); 416 raiseIconView();
398} 417}
399 418
400 419
401void PMainWindow::closeEvent( QCloseEvent* ev ) { 420void PMainWindow::closeEvent( QCloseEvent* ev ) {
402 /* 421 /*
403 * return from view 422 * return from view
404 * or properly quit 423 * or properly quit
405 */ 424 */
406 if ( m_stack->visibleWidget() == m_info || 425 if ( m_stack->visibleWidget() == m_info ||
407 m_stack->visibleWidget() == m_disp ) { 426 m_stack->visibleWidget() == m_disp ) {
408 ev->ignore(); 427 ev->ignore();
409 raiseIconView(); 428 raiseIconView();
410 return; 429 return;
411 } 430 }
412 if (m_disp && m_disp->fullScreen()) { 431 if (m_disp && m_disp->fullScreen()) {
413 /* otherwise opie-eye crashes in bigscreen mode! */ 432 /* otherwise opie-eye crashes in bigscreen mode! */
414 m_disp->reparent(0,QPoint(0,0)); 433 m_disp->reparent(0,QPoint(0,0));
415 m_stack->addWidget(m_disp,ImageDisplay); 434 m_stack->addWidget(m_disp,ImageDisplay);
416 } 435 }
417 ev->accept(); 436 ev->accept();
418 QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); 437 QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
419} 438}
420 439
421void PMainWindow::setDocument( const QString& showImg ) { 440void PMainWindow::setDocument( const QString& showImg ) {
422 QString file = showImg; 441 QString file = showImg;
423 DocLnk lnk(showImg); 442 DocLnk lnk(showImg);
424 if (lnk.isValid() ) 443 if (lnk.isValid() )
425 file = lnk.file(); 444 file = lnk.file();
426 445
427 slotDisplay( file ); 446 slotDisplay( file );
428} 447}
429 448
430void PMainWindow::slotSelectDir(int id) 449void PMainWindow::slotSelectDir(int id)
431{ 450{
432 emit changeDir( m_dev[fsMenu->text(id )] ); 451 emit changeDir( m_dev[fsMenu->text(id )] );
433} 452}
434 453
435void PMainWindow::dirChanged() 454void PMainWindow::dirChanged()
436{ 455{
437 fsMenu->clear(); 456 fsMenu->clear();
438 m_dev.clear(); 457 m_dev.clear();
439 458
440 /* home dir, too */ 459 /* home dir, too */
441 QString f = getenv( "HOME" ); 460 QString f = getenv( "HOME" );
442 if (!f.isEmpty()) { 461 if (!f.isEmpty()) {
443 m_dev.insert("Home directory",f); 462 m_dev.insert("Home directory",f);
444 fsMenu->insertItem("Home directory"); 463 fsMenu->insertItem("Home directory");
445 } 464 }
446 const QList<FileSystem> &fs = m_storage->fileSystems(); 465 const QList<FileSystem> &fs = m_storage->fileSystems();
447 QListIterator<FileSystem> it(fs ); 466 QListIterator<FileSystem> it(fs );
448 for ( ; it.current(); ++it ) { 467 for ( ; it.current(); ++it ) {
449 const QString disk = (*it)->name(); 468 const QString disk = (*it)->name();
450 const QString path = (*it)->path(); 469 const QString path = (*it)->path();
451 m_dev.insert( disk, path ); 470 m_dev.insert( disk, path );
452 fsMenu->insertItem( disk ); 471 fsMenu->insertItem( disk );
453 } 472 }
454} 473}
455 474
456void PMainWindow::showToolbar(bool how) 475void PMainWindow::showToolbar(bool how)
457{ 476{
458 if (!how) toolBar->hide(); 477 if (!how) toolBar->hide();
459 else toolBar->show(); 478 else toolBar->show();
479 if (autoSave) {
480 m_cfg->writeEntry("showtoolbar",how);
481 }
460} 482}
461 483
462void PMainWindow::setupActions() 484void PMainWindow::setupActions()
463{ 485{
464 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); 486 m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
465 m_aDirUp->setToggleAction(false); 487 m_aDirUp->setToggleAction(false);
466 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); 488 connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
467 489
468 if ( Ir::supported() ) { 490 if ( Ir::supported() ) {
469 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); 491 m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true );
470 m_aBeam->setToggleAction(false); 492 m_aBeam->setToggleAction(false);
471 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); 493 connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam()));
472 } else { 494 } else {
473 m_aBeam = 0; 495 m_aBeam = 0;
474 } 496 }
475 497
476 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); 498 m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true );
477 m_aShowInfo->setToggleAction(false); 499 m_aShowInfo->setToggleAction(false);
478 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); 500 connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo()));
479 501
480 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); 502 m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true );
481 m_aTrash->setToggleAction(false); 503 m_aTrash->setToggleAction(false);
482 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); 504 connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash()));
483 505
484 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); 506 m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true );
485 m_aViewfile->setToggleAction(false); 507 m_aViewfile->setToggleAction(false);
486 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); 508 connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage()));
487 509
488 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); 510 m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true );
489 m_aStartSlide->setToggleAction(false); 511 m_aStartSlide->setToggleAction(false);
490 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); 512 connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide()));
491 513
492 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); 514 m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true );
493 m_aHideToolbar->setOn (true); 515 m_aHideToolbar->setOn (true);
494 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); 516 connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool)));
495 517
496 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); 518 m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true );
497 m_aSetup->setToggleAction(false); 519 m_aSetup->setToggleAction(false);
498 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); 520 connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig()));
499 521
500 m_gListViewMode = new QActionGroup(this,"Select listmode",true); 522 m_gListViewMode = new QActionGroup(this,"Select listmode",true);
501 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); 523 connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*)));
502 524
503 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); 525 m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true );
504 m_aDirLong->setToggleAction(true); 526 m_aDirLong->setToggleAction(true);
505 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); 527 m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true );
506 m_aDirShort->setToggleAction(true); 528 m_aDirShort->setToggleAction(true);
507 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); 529 m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true );
508 m_aDirName->setToggleAction(true); 530 m_aDirName->setToggleAction(true);
509 int mode = m_cfg->readNumEntry("ListViewMode", 1); 531 int mode = m_cfg->readNumEntry("ListViewMode", 1);
510 if (mode < 1 || mode>3) mode = 1; 532 if (mode < 1 || mode>3) mode = 1;
511 switch (mode) { 533 switch (mode) {
512 case 3: 534 case 3:
513 m_aDirName->setOn(true); 535 m_aDirName->setOn(true);
514 break; 536 break;
515 case 2: 537 case 2:
516 m_aDirShort->setOn(true); 538 m_aDirShort->setOn(true);
517 break; 539 break;
518 case 1: 540 case 1:
519 default: 541 default:
520 m_aDirLong->setOn(true); 542 m_aDirLong->setOn(true);
521 } 543 }
522 m_gListViewMode->insert(m_aDirLong); 544 m_gListViewMode->insert(m_aDirLong);
523 m_gListViewMode->insert(m_aDirShort); 545 m_gListViewMode->insert(m_aDirShort);
524 m_gListViewMode->insert(m_aDirName); 546 m_gListViewMode->insert(m_aDirName);
525 547
526 m_gPrevNext = new QActionGroup(this,"imageprevnext",false); 548 m_gPrevNext = new QActionGroup(this,"imageprevnext",false);
527 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); 549 m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true );
528 m_aNext->setToggleAction(false); 550 m_aNext->setToggleAction(false);
529 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); 551 connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext()));
530 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); 552 m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true );
531 m_aPrevious->setToggleAction(false); 553 m_aPrevious->setToggleAction(false);
532 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); 554 connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
533 m_gPrevNext->insert(m_aPrevious); 555 m_gPrevNext->insert(m_aPrevious);
534 m_gPrevNext->insert(m_aNext); 556 m_gPrevNext->insert(m_aNext);
535 557
536 m_aFullScreen = new QAction( tr( "Show images fullscreen" ), 558 m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
537 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); 559 Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
538 m_aFullScreen->setToggleAction(true); 560 m_aFullScreen->setToggleAction(true);
539 m_aFullScreen->setOn(false); 561 if (autoSave) {
562 m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
563 } else {
564 m_aFullScreen->setOn(false);
565 }
540 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool))); 566 connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
541 567
542 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); 568 m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
543 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); 569 m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
544 m_aAutoRotate->setToggleAction(true); 570 m_aAutoRotate->setToggleAction(true);
571
545 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { 572 if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
546 m_aAutoRotate->setOn(true); 573 m_aAutoRotate->setOn(true);
547 autoRotate = true;
548 } else { 574 } else {
549 m_aAutoRotate->setOn(false); 575 m_aAutoRotate->setOn(false);
550 autoRotate = false; 576 }
577 if (autoSave) {
578 m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
551 } 579 }
552 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); 580 connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
553 581
554 m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); 582 m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
555 m_aAutoScale->setToggleAction(true); 583 m_aUnscaled->setToggleAction(true);
556 m_aAutoScale->setOn (false); 584 connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
557 connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); 585 if (autoSave) {
586 m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
587 } else {
588 m_aUnscaled->setOn(false);
589 }
558 590
559 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); 591 m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
560 m_aZoomer->setToggleAction(true); 592 m_aZoomer->setToggleAction(true);
561 m_aZoomer->setOn (true); 593 if (autoSave) {
562 zoomerOn = true; 594 m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
595 } else {
596 m_aZoomer->setOn (true);
597 }
563 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); 598 connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
564 m_gDisplayType->insert(m_aAutoRotate); 599 m_gDisplayType->insert(m_aAutoRotate);
565 m_gDisplayType->insert(m_aAutoScale); 600 m_gDisplayType->insert(m_aUnscaled);
566 m_gDisplayType->insert(m_aZoomer); 601 m_gDisplayType->insert(m_aZoomer);
567 602
568 m_hGroup = new QActionGroup(this,"actioncollection",false); 603 m_hGroup = new QActionGroup(this,"actioncollection",false);
569 m_hGroup->insert(m_aFullScreen); 604 m_hGroup->insert(m_aFullScreen);
570} 605}
571 606
572void PMainWindow::setupToolbar() 607void PMainWindow::setupToolbar()
573{ 608{
574 toolBar = new QToolBar( this ); 609 toolBar = new QToolBar( this );
575 addToolBar(toolBar); 610 addToolBar(toolBar);
576 toolBar->setHorizontalStretchable( true ); 611 toolBar->setHorizontalStretchable( true );
577 setToolBarsMovable( false ); 612 setToolBarsMovable( false );
578 m_aDirUp->addTo( toolBar ); 613 m_aDirUp->addTo( toolBar );
579 614
580 fsButton = new PFileSystem( toolBar ); 615 fsButton = new PFileSystem( toolBar );
581 connect( fsButton, SIGNAL( changeDir( const QString& ) ), 616 connect( fsButton, SIGNAL( changeDir( const QString& ) ),
582 m_view, SLOT(slotChangeDir( const QString& ) ) ); 617 m_view, SLOT(slotChangeDir( const QString& ) ) );
583 connect( this, SIGNAL( changeDir( const QString& ) ), 618 connect( this, SIGNAL( changeDir( const QString& ) ),
584 m_view, SLOT(slotChangeDir( const QString& ) ) ); 619 m_view, SLOT(slotChangeDir( const QString& ) ) );
585 620
586 if (m_aBeam) { 621 if (m_aBeam) {
587 m_aBeam->addTo( toolBar ); 622 m_aBeam->addTo( toolBar );
588 } 623 }
589 m_aShowInfo->addTo(toolBar); 624 m_aShowInfo->addTo(toolBar);
590 m_aTrash->addTo(toolBar); 625 m_aTrash->addTo(toolBar);
591// m_aSetup->addTo(toolBar); 626// m_aSetup->addTo(toolBar);
592 627
593 m_gDisplayType->addTo(toolBar); 628 m_gDisplayType->addTo(toolBar);
594 629
595 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { 630 if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
596 m_gPrevNext->addTo(toolBar); 631 m_gPrevNext->addTo(toolBar);
597 } else { 632 } else {
598 m_gPrevNext->setEnabled(false); 633 m_gPrevNext->setEnabled(false);
599 } 634 }
600} 635}
601 636
602void PMainWindow::setupMenu() 637void PMainWindow::setupMenu()
603{ 638{
604 fileMenu = new QPopupMenu( menuBar() ); 639 fileMenu = new QPopupMenu( menuBar() );
605 menuBar()->insertItem( tr( "File" ), fileMenu ); 640 menuBar()->insertItem( tr( "File" ), fileMenu );
606 dispMenu = new QPopupMenu( menuBar() ); 641 dispMenu = new QPopupMenu( menuBar() );
607 menuBar()->insertItem( tr( "Show" ), dispMenu ); 642 menuBar()->insertItem( tr( "Show" ), dispMenu );
608 settingsMenu = new QPopupMenu( menuBar() ); 643 settingsMenu = new QPopupMenu( menuBar() );
609 menuBar()->insertItem( tr( "Settings" ), settingsMenu ); 644 menuBar()->insertItem( tr( "Settings" ), settingsMenu );
610 645
611 m_aViewfile->addTo(fileMenu); 646 m_aViewfile->addTo(fileMenu);
612 m_aShowInfo->addTo(fileMenu); 647 m_aShowInfo->addTo(fileMenu);
613 m_aStartSlide->addTo(fileMenu); 648 m_aStartSlide->addTo(fileMenu);
614 649
615 fileMenu->insertSeparator(); 650 fileMenu->insertSeparator();
616 m_aDirUp->addTo( fileMenu ); 651 m_aDirUp->addTo( fileMenu );
617 652
618 fsMenu = new QPopupMenu(fileMenu); 653 fsMenu = new QPopupMenu(fileMenu);
619 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); 654 fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
620 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); 655 connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
621 dirChanged(); 656 dirChanged();
622 657
623 if ( m_aBeam ) { 658 if ( m_aBeam ) {
624 fileMenu->insertSeparator(); 659 fileMenu->insertSeparator();
625 m_aBeam->addTo( fileMenu ); 660 m_aBeam->addTo( fileMenu );
626 } 661 }
627 fileMenu->insertSeparator(); 662 fileMenu->insertSeparator();
628 m_aTrash->addTo(fileMenu); 663 m_aTrash->addTo(fileMenu);
629 664
630 listviewMenu = new QPopupMenu(dispMenu); 665 listviewMenu = new QPopupMenu(dispMenu);
631 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); 666 dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
632 m_gListViewMode->addTo(listviewMenu); 667 m_gListViewMode->addTo(listviewMenu);
633 dispMenu->insertSeparator(); 668 dispMenu->insertSeparator();
634 m_aFullScreen->addTo(dispMenu); 669 m_aFullScreen->addTo(dispMenu);
635 m_gDisplayType->addTo(dispMenu); 670 m_gDisplayType->addTo(dispMenu);
636 dispMenu->insertSeparator(); 671 dispMenu->insertSeparator();
637 m_gPrevNext->addTo(dispMenu); 672 m_gPrevNext->addTo(dispMenu);
638 673
639 m_aSetup->addTo(settingsMenu); 674 m_aSetup->addTo(settingsMenu);
640 m_aHideToolbar->addTo(settingsMenu); 675 m_aHideToolbar->addTo(settingsMenu);
641} 676}
642 677
643void PMainWindow::listviewselected(QAction*which) 678void PMainWindow::listviewselected(QAction*which)
644{ 679{
645 if (!which || which->isOn()==false) return; 680 if (!which || which->isOn()==false) return;
646 int val = 1; 681 int val = 1;
647// QString name; 682// QString name;
648 683
649 if (which==m_aDirName) { 684 if (which==m_aDirName) {
650 val = 3; 685 val = 3;
651// name = "opie-eye/opie-eye-textview"; 686// name = "opie-eye/opie-eye-textview";
652 } else if (which==m_aDirShort) { 687 } else if (which==m_aDirShort) {
653 val = 2; 688 val = 2;
654// name = "opie-eye/opie-eye-thumbonly"; 689// name = "opie-eye/opie-eye-thumbonly";
655 } else if (which==m_aDirLong) { 690 } else if (which==m_aDirLong) {
656 val = 1; 691 val = 1;
657// name = "opie-eye/opie-eye-thumb"; 692// name = "opie-eye/opie-eye-thumb";
658 } 693 }
659 emit changeListMode(val); 694 emit changeListMode(val);
660} 695}
696
697void PMainWindow::readConfig()
698{
699 autoSave =m_cfg->readBoolEntry("base_savestatus",true);
700}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 703965b..5707568 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -1,107 +1,106 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_MAIN_WINDOW_H 6#ifndef PHUNK_MAIN_WINDOW_H
7#define PHUNK_MAIN_WINDOW_H 7#define PHUNK_MAIN_WINDOW_H
8 8
9#include <opie2/oconfig.h> 9#include <opie2/oconfig.h>
10 10
11#include <qmainwindow.h> 11#include <qmainwindow.h>
12 12
13 13
14 14
15namespace Opie { 15namespace Opie {
16namespace Ui{ 16namespace Ui{
17 class OWidgetStack; 17 class OWidgetStack;
18} 18}
19namespace Core{ 19namespace Core{
20 class OKeyConfigManager; 20 class OKeyConfigManager;
21} 21}
22} 22}
23 23
24class ImageView; 24class ImageView;
25class ImageWidget; 25class ImageWidget;
26class PIconView; 26class PIconView;
27class imageinfo; 27class imageinfo;
28class QMenuBar; 28class QMenuBar;
29class QToolBar; 29class QToolBar;
30class QPopupMenu; 30class QPopupMenu;
31class QAction; 31class QAction;
32class QActionGroup; 32class QActionGroup;
33class StorageInfo; 33class StorageInfo;
34 34
35class PMainWindow : public QMainWindow { 35class PMainWindow : public QMainWindow {
36 Q_OBJECT 36 Q_OBJECT
37 enum Views { IconView, ImageInfo, ImageDisplay }; 37 enum Views { IconView, ImageInfo, ImageDisplay };
38public: 38public:
39 static QString appName() { return QString::fromLatin1("opie-eye" ); } 39 static QString appName() { return QString::fromLatin1("opie-eye" ); }
40 PMainWindow(QWidget*, const char*, WFlags ); 40 PMainWindow(QWidget*, const char*, WFlags );
41 ~PMainWindow(); 41 ~PMainWindow();
42 42
43signals: 43signals:
44 void configChanged(); 44 void configChanged();
45 void changeDir( const QString& ); 45 void changeDir( const QString& );
46 void changeListMode(int); 46 void changeListMode(int);
47 47
48public slots: 48public slots:
49 void slotShowInfo( const QString& inf ); 49 void slotShowInfo( const QString& inf );
50 void slotDisplay( const QString& inf ); 50 void slotDisplay( const QString& inf );
51 void slotReturn(); 51 void slotReturn();
52 void slotRotateToggled(bool); 52 void slotRotateToggled(bool);
53 void slotScaleToggled(bool); 53 void slotScaleToggled(bool);
54 void slotZoomerToggled(bool); 54 void slotZoomerToggled(bool);
55 void slotToggleZoomer(); 55 void slotToggleZoomer();
56 void slotToggleAutorotate(); 56 void slotToggleAutorotate();
57 void slotToggleAutoscale(); 57 void slotToggleAutoscale();
58 void setDocument( const QString& ); 58 void setDocument( const QString& );
59 virtual void slotToggleFullScreen(); 59 virtual void slotToggleFullScreen();
60 virtual void slotFullScreenToggled(bool); 60 virtual void slotFullScreenToggled(bool);
61 61
62protected slots: 62protected slots:
63 void raiseIconView(); 63 void raiseIconView();
64 void closeEvent( QCloseEvent* ); 64 void closeEvent( QCloseEvent* );
65 void showToolbar(bool); 65 void showToolbar(bool);
66 void listviewselected(QAction*); 66 void listviewselected(QAction*);
67 void slotFullScreenButton(bool); 67 void slotFullScreenButton(bool);
68 68
69private: 69private:
70 template<class T> void initT( const char* name, T**, int ); 70 template<class T> void initT( const char* name, T**, int );
71 void initInfo(); 71 void initInfo();
72 void initDisp(); 72 void initDisp();
73 void setupViewWindow(bool full, bool forceDisplay); 73 void setupViewWindow(bool full, bool forceDisplay);
74 74
75private: 75private:
76 Opie::Core::OConfig *m_cfg; 76 Opie::Core::OConfig *m_cfg;
77 Opie::Ui::OWidgetStack *m_stack; 77 Opie::Ui::OWidgetStack *m_stack;
78 PIconView* m_view; 78 PIconView* m_view;
79 imageinfo *m_info; 79 imageinfo *m_info;
80 ImageView *m_disp; 80 ImageView *m_disp;
81 bool autoRotate; 81 bool autoSave;
82 bool autoScale;
83 bool zoomerOn;
84 QToolButton*fsButton; 82 QToolButton*fsButton;
85 QToolBar *toolBar; 83 QToolBar *toolBar;
86 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu; 84 QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu;
87 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; 85 QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide;
88 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; 86 QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong;
89 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; 87 QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup;
90 QAction *m_aNext,*m_aPrevious,*m_aFullScreen; 88 QAction *m_aNext,*m_aPrevious,*m_aFullScreen;
91 QAction *m_aAutoRotate,*m_aAutoScale,*m_aZoomer; 89 QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer;
92 90
93 /* init funs */ 91 /* init funs */
92 void readConfig();
94 void setupActions(); 93 void setupActions();
95 void setupToolbar(); 94 void setupToolbar();
96 void setupMenu(); 95 void setupMenu();
97 /* for the device submenu - ToDo: Merge with the special button */ 96 /* for the device submenu - ToDo: Merge with the special button */
98 StorageInfo *m_storage; 97 StorageInfo *m_storage;
99 QMap<QString, QString> m_dev; 98 QMap<QString, QString> m_dev;
100 99
101private slots: 100private slots:
102 void slotConfig(); 101 void slotConfig();
103 void slotSelectDir(int); 102 void slotSelectDir(int);
104 void dirChanged(); 103 void dirChanged();
105}; 104};
106 105
107#endif 106#endif
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
index f4a6a87..9c69ce5 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
@@ -1,50 +1,58 @@
1/* 1/*
2 * GPLv2 2 * GPLv2
3 * zecke@handhelds.org 3 * zecke@handhelds.org
4 */ 4 */
5 5
6#include "dir_ifaceinfo.h" 6#include "dir_ifaceinfo.h"
7 7
8/* OPIE */ 8/* OPIE */
9#include <opie2/odebug.h> 9#include <opie2/odebug.h>
10#include <qpe/config.h> 10#include <qpe/config.h>
11 11
12/* QT */ 12/* QT */
13#include <qwidget.h> 13#include <qwidget.h>
14#include <qcheckbox.h> 14#include <qcheckbox.h>
15#include <qframe.h>
15#include <qhbox.h> 16#include <qhbox.h>
16#include <qlabel.h> 17#include <qlabel.h>
18#include <qlayout.h>
17 19
18namespace { 20namespace {
19 class DirImageWidget : public QHBox { 21 class DirImageWidget : public QFrame {
20 public: 22 public:
21 DirImageWidget() { 23 DirImageWidget(): QFrame() {
24 setFrameStyle(Box|Raised);
25 QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout");
22 chkbox = new QCheckBox( QObject::tr("Show all files"), this ); 26 chkbox = new QCheckBox( QObject::tr("Show all files"), this );
27 m_MainLayout->addWidget(chkbox);
28 QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
29 m_MainLayout->addItem( spacer1 );
30
23 } 31 }
24 ~DirImageWidget() {} 32 ~DirImageWidget() {}
25 QCheckBox* chkbox; 33 QCheckBox* chkbox;
26 }; 34 };
27} 35}
28 36
29 37
30DirInterfaceInfo::DirInterfaceInfo() { 38DirInterfaceInfo::DirInterfaceInfo() {
31} 39}
32DirInterfaceInfo::~DirInterfaceInfo() { 40DirInterfaceInfo::~DirInterfaceInfo() {
33} 41}
34 42
35QString DirInterfaceInfo::name()const { 43QString DirInterfaceInfo::name()const {
36 return QObject::tr("Directory View" ); 44 return QObject::tr("Directory View" );
37} 45}
38 46
39QWidget* DirInterfaceInfo::configWidget(const Config& cfg) { 47QWidget* DirInterfaceInfo::configWidget(const Config& cfg) {
40 DirImageWidget* wid = new DirImageWidget(); 48 DirImageWidget* wid = new DirImageWidget();
41 wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) ); 49 wid->chkbox->setChecked( cfg.readBoolEntry("Dir_Check_All_Files", true) );
42 50
43 return wid; 51 return wid;
44} 52}
45 53
46void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) { 54void DirInterfaceInfo::writeConfig( QWidget* _wid, Config& cfg) {
47 owarn << "Write Config" << oendl; 55 owarn << "Write Config" << oendl;
48 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid); 56 DirImageWidget* wid = static_cast<DirImageWidget*>(_wid);
49 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() ); 57 cfg.writeEntry("Dir_Check_All_Files", wid->chkbox->isChecked() );
50} 58}