Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index d11e4e1..4ee252f 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -220,110 +220,112 @@ void PMainWindow::slotConfig() { | |||
220 | m_view->resetView(); | 220 | m_view->resetView(); |
221 | readConfig(); | 221 | readConfig(); |
222 | } | 222 | } |
223 | delete keyWid; | 223 | delete keyWid; |
224 | 224 | ||
225 | m_stack->raiseWidget(w); | 225 | m_stack->raiseWidget(w); |
226 | if (remdisp) { | 226 | if (remdisp) { |
227 | m_disp->hide(); | 227 | m_disp->hide(); |
228 | } | 228 | } |
229 | if (reminfo) { | 229 | if (reminfo) { |
230 | m_info->hide(); | 230 | m_info->hide(); |
231 | } | 231 | } |
232 | if (m_disp) { | 232 | if (m_disp) { |
233 | m_disp->setIntensity(m_Intensity,true); | 233 | m_disp->setIntensity(m_Intensity,true); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * create a new image info component | 238 | * create a new image info component |
239 | * and detach the current one | 239 | * and detach the current one |
240 | * we will make the other delete on exit | 240 | * we will make the other delete on exit |
241 | */ | 241 | */ |
242 | template<class T> | 242 | template<class T> |
243 | void PMainWindow::initT( const char* name, T** ptr, int id) { | 243 | void PMainWindow::initT( const char* name, T** ptr, int id) { |
244 | if ( *ptr ) { | 244 | if ( *ptr ) { |
245 | (*ptr)->disconnect(this, SLOT(slotReturn())); | 245 | (*ptr)->disconnect(this, SLOT(slotReturn())); |
246 | (*ptr)->setDestructiveClose(); | 246 | (*ptr)->setDestructiveClose(); |
247 | m_stack->removeWidget( *ptr ); | 247 | m_stack->removeWidget( *ptr ); |
248 | } | 248 | } |
249 | *ptr = new T(m_cfg, m_stack, name ); | 249 | *ptr = new T(m_cfg, m_stack, name ); |
250 | m_stack->addWidget( *ptr, id ); | 250 | m_stack->addWidget( *ptr, id ); |
251 | 251 | ||
252 | connect(*ptr, SIGNAL(sig_return()), | 252 | connect(*ptr, SIGNAL(sig_return()), |
253 | this,SLOT(slotReturn())); | 253 | this,SLOT(slotReturn())); |
254 | 254 | ||
255 | } | 255 | } |
256 | 256 | ||
257 | void PMainWindow::initInfo() { | 257 | void PMainWindow::initInfo() { |
258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 258 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); | 259 | connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void PMainWindow::initDisp() { | 262 | void PMainWindow::initDisp() { |
263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); | 263 | initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay ); |
264 | if (m_disp) { | 264 | if (m_disp) { |
265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 265 | // if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 266 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
267 | // } | 267 | // } |
268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); | 268 | m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType,m_hBright); |
269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); | 269 | m_disp->setAutoScale(!m_aUnscaled->isOn()); |
270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); | 270 | m_disp->setAutoRotate(m_aAutoRotate->isOn()); |
271 | m_disp->setShowZoomer(m_aZoomer->isOn()); | 271 | m_disp->setShowZoomer(m_aZoomer->isOn()); |
272 | m_disp->setBackgroundColor(white); | 272 | m_disp->setBackgroundColor(white); |
273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); | 273 | connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&))); |
274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); | 274 | connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext())); |
275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); | 275 | connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev())); |
276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); | 276 | connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen())); |
277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); | 277 | connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView())); |
278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); | 278 | connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer())); |
279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); | 279 | connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale())); |
280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); | 280 | connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); |
281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); | 281 | connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); |
282 | connect(m_IncBrightness,SIGNAL(activated()),m_disp,SLOT(slotIncBrightness())); | ||
283 | connect(m_DecBrightness,SIGNAL(activated()),m_disp,SLOT(slotDecBrightness())); | ||
282 | slotFullScreenToggled(m_aFullScreen->isOn()); | 284 | slotFullScreenToggled(m_aFullScreen->isOn()); |
283 | } | 285 | } |
284 | } | 286 | } |
285 | 287 | ||
286 | void PMainWindow::slotToggleFullScreen() | 288 | void PMainWindow::slotToggleFullScreen() |
287 | { | 289 | { |
288 | bool current = !m_aFullScreen->isOn(); | 290 | bool current = !m_aFullScreen->isOn(); |
289 | m_aFullScreen->setOn(current); | 291 | m_aFullScreen->setOn(current); |
290 | } | 292 | } |
291 | 293 | ||
292 | void PMainWindow::slotFullScreenButton(bool current) | 294 | void PMainWindow::slotFullScreenButton(bool current) |
293 | { | 295 | { |
294 | if (autoSave) { | 296 | if (autoSave) { |
295 | m_cfg->writeEntry("fullscreen",current); | 297 | m_cfg->writeEntry("fullscreen",current); |
296 | } | 298 | } |
297 | if (!m_disp) return; | 299 | if (!m_disp) return; |
298 | if (m_disp->isVisible()) { | 300 | if (m_disp->isVisible()) { |
299 | setupViewWindow(current, true); | 301 | setupViewWindow(current, true); |
300 | } | 302 | } |
301 | } | 303 | } |
302 | 304 | ||
303 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | 305 | void PMainWindow::setupViewWindow(bool current, bool forceDisplay) |
304 | { | 306 | { |
305 | if (!m_disp) { | 307 | if (!m_disp) { |
306 | return; | 308 | return; |
307 | } | 309 | } |
308 | if (current) { | 310 | if (current) { |
309 | m_disp->setBackgroundColor(black); | 311 | m_disp->setBackgroundColor(black); |
310 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); | 312 | m_disp->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
311 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); | 313 | m_disp->setVScrollBarMode(QScrollView::AlwaysOff); |
312 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); | 314 | m_disp->setHScrollBarMode(QScrollView::AlwaysOff); |
313 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); | 315 | m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height()); |
314 | m_disp->setFullScreen(current,forceDisplay); | 316 | m_disp->setFullScreen(current,forceDisplay); |
315 | } else { | 317 | } else { |
316 | setUpdatesEnabled(false); | 318 | setUpdatesEnabled(false); |
317 | #if 0 | 319 | #if 0 |
318 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 320 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
319 | 321 | ||
320 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); | 322 | //m_disp->setMinimumSize(QApplication::desktop()->size()/2); |
321 | } else { | 323 | } else { |
322 | //m_disp->setMinimumSize(10,10); | 324 | //m_disp->setMinimumSize(10,10); |
323 | } | 325 | } |
324 | #endif | 326 | #endif |
325 | m_disp->setBackgroundColor(white); | 327 | m_disp->setBackgroundColor(white); |
326 | m_stack->addWidget(m_disp,ImageDisplay); | 328 | m_stack->addWidget(m_disp,ImageDisplay); |
327 | m_disp->setVScrollBarMode(QScrollView::Auto); | 329 | m_disp->setVScrollBarMode(QScrollView::Auto); |
328 | m_disp->setHScrollBarMode(QScrollView::Auto); | 330 | m_disp->setHScrollBarMode(QScrollView::Auto); |
329 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { | 331 | if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) { |
@@ -335,96 +337,97 @@ void PMainWindow::setupViewWindow(bool current, bool forceDisplay) | |||
335 | } | 337 | } |
336 | setUpdatesEnabled(true); | 338 | setUpdatesEnabled(true); |
337 | } | 339 | } |
338 | m_disp->setFullScreen(current,forceDisplay); | 340 | m_disp->setFullScreen(current,forceDisplay); |
339 | } | 341 | } |
340 | 342 | ||
341 | void PMainWindow::slotFullScreenToggled(bool current) | 343 | void PMainWindow::slotFullScreenToggled(bool current) |
342 | { | 344 | { |
343 | setupViewWindow(current,true); | 345 | setupViewWindow(current,true); |
344 | } | 346 | } |
345 | 347 | ||
346 | /** | 348 | /** |
347 | * With big Screen the plan could be to 'detach' the image | 349 | * With big Screen the plan could be to 'detach' the image |
348 | * window if visible and to create a ne wone | 350 | * window if visible and to create a ne wone |
349 | * init* already supports it but I make no use of it for | 351 | * init* already supports it but I make no use of it for |
350 | * now. We set filename and raise | 352 | * now. We set filename and raise |
351 | * | 353 | * |
352 | * ### FIXME and talk to alwin | 354 | * ### FIXME and talk to alwin |
353 | */ | 355 | */ |
354 | void PMainWindow::slotShowInfo( const QString& inf ) { | 356 | void PMainWindow::slotShowInfo( const QString& inf ) { |
355 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 357 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
356 | return; | 358 | return; |
357 | } | 359 | } |
358 | if ( !m_info ) { | 360 | if ( !m_info ) { |
359 | initInfo(); | 361 | initInfo(); |
360 | } | 362 | } |
361 | m_info->setPath( inf ); | 363 | m_info->setPath( inf ); |
362 | if (m_SmallWindow) { | 364 | if (m_SmallWindow) { |
363 | m_aNext->removeFrom(toolBar); | 365 | m_aNext->removeFrom(toolBar); |
364 | m_aPrevious->removeFrom(toolBar); | 366 | m_aPrevious->removeFrom(toolBar); |
365 | fsButton->hide(); | 367 | fsButton->hide(); |
366 | } | 368 | } |
367 | m_aNext->setEnabled(false); | 369 | m_aNext->setEnabled(false); |
368 | m_aPrevious->setEnabled(false); | 370 | m_aPrevious->setEnabled(false); |
369 | m_aDirUp->setEnabled(false); | 371 | m_aDirUp->setEnabled(false); |
370 | m_aShowInfo->setEnabled(false); | 372 | m_aShowInfo->setEnabled(false); |
371 | m_aViewfile->setEnabled(true); | 373 | m_aViewfile->setEnabled(true); |
372 | m_aStartSlide->setEnabled(false); | 374 | m_aStartSlide->setEnabled(false); |
373 | m_stack->raiseWidget( ImageInfo ); | 375 | m_stack->raiseWidget( ImageInfo ); |
374 | } | 376 | } |
375 | 377 | ||
376 | void PMainWindow::slotDisplay( const QString& inf ) { | 378 | void PMainWindow::slotDisplay( const QString& inf ) { |
377 | bool nwindow = false; | 379 | bool nwindow = false; |
378 | if ( !m_disp ) { | 380 | if ( !m_disp ) { |
379 | nwindow = true; | 381 | nwindow = true; |
380 | initDisp(); | 382 | initDisp(); |
381 | m_disp->setIntensity(m_Intensity); | 383 | m_disp->setIntensity(m_Intensity); |
382 | m_setCurrentBrightness->setEnabled(true); | 384 | m_setCurrentBrightness->setEnabled(true); |
385 | m_hBright->setEnabled(true); | ||
383 | } | 386 | } |
384 | m_disp->setImage( inf ); | 387 | m_disp->setImage( inf ); |
385 | if (m_SmallWindow) { | 388 | if (m_SmallWindow) { |
386 | if (m_gPrevNext->isEnabled()==false) { | 389 | if (m_gPrevNext->isEnabled()==false) { |
387 | m_gPrevNext->addTo(toolBar); | 390 | m_gPrevNext->addTo(toolBar); |
388 | fsButton->hide(); | 391 | fsButton->hide(); |
389 | } | 392 | } |
390 | } | 393 | } |
391 | m_gPrevNext->setEnabled(true); | 394 | m_gPrevNext->setEnabled(true); |
392 | m_aDirUp->setEnabled(false); | 395 | m_aDirUp->setEnabled(false); |
393 | m_aShowInfo->setEnabled(true); | 396 | m_aShowInfo->setEnabled(true); |
394 | m_aViewfile->setEnabled(false); | 397 | m_aViewfile->setEnabled(false); |
395 | m_aStartSlide->setEnabled(false); | 398 | m_aStartSlide->setEnabled(false); |
396 | 399 | ||
397 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { | 400 | if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { |
398 | slotFullScreenToggled(m_aFullScreen->isOn()); | 401 | slotFullScreenToggled(m_aFullScreen->isOn()); |
399 | } | 402 | } |
400 | if (m_disp->fullScreen()) { | 403 | if (m_disp->fullScreen()) { |
401 | if (!m_disp->isVisible()) { | 404 | if (!m_disp->isVisible()) { |
402 | m_disp->showFullScreen(); | 405 | m_disp->showFullScreen(); |
403 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); | 406 | qwsDisplay()->requestFocus( m_disp->winId(), TRUE); |
404 | } | 407 | } |
405 | } else { | 408 | } else { |
406 | m_stack->raiseWidget( ImageDisplay ); | 409 | m_stack->raiseWidget( ImageDisplay ); |
407 | } | 410 | } |
408 | } | 411 | } |
409 | 412 | ||
410 | void PMainWindow::raiseIconView() { | 413 | void PMainWindow::raiseIconView() { |
411 | setUpdatesEnabled(false); | 414 | setUpdatesEnabled(false); |
412 | if (m_SmallWindow) { | 415 | if (m_SmallWindow) { |
413 | m_gPrevNext->removeFrom(toolBar); | 416 | m_gPrevNext->removeFrom(toolBar); |
414 | fsButton->show(); | 417 | fsButton->show(); |
415 | } | 418 | } |
416 | m_gPrevNext->setEnabled(false); | 419 | m_gPrevNext->setEnabled(false); |
417 | m_aDirUp->setEnabled(true); | 420 | m_aDirUp->setEnabled(true); |
418 | m_aShowInfo->setEnabled(true); | 421 | m_aShowInfo->setEnabled(true); |
419 | m_aViewfile->setEnabled(true); | 422 | m_aViewfile->setEnabled(true); |
420 | m_aStartSlide->setEnabled(true); | 423 | m_aStartSlide->setEnabled(true); |
421 | 424 | ||
422 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { | 425 | if (m_disp && m_disp->fullScreen() && m_disp->isVisible()) { |
423 | m_disp->stopSlide(); | 426 | m_disp->stopSlide(); |
424 | m_disp->hide(); | 427 | m_disp->hide(); |
425 | } | 428 | } |
426 | m_stack->raiseWidget( IconView ); | 429 | m_stack->raiseWidget( IconView ); |
427 | setUpdatesEnabled(true); | 430 | setUpdatesEnabled(true); |
428 | repaint(); | 431 | repaint(); |
429 | } | 432 | } |
430 | 433 | ||
@@ -598,177 +601,186 @@ void PMainWindow::setupActions() | |||
598 | 601 | ||
599 | m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); | 602 | m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false); |
600 | m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); | 603 | m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true ); |
601 | m_aAutoRotate->setToggleAction(true); | 604 | m_aAutoRotate->setToggleAction(true); |
602 | 605 | ||
603 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 606 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
604 | m_aAutoRotate->setOn(true); | 607 | m_aAutoRotate->setOn(true); |
605 | } else { | 608 | } else { |
606 | m_aAutoRotate->setOn(false); | 609 | m_aAutoRotate->setOn(false); |
607 | } | 610 | } |
608 | if (autoSave) { | 611 | if (autoSave) { |
609 | m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); | 612 | m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn())); |
610 | } | 613 | } |
611 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 614 | connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
612 | 615 | ||
613 | m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); | 616 | m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true ); |
614 | m_aUnscaled->setToggleAction(true); | 617 | m_aUnscaled->setToggleAction(true); |
615 | connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 618 | connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
616 | if (autoSave) { | 619 | if (autoSave) { |
617 | m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); | 620 | m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false)); |
618 | } else { | 621 | } else { |
619 | m_aUnscaled->setOn(false); | 622 | m_aUnscaled->setOn(false); |
620 | } | 623 | } |
621 | 624 | ||
622 | 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 ); |
623 | m_aZoomer->setToggleAction(true); | 626 | m_aZoomer->setToggleAction(true); |
624 | if (autoSave) { | 627 | if (autoSave) { |
625 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); | 628 | m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true)); |
626 | } else { | 629 | } else { |
627 | m_aZoomer->setOn (true); | 630 | m_aZoomer->setOn (true); |
628 | } | 631 | } |
629 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 632 | connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
630 | m_gDisplayType->insert(m_aAutoRotate); | 633 | m_gDisplayType->insert(m_aAutoRotate); |
631 | m_gDisplayType->insert(m_aUnscaled); | 634 | m_gDisplayType->insert(m_aUnscaled); |
632 | m_gDisplayType->insert(m_aZoomer); | 635 | m_gDisplayType->insert(m_aZoomer); |
633 | 636 | ||
634 | m_hGroup = new QActionGroup(this,"actioncollection",false); | 637 | m_hGroup = new QActionGroup(this,"actioncollection",false); |
635 | m_hGroup->insert(m_aFullScreen); | 638 | m_hGroup->insert(m_aFullScreen); |
636 | 639 | ||
637 | if (!m_SmallWindow) { | 640 | if (!m_SmallWindow) { |
638 | 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); |
639 | m_aForceSmall->setToggleAction(true); | 642 | m_aForceSmall->setToggleAction(true); |
640 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); | 643 | connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); |
641 | } else { | 644 | } else { |
642 | m_aForceSmall = 0; | 645 | m_aForceSmall = 0; |
643 | } | 646 | } |
644 | 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); |
645 | 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); | ||
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), | ||
652 | m_hBright->insert(m_IncBrightness); | ||
653 | m_hBright->insert(m_DecBrightness); | ||
646 | } | 654 | } |
647 | 655 | ||
648 | void PMainWindow::setupBrightness() | 656 | void PMainWindow::setupBrightness() |
649 | { | 657 | { |
650 | if (!m_disp) { | 658 | if (!m_disp) { |
651 | return; | 659 | return; |
652 | } | 660 | } |
653 | int lb = m_disp->Intensity(); | 661 | int lb = m_disp->Intensity(); |
654 | if (Valuebox(0,-255,255,lb,lb)) { | 662 | if (Valuebox(0,-100,100,lb,lb)) { |
655 | m_disp->setIntensity(lb,true); | 663 | m_disp->setIntensity(lb,true); |
656 | } | 664 | } |
657 | } | 665 | } |
658 | 666 | ||
659 | void PMainWindow::setupToolbar() | 667 | void PMainWindow::setupToolbar() |
660 | { | 668 | { |
661 | toolBar = new QToolBar( this ); | 669 | toolBar = new QToolBar( this ); |
662 | addToolBar(toolBar); | 670 | addToolBar(toolBar); |
663 | toolBar->setHorizontalStretchable( true ); | 671 | toolBar->setHorizontalStretchable( true ); |
664 | setToolBarsMovable( false ); | 672 | setToolBarsMovable( false ); |
665 | m_aDirUp->addTo( toolBar ); | 673 | m_aDirUp->addTo( toolBar ); |
666 | 674 | ||
667 | fsButton = new PFileSystem( toolBar ); | 675 | fsButton = new PFileSystem( toolBar ); |
668 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 676 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
669 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 677 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
670 | connect( this, SIGNAL( changeDir( const QString& ) ), | 678 | connect( this, SIGNAL( changeDir( const QString& ) ), |
671 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 679 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
672 | 680 | ||
673 | if (m_aBeam) { | 681 | if (m_aBeam) { |
674 | m_aBeam->addTo( toolBar ); | 682 | m_aBeam->addTo( toolBar ); |
675 | } | 683 | } |
676 | m_aShowInfo->addTo(toolBar); | 684 | m_aShowInfo->addTo(toolBar); |
677 | m_aTrash->addTo(toolBar); | 685 | m_aTrash->addTo(toolBar); |
678 | // m_aSetup->addTo(toolBar); | 686 | // m_aSetup->addTo(toolBar); |
679 | 687 | ||
680 | m_gDisplayType->addTo(toolBar); | 688 | m_gDisplayType->addTo(toolBar); |
681 | 689 | ||
682 | if (!m_SmallWindow) { | 690 | if (!m_SmallWindow) { |
683 | m_gPrevNext->addTo(toolBar); | 691 | m_gPrevNext->addTo(toolBar); |
684 | } else { | 692 | } else { |
685 | m_gPrevNext->setEnabled(false); | 693 | m_gPrevNext->setEnabled(false); |
686 | } | 694 | } |
687 | } | 695 | } |
688 | 696 | ||
689 | void PMainWindow::setupMenu() | 697 | void PMainWindow::setupMenu() |
690 | { | 698 | { |
691 | fileMenu = new QPopupMenu( menuBar() ); | 699 | fileMenu = new QPopupMenu( menuBar() ); |
692 | menuBar()->insertItem( tr( "File" ), fileMenu ); | 700 | menuBar()->insertItem( tr( "File" ), fileMenu ); |
693 | dispMenu = new QPopupMenu( menuBar() ); | 701 | dispMenu = new QPopupMenu( menuBar() ); |
694 | menuBar()->insertItem( tr( "Show" ), dispMenu ); | 702 | menuBar()->insertItem( tr( "Show" ), dispMenu ); |
695 | settingsMenu = new QPopupMenu( menuBar() ); | 703 | settingsMenu = new QPopupMenu( menuBar() ); |
696 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); | 704 | menuBar()->insertItem( tr( "Settings" ), settingsMenu ); |
697 | 705 | ||
698 | m_aViewfile->addTo(fileMenu); | 706 | m_aViewfile->addTo(fileMenu); |
699 | m_aShowInfo->addTo(fileMenu); | 707 | m_aShowInfo->addTo(fileMenu); |
700 | m_aStartSlide->addTo(fileMenu); | 708 | m_aStartSlide->addTo(fileMenu); |
701 | 709 | ||
702 | fileMenu->insertSeparator(); | 710 | fileMenu->insertSeparator(); |
703 | m_aDirUp->addTo( fileMenu ); | 711 | m_aDirUp->addTo( fileMenu ); |
704 | 712 | ||
705 | fsMenu = new QPopupMenu(fileMenu); | 713 | fsMenu = new QPopupMenu(fileMenu); |
706 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); | 714 | fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu); |
707 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); | 715 | connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) ); |
708 | dirChanged(); | 716 | dirChanged(); |
709 | 717 | ||
710 | if ( m_aBeam ) { | 718 | if ( m_aBeam ) { |
711 | fileMenu->insertSeparator(); | 719 | fileMenu->insertSeparator(); |
712 | m_aBeam->addTo( fileMenu ); | 720 | m_aBeam->addTo( fileMenu ); |
713 | } | 721 | } |
714 | fileMenu->insertSeparator(); | 722 | fileMenu->insertSeparator(); |
715 | m_aTrash->addTo(fileMenu); | 723 | m_aTrash->addTo(fileMenu); |
716 | 724 | ||
717 | listviewMenu = new QPopupMenu(dispMenu); | 725 | listviewMenu = new QPopupMenu(dispMenu); |
718 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); | 726 | dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu); |
719 | m_gListViewMode->addTo(listviewMenu); | 727 | m_gListViewMode->addTo(listviewMenu); |
720 | dispMenu->insertSeparator(); | 728 | dispMenu->insertSeparator(); |
721 | m_aFullScreen->addTo(dispMenu); | 729 | m_aFullScreen->addTo(dispMenu); |
722 | m_gDisplayType->addTo(dispMenu); | 730 | m_gDisplayType->addTo(dispMenu); |
723 | dispMenu->insertSeparator(); | 731 | dispMenu->insertSeparator(); |
724 | m_gPrevNext->addTo(dispMenu); | 732 | m_gPrevNext->addTo(dispMenu); |
725 | m_setCurrentBrightness->addTo(dispMenu); | 733 | m_setCurrentBrightness->addTo(dispMenu); |
726 | m_setCurrentBrightness->setEnabled(false); | 734 | m_setCurrentBrightness->setEnabled(false); |
735 | dispMenu->insertSeparator(); | ||
736 | m_hBright->addTo(dispMenu); | ||
737 | m_hBright->setEnabled(false); | ||
738 | |||
727 | if (m_aForceSmall) { | 739 | if (m_aForceSmall) { |
728 | dispMenu->insertSeparator(); | 740 | dispMenu->insertSeparator(); |
729 | m_aForceSmall->addTo(dispMenu); | 741 | m_aForceSmall->addTo(dispMenu); |
730 | } | 742 | } |
731 | 743 | ||
732 | m_aSetup->addTo(settingsMenu); | 744 | m_aSetup->addTo(settingsMenu); |
733 | m_aHideToolbar->addTo(settingsMenu); | 745 | m_aHideToolbar->addTo(settingsMenu); |
734 | } | 746 | } |
735 | 747 | ||
736 | void PMainWindow::listviewselected(QAction*which) | 748 | void PMainWindow::listviewselected(QAction*which) |
737 | { | 749 | { |
738 | if (!which || which->isOn()==false) return; | 750 | if (!which || which->isOn()==false) return; |
739 | int val = 1; | 751 | int val = 1; |
740 | 752 | ||
741 | if (which==m_aDirName) { | 753 | if (which==m_aDirName) { |
742 | val = 3; | 754 | val = 3; |
743 | } else if (which==m_aDirShort) { | 755 | } else if (which==m_aDirShort) { |
744 | val = 2; | 756 | val = 2; |
745 | } else if (which==m_aDirLong) { | 757 | } else if (which==m_aDirLong) { |
746 | val = 1; | 758 | val = 1; |
747 | } | 759 | } |
748 | emit changeListMode(val); | 760 | emit changeListMode(val); |
749 | } | 761 | } |
750 | 762 | ||
751 | void PMainWindow::readConfig() | 763 | void PMainWindow::readConfig() |
752 | { | 764 | { |
753 | autoSave =m_cfg->readBoolEntry("savestatus",true); | 765 | autoSave =m_cfg->readBoolEntry("savestatus",true); |
754 | m_Intensity = m_cfg->readNumEntry("intensity",0); | 766 | m_Intensity = m_cfg->readNumEntry("intensity",0); |
755 | } | 767 | } |
756 | 768 | ||
757 | void PMainWindow::polish() | 769 | void PMainWindow::polish() |
758 | { | 770 | { |
759 | if (m_disp) { | 771 | if (m_disp) { |
760 | odebug << "======================\n" | 772 | odebug << "======================\n" |
761 | << "Called via setdocument\n" | 773 | << "Called via setdocument\n" |
762 | << "======================" << oendl; | 774 | << "======================" << oendl; |
763 | m_setDocCalled = true; | 775 | m_setDocCalled = true; |
764 | m_view->setDoccalled(true); | 776 | m_view->setDoccalled(true); |
765 | m_disp->setCloseIfHide(true); | 777 | m_disp->setCloseIfHide(true); |
766 | } else { | 778 | } else { |
767 | m_setDocCalled = false; | 779 | m_setDocCalled = false; |
768 | m_view->setDoccalled(false); | 780 | m_view->setDoccalled(false); |
769 | } | 781 | } |
770 | m_polishDone = true; | 782 | m_polishDone = true; |
771 | QMainWindow::polish(); | 783 | QMainWindow::polish(); |
772 | if (m_setDocCalled) { | 784 | if (m_setDocCalled) { |
773 | if (m_aFullScreen->isOn()) { | 785 | if (m_aFullScreen->isOn()) { |
774 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); | 786 | QTimer::singleShot(0,this,SLOT(check_view_fullscreen())); |