author | alwin <alwin> | 2004-04-14 20:51:30 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-14 20:51:30 (UTC) |
commit | db181c9145bd55b5e153a0ebdfcc17127c0ca179 (patch) (unidiff) | |
tree | f3e7e311db4e6e4147caa61daabf03905865db27 /noncore/graphics/opie-eye | |
parent | fe6808b41795d1b6000932bf84d74dbd24c4ed95 (diff) | |
download | opie-db181c9145bd55b5e153a0ebdfcc17127c0ca179.zip opie-db181c9145bd55b5e153a0ebdfcc17127c0ca179.tar.gz opie-db181c9145bd55b5e153a0ebdfcc17127c0ca179.tar.bz2 |
move base image widgets to lib for usage in other applications
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.cpp | 586 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.h | 95 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 3 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/oimagezoomer.cpp | 233 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/lib/oimagezoomer.h | 141 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/phunk_view.pro | 8 |
6 files changed, 4 insertions, 1062 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp deleted file mode 100644 index 3bb07a7..0000000 --- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp +++ b/dev/null | |||
@@ -1,586 +0,0 @@ | |||
1 | #include "imagescrollview.h" | ||
2 | |||
3 | #include "lib/oimagezoomer.h" | ||
4 | |||
5 | #include <opie2/odebug.h> | ||
6 | #include <opie2/oapplication.h> | ||
7 | #include <opie2/owait.h> | ||
8 | |||
9 | #include <qimage.h> | ||
10 | #include <qlayout.h> | ||
11 | #include <qpe/qcopenvelope_qws.h> | ||
12 | |||
13 | /* for usage with the bitset */ | ||
14 | #define AUTO_SCALE 0 | ||
15 | #define AUTO_ROTATE 1 | ||
16 | #define SHOW_ZOOMER 2 | ||
17 | #define FIRST_RESIZE_DONE 3 | ||
18 | #define IMAGE_IS_JPEG 4 | ||
19 | #define IMAGE_SCALED_LOADED 5 | ||
20 | |||
21 | #define SCROLLVIEW_BITSET_SIZE 6 | ||
22 | |||
23 | namespace Opie { | ||
24 | namespace MM { | ||
25 | OImageScrollView::OImageScrollView( QWidget* parent, const char* name, WFlags f ) | ||
26 | :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(), | ||
27 | m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") | ||
28 | { | ||
29 | _zoomer = 0; | ||
30 | m_states[AUTO_SCALE]=true; | ||
31 | m_states[AUTO_ROTATE]=true; | ||
32 | m_states[FIRST_RESIZE_DONE]=false; | ||
33 | m_states[IMAGE_IS_JPEG]=false; | ||
34 | m_states[IMAGE_SCALED_LOADED]=false; | ||
35 | m_states[SHOW_ZOOMER]=true; | ||
36 | init(); | ||
37 | } | ||
38 | |||
39 | OImageScrollView::OImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) | ||
40 | :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img), | ||
41 | m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") | ||
42 | { | ||
43 | _zoomer = 0; | ||
44 | m_states[AUTO_SCALE]=always_scale; | ||
45 | m_states[AUTO_ROTATE]=rfit; | ||
46 | m_states[FIRST_RESIZE_DONE]=false; | ||
47 | m_states[IMAGE_IS_JPEG]=false; | ||
48 | m_states[IMAGE_SCALED_LOADED]=false; | ||
49 | m_states[SHOW_ZOOMER]=true; | ||
50 | _original_data.convertDepth(QPixmap::defaultDepth()); | ||
51 | _original_data.setAlphaBuffer(false); | ||
52 | init(); | ||
53 | } | ||
54 | |||
55 | OImageScrollView::OImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) | ||
56 | :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") | ||
57 | { | ||
58 | _zoomer = 0; | ||
59 | m_states.resize(SCROLLVIEW_BITSET_SIZE); | ||
60 | m_states[AUTO_SCALE]=always_scale; | ||
61 | m_states[AUTO_ROTATE]=rfit; | ||
62 | m_states[FIRST_RESIZE_DONE]=false; | ||
63 | m_states[IMAGE_IS_JPEG]=false; | ||
64 | m_states[IMAGE_SCALED_LOADED]=false; | ||
65 | m_states[SHOW_ZOOMER]=true; | ||
66 | init(); | ||
67 | setImage(img); | ||
68 | } | ||
69 | |||
70 | void OImageScrollView::setImage(const QImage&img) | ||
71 | { | ||
72 | _image_data = QImage(); | ||
73 | _original_data=img; | ||
74 | _original_data.convertDepth(QPixmap::defaultDepth()); | ||
75 | _original_data.setAlphaBuffer(false); | ||
76 | m_lastName = ""; | ||
77 | setImageIsJpeg(false); | ||
78 | setImageScaledLoaded(false); | ||
79 | if (FirstResizeDone()) { | ||
80 | generateImage(); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | void OImageScrollView::loadJpeg(bool interncall) | ||
85 | { | ||
86 | if (m_lastName.isEmpty()) return; | ||
87 | QImageIO iio( m_lastName, 0l ); | ||
88 | QString param; | ||
89 | bool real_load = false; | ||
90 | if (AutoScale()) { | ||
91 | if (!interncall) { | ||
92 | int wid, hei; | ||
93 | wid = QApplication::desktop()->width(); | ||
94 | hei = QApplication::desktop()->height(); | ||
95 | if (hei>wid) { | ||
96 | wid = hei; | ||
97 | } else { | ||
98 | hei = wid; | ||
99 | } | ||
100 | param = QString( "Fast Shrink( 7 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); | ||
101 | odebug << "Load jpeg scaled \"" << param << "\"" << oendl; | ||
102 | iio.setParameters(param.latin1()); | ||
103 | setImageScaledLoaded(true); | ||
104 | real_load = true; | ||
105 | } | ||
106 | } else { | ||
107 | if (ImageScaledLoaded()||!interncall) { | ||
108 | odebug << "Load jpeg unscaled" << oendl; | ||
109 | real_load = true; | ||
110 | } | ||
111 | setImageScaledLoaded(false); | ||
112 | } | ||
113 | if (real_load) { | ||
114 | { | ||
115 | QCopEnvelope( "QPE/System", "busy()" ); | ||
116 | } | ||
117 | _original_data = iio.read() ? iio.image() : QImage(); | ||
118 | { | ||
119 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); | ||
120 | env << "Image loaded"; | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | |||
125 | void OImageScrollView::setImage( const QString& path ) { | ||
126 | odebug << "load new image " << oendl; | ||
127 | if (m_lastName == path) return; | ||
128 | m_lastName = path; | ||
129 | QString itype = QImage::imageFormat(m_lastName); | ||
130 | odebug << "Image type = " << itype << oendl; | ||
131 | if (itype == "JPEG") { | ||
132 | setImageIsJpeg(true); | ||
133 | loadJpeg(); | ||
134 | } else { | ||
135 | { | ||
136 | QCopEnvelope( "QPE/System", "busy()" ); | ||
137 | } | ||
138 | setImageIsJpeg(false); | ||
139 | _original_data.load(path); | ||
140 | _original_data.convertDepth(QPixmap::defaultDepth()); | ||
141 | _original_data.setAlphaBuffer(false); | ||
142 | { | ||
143 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); | ||
144 | env << "Image loaded"; | ||
145 | } | ||
146 | } | ||
147 | _image_data = QImage(); | ||
148 | if (FirstResizeDone()) { | ||
149 | generateImage(); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | /* should be called every time the QImage changed it content */ | ||
154 | void OImageScrollView::init() | ||
155 | { | ||
156 | odebug << "init " << oendl; | ||
157 | |||
158 | /* | ||
159 | * create the zoomer | ||
160 | * and connect ther various signals | ||
161 | */ | ||
162 | _zoomer = new Opie::MM::OImageZoomer( this, "The Zoomer" ); | ||
163 | connect(_zoomer, SIGNAL( zoomAreaRel(int,int)), | ||
164 | this, SLOT(scrollBy(int,int)) ); | ||
165 | connect(_zoomer, SIGNAL( zoomArea(int,int)), | ||
166 | this, SLOT(center(int,int)) ); | ||
167 | connect(this,SIGNAL(contentsMoving(int,int)), | ||
168 | _zoomer, (SLOT(setVisiblePoint(int,int))) ); | ||
169 | connect(this,SIGNAL(imageSizeChanged(const QSize&)), | ||
170 | _zoomer, SLOT(setImageSize(const QSize&)) ); | ||
171 | connect(this,SIGNAL(viewportSizeChanged(const QSize&)), | ||
172 | _zoomer, SLOT(setViewPortSize(const QSize&)) ); | ||
173 | |||
174 | viewport()->setBackgroundColor(white); | ||
175 | setFocusPolicy(QWidget::StrongFocus); | ||
176 | setImageScaledLoaded(false); | ||
177 | setImageIsJpeg(false); | ||
178 | if (FirstResizeDone()) { | ||
179 | m_last_rot = Rotate0; | ||
180 | generateImage(); | ||
181 | } else if (_original_data.size().isValid()) { | ||
182 | if (image_fit_into(_original_data.size()) || !ShowZoomer()) _zoomer->hide(); | ||
183 | resizeContents(_original_data.width(),_original_data.height()); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | void OImageScrollView::setAutoRotate(bool how) | ||
188 | { | ||
189 | /* to avoid double repaints */ | ||
190 | if (AutoRotate() != how) { | ||
191 | m_states.setBit(AUTO_ROTATE,how); | ||
192 | _image_data = QImage(); | ||
193 | generateImage(); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | bool OImageScrollView::AutoRotate()const | ||
198 | { | ||
199 | return m_states.testBit(AUTO_ROTATE); | ||
200 | } | ||
201 | |||
202 | void OImageScrollView::setAutoScale(bool how) | ||
203 | { | ||
204 | m_states.setBit(AUTO_SCALE,how); | ||
205 | if (!how) { | ||
206 | setAutoRotate(false); | ||
207 | } | ||
208 | _image_data = QImage(); | ||
209 | if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) { | ||
210 | loadJpeg(true); | ||
211 | } | ||
212 | generateImage(); | ||
213 | } | ||
214 | |||
215 | bool OImageScrollView::AutoScale()const | ||
216 | { | ||
217 | return m_states.testBit(AUTO_SCALE); | ||
218 | } | ||
219 | |||
220 | OImageScrollView::~OImageScrollView() | ||
221 | { | ||
222 | } | ||
223 | |||
224 | void OImageScrollView::rescaleImage(int w, int h) | ||
225 | { | ||
226 | if (_image_data.width()==w && _image_data.height()==h) { | ||
227 | return; | ||
228 | } | ||
229 | double hs = (double)h / (double)_image_data.height() ; | ||
230 | double ws = (double)w / (double)_image_data.width() ; | ||
231 | double scaleFactor = (hs > ws) ? ws : hs; | ||
232 | int smoothW = (int)(scaleFactor * _image_data.width()); | ||
233 | int smoothH = (int)(scaleFactor * _image_data.height()); | ||
234 | _image_data = _image_data.smoothScale(smoothW,smoothH); | ||
235 | } | ||
236 | |||
237 | void OImageScrollView::rotate_into_data(Rotation r) | ||
238 | { | ||
239 | /* realy - we must do this that way, 'cause when acting direct on _image_data the app will | ||
240 | segfault :( */ | ||
241 | QImage dest; | ||
242 | int x, y; | ||
243 | if ( _original_data.depth() > 8 ) | ||
244 | { | ||
245 | unsigned int *srcData, *destData; | ||
246 | switch ( r ) | ||
247 | { | ||
248 | case Rotate90: | ||
249 | dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); | ||
250 | for ( y=0; y < _original_data.height(); ++y ) | ||
251 | { | ||
252 | srcData = (unsigned int *)_original_data.scanLine(y); | ||
253 | for ( x=0; x < _original_data.width(); ++x ) | ||
254 | { | ||
255 | destData = (unsigned int *)dest.scanLine(x); | ||
256 | destData[_original_data.height()-y-1] = srcData[x]; | ||
257 | } | ||
258 | } | ||
259 | break; | ||
260 | case Rotate180: | ||
261 | dest.create(_original_data.width(), _original_data.height(), _original_data.depth()); | ||
262 | for ( y=0; y < _original_data.height(); ++y ) | ||
263 | { | ||
264 | srcData = (unsigned int *)_original_data.scanLine(y); | ||
265 | destData = (unsigned int *)dest.scanLine(_original_data.height()-y-1); | ||
266 | for ( x=0; x < _original_data.width(); ++x ) | ||
267 | destData[_original_data.width()-x-1] = srcData[x]; | ||
268 | } | ||
269 | break; | ||
270 | case Rotate270: | ||
271 | dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); | ||
272 | for ( y=0; y < _original_data.height(); ++y ) | ||
273 | { | ||
274 | srcData = (unsigned int *)_original_data.scanLine(y); | ||
275 | for ( x=0; x < _original_data.width(); ++x ) | ||
276 | { | ||
277 | destData = (unsigned int *)dest.scanLine(_original_data.width()-x-1); | ||
278 | destData[y] = srcData[x]; | ||
279 | } | ||
280 | } | ||
281 | break; | ||
282 | default: | ||
283 | dest = _original_data; | ||
284 | break; | ||
285 | } | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | unsigned char *srcData, *destData; | ||
290 | unsigned int *srcTable, *destTable; | ||
291 | switch ( r ) | ||
292 | { | ||
293 | case Rotate90: | ||
294 | dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); | ||
295 | dest.setNumColors(_original_data.numColors()); | ||
296 | srcTable = (unsigned int *)_original_data.colorTable(); | ||
297 | destTable = (unsigned int *)dest.colorTable(); | ||
298 | for ( x=0; x < _original_data.numColors(); ++x ) | ||
299 | destTable[x] = srcTable[x]; | ||
300 | for ( y=0; y < _original_data.height(); ++y ) | ||
301 | { | ||
302 | srcData = (unsigned char *)_original_data.scanLine(y); | ||
303 | for ( x=0; x < _original_data.width(); ++x ) | ||
304 | { | ||
305 | destData = (unsigned char *)dest.scanLine(x); | ||
306 | destData[_original_data.height()-y-1] = srcData[x]; | ||
307 | } | ||
308 | } | ||
309 | break; | ||
310 | case Rotate180: | ||
311 | dest.create(_original_data.width(), _original_data.height(), _original_data.depth()); | ||
312 | dest.setNumColors(_original_data.numColors()); | ||
313 | srcTable = (unsigned int *)_original_data.colorTable(); | ||
314 | destTable = (unsigned int *)dest.colorTable(); | ||
315 | for ( x=0; x < _original_data.numColors(); ++x ) | ||
316 | destTable[x] = srcTable[x]; | ||
317 | for ( y=0; y < _original_data.height(); ++y ) | ||
318 | { | ||
319 | srcData = (unsigned char *)_original_data.scanLine(y); | ||
320 | destData = (unsigned char *)dest.scanLine(_original_data.height()-y-1); | ||
321 | for ( x=0; x < _original_data.width(); ++x ) | ||
322 | destData[_original_data.width()-x-1] = srcData[x]; | ||
323 | } | ||
324 | break; | ||
325 | case Rotate270: | ||
326 | dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); | ||
327 | dest.setNumColors(_original_data.numColors()); | ||
328 | srcTable = (unsigned int *)_original_data.colorTable(); | ||
329 | destTable = (unsigned int *)dest.colorTable(); | ||
330 | for ( x=0; x < _original_data.numColors(); ++x ) | ||
331 | destTable[x] = srcTable[x]; | ||
332 | for ( y=0; y < _original_data.height(); ++y ) | ||
333 | { | ||
334 | srcData = (unsigned char *)_original_data.scanLine(y); | ||
335 | for ( x=0; x < _original_data.width(); ++x ) | ||
336 | { | ||
337 | destData = (unsigned char *)dest.scanLine(_original_data.width()-x-1); | ||
338 | destData[y] = srcData[x]; | ||
339 | } | ||
340 | } | ||
341 | break; | ||
342 | default: | ||
343 | dest = _original_data; | ||
344 | break; | ||
345 | } | ||
346 | |||
347 | } | ||
348 | _image_data = dest; | ||
349 | } | ||
350 | |||
351 | void OImageScrollView::generateImage() | ||
352 | { | ||
353 | Rotation r = Rotate0; | ||
354 | if (_original_data.isNull()) return; | ||
355 | { | ||
356 | QCopEnvelope( "QPE/System", "busy()" ); | ||
357 | } | ||
358 | if (width()>height()&&_original_data.width()<_original_data.height() || | ||
359 | width()<height()&&_original_data.width()>_original_data.height()) { | ||
360 | if (AutoRotate()) r = Rotate90; | ||
361 | } | ||
362 | |||
363 | odebug << " r = " << r << oendl; | ||
364 | if (AutoScale()) { | ||
365 | if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) { | ||
366 | odebug << "Rescaling data" << oendl; | ||
367 | if (r==Rotate0) { | ||
368 | _image_data = _original_data; | ||
369 | } else { | ||
370 | rotate_into_data(r); | ||
371 | } | ||
372 | } | ||
373 | rescaleImage(width(),height()); | ||
374 | resizeContents(_image_data.width(),_image_data.height()); | ||
375 | } else if (!FirstResizeDone()||r!=m_last_rot||_image_data.width()==0) { | ||
376 | if (r==Rotate0) { | ||
377 | _image_data = _original_data; | ||
378 | } else { | ||
379 | rotate_into_data(r); | ||
380 | } | ||
381 | m_last_rot = r; | ||
382 | resizeContents(_image_data.width(),_image_data.height()); | ||
383 | } | ||
384 | _pdata.convertFromImage(_image_data); | ||
385 | |||
386 | |||
387 | /* | ||
388 | * update the zoomer | ||
389 | */ | ||
390 | check_zoomer(); | ||
391 | emit imageSizeChanged( _image_data.size() ); | ||
392 | rescaleImage( 128, 128 ); | ||
393 | /* | ||
394 | * move scrollbar | ||
395 | */ | ||
396 | if (_zoomer) { | ||
397 | _zoomer->setGeometry( viewport()->width()-_image_data.width()/2, viewport()->height()-_image_data.height()/2, | ||
398 | _image_data.width()/2, _image_data.height()/2 ); | ||
399 | _zoomer->setImage( _image_data ); | ||
400 | } | ||
401 | /* | ||
402 | * invalidate | ||
403 | */ | ||
404 | _image_data=QImage(); | ||
405 | { | ||
406 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); | ||
407 | env << "Image generated"; | ||
408 | } | ||
409 | } | ||
410 | |||
411 | void OImageScrollView::resizeEvent(QResizeEvent * e) | ||
412 | { | ||
413 | odebug << "OImageScrollView resizeEvent" << oendl; | ||
414 | QScrollView::resizeEvent(e); | ||
415 | generateImage(); | ||
416 | setFirstResizeDone(true); | ||
417 | emit viewportSizeChanged( viewport()->size() ); | ||
418 | |||
419 | } | ||
420 | |||
421 | void OImageScrollView::keyPressEvent(QKeyEvent * e) | ||
422 | { | ||
423 | if (!e) return; | ||
424 | int dx = horizontalScrollBar()->lineStep(); | ||
425 | int dy = verticalScrollBar()->lineStep(); | ||
426 | if (e->key()==Qt::Key_Right) { | ||
427 | scrollBy(dx,0); | ||
428 | e->accept(); | ||
429 | } else if (e->key()==Qt::Key_Left) { | ||
430 | scrollBy(0-dx,0); | ||
431 | e->accept(); | ||
432 | } else if (e->key()==Qt::Key_Up) { | ||
433 | scrollBy(0,0-dy); | ||
434 | e->accept(); | ||
435 | } else if (e->key()==Qt::Key_Down) { | ||
436 | scrollBy(0,dy); | ||
437 | e->accept(); | ||
438 | } else { | ||
439 | e->ignore(); | ||
440 | } | ||
441 | QScrollView::keyPressEvent(e); | ||
442 | } | ||
443 | |||
444 | void OImageScrollView::drawContents(QPainter * p, int clipx, int clipy, int clipw, int cliph) | ||
445 | { | ||
446 | int w = clipw; | ||
447 | int h = cliph; | ||
448 | int x = clipx; | ||
449 | int y = clipy; | ||
450 | bool erase = false; | ||
451 | |||
452 | if (!_pdata.size().isValid()) { | ||
453 | p->fillRect(clipx,clipy,clipw,cliph,white); | ||
454 | return; | ||
455 | } | ||
456 | if (w>_pdata.width()) { | ||
457 | w=_pdata.width(); | ||
458 | x = 0; | ||
459 | erase = true; | ||
460 | } else if (x+w>_pdata.width()){ | ||
461 | x = _pdata.width()-w; | ||
462 | } | ||
463 | if (h>_pdata.height()) { | ||
464 | h=_pdata.height(); | ||
465 | y = 0; | ||
466 | erase = true; | ||
467 | } else if (y+h>_pdata.height()){ | ||
468 | y = _pdata.height()-h; | ||
469 | } | ||
470 | if (erase||_original_data.hasAlphaBuffer()) { | ||
471 | p->fillRect(clipx,clipy,clipw,cliph,white); | ||
472 | } | ||
473 | p->drawPixmap(clipx,clipy,_pdata,x,y,w,h); | ||
474 | } | ||
475 | |||
476 | /* using the real geometry points and not the translated points is wanted! */ | ||
477 | void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e) | ||
478 | { | ||
479 | odebug << "Move X and Y " << e->x() << " " << e->y() << oendl; | ||
480 | int mx, my; | ||
481 | mx = e->x(); | ||
482 | my = e->y(); | ||
483 | if (_mouseStartPosX!=-1 && _mouseStartPosY!=-1) { | ||
484 | int diffx = _mouseStartPosX-mx; | ||
485 | int diffy = _mouseStartPosY-my; | ||
486 | #if 0 | ||
487 | QScrollBar*xbar = horizontalScrollBar(); | ||
488 | QScrollBar*ybar = verticalScrollBar(); | ||
489 | if (xbar->value()+diffx>xbar->maxValue()) { | ||
490 | diffx = xbar->maxValue()-xbar->value(); | ||
491 | } else if (xbar->value()+diffx<0) { | ||
492 | diffx=0-xbar->value(); | ||
493 | } | ||
494 | if (ybar->value()+diffy>ybar->maxValue()) { | ||
495 | diffy = ybar->maxValue()-ybar->value(); | ||
496 | } else if (ybar->value()+diffy<0) { | ||
497 | diffy=0-ybar->value(); | ||
498 | } | ||
499 | #endif | ||
500 | scrollBy(diffx,diffy); | ||
501 | } | ||
502 | _mouseStartPosX=mx; | ||
503 | _mouseStartPosY=my; | ||
504 | } | ||
505 | |||
506 | void OImageScrollView::contentsMousePressEvent ( QMouseEvent * e) | ||
507 | { | ||
508 | odebug << " X and Y " << e->x() << " " << e->y() << oendl; | ||
509 | /* this marks the beginning of a possible mouse move. Due internal reasons of QT | ||
510 | the geometry values here may real differ from that set in MoveEvent (I don't know | ||
511 | why). For getting them in real context, we use the first move-event to set the start | ||
512 | position ;) | ||
513 | */ | ||
514 | _mouseStartPosX = -1; | ||
515 | _mouseStartPosY = -1; | ||
516 | } | ||
517 | |||
518 | void OImageScrollView::setDestructiveClose() { | ||
519 | WFlags fl = getWFlags(); | ||
520 | /* clear it just in case */ | ||
521 | fl &= ~WDestructiveClose; | ||
522 | fl |= WDestructiveClose; | ||
523 | setWFlags( fl ); | ||
524 | } | ||
525 | |||
526 | bool OImageScrollView::image_fit_into(const QSize&s ) | ||
527 | { | ||
528 | if (s.width()>width()||s.height()>height()) { | ||
529 | return false; | ||
530 | } | ||
531 | return true; | ||
532 | } | ||
533 | |||
534 | void OImageScrollView::setShowZoomer(bool how) | ||
535 | { | ||
536 | m_states.setBit(SHOW_ZOOMER,how); | ||
537 | check_zoomer(); | ||
538 | } | ||
539 | |||
540 | bool OImageScrollView::ShowZoomer()const | ||
541 | { | ||
542 | return m_states.testBit(SHOW_ZOOMER); | ||
543 | } | ||
544 | |||
545 | void OImageScrollView::check_zoomer() | ||
546 | { | ||
547 | if (!_zoomer) return; | ||
548 | if ( (!ShowZoomer()||image_fit_into(_pdata.size()) ) && _zoomer->isVisible()) { | ||
549 | _zoomer->hide(); | ||
550 | } else if ( ShowZoomer() && !image_fit_into(_pdata.size()) && _zoomer->isHidden()){ | ||
551 | _zoomer->show(); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | bool OImageScrollView::FirstResizeDone()const | ||
556 | { | ||
557 | return m_states.testBit(FIRST_RESIZE_DONE); | ||
558 | } | ||
559 | |||
560 | void OImageScrollView::setFirstResizeDone(bool how) | ||
561 | { | ||
562 | m_states.setBit(FIRST_RESIZE_DONE,how); | ||
563 | } | ||
564 | |||
565 | bool OImageScrollView::ImageIsJpeg()const | ||
566 | { | ||
567 | return m_states.testBit(IMAGE_IS_JPEG); | ||
568 | } | ||
569 | |||
570 | void OImageScrollView::setImageIsJpeg(bool how) | ||
571 | { | ||
572 | m_states.setBit(IMAGE_IS_JPEG,how); | ||
573 | } | ||
574 | |||
575 | bool OImageScrollView::ImageScaledLoaded()const | ||
576 | { | ||
577 | return m_states.testBit(IMAGE_SCALED_LOADED); | ||
578 | } | ||
579 | |||
580 | void OImageScrollView::setImageScaledLoaded(bool how) | ||
581 | { | ||
582 | m_states.setBit(IMAGE_SCALED_LOADED,how); | ||
583 | } | ||
584 | |||
585 | } // namespace MM | ||
586 | } // namespace Opie | ||
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h deleted file mode 100644 index 3d2ea38..0000000 --- a/noncore/graphics/opie-eye/gui/imagescrollview.h +++ b/dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | #ifndef _IMAGE_SCROLL_VIEW_H | ||
2 | #define _IMAGE_SCROLL_VIEW_H | ||
3 | |||
4 | #include <qscrollview.h> | ||
5 | #include <qimage.h> | ||
6 | #include <qpixmap.h> | ||
7 | #include <qstring.h> | ||
8 | #include <qdialog.h> | ||
9 | #include <qbitarray.h> | ||
10 | |||
11 | |||
12 | class QPainter; | ||
13 | |||
14 | namespace Opie { namespace MM { | ||
15 | |||
16 | class OImageZoomer; | ||
17 | |||
18 | class OImageScrollView:public QScrollView | ||
19 | { | ||
20 | Q_OBJECT | ||
21 | public: | ||
22 | enum Rotation { | ||
23 | Rotate0, | ||
24 | Rotate90, | ||
25 | Rotate180, | ||
26 | Rotate270 | ||
27 | }; | ||
28 | |||
29 | OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | ||
30 | OImageScrollView (const QImage&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); | ||
31 | OImageScrollView (const QString&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); | ||
32 | virtual ~OImageScrollView(); | ||
33 | |||
34 | |||
35 | virtual void setDestructiveClose(); | ||
36 | |||
37 | virtual void setAutoRotate(bool); | ||
38 | virtual void setAutoScale(bool); | ||
39 | virtual void setShowZoomer(bool); | ||
40 | |||
41 | virtual bool AutoRotate()const; | ||
42 | virtual bool AutoScale()const; | ||
43 | virtual bool ShowZoomer()const; | ||
44 | |||
45 | public slots: | ||
46 | virtual void setImage(const QImage&); | ||
47 | virtual void setImage( const QString& path ); | ||
48 | |||
49 | |||
50 | signals: | ||
51 | void imageSizeChanged( const QSize& ); | ||
52 | void viewportSizeChanged( const QSize& ); | ||
53 | |||
54 | protected: | ||
55 | virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); | ||
56 | void init(); | ||
57 | |||
58 | Opie::MM::OImageZoomer *_zoomer; | ||
59 | QImage _image_data; | ||
60 | QImage _original_data; | ||
61 | QPixmap _pdata; | ||
62 | |||
63 | int _mouseStartPosX,_mouseStartPosY; | ||
64 | |||
65 | QBitArray m_states; | ||
66 | |||
67 | Rotation m_last_rot; | ||
68 | QString m_lastName; | ||
69 | virtual void rescaleImage(int w, int h); | ||
70 | |||
71 | virtual void rotate_into_data(Rotation r); | ||
72 | virtual void generateImage(); | ||
73 | virtual void loadJpeg(bool interncall = false); | ||
74 | bool image_fit_into(const QSize&s); | ||
75 | void check_zoomer(); | ||
76 | |||
77 | /* internal bitset manipulation */ | ||
78 | virtual bool ImageIsJpeg()const; | ||
79 | virtual void setImageIsJpeg(bool how); | ||
80 | virtual bool ImageScaledLoaded()const; | ||
81 | virtual void setImageScaledLoaded(bool how); | ||
82 | virtual bool FirstResizeDone()const; | ||
83 | virtual void setFirstResizeDone(bool how); | ||
84 | |||
85 | protected slots: | ||
86 | virtual void viewportMouseMoveEvent(QMouseEvent* e); | ||
87 | virtual void contentsMousePressEvent ( QMouseEvent * e); | ||
88 | virtual void resizeEvent(QResizeEvent * e); | ||
89 | virtual void keyPressEvent(QKeyEvent * e); | ||
90 | }; | ||
91 | |||
92 | } | ||
93 | } | ||
94 | |||
95 | #endif | ||
diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index e4f899a..1790c4f 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h | |||
@@ -1,17 +1,16 @@ | |||
1 | #ifndef _IMAGE_VIEW_H | 1 | #ifndef _IMAGE_VIEW_H |
2 | #define _IMAGE_VIEW_H | 2 | #define _IMAGE_VIEW_H |
3 | 3 | ||
4 | /* must be changed when it will moved to Opie::MM */ | 4 | #include <opie2/oimagescrollview.h> |
5 | #include "imagescrollview.h" | ||
6 | 5 | ||
7 | namespace Opie { | 6 | namespace Opie { |
8 | namespace Core { | 7 | namespace Core { |
9 | class OConfig; | 8 | class OConfig; |
10 | class OKeyConfigManager; | 9 | class OKeyConfigManager; |
11 | } | 10 | } |
12 | } | 11 | } |
13 | 12 | ||
14 | class ImageView:public Opie::MM::OImageScrollView | 13 | class ImageView:public Opie::MM::OImageScrollView |
15 | { | 14 | { |
16 | Q_OBJECT | 15 | Q_OBJECT |
17 | 16 | ||
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp deleted file mode 100644 index d1eec67..0000000 --- a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp +++ b/dev/null | |||
@@ -1,233 +0,0 @@ | |||
1 | #include "oimagezoomer.h" | ||
2 | |||
3 | #include <opie2/odebug.h> | ||
4 | |||
5 | #include <qimage.h> | ||
6 | #include <qpixmap.h> | ||
7 | #include <qpainter.h> | ||
8 | #include <qrect.h> | ||
9 | #include <qpoint.h> | ||
10 | #include <qsize.h> | ||
11 | |||
12 | namespace Opie { | ||
13 | namespace MM { | ||
14 | |||
15 | /** | ||
16 | * \brief The most simple c'tor | ||
17 | * The main c'tor. You still need to set a QPixmap/QIMage, | ||
18 | * setImageSize,setViewPortSize,setVisiblePoint | ||
19 | * | ||
20 | * @param parent The parent widget | ||
21 | * @param name A name for this widget | ||
22 | * @param fl The widget flags | ||
23 | * | ||
24 | */ | ||
25 | OImageZoomer::OImageZoomer( QWidget* parent, const char* name, WFlags fl ) | ||
26 | : QFrame( parent, name, fl ) { | ||
27 | init(); | ||
28 | } | ||
29 | |||
30 | |||
31 | /** | ||
32 | * \brief This c'tor takes a QPixmap additional | ||
33 | * | ||
34 | * You initially set the QPixmap but you still need to provide | ||
35 | * the additional data to make this widget useful | ||
36 | * | ||
37 | * @param pix A Pixmap it'll be converted to a QImage later! | ||
38 | * @param par The parent widget | ||
39 | * @param name The name of this widget | ||
40 | * @param fl The widget flags | ||
41 | */ | ||
42 | OImageZoomer::OImageZoomer( const QPixmap& pix, QWidget* par, const char* name, WFlags fl ) | ||
43 | : QFrame( par, name, fl ) { | ||
44 | init(); | ||
45 | setImage( pix ); | ||
46 | } | ||
47 | |||
48 | |||
49 | /** | ||
50 | * \brief This c'tor takes a QImage instead | ||
51 | * You just provide a QImage which is saved. It behaves the same as the others. | ||
52 | * | ||
53 | * @param img A Image which will be used for the zoomer content | ||
54 | * @param par The parent of the widget | ||
55 | * @param name The name of the widget | ||
56 | * @param fl The widgets flags | ||
57 | */ | ||
58 | OImageZoomer::OImageZoomer( const QImage& img, QWidget* par, const char* name, WFlags fl) | ||
59 | : QFrame( par, name, fl ) { | ||
60 | init(); | ||
61 | setImage( img ); | ||
62 | } | ||
63 | |||
64 | |||
65 | /** | ||
66 | * \brief overloaded c'tor | ||
67 | * | ||
68 | * This differs only in the arguments it takes | ||
69 | * | ||
70 | * | ||
71 | * @param pSize The size of the Page you show | ||
72 | * @param vSize The size of the viewport. The size of the visible part of the widget | ||
73 | * @param par The parent of the widget | ||
74 | * @param name The name | ||
75 | * @param fl The window flags | ||
76 | */ | ||
77 | OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par, | ||
78 | const char* name, WFlags fl ) | ||
79 | : QFrame( par, name, fl ), m_imgSize( pSize ),m_visSize( vSize ) { | ||
80 | init(); | ||
81 | } | ||
82 | |||
83 | /** | ||
84 | * d'tor | ||
85 | */ | ||
86 | OImageZoomer::~OImageZoomer() { | ||
87 | |||
88 | } | ||
89 | |||
90 | void OImageZoomer::init() { | ||
91 | m_mevent = false; | ||
92 | setFrameStyle( Panel | Sunken ); | ||
93 | } | ||
94 | |||
95 | |||
96 | /** | ||
97 | * \brief set the page/image size | ||
98 | * Tell us the QSize of the Data you show to the user. We need this | ||
99 | * to do the calculations | ||
100 | * | ||
101 | * @param size The size of the stuff you want to zoom on | ||
102 | */ | ||
103 | void OImageZoomer::setImageSize( const QSize& size ) { | ||
104 | m_imgSize = size; | ||
105 | repaint(); | ||
106 | } | ||
107 | |||
108 | /** | ||
109 | * \brief Set the size of the viewport | ||
110 | * Tell us the QSize of the viewport. The viewport is the part | ||
111 | * of the widget which is exposed on the screen | ||
112 | * | ||
113 | * @param size Te size of the viewport | ||
114 | * | ||
115 | * @see QScrollView::viewport() | ||
116 | */ | ||
117 | void OImageZoomer::setViewPortSize( const QSize& size ) { | ||
118 | m_visSize = size; | ||
119 | repaint(); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * \brief the point in the topleft corner which is currently visible | ||
124 | * Set the visible point. This most of the times relate to QScrollView::contentsX() | ||
125 | * and QScrollView::contentsY() | ||
126 | * | ||
127 | * @see setVisiblePoint(int,int) | ||
128 | */ | ||
129 | void OImageZoomer::setVisiblePoint( const QPoint& pt ) { | ||
130 | m_visPt = pt; | ||
131 | repaint(); | ||
132 | } | ||
133 | |||
134 | |||
135 | /** | ||
136 | * Set the Image. The image will be resized on resizeEvent | ||
137 | * and it'll set the QPixmap background | ||
138 | * | ||
139 | * @param img The image will be stored internally and used as the background | ||
140 | */ | ||
141 | void OImageZoomer::setImage( const QImage& img) { | ||
142 | m_img = img; | ||
143 | resizeEvent( 0 ); | ||
144 | repaint(); | ||
145 | } | ||
146 | |||
147 | /** | ||
148 | * overloaded function it calls the QImage version | ||
149 | */ | ||
150 | void OImageZoomer::setImage( const QPixmap& pix) { | ||
151 | setImage( pix.convertToImage() ); | ||
152 | } | ||
153 | |||
154 | void OImageZoomer::resizeEvent( QResizeEvent* ev ) { | ||
155 | QFrame::resizeEvent( ev ); | ||
156 | setBackgroundOrigin( QWidget::WidgetOrigin ); | ||
157 | // TODO Qt3 use PalettePixmap and use size | ||
158 | QPixmap pix; pix.convertFromImage( m_img.smoothScale( size().width(), size().height() ) ); | ||
159 | setBackgroundPixmap( pix); | ||
160 | } | ||
161 | |||
162 | void OImageZoomer::drawContents( QPainter* p ) { | ||
163 | /* | ||
164 | * if the page size | ||
165 | */ | ||
166 | if ( m_imgSize.isEmpty() ) | ||
167 | return; | ||
168 | |||
169 | /* | ||
170 | * paint a red rect which represents the visible size | ||
171 | * | ||
172 | * We need to recalculate x,y and width and height of the | ||
173 | * rect. So image size relates to contentRect | ||
174 | * | ||
175 | */ | ||
176 | QRect c( contentsRect() ); | ||
177 | p->setPen( Qt::red ); | ||
178 | |||
179 | /* | ||
180 | * the contentRect is set equal to the size of the image | ||
181 | * Rect/Original = NewRectORWidth/OriginalVisibleStuff and then simply we | ||
182 | * need to add the c.y/x due usage of QFrame | ||
183 | * For x and y we use the visiblePoint | ||
184 | * For height and width we use the size of the viewport | ||
185 | * if width/height would be bigger than our widget we use this width/height | ||
186 | * | ||
187 | */ | ||
188 | int len = m_imgSize.width(); | ||
189 | int x = (c.width()*m_visPt.x())/len + c.x(); | ||
190 | int w = (c.width()*m_visSize.width() )/len + c.x(); | ||
191 | if ( w > c.width() ) w = c.width(); | ||
192 | |||
193 | len = m_imgSize.height(); | ||
194 | int y = (c.height()*m_visPt.y() )/len + c.y(); | ||
195 | int h = (c.height()*m_visSize.height() )/len + c.y(); | ||
196 | if ( h > c.height() ) h = c.height(); | ||
197 | |||
198 | p->drawRect( x, y, w, h ); | ||
199 | } | ||
200 | |||
201 | void OImageZoomer::mousePressEvent( QMouseEvent*ev) { | ||
202 | m_mouseX = m_mouseY = -1; | ||
203 | m_mevent = true; | ||
204 | } | ||
205 | |||
206 | void OImageZoomer::mouseReleaseEvent( QMouseEvent*ev) { | ||
207 | if (!m_mevent) return; | ||
208 | int mx, my; | ||
209 | mx = ev->x(); | ||
210 | my = ev->y(); | ||
211 | int diffx = (mx) * m_imgSize.width() / width(); | ||
212 | int diffy = (my) * m_imgSize.height() / height(); | ||
213 | emit zoomArea(diffx,diffy); | ||
214 | } | ||
215 | |||
216 | void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) { | ||
217 | int mx, my; | ||
218 | mx = ev->x(); | ||
219 | my = ev->y(); | ||
220 | |||
221 | if ( m_mouseX != -1 && m_mouseY != -1 ) { | ||
222 | m_mevent = false; | ||
223 | int diffx = ( mx - m_mouseX ) * m_imgSize.width() / width(); | ||
224 | int diffy = ( my - m_mouseY ) * m_imgSize.height() / height(); | ||
225 | emit zoomAreaRel( diffx, diffy ); | ||
226 | } | ||
227 | m_mouseX = mx; | ||
228 | m_mouseY = my; | ||
229 | } | ||
230 | |||
231 | |||
232 | } | ||
233 | } | ||
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.h b/noncore/graphics/opie-eye/lib/oimagezoomer.h deleted file mode 100644 index 0b356c9..0000000 --- a/noncore/graphics/opie-eye/lib/oimagezoomer.h +++ b/dev/null | |||
@@ -1,141 +0,0 @@ | |||
1 | #ifndef OPIE_ODP_IMAGE_ZOOMER_H | ||
2 | #define OPIE_ODP_IMAGE_ZOOMER_H | ||
3 | |||
4 | #include <qframe.h> | ||
5 | #include <qimage.h> | ||
6 | |||
7 | class QPixmap; | ||
8 | class QRect; | ||
9 | class QPoint; | ||
10 | |||
11 | |||
12 | namespace Opie { | ||
13 | namespace MM { | ||
14 | |||
15 | /** | ||
16 | * \brief small class to zoom over a Page | ||
17 | * | ||
18 | * This class represents your page but smaller. | ||
19 | * It can draw a Rect on top of an Image/Pixmap you supply | ||
20 | * and you can allow the user easily zooming/moving | ||
21 | * over your widget. | ||
22 | * All you need to do is to supply a image/pixmap, the visible size | ||
23 | * and the original image/pixmap size and the current visible top/left | ||
24 | * position. | ||
25 | * | ||
26 | * This Image works perfectly with QScrollView as you can connect | ||
27 | * QScrollView::contentsMoving to setVisiblePoint slot and the zoomAreRel | ||
28 | * to the QScrollView::scrollBy slot. Now you would only need to watch | ||
29 | * the resize event anf give us the new information about QScrollView::viewport | ||
30 | * | ||
31 | * You need to position and set the size of this widget! using setFixedSize() is quite | ||
32 | * a good idea for this widget | ||
33 | * | ||
34 | * @see QScrollView | ||
35 | * @see QScrollView::viewport() | ||
36 | * | ||
37 | * @since 1.2 | ||
38 | * | ||
39 | */ | ||
40 | class OImageZoomer : public QFrame { | ||
41 | Q_OBJECT | ||
42 | public: | ||
43 | OImageZoomer( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
44 | OImageZoomer( const QPixmap&,QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
45 | OImageZoomer( const QImage&, QWidget* parent = 0, const char* name= 0, WFlags fl = 0 ); | ||
46 | OImageZoomer( const QSize&, const QSize&, QWidget* par, const char*, WFlags fl ); | ||
47 | ~OImageZoomer(); | ||
48 | |||
49 | public slots: | ||
50 | void setImageSize( const QSize& ); | ||
51 | void setViewPortSize( const QSize& ); | ||
52 | void setVisiblePoint( const QPoint& ); | ||
53 | void setVisiblePoint( int x, int y ); | ||
54 | void setImage( const QImage& ); | ||
55 | void setImage( const QPixmap& ); | ||
56 | |||
57 | signals: | ||
58 | /** | ||
59 | * Relative movement in the coordinates of the viewport | ||
60 | * This signal can easily be connected to QScrollView::scrollBy. | ||
61 | * This signal is emitted from within the mouseMoveEvent of this widget | ||
62 | * | ||
63 | * | ||
64 | * @param x The way to move relative on the X-Axis | ||
65 | * @param y The way to move relative on the Y-Axis | ||
66 | * | ||
67 | * @see setVisiblePoint | ||
68 | * @see QScrollView::scrollBy | ||
69 | */ | ||
70 | void zoomAreaRel( int x,int y); | ||
71 | |||
72 | /** | ||
73 | * Here you get absolute coordinates. | ||
74 | * This slot will be emitted from within the mouseReleaseEvent of this widget. | ||
75 | * if no mouse move where done. | ||
76 | * So you may not delete this widget | ||
77 | * | ||
78 | * @param x The absolute X Coordinate to scroll to. | ||
79 | * @param y The absolute Y Coordinate to scroll to. | ||
80 | * | ||
81 | */ | ||
82 | void zoomArea( int x,int y); | ||
83 | |||
84 | public: | ||
85 | /** | ||
86 | * make sure to call these if you reimplement | ||
87 | * @internal | ||
88 | */ | ||
89 | void resizeEvent( QResizeEvent* ); | ||
90 | |||
91 | protected: | ||
92 | /** | ||
93 | * make sure to call these if you reimplement | ||
94 | * @internal | ||
95 | */ | ||
96 | void drawContents( QPainter* p ); | ||
97 | |||
98 | /** | ||
99 | * make sure to call these if you reimplememt | ||
100 | * @internal | ||
101 | */ | ||
102 | virtual void mousePressEvent( QMouseEvent* ev ); | ||
103 | /** | ||
104 | * make sure to call these if you reimplement | ||
105 | * @internal | ||
106 | */ | ||
107 | virtual void mouseMoveEvent( QMouseEvent* ev ); | ||
108 | /** | ||
109 | * make sure to call these if you reimplement | ||
110 | * @internal | ||
111 | */ | ||
112 | virtual void mouseReleaseEvent( QMouseEvent* ev ); | ||
113 | |||
114 | private: | ||
115 | /** | ||
116 | * @internal | ||
117 | */ | ||
118 | void init(); | ||
119 | QImage m_img; | ||
120 | QSize m_imgSize, m_visSize; | ||
121 | QPoint m_visPt; | ||
122 | int m_mouseX, m_mouseY; | ||
123 | bool m_mevent; | ||
124 | }; | ||
125 | |||
126 | /** | ||
127 | * This slot is present for convience. You can connect the | ||
128 | * QScrollView::contentsMoved to this slot and it calls the QPoint | ||
129 | * version for you | ||
130 | * This realtes to QScrollView::contentsX() and QScrollView::contentsY() | ||
131 | * | ||
132 | * @param x The top left x coordinate | ||
133 | * @param y The top left y coorisnate | ||
134 | */ | ||
135 | inline void OImageZoomer::setVisiblePoint( int x, int y ) { | ||
136 | setVisiblePoint( QPoint( x, y ) ); | ||
137 | } | ||
138 | |||
139 | } | ||
140 | } | ||
141 | #endif | ||
diff --git a/noncore/graphics/opie-eye/phunk_view.pro b/noncore/graphics/opie-eye/phunk_view.pro index e9459ad..57e69b6 100644 --- a/noncore/graphics/opie-eye/phunk_view.pro +++ b/noncore/graphics/opie-eye/phunk_view.pro | |||
@@ -1,42 +1,40 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | DESTDIR = $(OPIEDIR)/bin | 2 | DESTDIR = $(OPIEDIR)/bin |
3 | TEMPLATE = app | 3 | TEMPLATE = app |
4 | TARGET = opie-eye | 4 | TARGET = opie-eye |
5 | # the name of the resulting object | 5 | # the name of the resulting object |
6 | 6 | ||
7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ | 7 | HEADERS = gui/iconview.h gui/filesystem.h gui/mainwindow.h \ |
8 | lib/imagecache.h impl/dir/dir_dirview.h \ | 8 | lib/imagecache.h impl/dir/dir_dirview.h \ |
9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ | 9 | iface/dirview.h iface/dirlister.h iface/ifaceinfo.h \ |
10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ | 10 | impl/dir/dir_lister.h impl/dir/dir_ifaceinfo.h \ |
11 | lib/slavemaster.h \ | 11 | lib/slavemaster.h \ |
12 | iface/slaveiface.h \ | 12 | iface/slaveiface.h \ |
13 | gui/imageinfoui.h gui/imagescrollview.h \ | 13 | gui/imageinfoui.h \ |
14 | gui/imageview.h \ | 14 | gui/imageview.h \ |
15 | lib/oimagezoomer.h \ | ||
16 | gui/viewmodebutton.h | 15 | gui/viewmodebutton.h |
17 | 16 | ||
18 | # A list header files | 17 | # A list header files |
19 | 18 | ||
20 | 19 | ||
21 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ | 20 | SOURCES = gui/iconview.cpp gui/filesystem.cpp gui/mainwindow.cpp \ |
22 | lib/imagecache.cpp lib/viewmap.cpp \ | 21 | lib/imagecache.cpp lib/viewmap.cpp \ |
23 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ | 22 | impl/dir/dir_dirview.cpp iface/dirlister.cpp \ |
24 | iface/dirview.cpp impl/dir/dir_lister.cpp \ | 23 | iface/dirview.cpp impl/dir/dir_lister.cpp \ |
25 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ | 24 | impl/dir/dir_ifaceinfo.cpp lib/slavemaster.cpp \ |
26 | gui/imageinfoui.cpp gui/imagescrollview.cpp \ | 25 | gui/imageinfoui.cpp \ |
27 | gui/imageview.cpp \ | 26 | gui/imageview.cpp \ |
28 | lib/oimagezoomer.cpp \ | ||
29 | gui/viewmodebutton.cpp | 27 | gui/viewmodebutton.cpp |
30 | # A list of source files | 28 | # A list of source files |
31 | 29 | ||
32 | INTERFACES = | 30 | INTERFACES = |
33 | # list of ui files | 31 | # list of ui files |
34 | 32 | ||
35 | INCLUDEPATH += . $(OPIEDIR)/include | 33 | INCLUDEPATH += . $(OPIEDIR)/include |
36 | DEPENDPATH += $(OPIEDIR)/include | 34 | DEPENDPATH += $(OPIEDIR)/include |
37 | 35 | ||
38 | 36 | ||
39 | 37 | ||
40 | LIBS += -lqpe -lopiecore2 -lopieui2 | 38 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiemm2 |
41 | 39 | ||
42 | include ( $(OPIEDIR)/include.pro ) | 40 | include ( $(OPIEDIR)/include.pro ) |