author | alwin <alwin> | 2005-03-24 21:13:40 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-24 21:13:40 (UTC) |
commit | b6fc9840f4fe9bad392167c49dbcfa2acda9ed21 (patch) (unidiff) | |
tree | 1d7d1225a9c440f5d0608d8901dfd151db8a6f1c | |
parent | 1e6c3181dcc7ec4edbe99db0d886ce7a9c483056 (diff) | |
download | opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.zip opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.tar.gz opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.tar.bz2 |
last bugfixes on opie-eye an imagescrollview. Seems that now all is working
as it should.
-rw-r--r-- | libopie2/opiemm/oimagescrollview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 13 |
3 files changed, 15 insertions, 8 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp index 10da823..76f50e1 100644 --- a/libopie2/opiemm/oimagescrollview.cpp +++ b/libopie2/opiemm/oimagescrollview.cpp | |||
@@ -176,64 +176,65 @@ void OImageScrollView::init() | |||
176 | } | 176 | } |
177 | _intensity = 0; | 177 | _intensity = 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | void OImageScrollView::setAutoRotate(bool how) | 180 | void OImageScrollView::setAutoRotate(bool how) |
181 | { | 181 | { |
182 | /* to avoid double repaints */ | 182 | /* to avoid double repaints */ |
183 | if (AutoRotate() != how) { | 183 | if (AutoRotate() != how) { |
184 | m_states.setBit(AUTO_ROTATE,how); | 184 | m_states.setBit(AUTO_ROTATE,how); |
185 | _image_data = QImage(); | 185 | _image_data = QImage(); |
186 | generateImage(); | 186 | generateImage(); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | bool OImageScrollView::AutoRotate()const | 190 | bool OImageScrollView::AutoRotate()const |
191 | { | 191 | { |
192 | return m_states.testBit(AUTO_ROTATE); | 192 | return m_states.testBit(AUTO_ROTATE); |
193 | } | 193 | } |
194 | 194 | ||
195 | void OImageScrollView::setAutoScaleRotate(bool scale, bool rotate) | 195 | void OImageScrollView::setAutoScaleRotate(bool scale, bool rotate) |
196 | { | 196 | { |
197 | m_states.setBit(AUTO_ROTATE,rotate); | 197 | m_states.setBit(AUTO_ROTATE,rotate); |
198 | setAutoScale(scale); | 198 | setAutoScale(scale); |
199 | } | 199 | } |
200 | 200 | ||
201 | void OImageScrollView::setAutoScale(bool how) | 201 | void OImageScrollView::setAutoScale(bool how) |
202 | { | 202 | { |
203 | m_states.setBit(AUTO_SCALE,how); | 203 | m_states.setBit(AUTO_SCALE,how); |
204 | _image_data = QImage(); | 204 | _image_data = QImage(); |
205 | if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) { | 205 | if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) { |
206 | loadJpeg(true); | 206 | loadJpeg(true); |
207 | } | 207 | } |
208 | _newImage = true; | ||
208 | generateImage(); | 209 | generateImage(); |
209 | } | 210 | } |
210 | 211 | ||
211 | bool OImageScrollView::AutoScale()const | 212 | bool OImageScrollView::AutoScale()const |
212 | { | 213 | { |
213 | return m_states.testBit(AUTO_SCALE); | 214 | return m_states.testBit(AUTO_SCALE); |
214 | } | 215 | } |
215 | 216 | ||
216 | OImageScrollView::~OImageScrollView() | 217 | OImageScrollView::~OImageScrollView() |
217 | { | 218 | { |
218 | } | 219 | } |
219 | 220 | ||
220 | void OImageScrollView::rescaleImage(int w, int h) | 221 | void OImageScrollView::rescaleImage(int w, int h) |
221 | { | 222 | { |
222 | if (_image_data.width()==w && _image_data.height()==h) { | 223 | if (_image_data.width()==w && _image_data.height()==h) { |
223 | return; | 224 | return; |
224 | } | 225 | } |
225 | double hs = (double)h / (double)_image_data.height() ; | 226 | double hs = (double)h / (double)_image_data.height() ; |
226 | double ws = (double)w / (double)_image_data.width() ; | 227 | double ws = (double)w / (double)_image_data.width() ; |
227 | double scaleFactor = (hs > ws) ? ws : hs; | 228 | double scaleFactor = (hs > ws) ? ws : hs; |
228 | int smoothW = (int)(scaleFactor * _image_data.width()); | 229 | int smoothW = (int)(scaleFactor * _image_data.width()); |
229 | int smoothH = (int)(scaleFactor * _image_data.height()); | 230 | int smoothH = (int)(scaleFactor * _image_data.height()); |
230 | _image_data = _image_data.smoothScale(smoothW,smoothH); | 231 | _image_data = _image_data.smoothScale(smoothW,smoothH); |
231 | } | 232 | } |
232 | 233 | ||
233 | void OImageScrollView::rotate_into_data(Rotation r) | 234 | void OImageScrollView::rotate_into_data(Rotation r) |
234 | { | 235 | { |
235 | /* realy - we must do this that way, 'cause when acting direct on _image_data the app will | 236 | /* realy - we must do this that way, 'cause when acting direct on _image_data the app will |
236 | segfault :( */ | 237 | segfault :( */ |
237 | QImage dest; | 238 | QImage dest; |
238 | int x, y; | 239 | int x, y; |
239 | if ( _original_data.depth() > 8 ) | 240 | if ( _original_data.depth() > 8 ) |
@@ -319,66 +320,68 @@ void OImageScrollView::rotate_into_data(Rotation r) | |||
319 | } | 320 | } |
320 | break; | 321 | break; |
321 | case Rotate270: | 322 | case Rotate270: |
322 | dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); | 323 | dest.create(_original_data.height(), _original_data.width(), _original_data.depth()); |
323 | dest.setNumColors(_original_data.numColors()); | 324 | dest.setNumColors(_original_data.numColors()); |
324 | srcTable = (unsigned int *)_original_data.colorTable(); | 325 | srcTable = (unsigned int *)_original_data.colorTable(); |
325 | destTable = (unsigned int *)dest.colorTable(); | 326 | destTable = (unsigned int *)dest.colorTable(); |
326 | for ( x=0; x < _original_data.numColors(); ++x ) | 327 | for ( x=0; x < _original_data.numColors(); ++x ) |
327 | destTable[x] = srcTable[x]; | 328 | destTable[x] = srcTable[x]; |
328 | for ( y=0; y < _original_data.height(); ++y ) | 329 | for ( y=0; y < _original_data.height(); ++y ) |
329 | { | 330 | { |
330 | srcData = (unsigned char *)_original_data.scanLine(y); | 331 | srcData = (unsigned char *)_original_data.scanLine(y); |
331 | for ( x=0; x < _original_data.width(); ++x ) | 332 | for ( x=0; x < _original_data.width(); ++x ) |
332 | { | 333 | { |
333 | destData = (unsigned char *)dest.scanLine(_original_data.width()-x-1); | 334 | destData = (unsigned char *)dest.scanLine(_original_data.width()-x-1); |
334 | destData[y] = srcData[x]; | 335 | destData[y] = srcData[x]; |
335 | } | 336 | } |
336 | } | 337 | } |
337 | break; | 338 | break; |
338 | default: | 339 | default: |
339 | dest = _original_data; | 340 | dest = _original_data; |
340 | break; | 341 | break; |
341 | } | 342 | } |
342 | 343 | ||
343 | } | 344 | } |
344 | _newImage = true; | 345 | _newImage = true; |
345 | _image_data = dest; | 346 | _image_data = dest; |
346 | } | 347 | } |
347 | 348 | ||
348 | // yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin | 349 | // yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin |
349 | void OImageScrollView::apply_gamma(int aValue) | 350 | void OImageScrollView::apply_gamma(int aValue) |
350 | { | 351 | { |
351 | if (!_image_data.size().isValid()) return; | 352 | if (aValue==0 || !_image_data.size().isValid()) return; |
352 | float percent = ((float)aValue/100.0); | 353 | float percent = ((float)aValue/100.0); |
354 | /* make sure working on a copy */ | ||
355 | _image_data.detach(); | ||
353 | 356 | ||
354 | int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors(); | 357 | int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors(); |
355 | /* must be - otherwise it displays some ... strange colors */ | 358 | /* must be - otherwise it displays some ... strange colors */ |
356 | if (segColors<256) segColors=256; | 359 | if (segColors<256) segColors=256; |
357 | 360 | ||
358 | unsigned char *segTbl = new unsigned char[segColors]; | 361 | unsigned char *segTbl = new unsigned char[segColors]; |
359 | int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors(); | 362 | int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors(); |
360 | 363 | ||
361 | 364 | ||
362 | bool brighten = (percent >= 0); | 365 | bool brighten = (percent >= 0); |
363 | if ( percent < 0 ) { | 366 | if ( percent < 0 ) { |
364 | percent = -percent; | 367 | percent = -percent; |
365 | } | 368 | } |
366 | 369 | ||
367 | unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() : | 370 | unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() : |
368 | (unsigned int *)_image_data.colorTable(); | 371 | (unsigned int *)_image_data.colorTable(); |
369 | 372 | ||
370 | int tmp = 0; | 373 | int tmp = 0; |
371 | 374 | ||
372 | if (brighten) { | 375 | if (brighten) { |
373 | for ( int i=0; i < segColors; ++i ) | 376 | for ( int i=0; i < segColors; ++i ) |
374 | { | 377 | { |
375 | tmp = (int)(i*percent); | 378 | tmp = (int)(i*percent); |
376 | if ( tmp > 255 ) | 379 | if ( tmp > 255 ) |
377 | tmp = 255; | 380 | tmp = 255; |
378 | segTbl[i] = tmp; | 381 | segTbl[i] = tmp; |
379 | } | 382 | } |
380 | } else { | 383 | } else { |
381 | for ( int i=0; i < segColors; ++i ) | 384 | for ( int i=0; i < segColors; ++i ) |
382 | { | 385 | { |
383 | tmp = (int)(i*percent); | 386 | tmp = (int)(i*percent); |
384 | if ( tmp < 0 ) | 387 | if ( tmp < 0 ) |
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 994fe12..b919ca8 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp | |||
@@ -17,89 +17,88 @@ using namespace Opie::Core; | |||
17 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) | 17 | ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl ) |
18 | : Opie::MM::OImageScrollView(parent,name,fl) | 18 | : Opie::MM::OImageScrollView(parent,name,fl) |
19 | { | 19 | { |
20 | m_viewManager = 0; | 20 | m_viewManager = 0; |
21 | focus_in_count = 0; | 21 | focus_in_count = 0; |
22 | m_cfg = cfg; | 22 | m_cfg = cfg; |
23 | m_isFullScreen = false; | 23 | m_isFullScreen = false; |
24 | m_ignore_next_in = false; | 24 | m_ignore_next_in = false; |
25 | m_slideTimer = 0; | 25 | m_slideTimer = 0; |
26 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); | 26 | QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold); |
27 | initKeys(); | 27 | initKeys(); |
28 | m_slideValue = 5; | 28 | m_slideValue = 5; |
29 | m_gDisplayType = 0; | 29 | m_gDisplayType = 0; |
30 | m_gPrevNext = 0; | 30 | m_gPrevNext = 0; |
31 | m_hGroup = 0; | 31 | m_hGroup = 0; |
32 | m_gBright = 0; | 32 | m_gBright = 0; |
33 | m_Rotated = false; | 33 | m_Rotated = false; |
34 | closeIfHide = false; | 34 | closeIfHide = false; |
35 | int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()? | 35 | int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()? |
36 | QApplication::desktop()->size().height():QApplication::desktop()->size().width(); | 36 | QApplication::desktop()->size().height():QApplication::desktop()->size().width(); |
37 | if (min>320) { | 37 | if (min>320) { |
38 | // bigscreen | 38 | // bigscreen |
39 | setMinimumSize(min/3,min/3); | 39 | setMinimumSize(min/3,min/3); |
40 | } else { | 40 | } else { |
41 | setMinimumSize(10,10); | 41 | setMinimumSize(10,10); |
42 | } | 42 | } |
43 | connect(this,SIGNAL(incBrightness()),this,SLOT(slotIncBrightness())); | 43 | connect(this,SIGNAL(incBrightness()),this,SLOT(slotIncBrightness())); |
44 | connect(this,SIGNAL(decBrightness()),this,SLOT(slotDecBrightness())); | 44 | connect(this,SIGNAL(decBrightness()),this,SLOT(slotDecBrightness())); |
45 | 45 | ||
46 | m_sysChannel = new QCopChannel( "QPE/System", this ); | 46 | m_sysChannel = new QCopChannel( "QPE/System", this ); |
47 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 47 | connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
48 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); | 48 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); |
49 | setKeyCompression(true); | ||
49 | } | 50 | } |
50 | 51 | ||
51 | void ImageView::slotIncBrightness() | 52 | void ImageView::slotIncBrightness() |
52 | { | 53 | { |
53 | int lb = Intensity()+5; | 54 | int lb = Intensity()+5; |
54 | if (lb>100) lb=100; | 55 | if (lb>100) lb=100; |
55 | setIntensity(lb,true); | 56 | setIntensity(lb,true); |
56 | } | 57 | } |
57 | 58 | ||
58 | void ImageView::slotDecBrightness() | 59 | void ImageView::slotDecBrightness() |
59 | { | 60 | { |
60 | int lb = Intensity()-5; | 61 | int lb = Intensity()-5; |
61 | if (lb<-100) lb=-100; | 62 | if (lb<-100) lb=-100; |
62 | setIntensity(lb,true); | 63 | setIntensity(lb,true); |
63 | } | 64 | } |
64 | 65 | ||
65 | void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) | 66 | void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) |
66 | { | 67 | { |
67 | int _newrotation; | 68 | int _newrotation; |
68 | QDataStream stream( data, IO_ReadOnly ); | 69 | QDataStream stream( data, IO_ReadOnly ); |
69 | odebug << "received system message: " << msg << oendl; | ||
70 | if ( msg == "setCurrentRotation(int)" ) | 70 | if ( msg == "setCurrentRotation(int)" ) |
71 | { | 71 | { |
72 | stream >> _newrotation; | 72 | stream >> _newrotation; |
73 | odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl; | ||
74 | if (!fullScreen()) { | 73 | if (!fullScreen()) { |
75 | m_rotation = _newrotation; | 74 | m_rotation = _newrotation; |
76 | return; | 75 | return; |
77 | } | 76 | } |
78 | } | 77 | } |
79 | } | 78 | } |
80 | 79 | ||
81 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup) | 80 | void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup) |
82 | { | 81 | { |
83 | m_gDisplayType = disptypeGroup; | 82 | m_gDisplayType = disptypeGroup; |
84 | m_gPrevNext = nextprevGroup; | 83 | m_gPrevNext = nextprevGroup; |
85 | m_hGroup = hGroup; | 84 | m_hGroup = hGroup; |
86 | m_gBright = brightGroup; | 85 | m_gBright = brightGroup; |
87 | } | 86 | } |
88 | 87 | ||
89 | ImageView::~ImageView() | 88 | ImageView::~ImageView() |
90 | { | 89 | { |
91 | odebug << "Destructor imageview" << oendl; | 90 | odebug << "Destructor imageview" << oendl; |
92 | delete m_viewManager; | 91 | delete m_viewManager; |
93 | } | 92 | } |
94 | 93 | ||
95 | Opie::Core::OKeyConfigManager* ImageView::manager() | 94 | Opie::Core::OKeyConfigManager* ImageView::manager() |
96 | { | 95 | { |
97 | if (!m_viewManager) { | 96 | if (!m_viewManager) { |
98 | initKeys(); | 97 | initKeys(); |
99 | } | 98 | } |
100 | return m_viewManager; | 99 | return m_viewManager; |
101 | } | 100 | } |
102 | 101 | ||
103 | void ImageView::startSlide(int value) | 102 | void ImageView::startSlide(int value) |
104 | { | 103 | { |
105 | if (!m_slideTimer) { | 104 | if (!m_slideTimer) { |
@@ -207,115 +206,113 @@ void ImageView::initKeys() | |||
207 | } | 206 | } |
208 | 207 | ||
209 | void ImageView::keyReleaseEvent(QKeyEvent * e) | 208 | void ImageView::keyReleaseEvent(QKeyEvent * e) |
210 | { | 209 | { |
211 | if (!e || e->state()!=0) { | 210 | if (!e || e->state()!=0) { |
212 | return; | 211 | return; |
213 | } | 212 | } |
214 | if (e->key()==Qt::Key_Escape) { | 213 | if (e->key()==Qt::Key_Escape) { |
215 | if (fullScreen()) { | 214 | if (fullScreen()) { |
216 | emit hideMe(); | 215 | emit hideMe(); |
217 | } | 216 | } |
218 | if (closeIfHide) { | 217 | if (closeIfHide) { |
219 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); | 218 | QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); |
220 | } | 219 | } |
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
224 | void ImageView::setCloseIfHide(bool how) | 223 | void ImageView::setCloseIfHide(bool how) |
225 | { | 224 | { |
226 | closeIfHide = how; | 225 | closeIfHide = how; |
227 | } | 226 | } |
228 | 227 | ||
229 | void ImageView::slotShowImageInfo() | 228 | void ImageView::slotShowImageInfo() |
230 | { | 229 | { |
231 | emit dispImageInfo(m_lastName); | 230 | emit dispImageInfo(m_lastName); |
232 | } | 231 | } |
233 | 232 | ||
234 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) | 233 | void ImageView::contentsMousePressEvent ( QMouseEvent * e) |
235 | { | 234 | { |
236 | if (e->button()==1) { | 235 | if (e->button()==1) { |
237 | return OImageScrollView::contentsMousePressEvent(e); | 236 | return OImageScrollView::contentsMousePressEvent(e); |
238 | } | 237 | } |
239 | odebug << "Popup " << oendl; | ||
240 | QPopupMenu *m = new QPopupMenu(this); | 238 | QPopupMenu *m = new QPopupMenu(this); |
241 | if (!m) return; | 239 | if (!m) return; |
242 | if (m_hGroup) { | 240 | if (m_hGroup) { |
243 | m_hGroup->addTo(m); | 241 | m_hGroup->addTo(m); |
244 | } | 242 | } |
245 | if (fullScreen()) { | 243 | if (fullScreen()) { |
246 | if (m_gPrevNext) { | 244 | if (m_gPrevNext) { |
247 | m->insertSeparator(); | 245 | m->insertSeparator(); |
248 | m_gPrevNext->addTo(m); | 246 | m_gPrevNext->addTo(m); |
249 | } | 247 | } |
250 | if (m_gDisplayType) { | 248 | if (m_gDisplayType) { |
251 | m->insertSeparator(); | 249 | m->insertSeparator(); |
252 | m_gDisplayType->addTo(m); | 250 | m_gDisplayType->addTo(m); |
253 | } | 251 | } |
254 | if (m_gBright) { | 252 | if (m_gBright) { |
255 | m->insertSeparator(); | 253 | m->insertSeparator(); |
256 | m_gBright->addTo(m); | 254 | m_gBright->addTo(m); |
257 | } | 255 | } |
258 | } | 256 | } |
259 | m->setFocus(); | 257 | m->setFocus(); |
260 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 258 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
261 | if (m_hGroup) { | 259 | if (m_hGroup) { |
262 | m_hGroup->removeFrom(m); | 260 | m_hGroup->removeFrom(m); |
263 | } | 261 | } |
264 | if (m_gPrevNext) { | 262 | if (m_gPrevNext) { |
265 | m_gPrevNext->removeFrom(m); | 263 | m_gPrevNext->removeFrom(m); |
266 | } | 264 | } |
267 | if (m_gDisplayType) { | 265 | if (m_gDisplayType) { |
268 | m_gDisplayType->removeFrom(m); | 266 | m_gDisplayType->removeFrom(m); |
269 | } | 267 | } |
270 | if (m_gBright) { | 268 | if (m_gBright) { |
271 | m_gBright->removeFrom(m); | 269 | m_gBright->removeFrom(m); |
272 | } | 270 | } |
273 | delete m; | 271 | delete m; |
274 | } | 272 | } |
275 | 273 | ||
276 | void ImageView::setFullScreen(bool how,bool force) | 274 | void ImageView::setFullScreen(bool how,bool force) |
277 | { | 275 | { |
278 | m_isFullScreen = how; | 276 | m_isFullScreen = how; |
279 | if (how) { | 277 | if (how) { |
280 | m_ignore_next_in = true; | 278 | m_ignore_next_in = true; |
281 | // setFixedSize(qApp->desktop()->size()); | 279 | // setFixedSize(qApp->desktop()->size()); |
282 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); | 280 | setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); |
283 | if (force) showFullScreen(); | 281 | if (force) showFullScreen(); |
284 | } else { | 282 | } else { |
285 | // setMinimumSize(10,10); | 283 | // setMinimumSize(10,10); |
286 | } | 284 | } |
287 | } | 285 | } |
288 | 286 | ||
289 | void ImageView::focusInEvent(QFocusEvent *) | 287 | void ImageView::focusInEvent(QFocusEvent *) |
290 | { | 288 | { |
291 | // Always do it here, no matter the size. | 289 | // Always do it here, no matter the size. |
292 | odebug << "Focus in (view)" << oendl; | ||
293 | //if (fullScreen()) parentWidget()->showNormal(); | 290 | //if (fullScreen()) parentWidget()->showNormal(); |
294 | if (m_ignore_next_in){m_ignore_next_in=false;return;} | 291 | if (m_ignore_next_in){m_ignore_next_in=false;return;} |
295 | if (fullScreen()) enableFullscreen(); | 292 | if (fullScreen()) enableFullscreen(); |
296 | } | 293 | } |
297 | 294 | ||
298 | void ImageView::hide() | 295 | void ImageView::hide() |
299 | { | 296 | { |
300 | if (fullScreen()) { | 297 | if (fullScreen()) { |
301 | m_ignore_next_in = true; | 298 | m_ignore_next_in = true; |
302 | showNormal(); | 299 | showNormal(); |
303 | } | 300 | } |
304 | QWidget::hide(); | 301 | QWidget::hide(); |
305 | } | 302 | } |
306 | void ImageView::enableFullscreen() | 303 | void ImageView::enableFullscreen() |
307 | { | 304 | { |
308 | if (!fullScreen()) return; | 305 | if (!fullScreen()) return; |
309 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} | 306 | if (m_ignore_next_in) {m_ignore_next_in = false;return;} |
310 | 307 | ||
311 | setUpdatesEnabled(false); | 308 | setUpdatesEnabled(false); |
312 | // This is needed because showNormal() forcefully changes the window | 309 | // This is needed because showNormal() forcefully changes the window |
313 | // style to WSTyle_TopLevel. | 310 | // style to WSTyle_TopLevel. |
314 | reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); | 311 | reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
315 | // Enable fullscreen. | 312 | // Enable fullscreen. |
316 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus | 313 | /* this is the trick - I don't now why, but after a showFullScreen QTE toggles the focus |
317 | * so we must block it here! */ | 314 | * so we must block it here! */ |
318 | m_ignore_next_in = true; | 315 | m_ignore_next_in = true; |
319 | showFullScreen(); | 316 | showFullScreen(); |
320 | setUpdatesEnabled(true); | 317 | setUpdatesEnabled(true); |
321 | } | 318 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 4ee252f..3efbb53 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -620,147 +620,154 @@ void PMainWindow::setupActions() | |||
620 | m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); | 620 | m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); |
621 | } else { | 621 | } else { |
622 | m_aUnscaled->setOn(false); | 622 | m_aUnscaled->setOn(false); |
623 | } | 623 | } |
624 | 624 | ||
625 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); | 625 | m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true ); |
626 | m_aZoomer->setToggleAction(true); | 626 | m_aZoomer->setToggleAction(true); |
627 | if (autoSave) { | 627 | if (autoSave) { |
628 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); | 628 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); |
629 | } else { | 629 | } else { |
630 | m_aZoomer->setOn (true); | 630 | m_aZoomer->setOn (true); |
631 | } | 631 | } |
632 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 632 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
633 | m_gDisplayType->insert(m_aAutoRotate); | 633 | m_gDisplayType->insert(m_aAutoRotate); |
634 | m_gDisplayType->insert(m_aUnscaled); | 634 | m_gDisplayType->insert(m_aUnscaled); |
635 | m_gDisplayType->insert(m_aZoomer); | 635 | m_gDisplayType->insert(m_aZoomer); |
636 | 636 | ||
637 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 637 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
638 | m_hGroup->insert(m_aFullScreen); | 638 | m_hGroup->insert(m_aFullScreen); |
639 | 639 | ||
640 | if (!m_SmallWindow) { | 640 | if (!m_SmallWindow) { |
641 | m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); | 641 | m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); |
642 | m_aForceSmall->setToggleAction(true); | 642 | m_aForceSmall->setToggleAction(true); |
643 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); | 643 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); |
644 | } else { | 644 | } else { |
645 | m_aForceSmall = 0; | 645 | m_aForceSmall = 0; |
646 | } | 646 | } |
647 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); | 647 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); |
648 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); | 648 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); |
649 | m_IncBrightness = new QAction(tr("Increase brightness by 5"),Resource::loadIconSet( "up" ),0, 0, this, 0, false); | 649 | m_IncBrightness = new QAction(tr("Increase brightness by 5"),Resource::loadIconSet( "up" ),0, 0, this, 0, false); |
650 | m_DecBrightness = new QAction(tr("Decrease brightness by 5"),Resource::loadIconSet( "down" ),0, 0, this, 0, false); | 650 | m_DecBrightness = new QAction(tr("Decrease brightness by 5"),Resource::loadIconSet( "down" ),0, 0, this, 0, false); |
651 | m_hBright = new QActionGroup(this,"actioncollection",false), | 651 | m_hBright = new QActionGroup(this,"actioncollection",false), |
652 | m_hBright->insert(m_setCurrentBrightness); | ||
652 | m_hBright->insert(m_IncBrightness); | 653 | m_hBright->insert(m_IncBrightness); |
653 | m_hBright->insert(m_DecBrightness); | 654 | m_hBright->insert(m_DecBrightness); |
654 | } | 655 | } |
655 | 656 | ||
656 | void PMainWindow::setupBrightness() | 657 | void PMainWindow::setupBrightness() |
657 | { | 658 | { |
658 | if (!m_disp) { | 659 | if (!m_disp) { |
659 | return; | 660 | return; |
660 | } | 661 | } |
662 | bool reshow=false; | ||
663 | if (m_disp->isVisible()&&m_disp->fullScreen()) { | ||
664 | m_disp->hide(); | ||
665 | reshow = true; | ||
666 | } | ||
661 | int lb = m_disp->Intensity(); | 667 | int lb = m_disp->Intensity(); |
662 | if (Valuebox(0,-100,100,lb,lb)) { | 668 | if (Valuebox(0,-100,100,lb,lb)) { |
663 | m_disp->setIntensity(lb,true); | 669 | m_disp->setIntensity(lb,true); |
664 | } | 670 | } |
671 | if (reshow) { | ||
672 | m_disp->showFullScreen(); | ||
673 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | ||
674 | } | ||
665 | } | 675 | } |
666 | 676 | ||
667 | void PMainWindow::setupToolbar() | 677 | void PMainWindow::setupToolbar() |
668 | { | 678 | { |
669 | toolBar = new QToolBar( this ); | 679 | toolBar = new QToolBar( this ); |
670 | addToolBar(toolBar); | 680 | addToolBar(toolBar); |
671 | toolBar->setHorizontalStretchable( true ); | 681 | toolBar->setHorizontalStretchable( true ); |
672 | setToolBarsMovable( false ); | 682 | setToolBarsMovable( false ); |
673 | m_aDirUp->addTo( toolBar ); | 683 | m_aDirUp->addTo( toolBar ); |
674 | 684 | ||
675 | fsButton = new PFileSystem( toolBar ); | 685 | fsButton = new PFileSystem( toolBar ); |
676 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 686 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
677 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 687 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
678 | connect( this, SIGNAL( changeDir( const QString& ) ), | 688 | connect( this, SIGNAL( changeDir( const QString& ) ), |
679 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 689 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
680 | 690 | ||
681 | if (m_aBeam) { | 691 | if (m_aBeam) { |
682 | m_aBeam->addTo( toolBar ); | 692 | m_aBeam->addTo( toolBar ); |
683 | } | 693 | } |
684 | m_aShowInfo->addTo(toolBar); | 694 | m_aShowInfo->addTo(toolBar); |
685 | m_aTrash->addTo(toolBar); | 695 | m_aTrash->addTo(toolBar); |
686 | // m_aSetup->addTo(toolBar); | ||
687 | 696 | ||
688 | m_gDisplayType->addTo(toolBar); | 697 | m_gDisplayType->addTo(toolBar); |
689 | 698 | ||
690 | if (!m_SmallWindow) { | 699 | if (!m_SmallWindow) { |
691 | m_gPrevNext->addTo(toolBar); | 700 | m_gPrevNext->addTo(toolBar); |
692 | } else { | 701 | } else { |
693 | m_gPrevNext->setEnabled(false); | 702 | m_gPrevNext->setEnabled(false); |
694 | } | 703 | } |
695 | } | 704 | } |
696 | 705 | ||
697 | void PMainWindow::setupMenu() | 706 | void PMainWindow::setupMenu() |
698 | { | 707 | { |
699 | fileMenu = new QPopupMenu( menuBar() ); | 708 | fileMenu = new QPopupMenu( menuBar() ); |
700 | menuBar()->insertItem( tr( "File" ), fileMenu ); | 709 | menuBar()->insertItem( tr( "File" ), fileMenu ); |
701 | dispMenu = new QPopupMenu( menuBar() ); | 710 | dispMenu = new QPopupMenu( menuBar() ); |
702 | menuBar()->insertItem( tr( "Show" ), dispMenu ); | 711 | menuBar()->insertItem( tr( "Show" ), dispMenu ); |
703 | settingsMenu = new QPopupMenu( menuBar() ); | 712 | settingsMenu = new QPopupMenu( menuBar() ); |
704 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); | 713 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); |
705 | 714 | ||
706 | m_aViewfile->addTo(fileMenu); | 715 | m_aViewfile->addTo(fileMenu); |
707 | m_aShowInfo->addTo(fileMenu); | 716 | m_aShowInfo->addTo(fileMenu); |
708 | m_aStartSlide->addTo(fileMenu); | 717 | m_aStartSlide->addTo(fileMenu); |
709 | 718 | ||
710 | fileMenu->insertSeparator(); | 719 | fileMenu->insertSeparator(); |
711 | m_aDirUp->addTo( fileMenu ); | 720 | m_aDirUp->addTo( fileMenu ); |
712 | 721 | ||
713 | fsMenu = new QPopupMenu(fileMenu); | 722 | fsMenu = new QPopupMenu(fileMenu); |
714 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); | 723 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); |
715 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); | 724 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); |
716 | dirChanged(); | 725 | dirChanged(); |
717 | 726 | ||
718 | if ( m_aBeam ) { | 727 | if ( m_aBeam ) { |
719 | fileMenu->insertSeparator(); | 728 | fileMenu->insertSeparator(); |
720 | m_aBeam->addTo( fileMenu ); | 729 | m_aBeam->addTo( fileMenu ); |
721 | } | 730 | } |
722 | fileMenu->insertSeparator(); | 731 | fileMenu->insertSeparator(); |
723 | m_aTrash->addTo(fileMenu); | 732 | m_aTrash->addTo(fileMenu); |
724 | 733 | ||
725 | listviewMenu = new QPopupMenu(dispMenu); | 734 | listviewMenu = new QPopupMenu(dispMenu); |
726 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); | 735 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); |
727 | m_gListViewMode->addTo(listviewMenu); | 736 | m_gListViewMode->addTo(listviewMenu); |
728 | dispMenu->insertSeparator(); | 737 | dispMenu->insertSeparator(); |
729 | m_aFullScreen->addTo(dispMenu); | 738 | m_aFullScreen->addTo(dispMenu); |
730 | m_gDisplayType->addTo(dispMenu); | 739 | m_gDisplayType->addTo(dispMenu); |
731 | dispMenu->insertSeparator(); | 740 | dispMenu->insertSeparator(); |
732 | m_gPrevNext->addTo(dispMenu); | 741 | m_gPrevNext->addTo(dispMenu); |
733 | m_setCurrentBrightness->addTo(dispMenu); | ||
734 | m_setCurrentBrightness->setEnabled(false); | ||
735 | dispMenu->insertSeparator(); | 742 | dispMenu->insertSeparator(); |
736 | m_hBright->addTo(dispMenu); | 743 | m_hBright->addTo(dispMenu); |
737 | m_hBright->setEnabled(false); | 744 | m_hBright->setEnabled(false); |
738 | 745 | ||
739 | if (m_aForceSmall) { | 746 | if (m_aForceSmall) { |
740 | dispMenu->insertSeparator(); | 747 | dispMenu->insertSeparator(); |
741 | m_aForceSmall->addTo(dispMenu); | 748 | m_aForceSmall->addTo(dispMenu); |
742 | } | 749 | } |
743 | 750 | ||
744 | m_aSetup->addTo(settingsMenu); | 751 | m_aSetup->addTo(settingsMenu); |
745 | m_aHideToolbar->addTo(settingsMenu); | 752 | m_aHideToolbar->addTo(settingsMenu); |
746 | } | 753 | } |
747 | 754 | ||
748 | void PMainWindow::listviewselected(QAction*which) | 755 | void PMainWindow::listviewselected(QAction*which) |
749 | { | 756 | { |
750 | if (!which || which->isOn()==false) return; | 757 | if (!which || which->isOn()==false) return; |
751 | int val = 1; | 758 | int val = 1; |
752 | 759 | ||
753 | if (which==m_aDirName) { | 760 | if (which==m_aDirName) { |
754 | val = 3; | 761 | val = 3; |
755 | } else if (which==m_aDirShort) { | 762 | } else if (which==m_aDirShort) { |
756 | val = 2; | 763 | val = 2; |
757 | } else if (which==m_aDirLong) { | 764 | } else if (which==m_aDirLong) { |
758 | val = 1; | 765 | val = 1; |
759 | } | 766 | } |
760 | emit changeListMode(val); | 767 | emit changeListMode(val); |
761 | } | 768 | } |
762 | 769 | ||
763 | void PMainWindow::readConfig() | 770 | void PMainWindow::readConfig() |
764 | { | 771 | { |
765 | autoSave =m_cfg->readBoolEntry("savestatus",true); | 772 | autoSave =m_cfg->readBoolEntry("savestatus",true); |
766 | m_Intensity = m_cfg->readNumEntry("intensity",0); | 773 | m_Intensity = m_cfg->readNumEntry("intensity",0); |