author | alwin <alwin> | 2005-03-23 18:26:46 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-23 18:26:46 (UTC) |
commit | 76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5 (patch) (unidiff) | |
tree | 8269bc37e5d3addf36194e231e84bce8a9e49e8b | |
parent | 73928229c1ed258a78e815d9089667f0d99e72d8 (diff) | |
download | opie-76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5.zip opie-76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5.tar.gz opie-76ea5ee6e306a4ee9fe6831dbe4c13ee53f6cdf5.tar.bz2 |
dirty hack let opie-eye crash
fixed display problems the right way now I hope
ToDo:
fix flicker when switching images in fullscreen mode while window is
visible
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 27 |
2 files changed, 8 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 03df321..6c3f9cb 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -87,200 +87,200 @@ void ImageView::startSlide(int value) | |||
87 | m_slideTimer = new QTimer(this); | 87 | m_slideTimer = new QTimer(this); |
88 | } | 88 | } |
89 | m_slideValue=value; | 89 | m_slideValue=value; |
90 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); | 90 | connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide())); |
91 | /* this "+1" is one millisecond. with that we can setup a slideshowvalue | 91 | /* this "+1" is one millisecond. with that we can setup a slideshowvalue |
92 | of 0. eg "as fast as possible". | 92 | of 0. eg "as fast as possible". |
93 | */ | 93 | */ |
94 | m_slideTimer->start(m_slideValue*1000+1,true); | 94 | m_slideTimer->start(m_slideValue*1000+1,true); |
95 | } | 95 | } |
96 | 96 | ||
97 | void ImageView::stopSlide() | 97 | void ImageView::stopSlide() |
98 | { | 98 | { |
99 | if (!m_slideTimer) { | 99 | if (!m_slideTimer) { |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | m_slideTimer->stop(); | 102 | m_slideTimer->stop(); |
103 | delete m_slideTimer; | 103 | delete m_slideTimer; |
104 | m_slideTimer = 0; | 104 | m_slideTimer = 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | void ImageView::nextSlide() | 107 | void ImageView::nextSlide() |
108 | { | 108 | { |
109 | if (!m_slideTimer) { | 109 | if (!m_slideTimer) { |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | #if 0 | 112 | #if 0 |
113 | if (isHidden()) { | 113 | if (isHidden()) { |
114 | delete m_slideTimer; | 114 | delete m_slideTimer; |
115 | m_slideTimer = 0; | 115 | m_slideTimer = 0; |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | #endif | 118 | #endif |
119 | emit dispNext(); | 119 | emit dispNext(); |
120 | m_slideTimer->start(m_slideValue*1000,true); | 120 | m_slideTimer->start(m_slideValue*1000,true); |
121 | } | 121 | } |
122 | void ImageView::initKeys() | 122 | void ImageView::initKeys() |
123 | { | 123 | { |
124 | odebug << "init imageview keys" << oendl; | 124 | odebug << "init imageview keys" << oendl; |
125 | if (!m_cfg) { | 125 | if (!m_cfg) { |
126 | m_cfg = new Opie::Core::OConfig("opie-eye"); | 126 | m_cfg = new Opie::Core::OConfig("opie-eye"); |
127 | m_cfg->setGroup("image_view_keys" ); | 127 | m_cfg->setGroup("image_view_keys" ); |
128 | } | 128 | } |
129 | Opie::Core::OKeyPair::List lst; | 129 | Opie::Core::OKeyPair::List lst; |
130 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 130 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
131 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 131 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
132 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 132 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
133 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 133 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
134 | lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); | 134 | lst.append( Opie::Core::OKeyPair(Qt::Key_Escape,0)); |
135 | 135 | ||
136 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", | 136 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "image_view_keys", |
137 | lst, false,this, "image_view_keys" ); | 137 | lst, false,this, "image_view_keys" ); |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Handle KeyEvents when they're pressed. This avoids problems | 140 | * Handle KeyEvents when they're pressed. This avoids problems |
141 | * with 'double next' on Return. | 141 | * with 'double next' on Return. |
142 | * The Return press would switch to this view and the return | 142 | * The Return press would switch to this view and the return |
143 | * release would emit the dispNext Signal. | 143 | * release would emit the dispNext Signal. |
144 | */ | 144 | */ |
145 | m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); | 145 | m_viewManager->setEventMask( Opie::Core::OKeyConfigManager::MaskPressed ); |
146 | 146 | ||
147 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", | 147 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("View Image Info"), "imageviewinfo", |
148 | Resource::loadPixmap("1to1"), ViewInfo, | 148 | Resource::loadPixmap("1to1"), ViewInfo, |
149 | Opie::Core::OKeyPair(Qt::Key_I,0), | 149 | Opie::Core::OKeyPair(Qt::Key_I,0), |
150 | this, SLOT(slotShowImageInfo()))); | 150 | this, SLOT(slotShowImageInfo()))); |
151 | 151 | ||
152 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", | 152 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autorotate"), "imageautorotate", |
153 | Resource::loadPixmap("rotate"), Autorotate, | 153 | Resource::loadPixmap("rotate"), Autorotate, |
154 | Opie::Core::OKeyPair(Qt::Key_R,0), | 154 | Opie::Core::OKeyPair(Qt::Key_R,0), |
155 | this, SIGNAL(toggleAutorotate()))); | 155 | this, SIGNAL(toggleAutorotate()))); |
156 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", | 156 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale", |
157 | Resource::loadPixmap("1to1"), Autoscale, | 157 | Resource::loadPixmap("1to1"), Autoscale, |
158 | Opie::Core::OKeyPair(Qt::Key_S,0), | 158 | Opie::Core::OKeyPair(Qt::Key_S,0), |
159 | this, SIGNAL(toggleAutoscale()))); | 159 | this, SIGNAL(toggleAutoscale()))); |
160 | 160 | ||
161 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", | 161 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext", |
162 | Resource::loadPixmap("forward"), ShowNext, | 162 | Resource::loadPixmap("forward"), ShowNext, |
163 | Opie::Core::OKeyPair(Qt::Key_Return,0), | 163 | Opie::Core::OKeyPair(Qt::Key_Return,0), |
164 | this, SIGNAL(dispNext()))); | 164 | this, SIGNAL(dispNext()))); |
165 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", | 165 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev", |
166 | Resource::loadPixmap("back"), ShowPrevious, | 166 | Resource::loadPixmap("back"), ShowPrevious, |
167 | Opie::Core::OKeyPair(Qt::Key_P,0), | 167 | Opie::Core::OKeyPair(Qt::Key_P,0), |
168 | this, SIGNAL(dispPrev()))); | 168 | this, SIGNAL(dispPrev()))); |
169 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", | 169 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen", |
170 | Resource::loadPixmap("fullscreen"), FullScreen, | 170 | Resource::loadPixmap("fullscreen"), FullScreen, |
171 | Opie::Core::OKeyPair(Qt::Key_F,0), | 171 | Opie::Core::OKeyPair(Qt::Key_F,0), |
172 | this, SIGNAL(toggleFullScreen()))); | 172 | this, SIGNAL(toggleFullScreen()))); |
173 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", | 173 | m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", |
174 | Resource::loadPixmap("mag"), Zoomer, | 174 | Resource::loadPixmap("mag"), Zoomer, |
175 | Opie::Core::OKeyPair(Qt::Key_T,0), | 175 | Opie::Core::OKeyPair(Qt::Key_T,0), |
176 | this, SIGNAL(toggleZoomer()))); | 176 | this, SIGNAL(toggleZoomer()))); |
177 | m_viewManager->handleWidget( this ); | 177 | m_viewManager->handleWidget( this ); |
178 | m_viewManager->load(); | 178 | m_viewManager->load(); |
179 | } | 179 | } |
180 | 180 | ||
181 | void ImageView::keyReleaseEvent(QKeyEvent * e) | 181 | void ImageView::keyReleaseEvent(QKeyEvent * e) |
182 | { | 182 | { |
183 | if (!e || e->state()!=0) { | 183 | if (!e || e->state()!=0) { |
184 | return; | 184 | return; |
185 | } | 185 | } |
186 | if (e->key()==Qt::Key_Escape) { | 186 | if (e->key()==Qt::Key_Escape) { |
187 | if (fullScreen()) { | 187 | if (fullScreen()) { |
188 | emit hideMe(); | 188 | emit hideMe(); |
189 | } | 189 | } |
190 | if (closeIfHide) { | 190 | if (closeIfHide) { |
191 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 191 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | void ImageView::setCloseIfHide(bool how) | 196 | void ImageView::setCloseIfHide(bool how) |
197 | { | 197 | { |
198 | closeIfHide = how; | 198 | closeIfHide = how; |
199 | } | 199 | } |
200 | 200 | ||
201 | void ImageView::slotShowImageInfo() | 201 | void ImageView::slotShowImageInfo() |
202 | { | 202 | { |
203 | emit dispImageInfo(m_lastName); | 203 | emit dispImageInfo(m_lastName); |
204 | } | 204 | } |
205 | 205 | ||
206 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 206 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
207 | { | 207 | { |
208 | if (e->button()==1) { | 208 | if (e->button()==1) { |
209 | return OImageScrollView::contentsMousePressEvent(e); | 209 | return OImageScrollView::contentsMousePressEvent(e); |
210 | } | 210 | } |
211 | odebug << "Popup " << oendl; | 211 | odebug << "Popup " << oendl; |
212 | QPopupMenu *m = new QPopupMenu(this); | 212 | QPopupMenu *m = new QPopupMenu(this); |
213 | if (!m) return; | 213 | if (!m) return; |
214 | if (m_hGroup) { | 214 | if (m_hGroup) { |
215 | m_hGroup->addTo(m); | 215 | m_hGroup->addTo(m); |
216 | } | 216 | } |
217 | if (fullScreen()) { | 217 | if (fullScreen()) { |
218 | if (m_gPrevNext) { | 218 | if (m_gPrevNext) { |
219 | m->insertSeparator(); | 219 | m->insertSeparator(); |
220 | m_gPrevNext->addTo(m); | 220 | m_gPrevNext->addTo(m); |
221 | } | 221 | } |
222 | if (m_gDisplayType) { | 222 | if (m_gDisplayType) { |
223 | m->insertSeparator(); | 223 | m->insertSeparator(); |
224 | m_gDisplayType->addTo(m); | 224 | m_gDisplayType->addTo(m); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | m->setFocus(); | 227 | m->setFocus(); |
228 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 228 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
229 | if (m_hGroup) { | 229 | if (m_hGroup) { |
230 | m_hGroup->removeFrom(m); | 230 | m_hGroup->removeFrom(m); |
231 | } | 231 | } |
232 | if (m_gPrevNext) { | 232 | if (m_gPrevNext) { |
233 | m_gPrevNext->removeFrom(m); | 233 | m_gPrevNext->removeFrom(m); |
234 | } | 234 | } |
235 | if (m_gDisplayType) { | 235 | if (m_gDisplayType) { |
236 | m_gDisplayType->removeFrom(m); | 236 | m_gDisplayType->removeFrom(m); |
237 | } | 237 | } |
238 | delete m; | 238 | delete m; |
239 | } | 239 | } |
240 | 240 | ||
241 | void ImageView::setFullScreen(bool how,bool force) | 241 | void ImageView::setFullScreen(bool how,bool force) |
242 | { | 242 | { |
243 | m_isFullScreen = how; | 243 | m_isFullScreen = how; |
244 | if (how) { | 244 | if (how) { |
245 | m_ignore_next_in = true; | 245 | m_ignore_next_in = true; |
246 | // setFixedSize(qApp->desktop()->size()); | 246 | // setFixedSize(qApp->desktop()->size()); |
247 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); | 247 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); |
248 | if (force) showFullScreen(); | 248 | if (force) showFullScreen(); |
249 | } else { | 249 | } else { |
250 | // setMinimumSize(10,10); | 250 | // setMinimumSize(10,10); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | void ImageView::focusInEvent(QFocusEvent *) | 254 | void ImageView::focusInEvent(QFocusEvent *) |
255 | { | 255 | { |
256 | // Always do it here, no matter the size. | 256 | // Always do it here, no matter the size. |
257 | odebug << "Focus in (view)" << oendl; | 257 | odebug << "Focus in (view)" << oendl; |
258 | //if (fullScreen()) parentWidget()->showNormal(); | 258 | //if (fullScreen()) parentWidget()->showNormal(); |
259 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | 259 | if (m_ignore_next_in){m_ignore_next_in=false;return;} |
260 | if (fullScreen()) enableFullscreen(); | 260 | if (fullScreen()) enableFullscreen(); |
261 | } | 261 | } |
262 | 262 | ||
263 | void ImageView::hide() | 263 | void ImageView::hide() |
264 | { | 264 | { |
265 | if (fullScreen()) { | 265 | if (fullScreen()) { |
266 | m_ignore_next_in = true; | 266 | m_ignore_next_in = true; |
267 | showNormal(); | 267 | showNormal(); |
268 | } | 268 | } |
269 | QWidget::hide(); | 269 | QWidget::hide(); |
270 | } | 270 | } |
271 | void ImageView::enableFullscreen() | 271 | void ImageView::enableFullscreen() |
272 | { | 272 | { |
273 | if (!fullScreen()) return; | 273 | if (!fullScreen()) return; |
274 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} | 274 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} |
275 | 275 | ||
276 | setUpdatesEnabled(false); | 276 | setUpdatesEnabled(false); |
277 | // This is needed because showNormal() forcefully changes the window | 277 | // This is needed because showNormal() forcefully changes the window |
278 | // style to WSTyle_TopLevel. | 278 | // style to WSTyle_TopLevel. |
279 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 279 | reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
280 | // Enable fullscreen. | 280 | // Enable fullscreen. |
281 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus | 281 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus |
282 | * so we must block it here! */ | 282 | * so we must block it here! */ |
283 | m_ignore_next_in = true; | 283 | m_ignore_next_in = true; |
284 | showFullScreen(); | 284 | showFullScreen(); |
285 | setUpdatesEnabled(true); | 285 | setUpdatesEnabled(true); |
286 | } | 286 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 3a89dfd..d11e4e1 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -118,492 +118,479 @@ void PMainWindow::slotRotateToggled(bool how) | |||
118 | m_cfg->writeEntry("autorotate",how); | 118 | m_cfg->writeEntry("autorotate",how); |
119 | } | 119 | } |
120 | if (m_disp) { | 120 | if (m_disp) { |
121 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); | 121 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | void PMainWindow::slotScaleToggled(bool how) | 125 | void PMainWindow::slotScaleToggled(bool how) |
126 | { | 126 | { |
127 | if (autoSave) { | 127 | if (autoSave) { |
128 | m_cfg->writeEntry("unscaled",how); | 128 | m_cfg->writeEntry("unscaled",how); |
129 | } | 129 | } |
130 | odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; | 130 | odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl; |
131 | odebug << "How: " << how << oendl; | 131 | odebug << "How: " << how << oendl; |
132 | if (how) { | 132 | if (how) { |
133 | m_aAutoRotate->setOn(false); | 133 | m_aAutoRotate->setOn(false); |
134 | } | 134 | } |
135 | if (m_disp) { | 135 | if (m_disp) { |
136 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); | 136 | m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn()); |
137 | } | 137 | } |
138 | m_aAutoRotate->setEnabled(!how); | 138 | m_aAutoRotate->setEnabled(!how); |
139 | odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; | 139 | odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl; |
140 | } | 140 | } |
141 | 141 | ||
142 | void PMainWindow::slotConfig() { | 142 | void PMainWindow::slotConfig() { |
143 | /* | 143 | /* |
144 | * have a tab with the possible views | 144 | * have a tab with the possible views |
145 | * a tab for globals image cache size.. scaled loading | 145 | * a tab for globals image cache size.. scaled loading |
146 | * and one tab for the KeyConfigs | 146 | * and one tab for the KeyConfigs |
147 | */ | 147 | */ |
148 | QDialog dlg(this, 0, true); | 148 | QDialog dlg(this, 0, true); |
149 | dlg.setCaption( tr("Opie Eye - Config" ) ); | 149 | dlg.setCaption( tr("Opie Eye - Config" ) ); |
150 | 150 | ||
151 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 151 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
152 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 152 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
153 | lay->addWidget( wid ); | 153 | lay->addWidget( wid ); |
154 | 154 | ||
155 | BaseSetup*bSetup = new BaseSetup(m_cfg,wid); | 155 | BaseSetup*bSetup = new BaseSetup(m_cfg,wid); |
156 | wid->addTab(bSetup,"SettingsIcon","Basics setup"); | 156 | wid->addTab(bSetup,"SettingsIcon","Basics setup"); |
157 | 157 | ||
158 | ViewMap *vM = viewMap(); | 158 | ViewMap *vM = viewMap(); |
159 | ViewMap::Iterator _it = vM->begin(); | 159 | ViewMap::Iterator _it = vM->begin(); |
160 | QMap<PDirView*, QWidget*> lst; | 160 | QMap<PDirView*, QWidget*> lst; |
161 | 161 | ||
162 | for( ; _it != vM->end(); ++_it ) { | 162 | for( ; _it != vM->end(); ++_it ) { |
163 | PDirView *view = (_it.data())(*m_cfg); | 163 | PDirView *view = (_it.data())(*m_cfg); |
164 | PInterfaceInfo *inf = view->interfaceInfo(); | 164 | PInterfaceInfo *inf = view->interfaceInfo(); |
165 | QWidget *_wid = inf->configWidget( *m_cfg ); | 165 | QWidget *_wid = inf->configWidget( *m_cfg ); |
166 | if (!_wid) continue; | 166 | if (!_wid) continue; |
167 | _wid->reparent(wid, QPoint() ); | 167 | _wid->reparent(wid, QPoint() ); |
168 | lst.insert( view, _wid ); | 168 | lst.insert( view, _wid ); |
169 | wid->addTab( _wid, "fileopen", inf->name() ); | 169 | wid->addTab( _wid, "fileopen", inf->name() ); |
170 | } | 170 | } |
171 | 171 | ||
172 | /* | 172 | /* |
173 | * Add the KeyConfigWidget | 173 | * Add the KeyConfigWidget |
174 | */ | 174 | */ |
175 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | 175 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); |
176 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | 176 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); |
177 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | 177 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); |
178 | QWidget*w = m_stack->visibleWidget(); | 178 | QWidget*w = m_stack->visibleWidget(); |
179 | 179 | ||
180 | bool reminfo = false; | 180 | bool reminfo = false; |
181 | if ( !m_info ) { | 181 | if ( !m_info ) { |
182 | reminfo = true; | 182 | reminfo = true; |
183 | initInfo(); | 183 | initInfo(); |
184 | m_info->hide(); | 184 | m_info->hide(); |
185 | } | 185 | } |
186 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); | 186 | keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); |
187 | 187 | ||
188 | bool remdisp = false; | 188 | bool remdisp = false; |
189 | if ( !m_disp ) { | 189 | if ( !m_disp ) { |
190 | remdisp = true; | 190 | remdisp = true; |
191 | initDisp(); | 191 | initDisp(); |
192 | m_disp->hide(); | 192 | m_disp->hide(); |
193 | } | 193 | } |
194 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); | 194 | keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); |
195 | 195 | ||
196 | keyWid->load(); | 196 | keyWid->load(); |
197 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | 197 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); |
198 | wid->setCurrentTab(0); | 198 | wid->setCurrentTab(0); |
199 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | 199 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); |
200 | 200 | ||
201 | /* | 201 | /* |
202 | * clean up | 202 | * clean up |
203 | *apply changes | 203 | *apply changes |
204 | */ | 204 | */ |
205 | 205 | ||
206 | QMap<PDirView*, QWidget*>::Iterator it; | 206 | QMap<PDirView*, QWidget*>::Iterator it; |
207 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 207 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
208 | if ( act ) | 208 | if ( act ) |
209 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); | 209 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
210 | delete it.key(); | 210 | delete it.key(); |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | if ( act ) { | 214 | if ( act ) { |
215 | keyWid->save(); | 215 | keyWid->save(); |
216 | m_disp->manager()->save(); | 216 | m_disp->manager()->save(); |
217 | m_info->manager()->save(); | 217 | m_info->manager()->save(); |
218 | m_view->manager()->save(); | 218 | m_view->manager()->save(); |
219 | bSetup->save_values(); | 219 | bSetup->save_values(); |
220 | m_view->resetView(); | 220 | m_view->resetView(); |
221 | readConfig(); | 221 | readConfig(); |
222 | } | 222 | } |
223 | delete keyWid; | 223 | delete keyWid; |
224 | 224 | ||
225 | m_stack->raiseWidget(w); | 225 | m_stack->raiseWidget(w); |
226 | if (remdisp) { | 226 | if (remdisp) { |
227 | m_disp->hide(); | 227 | m_disp->hide(); |
228 | } | 228 | } |
229 | if (reminfo) { | 229 | if (reminfo) { |
230 | m_info->hide(); | 230 | m_info->hide(); |
231 | } | 231 | } |
232 | if (m_disp) { | 232 | if (m_disp) { |
233 | m_disp->setIntensity(m_Intensity,true); | 233 | m_disp->setIntensity(m_Intensity,true); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * create a new image info component | 238 | * create a new image info component |
239 | * and detach the current one | 239 | * and detach the current one |
240 | * we will make the other delete on exit | 240 | * we will make the other delete on exit |
241 | */ | 241 | */ |
242 | template<class T> | 242 | template<class T> |
243 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 243 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
244 | if ( *ptr ) { | 244 | if ( *ptr ) { |
245 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 245 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
246 | (*ptr)->setDestructiveClose(); | 246 | (*ptr)->setDestructiveClose(); |
247 | m_stack->removeWidget( *ptr ); | 247 | m_stack->removeWidget( *ptr ); |
248 | } | 248 | } |
249 | *ptr = new T(m_cfg, m_stack, name ); | 249 | *ptr = new T(m_cfg, m_stack, name ); |
250 | m_stack->addWidget( *ptr, id ); | 250 | m_stack->addWidget( *ptr, id ); |
251 | 251 | ||
252 | connect(*ptr, SIGNAL(sig_return()), | 252 | connect(*ptr, SIGNAL(sig_return()), |
253 | this,SLOT(slotReturn())); | 253 | this,SLOT(slotReturn())); |
254 | 254 | ||
255 | } | 255 | } |
256 | 256 | ||
257 | void PMainWindow::initInfo() { | 257 | void PMainWindow::initInfo() { |
258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void PMainWindow::initDisp() { | 262 | void PMainWindow::initDisp() { |
263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
264 | if (m_disp) { | 264 | if (m_disp) { |
265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
267 | // } | 267 | // } |
268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); |
269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
271 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 271 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
272 | m_disp->setBackgroundColor(white); | 272 | m_disp->setBackgroundColor(white); |
273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
282 | slotFullScreenToggled(m_aFullScreen->isOn()); | 282 | slotFullScreenToggled(m_aFullScreen->isOn()); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | void PMainWindow::slotToggleFullScreen() | 286 | void PMainWindow::slotToggleFullScreen() |
287 | { | 287 | { |
288 | bool current = !m_aFullScreen->isOn(); | 288 | bool current = !m_aFullScreen->isOn(); |
289 | m_aFullScreen->setOn(current); | 289 | m_aFullScreen->setOn(current); |
290 | } | 290 | } |
291 | 291 | ||
292 | void PMainWindow::slotFullScreenButton(bool current) | 292 | void PMainWindow::slotFullScreenButton(bool current) |
293 | { | 293 | { |
294 | if (autoSave) { | 294 | if (autoSave) { |
295 | m_cfg->writeEntry("fullscreen",current); | 295 | m_cfg->writeEntry("fullscreen",current); |
296 | } | 296 | } |
297 | if (!m_disp) return; | 297 | if (!m_disp) return; |
298 | if (m_disp->isVisible()) { | 298 | if (m_disp->isVisible()) { |
299 | setupViewWindow(current, true); | 299 | setupViewWindow(current, true); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | 303 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) |
304 | { | 304 | { |
305 | if (!m_disp) { | 305 | if (!m_disp) { |
306 | return; | 306 | return; |
307 | } | 307 | } |
308 | if (current) { | 308 | if (current) { |
309 | m_disp->setBackgroundColor(black); | 309 | m_disp->setBackgroundColor(black); |
310 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | 310 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
311 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 311 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
312 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 312 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
313 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 313 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
314 | m_disp->setFullScreen(current,forceDisplay); | 314 | m_disp->setFullScreen(current,forceDisplay); |
315 | } else { | 315 | } else { |
316 | setUpdatesEnabled(false); | 316 | setUpdatesEnabled(false); |
317 | #if 0 | 317 | #if 0 |
318 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 318 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
319 | 319 | ||
320 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 320 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
321 | } else { | 321 | } else { |
322 | //m_disp->setMinimumSize(10,10); | 322 | //m_disp->setMinimumSize(10,10); |
323 | } | 323 | } |
324 | #endif | 324 | #endif |
325 | m_disp->setBackgroundColor(white); | 325 | m_disp->setBackgroundColor(white); |
326 | m_stack->addWidget(m_disp,ImageDisplay); | 326 | m_stack->addWidget(m_disp,ImageDisplay); |
327 | m_disp->setVScrollBarMode(QScrollView::Auto); | 327 | m_disp->setVScrollBarMode(QScrollView::Auto); |
328 | m_disp->setHScrollBarMode(QScrollView::Auto); | 328 | m_disp->setHScrollBarMode(QScrollView::Auto); |
329 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 329 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
330 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); | 330 | m_disp->setGeometry(30,30,QApplication::desktop()->width()-60,QApplication::desktop()->height()-60); |
331 | } | 331 | } |
332 | if (forceDisplay || m_disp->isVisible()) { | 332 | if (forceDisplay || m_disp->isVisible()) { |
333 | m_stack->raiseWidget(m_disp); | 333 | m_stack->raiseWidget(m_disp); |
334 | m_disp->setFocus(); | 334 | m_disp->setFocus(); |
335 | } | 335 | } |
336 | setUpdatesEnabled(true); | 336 | setUpdatesEnabled(true); |
337 | } | 337 | } |
338 | m_disp->setFullScreen(current,forceDisplay); | 338 | m_disp->setFullScreen(current,forceDisplay); |
339 | } | 339 | } |
340 | 340 | ||
341 | void PMainWindow::slotFullScreenToggled(bool current) | 341 | void PMainWindow::slotFullScreenToggled(bool current) |
342 | { | 342 | { |
343 | setupViewWindow(current,true); | 343 | setupViewWindow(current,true); |
344 | } | 344 | } |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * With big Screen the plan could be to 'detach' the image | 347 | * With big Screen the plan could be to 'detach' the image |
348 | * window if visible and to create a ne wone | 348 | * window if visible and to create a ne wone |
349 | * init* already supports it but I make no use of it for | 349 | * init* already supports it but I make no use of it for |
350 | * now. We set filename and raise | 350 | * now. We set filename and raise |
351 | * | 351 | * |
352 | * ### FIXME and talk to alwin | 352 | * ### FIXME and talk to alwin |
353 | */ | 353 | */ |
354 | void PMainWindow::slotShowInfo( const QString& inf ) { | 354 | void PMainWindow::slotShowInfo( const QString& inf ) { |
355 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 355 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
356 | return; | 356 | return; |
357 | } | 357 | } |
358 | if ( !m_info ) { | 358 | if ( !m_info ) { |
359 | initInfo(); | 359 | initInfo(); |
360 | } | 360 | } |
361 | m_info->setPath( inf ); | 361 | m_info->setPath( inf ); |
362 | if (m_SmallWindow) { | 362 | if (m_SmallWindow) { |
363 | m_aNext->removeFrom(toolBar); | 363 | m_aNext->removeFrom(toolBar); |
364 | m_aPrevious->removeFrom(toolBar); | 364 | m_aPrevious->removeFrom(toolBar); |
365 | fsButton->hide(); | 365 | fsButton->hide(); |
366 | } | 366 | } |
367 | m_aNext->setEnabled(false); | 367 | m_aNext->setEnabled(false); |
368 | m_aPrevious->setEnabled(false); | 368 | m_aPrevious->setEnabled(false); |
369 | m_aDirUp->setEnabled(false); | 369 | m_aDirUp->setEnabled(false); |
370 | m_aShowInfo->setEnabled(false); | 370 | m_aShowInfo->setEnabled(false); |
371 | m_aViewfile->setEnabled(true); | 371 | m_aViewfile->setEnabled(true); |
372 | m_aStartSlide->setEnabled(false); | 372 | m_aStartSlide->setEnabled(false); |
373 | m_stack->raiseWidget( ImageInfo ); | 373 | m_stack->raiseWidget( ImageInfo ); |
374 | } | 374 | } |
375 | 375 | ||
376 | void PMainWindow::slotDisplay( const QString& inf ) { | 376 | void PMainWindow::slotDisplay( const QString& inf ) { |
377 | bool nwindow = false; | 377 | bool nwindow = false; |
378 | bool disp_hack = false; | ||
379 | int lb; | ||
380 | if (m_disp && m_disp->fullScreen()) { | ||
381 | lb = m_disp->Intensity(); | ||
382 | delete m_disp; | ||
383 | m_disp = 0; | ||
384 | |||
385 | disp_hack = true; | ||
386 | } | ||
387 | if ( !m_disp ) { | 378 | if ( !m_disp ) { |
388 | nwindow = true; | 379 | nwindow = true; |
389 | initDisp(); | 380 | initDisp(); |
390 | m_disp->setIntensity((disp_hack?lb:m_Intensity)); | 381 | m_disp->setIntensity(m_Intensity); |
382 | m_setCurrentBrightness->setEnabled(true); | ||
391 | } | 383 | } |
392 | m_setCurrentBrightness->setEnabled(true); | ||
393 | |||
394 | Opie::Ui::OWait wdlg; | ||
395 | wdlg.setTimerLength(30); | ||
396 | wdlg.show(); | ||
397 | //qApp->processEvents(20); | ||
398 | m_disp->setImage( inf ); | 384 | m_disp->setImage( inf ); |
399 | wdlg.hide(); | ||
400 | //qApp->processEvents(20); | ||
401 | if (m_SmallWindow) { | 385 | if (m_SmallWindow) { |
402 | if (m_gPrevNext->isEnabled()==false) { | 386 | if (m_gPrevNext->isEnabled()==false) { |
403 | m_gPrevNext->addTo(toolBar); | 387 | m_gPrevNext->addTo(toolBar); |
404 | fsButton->hide(); | 388 | fsButton->hide(); |
405 | } | 389 | } |
406 | } | 390 | } |
407 | m_gPrevNext->setEnabled(true); | 391 | m_gPrevNext->setEnabled(true); |
408 | m_aDirUp->setEnabled(false); | 392 | m_aDirUp->setEnabled(false); |
409 | m_aShowInfo->setEnabled(true); | 393 | m_aShowInfo->setEnabled(true); |
410 | m_aViewfile->setEnabled(false); | 394 | m_aViewfile->setEnabled(false); |
411 | m_aStartSlide->setEnabled(false); | 395 | m_aStartSlide->setEnabled(false); |
412 | 396 | ||
413 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 397 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
414 | slotFullScreenToggled(m_aFullScreen->isOn()); | 398 | slotFullScreenToggled(m_aFullScreen->isOn()); |
415 | } | 399 | } |
416 | if (m_disp->fullScreen()) { | 400 | if (m_disp->fullScreen()) { |
417 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 401 | if (!m_disp->isVisible()) { |
402 | m_disp->showFullScreen(); | ||
403 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | ||
404 | } | ||
418 | } else { | 405 | } else { |
419 | m_stack->raiseWidget( ImageDisplay ); | 406 | m_stack->raiseWidget( ImageDisplay ); |
420 | } | 407 | } |
421 | } | 408 | } |
422 | 409 | ||
423 | void PMainWindow::raiseIconView() { | 410 | void PMainWindow::raiseIconView() { |
424 | setUpdatesEnabled(false); | 411 | setUpdatesEnabled(false); |
425 | if (m_SmallWindow) { | 412 | if (m_SmallWindow) { |
426 | m_gPrevNext->removeFrom(toolBar); | 413 | m_gPrevNext->removeFrom(toolBar); |
427 | fsButton->show(); | 414 | fsButton->show(); |
428 | } | 415 | } |
429 | m_gPrevNext->setEnabled(false); | 416 | m_gPrevNext->setEnabled(false); |
430 | m_aDirUp->setEnabled(true); | 417 | m_aDirUp->setEnabled(true); |
431 | m_aShowInfo->setEnabled(true); | 418 | m_aShowInfo->setEnabled(true); |
432 | m_aViewfile->setEnabled(true); | 419 | m_aViewfile->setEnabled(true); |
433 | m_aStartSlide->setEnabled(true); | 420 | m_aStartSlide->setEnabled(true); |
434 | 421 | ||
435 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 422 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
436 | m_disp->stopSlide(); | 423 | m_disp->stopSlide(); |
437 | m_disp->hide(); | 424 | m_disp->hide(); |
438 | } | 425 | } |
439 | m_stack->raiseWidget( IconView ); | 426 | m_stack->raiseWidget( IconView ); |
440 | setUpdatesEnabled(true); | 427 | setUpdatesEnabled(true); |
441 | repaint(); | 428 | repaint(); |
442 | } | 429 | } |
443 | 430 | ||
444 | void PMainWindow::slotReturn() { | 431 | void PMainWindow::slotReturn() { |
445 | raiseIconView(); | 432 | raiseIconView(); |
446 | } | 433 | } |
447 | 434 | ||
448 | 435 | ||
449 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 436 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
450 | /* | 437 | /* |
451 | * return from view | 438 | * return from view |
452 | * or properly quit | 439 | * or properly quit |
453 | */ | 440 | */ |
454 | if (!m_setDocCalled) { | 441 | if (!m_setDocCalled) { |
455 | if ( m_stack->visibleWidget() == m_info || | 442 | if ( m_stack->visibleWidget() == m_info || |
456 | m_stack->visibleWidget() == m_disp ) { | 443 | m_stack->visibleWidget() == m_disp ) { |
457 | ev->ignore(); | 444 | ev->ignore(); |
458 | raiseIconView(); | 445 | raiseIconView(); |
459 | return; | 446 | return; |
460 | } | 447 | } |
461 | } | 448 | } |
462 | if (m_disp && m_disp->fullScreen()) { | 449 | if (m_disp && m_disp->fullScreen()) { |
463 | /* otherwise opie-eye crashes in bigscreen mode! */ | 450 | /* otherwise opie-eye crashes in bigscreen mode! */ |
464 | m_disp->reparent(0,QPoint(0,0)); | 451 | m_disp->reparent(0,QPoint(0,0)); |
465 | m_stack->addWidget(m_disp,ImageDisplay); | 452 | m_stack->addWidget(m_disp,ImageDisplay); |
466 | } | 453 | } |
467 | ev->accept(); | 454 | ev->accept(); |
468 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 455 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
469 | } | 456 | } |
470 | 457 | ||
471 | void PMainWindow::setDocument( const QString& showImg ) | 458 | void PMainWindow::setDocument( const QString& showImg ) |
472 | { | 459 | { |
473 | QString file = showImg; | 460 | QString file = showImg; |
474 | DocLnk lnk(showImg); | 461 | DocLnk lnk(showImg); |
475 | if (lnk.isValid() ) | 462 | if (lnk.isValid() ) |
476 | file = lnk.file(); | 463 | file = lnk.file(); |
477 | slotDisplay( file ); | 464 | slotDisplay( file ); |
478 | #if 0 | 465 | #if 0 |
479 | if (!m_polishDone) { | 466 | if (!m_polishDone) { |
480 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); | 467 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); |
481 | } | 468 | } |
482 | #endif | 469 | #endif |
483 | } | 470 | } |
484 | 471 | ||
485 | void PMainWindow::check_view_fullscreen() | 472 | void PMainWindow::check_view_fullscreen() |
486 | { | 473 | { |
487 | if (!m_view) return; | 474 | if (!m_view) return; |
488 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { | 475 | if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { |
489 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 476 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
490 | } | 477 | } |
491 | } | 478 | } |
492 | 479 | ||
493 | void PMainWindow::slotSelectDir(int id) | 480 | void PMainWindow::slotSelectDir(int id) |
494 | { | 481 | { |
495 | emit changeDir( m_dev[fsMenu->text(id )] ); | 482 | emit changeDir( m_dev[fsMenu->text(id )] ); |
496 | } | 483 | } |
497 | 484 | ||
498 | void PMainWindow::dirChanged() | 485 | void PMainWindow::dirChanged() |
499 | { | 486 | { |
500 | fsMenu->clear(); | 487 | fsMenu->clear(); |
501 | m_dev.clear(); | 488 | m_dev.clear(); |
502 | 489 | ||
503 | /* home dir, too */ | 490 | /* home dir, too */ |
504 | QString f = getenv( "HOME" ); | 491 | QString f = getenv( "HOME" ); |
505 | if (!f.isEmpty()) { | 492 | if (!f.isEmpty()) { |
506 | m_dev.insert("Home directory",f); | 493 | m_dev.insert("Home directory",f); |
507 | fsMenu->insertItem("Home directory"); | 494 | fsMenu->insertItem("Home directory"); |
508 | } | 495 | } |
509 | const QList<FileSystem> &fs = m_storage->fileSystems(); | 496 | const QList<FileSystem> &fs = m_storage->fileSystems(); |
510 | QListIterator<FileSystem> it(fs ); | 497 | QListIterator<FileSystem> it(fs ); |
511 | for ( ; it.current(); ++it ) { | 498 | for ( ; it.current(); ++it ) { |
512 | const QString disk = (*it)->name(); | 499 | const QString disk = (*it)->name(); |
513 | const QString path = (*it)->path(); | 500 | const QString path = (*it)->path(); |
514 | m_dev.insert( disk, path ); | 501 | m_dev.insert( disk, path ); |
515 | fsMenu->insertItem( disk ); | 502 | fsMenu->insertItem( disk ); |
516 | } | 503 | } |
517 | } | 504 | } |
518 | 505 | ||
519 | void PMainWindow::showToolbar(bool how) | 506 | void PMainWindow::showToolbar(bool how) |
520 | { | 507 | { |
521 | if (!how) toolBar->hide(); | 508 | if (!how) toolBar->hide(); |
522 | else toolBar->show(); | 509 | else toolBar->show(); |
523 | if (autoSave) { | 510 | if (autoSave) { |
524 | m_cfg->writeEntry("showtoolbar",how); | 511 | m_cfg->writeEntry("showtoolbar",how); |
525 | } | 512 | } |
526 | } | 513 | } |
527 | 514 | ||
528 | void PMainWindow::setupActions() | 515 | void PMainWindow::setupActions() |
529 | { | 516 | { |
530 | m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); | 517 | m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true ); |
531 | m_aDirUp->setToggleAction(false); | 518 | m_aDirUp->setToggleAction(false); |
532 | connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); | 519 | connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp())); |
533 | 520 | ||
534 | if ( Ir::supported() ) { | 521 | if ( Ir::supported() ) { |
535 | m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); | 522 | m_aBeam = new QAction( tr( "Beam file" ), Resource::loadIconSet( "beam" ),0, 0, this, 0, true ); |
536 | m_aBeam->setToggleAction(false); | 523 | m_aBeam->setToggleAction(false); |
537 | connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); | 524 | connect(m_aBeam,SIGNAL(activated()),m_view,SLOT(slotBeam())); |
538 | } else { | 525 | } else { |
539 | m_aBeam = 0; | 526 | m_aBeam = 0; |
540 | } | 527 | } |
541 | 528 | ||
542 | m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); | 529 | m_aShowInfo = new QAction( tr( "Show imageinfo" ), Resource::loadIconSet( "edit" ), 0, 0, this, 0, true ); |
543 | m_aShowInfo->setToggleAction(false); | 530 | m_aShowInfo->setToggleAction(false); |
544 | connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); | 531 | connect(m_aShowInfo,SIGNAL(activated()),m_view,SLOT(slotImageInfo())); |
545 | 532 | ||
546 | m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); | 533 | m_aTrash = new QAction( tr( "Delete file" ), Resource::loadIconSet("trash"), 0, 0, this, 0, true ); |
547 | m_aTrash->setToggleAction(false); | 534 | m_aTrash->setToggleAction(false); |
548 | connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); | 535 | connect(m_aTrash,SIGNAL(activated()),m_view,SLOT(slotTrash())); |
549 | 536 | ||
550 | m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); | 537 | m_aViewfile = new QAction( tr( "Display image" ), Resource::loadIconSet("mag"), 0, 0, this, 0, true ); |
551 | m_aViewfile->setToggleAction(false); | 538 | m_aViewfile->setToggleAction(false); |
552 | connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); | 539 | connect(m_aViewfile,SIGNAL(activated()),m_view,SLOT(slotShowImage())); |
553 | 540 | ||
554 | m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); | 541 | m_aStartSlide = new QAction( tr( "Start slideshow" ), Resource::loadIconSet("play"),0, 0, this, 0, true ); |
555 | m_aStartSlide->setToggleAction(false); | 542 | m_aStartSlide->setToggleAction(false); |
556 | connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); | 543 | connect(m_aStartSlide,SIGNAL(activated()),m_view,SLOT(slotStartSlide())); |
557 | 544 | ||
558 | m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); | 545 | m_aHideToolbar = new QAction( tr( "Show toolbar" ), Resource::loadIconSet( "UtilsIcon" ), 0, 0, this, 0, true ); |
559 | m_aHideToolbar->setOn (true); | 546 | m_aHideToolbar->setOn (true); |
560 | connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); | 547 | connect(m_aHideToolbar,SIGNAL(toggled(bool)),this,SLOT(showToolbar(bool))); |
561 | 548 | ||
562 | m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); | 549 | m_aSetup = new QAction( tr( "Settings" ), Resource::loadIconSet("SettingsIcon"), 0, 0, this, 0, true ); |
563 | m_aSetup->setToggleAction(false); | 550 | m_aSetup->setToggleAction(false); |
564 | connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); | 551 | connect(m_aSetup,SIGNAL(activated()),this,SLOT(slotConfig())); |
565 | 552 | ||
566 | m_gListViewMode = new QActionGroup(this,"Select listmode",true); | 553 | m_gListViewMode = new QActionGroup(this,"Select listmode",true); |
567 | connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); | 554 | connect(m_gListViewMode,SIGNAL(selected(QAction*)),this,SLOT(listviewselected(QAction*))); |
568 | 555 | ||
569 | m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); | 556 | m_aDirLong = new QAction( tr( "Thumbnail and Imageinfo" ),Resource::loadIconSet("opie-eye/opie-eye-thumb"), 0, 0, this, 0, true ); |
570 | m_aDirLong->setToggleAction(true); | 557 | m_aDirLong->setToggleAction(true); |
571 | m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); | 558 | m_aDirShort = new QAction( tr( "Thumbnail and name" ),Resource::loadIconSet("opie-eye/opie-eye-thumbonly"), 0, 0, this, 0, true ); |
572 | m_aDirShort->setToggleAction(true); | 559 | m_aDirShort->setToggleAction(true); |
573 | m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); | 560 | m_aDirName = new QAction( tr( "Name only" ), Resource::loadIconSet("opie-eye/opie-eye-textview"),0, 0, this, 0, true ); |
574 | m_aDirName->setToggleAction(true); | 561 | m_aDirName->setToggleAction(true); |
575 | int mode = m_cfg->readNumEntry("ListViewMode", 1); | 562 | int mode = m_cfg->readNumEntry("ListViewMode", 1); |
576 | if (mode < 1 || mode>3) mode = 1; | 563 | if (mode < 1 || mode>3) mode = 1; |
577 | switch (mode) { | 564 | switch (mode) { |
578 | case 3: | 565 | case 3: |
579 | m_aDirName->setOn(true); | 566 | m_aDirName->setOn(true); |
580 | break; | 567 | break; |
581 | case 2: | 568 | case 2: |
582 | m_aDirShort->setOn(true); | 569 | m_aDirShort->setOn(true); |
583 | break; | 570 | break; |
584 | case 1: | 571 | case 1: |
585 | default: | 572 | default: |
586 | m_aDirLong->setOn(true); | 573 | m_aDirLong->setOn(true); |
587 | } | 574 | } |
588 | m_gListViewMode->insert(m_aDirLong); | 575 | m_gListViewMode->insert(m_aDirLong); |
589 | m_gListViewMode->insert(m_aDirShort); | 576 | m_gListViewMode->insert(m_aDirShort); |
590 | m_gListViewMode->insert(m_aDirName); | 577 | m_gListViewMode->insert(m_aDirName); |
591 | 578 | ||
592 | m_gPrevNext = new QActionGroup(this,"imageprevnext",false); | 579 | m_gPrevNext = new QActionGroup(this,"imageprevnext",false); |
593 | m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); | 580 | m_aNext = new QAction( tr( "Next image" ), Resource::loadIconSet("forward"), 0, 0, this, 0, true ); |
594 | m_aNext->setToggleAction(false); | 581 | m_aNext->setToggleAction(false); |
595 | connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); | 582 | connect(m_aNext,SIGNAL(activated()),m_view,SLOT(slotShowNext())); |
596 | m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); | 583 | m_aPrevious = new QAction( tr( "Previous image" ), Resource::loadIconSet("back"), 0, 0, this, 0, true ); |
597 | m_aPrevious->setToggleAction(false); | 584 | m_aPrevious->setToggleAction(false); |
598 | connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); | 585 | connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev())); |
599 | m_gPrevNext->insert(m_aPrevious); | 586 | m_gPrevNext->insert(m_aPrevious); |
600 | m_gPrevNext->insert(m_aNext); | 587 | m_gPrevNext->insert(m_aNext); |
601 | 588 | ||
602 | m_aFullScreen = new QAction( tr( "Show images fullscreen" ), | 589 | m_aFullScreen = new QAction( tr( "Show images fullscreen" ), |
603 | Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); | 590 | Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true ); |
604 | m_aFullScreen->setToggleAction(true); | 591 | m_aFullScreen->setToggleAction(true); |
605 | if (autoSave) { | 592 | if (autoSave) { |
606 | m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false)); | 593 | m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false)); |
607 | } else { | 594 | } else { |
608 | m_aFullScreen->setOn(false); | 595 | m_aFullScreen->setOn(false); |
609 | } | 596 | } |