summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.cpp44
-rw-r--r--noncore/graphics/opie-eye/gui/imagescrollview.h4
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp15
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h2
4 files changed, 56 insertions, 9 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp
index 5b12258..2f16d82 100644
--- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp
+++ b/noncore/graphics/opie-eye/gui/imagescrollview.cpp
@@ -11,3 +11,3 @@ ImageScrollView::ImageScrollView( QWidget* parent, const char* name, WFlags f )
11 :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(),scale_to_fit(true), 11 :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(),scale_to_fit(true),
12 rotate_to_fit(true),first_resize_done(false),m_lastName("") 12 rotate_to_fit(true),show_zoomer(true),first_resize_done(false),m_lastName("")
13{ 13{
@@ -18,3 +18,3 @@ ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char
18 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img),scale_to_fit(always_scale), 18 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img),scale_to_fit(always_scale),
19 rotate_to_fit(rfit),first_resize_done(false),m_lastName("") 19 rotate_to_fit(rfit),show_zoomer(true),first_resize_done(false),m_lastName("")
20{ 20{
@@ -27,3 +27,3 @@ ImageScrollView::ImageScrollView (const QString&img, QWidget * parent, const cha
27 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),scale_to_fit(always_scale), 27 :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),scale_to_fit(always_scale),
28 rotate_to_fit(rfit),first_resize_done(false),m_lastName("") 28 rotate_to_fit(rfit),show_zoomer(true),first_resize_done(false),m_lastName("")
29{ 29{
@@ -82,4 +82,4 @@ void ImageScrollView::init()
82 generateImage(); 82 generateImage();
83 odebug << "reinit display " << oendl;
84 } else if (_original_data.size().isValid()) { 83 } else if (_original_data.size().isValid()) {
84 if (image_fit_into(_original_data.size()) || !show_zoomer) _zoomer->hide();
85 resizeContents(_original_data.width(),_original_data.height()); 85 resizeContents(_original_data.width(),_original_data.height());
@@ -268,2 +268,3 @@ void ImageScrollView::generateImage()
268 _pdata.convertFromImage(_image_data); 268 _pdata.convertFromImage(_image_data);
269
269 270
@@ -272,6 +273,12 @@ void ImageScrollView::generateImage()
272 */ 273 */
274 check_zoomer();
273 emit imageSizeChanged( _image_data.size() ); 275 emit imageSizeChanged( _image_data.size() );
274 rescaleImage( 128, 128 ); 276 rescaleImage( 128, 128 );
277 /*
278 * move scrollbar
279 */
280 _zoomer->setGeometry( viewport()->width()-_image_data.width()/2, viewport()->height()-_image_data.height()/2,
281 _image_data.width()/2, _image_data.height()/2 );
282
275 _zoomer->setImage( _image_data ); 283 _zoomer->setImage( _image_data );
276
277 /* 284 /*
@@ -290,6 +297,2 @@ void ImageScrollView::resizeEvent(QResizeEvent * e)
290 297
291 /*
292 * move scrollbar
293 */
294 _zoomer->setGeometry( viewport()->width()-100, viewport()->height()-50, 100, 50 );
295} 298}
@@ -400 +403,24 @@ void ImageScrollView::setDestructiveClose() {
400} 403}
404
405bool ImageScrollView::image_fit_into(const QSize&s )
406{
407 if (s.width()>width()||s.height()>height()) {
408 return false;
409 }
410 return true;
411}
412
413void ImageScrollView::setShowZoomer(bool how)
414{
415 show_zoomer = how;
416 check_zoomer();
417}
418
419void ImageScrollView::check_zoomer()
420{
421 if ( (!show_zoomer||image_fit_into(_pdata.size()) ) && _zoomer->isVisible()) {
422 _zoomer->hide();
423 } else if ( show_zoomer && !image_fit_into(_pdata.size()) && _zoomer->isHidden()){
424 _zoomer->show();
425 }
426}
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h
index 1b25103..e209dfb 100644
--- a/noncore/graphics/opie-eye/gui/imagescrollview.h
+++ b/noncore/graphics/opie-eye/gui/imagescrollview.h
@@ -30,2 +30,3 @@ public:
30 virtual void setAutoScale(bool); 30 virtual void setAutoScale(bool);
31 virtual void setShowZoomer(bool);
31 32
@@ -56,2 +57,3 @@ protected:
56 bool rotate_to_fit; 57 bool rotate_to_fit;
58 bool show_zoomer;
57 bool first_resize_done; 59 bool first_resize_done;
@@ -63,2 +65,4 @@ protected:
63 virtual void generateImage(); 65 virtual void generateImage();
66 bool image_fit_into(const QSize&s);
67 void check_zoomer();
64 68
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 3650493..ef23f79 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -108,2 +108,8 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
108 108
109 btn = new QToolButton(bar);
110 btn->setIconSet( Resource::loadIconSet( "mag" ) );
111 btn->setToggleButton(true);
112 btn->setOn(true);
113 connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
114 zoomerOn = true;
109} 115}
@@ -114,2 +120,10 @@ PMainWindow::~PMainWindow() {
114 120
121void PMainWindow::slotZoomerToggled(bool how)
122{
123 zoomerOn = how;
124 if (m_disp) {
125 m_disp->setShowZoomer(zoomerOn);
126 }
127}
128
115void PMainWindow::slotRotateToggled(bool how) 129void PMainWindow::slotRotateToggled(bool how)
@@ -233,2 +247,3 @@ void PMainWindow::initDisp() {
233 m_disp->setAutoRotate(autoRotate); 247 m_disp->setAutoRotate(autoRotate);
248 m_disp->setShowZoomer(zoomerOn);
234 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); 249 connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 59dba30..e9b16d0 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -43,2 +43,3 @@ public slots:
43 void slotScaleToggled(bool); 43 void slotScaleToggled(bool);
44 void slotZoomerToggled(bool);
44 void setDocument( const QString& ); 45 void setDocument( const QString& );
@@ -62,2 +63,3 @@ private:
62 bool autoScale; 63 bool autoScale;
64 bool zoomerOn;
63 QToolButton*rotateButton; 65 QToolButton*rotateButton;