Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 0484f73..a784f5b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <qdialog.h> | 30 | #include <qdialog.h> |
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | #include <qframe.h> | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
@@ -42,6 +42,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
43 | m_cfg = new Opie::Core::OConfig("phunkview"); | 43 | m_cfg = new Opie::Core::OConfig("phunkview"); |
44 | m_cfg->setGroup("Zecke_view" ); | 44 | m_cfg->setGroup("Zecke_view" ); |
45 | tFrame = 0; | ||
45 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | 46 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); |
46 | /* | 47 | /* |
47 | * Initialize ToolBar and IconView | 48 | * Initialize ToolBar and IconView |
@@ -128,11 +129,11 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
128 | 129 | ||
129 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 130 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
130 | 131 | ||
131 | btn = new QToolButton(bar); | 132 | scaleButton = new QToolButton(bar); |
132 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); | 133 | scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) ); |
133 | btn->setToggleButton(true); | 134 | scaleButton->setToggleButton(true); |
134 | btn->setOn(false); | 135 | scaleButton->setOn(false); |
135 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 136 | connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
136 | autoScale = true; | 137 | autoScale = true; |
137 | 138 | ||
138 | zoomButton = new QToolButton(bar); | 139 | zoomButton = new QToolButton(bar); |
@@ -145,6 +146,8 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
145 | 146 | ||
146 | PMainWindow::~PMainWindow() { | 147 | PMainWindow::~PMainWindow() { |
147 | odebug << "Shutting down" << oendl; | 148 | odebug << "Shutting down" << oendl; |
149 | if (tFrame) delete tFrame; | ||
150 | odebug << "Shutting down done" << oendl; | ||
148 | } | 151 | } |
149 | 152 | ||
150 | void PMainWindow::slotToggleZoomer() | 153 | void PMainWindow::slotToggleZoomer() |
@@ -162,6 +165,21 @@ void PMainWindow::slotZoomerToggled(bool how) | |||
162 | } | 165 | } |
163 | } | 166 | } |
164 | 167 | ||
168 | void PMainWindow::slotToggleAutorotate() | ||
169 | { | ||
170 | if (!m_disp) return; | ||
171 | if (!rotateButton->isEnabled()) return; | ||
172 | bool cur = rotateButton->isOn(); | ||
173 | rotateButton->setOn(!cur); | ||
174 | } | ||
175 | |||
176 | void PMainWindow::slotToggleAutoscale() | ||
177 | { | ||
178 | if (!m_disp) return; | ||
179 | bool cur = scaleButton->isOn(); | ||
180 | scaleButton->setOn(!cur); | ||
181 | } | ||
182 | |||
165 | void PMainWindow::slotRotateToggled(bool how) | 183 | void PMainWindow::slotRotateToggled(bool how) |
166 | { | 184 | { |
167 | autoRotate = how; | 185 | autoRotate = how; |
@@ -295,6 +313,8 @@ void PMainWindow::initDisp() { | |||
295 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 313 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
296 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 314 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
297 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 315 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
316 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | ||
317 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | ||
298 | } | 318 | } |
299 | } | 319 | } |
300 | 320 | ||
@@ -308,13 +328,22 @@ void PMainWindow::slotToggleFullScreen() | |||
308 | if (current) { | 328 | if (current) { |
309 | odebug << "full" << oendl; | 329 | odebug << "full" << oendl; |
310 | m_disp->setBackgroundColor(black); | 330 | m_disp->setBackgroundColor(black); |
311 | m_disp->reparent(0,QPoint(0,0)); | 331 | if (!tFrame) { |
332 | tFrame = new QWidget(0,0,WType_TopLevel|WStyle_NoBorder|WStyle_StaysOnTop); | ||
333 | tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height()); | ||
334 | tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height()); | ||
335 | } | ||
336 | m_disp->reparent(tFrame,QPoint(0,0)); | ||
312 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 337 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
313 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 338 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
314 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 339 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
315 | m_disp->showFullScreen(); | 340 | tFrame->showFullScreen(); |
316 | } else { | 341 | } else { |
317 | odebug << "window" << oendl; | 342 | odebug << "window" << oendl; |
343 | m_disp->reparent(0,QPoint(0,0)); | ||
344 | m_disp->showNormal(); | ||
345 | /* don't forget it! */ | ||
346 | tFrame->hide(); | ||
318 | m_disp->setBackgroundColor(white); | 347 | m_disp->setBackgroundColor(white); |
319 | m_stack->addWidget(m_disp,ImageDisplay); | 348 | m_stack->addWidget(m_disp,ImageDisplay); |
320 | m_disp->setVScrollBarMode(QScrollView::Auto); | 349 | m_disp->setVScrollBarMode(QScrollView::Auto); |
@@ -335,6 +364,9 @@ void PMainWindow::slotToggleFullScreen() | |||
335 | * ### FIXME and talk to alwin | 364 | * ### FIXME and talk to alwin |
336 | */ | 365 | */ |
337 | void PMainWindow::slotShowInfo( const QString& inf ) { | 366 | void PMainWindow::slotShowInfo( const QString& inf ) { |
367 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | ||
368 | return; | ||
369 | } | ||
338 | if ( !m_info ) { | 370 | if ( !m_info ) { |
339 | initInfo(); | 371 | initInfo(); |
340 | } | 372 | } |
@@ -346,9 +378,6 @@ void PMainWindow::slotShowInfo( const QString& inf ) { | |||
346 | fsButton->hide(); | 378 | fsButton->hide(); |
347 | viewModeButton->hide(); | 379 | viewModeButton->hide(); |
348 | } | 380 | } |
349 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | ||
350 | m_disp->hide(); | ||
351 | } | ||
352 | m_stack->raiseWidget( ImageInfo ); | 381 | m_stack->raiseWidget( ImageInfo ); |
353 | } | 382 | } |
354 | 383 | ||
@@ -365,7 +394,8 @@ void PMainWindow::slotDisplay( const QString& inf ) { | |||
365 | viewModeButton->hide(); | 394 | viewModeButton->hide(); |
366 | } | 395 | } |
367 | if (m_disp->fullScreen()) { | 396 | if (m_disp->fullScreen()) { |
368 | m_disp->show(); | 397 | tFrame->setActiveWindow(); |
398 | tFrame->showFullScreen(); | ||
369 | } else { | 399 | } else { |
370 | m_stack->raiseWidget( ImageDisplay ); | 400 | m_stack->raiseWidget( ImageDisplay ); |
371 | } | 401 | } |
@@ -383,10 +413,15 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) { | |||
383 | */ | 413 | */ |
384 | if ( m_stack->visibleWidget() == m_info || | 414 | if ( m_stack->visibleWidget() == m_info || |
385 | m_stack->visibleWidget() == m_disp ) { | 415 | m_stack->visibleWidget() == m_disp ) { |
386 | raiseIconView(); | ||
387 | ev->ignore(); | 416 | ev->ignore(); |
417 | raiseIconView(); | ||
388 | return; | 418 | return; |
389 | } | 419 | } |
420 | if (m_disp && m_disp->fullScreen()) { | ||
421 | /* otherwise opie-eye crashes in bigscreen mode! */ | ||
422 | m_disp->reparent(0,QPoint(0,0)); | ||
423 | m_stack->addWidget(m_disp,ImageDisplay); | ||
424 | } | ||
390 | ev->accept(); | 425 | ev->accept(); |
391 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 426 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
392 | } | 427 | } |
@@ -400,7 +435,7 @@ void PMainWindow::raiseIconView() { | |||
400 | viewModeButton->show(); | 435 | viewModeButton->show(); |
401 | } | 436 | } |
402 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 437 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
403 | m_disp->hide(); | 438 | tFrame->hide(); |
404 | } | 439 | } |
405 | m_stack->raiseWidget( IconView ); | 440 | m_stack->raiseWidget( IconView ); |
406 | } | 441 | } |