summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-23 13:22:22 (UTC)
committer alwin <alwin>2004-04-23 13:22:22 (UTC)
commitda6a98dbc555018a29bf140ed8e890015240b322 (patch) (side-by-side diff)
tree3b8b05451fcd2c653982e1cd63b92eb0fb8b9a72
parent33666eb31ae6d35aa527cf7bf22c2c2e0dcd6824 (diff)
downloadopie-da6a98dbc555018a29bf140ed8e890015240b322.zip
opie-da6a98dbc555018a29bf140ed8e890015240b322.tar.gz
opie-da6a98dbc555018a29bf140ed8e890015240b322.tar.bz2
ok, I think I have all tried to reduce flicker in fullscreen when opie-eye
get focus back. But as long I must repaint the fullScreenwidget my self when taskbar comes visible I can not do anymore.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp30
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h16
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp24
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h1
4 files changed, 27 insertions, 44 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 03f3c1c..b4f3110 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -97,72 +97,78 @@ void ImageView::keyReleaseEvent(QKeyEvent * e)
if (e->key()==Qt::Key_Escape && fullScreen()) emit hideMe();
}
void ImageView::slotShowImageInfo()
{
emit dispImageInfo(m_lastName);
}
void ImageView::contentsMousePressEvent ( QMouseEvent * e)
{
if (e->button()==1) {
return OImageScrollView::contentsMousePressEvent(e);
}
odebug << "Popup " << oendl;
QPopupMenu *m = new QPopupMenu(0);
if (!m) return;
- bool old = fullScreen();
m->insertItem(tr("Toggle fullscreen"),this, SIGNAL(toggleFullScreen()));
if (fullScreen()) {
m->insertSeparator();
m->insertItem(tr("Previous image"),this,SIGNAL(dispPrev()));
m->insertItem(tr("Next image"),this,SIGNAL(dispNext()));
m->insertSeparator();
m->insertItem(tr("Toggle autoscale"),this, SIGNAL(toggleAutoscale()));
m->insertItem(tr("Toggle autorotate"),this, SIGNAL(toggleAutorotate()));
m->insertItem(tr("Toggle thumbnail"),this, SIGNAL(toggleZoomer()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
void ImageView::setFullScreen(bool how)
{
m_isFullScreen = how;
+ if (how) {
+ m_ignore_next_in = true;
+ setFixedSize(qApp->desktop()->size());
+ showFullScreen();
+ } else {
+ setMinimumSize(10,10);
+ }
}
void ImageView::focusInEvent(QFocusEvent *)
{
// Always do it here, no matter the size.
odebug << "Focus in (view)" << oendl;
//if (fullScreen()) parentWidget()->showNormal();
if (m_ignore_next_in){m_ignore_next_in=false;return;}
if (fullScreen()) enableFullscreen();
}
+void ImageView::hide()
+{
+ if (fullScreen()) {
+ m_ignore_next_in = true;
+ showNormal();
+ }
+ QWidget::hide();
+}
void ImageView::enableFullscreen()
{
- // This call is needed because showFullScreen won't work
- // correctly if the widget already considers itself to be fullscreen.
if (!fullScreen()) return;
if (m_ignore_next_in) {m_ignore_next_in = false;return;}
setUpdatesEnabled(false);
- parentWidget()->showNormal();
// This is needed because showNormal() forcefully changes the window
// style to WSTyle_TopLevel.
- parentWidget()->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
+ reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
// Enable fullscreen.
/* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus
* so we must block it here! */
m_ignore_next_in = true;
- parentWidget()->showFullScreen();
+ showFullScreen();
setUpdatesEnabled(true);
-}
-ImageWidget::ImageWidget(QWidget * parent, const char * name, WFlags f)
- : QWidget(parent,name,f)
-{
- // Make sure size is correct
- setFixedSize(qApp->desktop()->size());
}
+
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h
index f3c37b5..18697e0 100644
--- a/noncore/graphics/opie-eye/gui/imageview.h
+++ b/noncore/graphics/opie-eye/gui/imageview.h
@@ -40,38 +40,26 @@ signals:
void dispPrev();
void toggleFullScreen();
void hideMe();
void toggleZoomer();
void toggleAutoscale();
void toggleAutorotate();
protected:
Opie::Core::OConfig * m_cfg;
Opie::Core::OKeyConfigManager*m_viewManager;
void initKeys();
bool m_isFullScreen:1;
bool m_ignore_next_in:1;
int focus_in_count;
virtual void focusInEvent ( QFocusEvent * );
+public slots:
+ virtual void hide();
protected slots:
virtual void slotShowImageInfo();
virtual void keyReleaseEvent(QKeyEvent * e);
virtual void contentsMousePressEvent ( QMouseEvent * e);
};
-class ImageWidget:public QWidget
-{
- Q_OBJECT
-public:
- ImageWidget(QWidget * parent=0, const char * name=0, WFlags f = WStyle_Customize | WStyle_NoBorder);
- virtual ~ImageWidget(){};
-
-protected:
-
-public slots:
-
-protected slots:
-};
-
#endif
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index cdaf34c..274a22a 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -20,43 +20,41 @@
#include <opie2/okeyconfigwidget.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/ir.h>
#include <qpe/applnk.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qmap.h>
#include <qtimer.h>
#include <qframe.h>
-
//OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" )
OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
: QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
{
setCaption( QObject::tr("Opie Eye Caramba" ) );
m_cfg = new Opie::Core::OConfig("phunkview");
m_cfg->setGroup("Zecke_view" );
- tFrame = 0;
// qDebug( "Process-wide OApplication object @ %0x", oApp );
/*
* Initialize ToolBar and IconView
* And Connect Them
*/
QToolBar *bar = new QToolBar( this );
bar->setHorizontalStretchable( true );
setToolBarsMovable( false );
m_stack = new Opie::Ui::OWidgetStack( this );
setCentralWidget( m_stack );
m_view = new PIconView( m_stack, m_cfg );
m_stack->addWidget( m_view, IconView );
m_stack->raiseWidget( IconView );
connect(m_view, SIGNAL(sig_display(const QString&)),
@@ -133,35 +131,32 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
scaleButton = new QToolButton(bar);
scaleButton->setIconSet( Resource::loadIconSet( "1to1" ) );
scaleButton->setToggleButton(true);
scaleButton->setOn(false);
connect(scaleButton,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
autoScale = true;
zoomButton = new QToolButton(bar);
zoomButton->setIconSet( Resource::loadIconSet( "mag" ) );
zoomButton->setToggleButton(true);
zoomButton->setOn(true);
connect(zoomButton,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
zoomerOn = true;
}
PMainWindow::~PMainWindow() {
- odebug << "Shutting down" << oendl;
- if (tFrame) delete tFrame;
- odebug << "Shutting down done" << oendl;
}
void PMainWindow::slotToggleZoomer()
{
if (!m_disp) return;
bool cur = zoomButton->isOn();
zoomButton->setOn(!cur);
}
void PMainWindow::slotZoomerToggled(bool how)
{
zoomerOn = how;
if (m_disp) {
m_disp->setShowZoomer(zoomerOn);
}
}
@@ -312,64 +307,58 @@ void PMainWindow::initDisp() {
connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate()));
}
}
void PMainWindow::slotToggleFullScreen()
{
odebug << "Toggle full " << oendl;
if (!m_disp) return;
bool current = !m_disp->fullScreen();
- m_disp->setFullScreen(current);
odebug << "Current = " << current << oendl;
if (current) {
odebug << "full" << oendl;
m_disp->setBackgroundColor(black);
- if (!tFrame) {
- tFrame = new ImageWidget(0,0,WStyle_Customize|WStyle_NoBorder);
- tFrame->resize(qApp->desktop()->width(), qApp->desktop()->height());
- tFrame->setMinimumSize(qApp->desktop()->width(), qApp->desktop()->height());
- }
- m_disp->reparent(tFrame,QPoint(0,0));
+ m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
- tFrame->showFullScreen();
+ //m_disp->showFullScreen();
+ //qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
} else {
setUpdatesEnabled(false);
odebug << "window" << oendl;
m_disp->reparent(0,QPoint(0,0));
m_disp->showNormal();
- /* don't forget it! */
- tFrame->hide();
m_disp->setBackgroundColor(white);
m_stack->addWidget(m_disp,ImageDisplay);
m_disp->setVScrollBarMode(QScrollView::Auto);
m_disp->setHScrollBarMode(QScrollView::Auto);
m_stack->raiseWidget(m_disp);
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->resize(m_disp->minimumSize());
}
setUpdatesEnabled(true);
}
+ m_disp->setFullScreen(current);
}
/**
* With big Screen the plan could be to 'detach' the image
* window if visible and to create a ne wone
* init* already supports it but I make no use of it for
* now. We set filename and raise
*
* ### FIXME and talk to alwin
*/
void PMainWindow::slotShowInfo( const QString& inf ) {
if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
return;
}
if ( !m_info ) {
initInfo();
@@ -385,33 +374,34 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
if ( !m_disp ) {
initDisp();
}
m_disp->setImage( inf );
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->show();
nextButton->show();
upButton->hide();
fsButton->hide();
viewModeButton->hide();
}
if (m_disp->fullScreen()) {
- tFrame->show();//FullScreen();
+ //m_disp->showFullScreen();
+ qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
} else {
m_stack->raiseWidget( ImageDisplay );
}
}
void PMainWindow::slotReturn() {
raiseIconView();
}
void PMainWindow::closeEvent( QCloseEvent* ev ) {
/*
* return from view
* or properly quit
*/
if ( m_stack->visibleWidget() == m_info ||
@@ -426,31 +416,31 @@ void PMainWindow::closeEvent( QCloseEvent* ev ) {
m_stack->addWidget(m_disp,ImageDisplay);
}
ev->accept();
QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
}
void PMainWindow::raiseIconView() {
setUpdatesEnabled(false);
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
prevButton->hide();
nextButton->hide();
upButton->show();
fsButton->show();
viewModeButton->show();
}
if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) {
- tFrame->hide();
+ m_disp->hide();
}
m_stack->raiseWidget( IconView );
setUpdatesEnabled(true);
repaint();
}
void PMainWindow::setDocument( const QString& showImg ) {
QString file = showImg;
DocLnk lnk(showImg);
if (lnk.isValid() )
file = lnk.file();
slotDisplay( file );
}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 9e94c60..6fa1ab6 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -55,25 +55,24 @@ protected slots:
void closeEvent( QCloseEvent* );
private:
template<class T> void initT( const char* name, T**, int );
void initInfo();
void initDisp();
private:
Opie::Core::OConfig *m_cfg;
Opie::Ui::OWidgetStack *m_stack;
PIconView* m_view;
imageinfo *m_info;
ImageView *m_disp;
bool autoRotate;
bool autoScale;
bool zoomerOn;
- ImageWidget*tFrame;
QToolButton*rotateButton,*upButton,*fsButton,*viewModeButton;
QToolButton*nextButton,*prevButton,*zoomButton,*scaleButton;
private slots:
void slotConfig();
};
#endif