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 | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index e532867..3a89dfd 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -20,4 +20,6 @@ | |||
20 | #include <opie2/otabwidget.h> | 20 | #include <opie2/otabwidget.h> |
21 | #include <opie2/okeyconfigwidget.h> | 21 | #include <opie2/okeyconfigwidget.h> |
22 | #include <opie2/owait.h> | ||
23 | #include <opie2/oapplication.h> | ||
22 | 24 | ||
23 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
@@ -36,4 +38,5 @@ | |||
36 | #include <qmenubar.h> | 38 | #include <qmenubar.h> |
37 | #include <qaction.h> | 39 | #include <qaction.h> |
40 | #include <qspinbox.h> | ||
38 | 41 | ||
39 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 42 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
@@ -227,4 +230,7 @@ void PMainWindow::slotConfig() { | |||
227 | m_info->hide(); | 230 | m_info->hide(); |
228 | } | 231 | } |
232 | if (m_disp) { | ||
233 | m_disp->setIntensity(m_Intensity,true); | ||
234 | } | ||
229 | } | 235 | } |
230 | 236 | ||
@@ -370,9 +376,27 @@ void PMainWindow::slotShowInfo( const QString& inf ) { | |||
370 | void PMainWindow::slotDisplay( const QString& inf ) { | 376 | void PMainWindow::slotDisplay( const QString& inf ) { |
371 | bool nwindow = false; | 377 | bool nwindow = false; |
378 | bool disp_hack = false; | ||
379 | int lb; | ||
380 | if (m_disp && m_disp->fullScreen()) { | ||
381 | lb = m_disp->Intensity(); | ||
382 | delete m_disp; | ||
383 | m_disp = 0; | ||
384 | |||
385 | disp_hack = true; | ||
386 | } | ||
372 | if ( !m_disp ) { | 387 | if ( !m_disp ) { |
373 | nwindow = true; | 388 | nwindow = true; |
374 | initDisp(); | 389 | initDisp(); |
390 | m_disp->setIntensity((disp_hack?lb:m_Intensity)); | ||
375 | } | 391 | } |
392 | m_setCurrentBrightness->setEnabled(true); | ||
393 | |||
394 | Opie::Ui::OWait wdlg; | ||
395 | wdlg.setTimerLength(30); | ||
396 | wdlg.show(); | ||
397 | //qApp->processEvents(20); | ||
376 | m_disp->setImage( inf ); | 398 | m_disp->setImage( inf ); |
399 | wdlg.hide(); | ||
400 | //qApp->processEvents(20); | ||
377 | if (m_SmallWindow) { | 401 | if (m_SmallWindow) { |
378 | if (m_gPrevNext->isEnabled()==false) { | 402 | if (m_gPrevNext->isEnabled()==false) { |
@@ -631,4 +655,17 @@ void PMainWindow::setupActions() | |||
631 | m_aForceSmall = 0; | 655 | m_aForceSmall = 0; |
632 | } | 656 | } |
657 | m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); | ||
658 | connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); | ||
659 | } | ||
660 | |||
661 | void PMainWindow::setupBrightness() | ||
662 | { | ||
663 | if (!m_disp) { | ||
664 | return; | ||
665 | } | ||
666 | int lb = m_disp->Intensity(); | ||
667 | if (Valuebox(0,-255,255,lb,lb)) { | ||
668 | m_disp->setIntensity(lb,true); | ||
669 | } | ||
633 | } | 670 | } |
634 | 671 | ||
@@ -699,4 +736,6 @@ void PMainWindow::setupMenu() | |||
699 | dispMenu->insertSeparator(); | 736 | dispMenu->insertSeparator(); |
700 | m_gPrevNext->addTo(dispMenu); | 737 | m_gPrevNext->addTo(dispMenu); |
738 | m_setCurrentBrightness->addTo(dispMenu); | ||
739 | m_setCurrentBrightness->setEnabled(false); | ||
701 | if (m_aForceSmall) { | 740 | if (m_aForceSmall) { |
702 | dispMenu->insertSeparator(); | 741 | dispMenu->insertSeparator(); |
@@ -726,4 +765,5 @@ void PMainWindow::readConfig() | |||
726 | { | 765 | { |
727 | autoSave =m_cfg->readBoolEntry("savestatus",true); | 766 | autoSave =m_cfg->readBoolEntry("savestatus",true); |
767 | m_Intensity = m_cfg->readNumEntry("intensity",0); | ||
728 | } | 768 | } |
729 | 769 | ||
@@ -765,2 +805,30 @@ void PMainWindow::slotForceSmall(bool how) | |||
765 | } | 805 | } |
766 | } | 806 | } |
807 | |||
808 | bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store) | ||
809 | { | ||
810 | QDialog dlg(parent,"brightnessbox",true); | ||
811 | QVBoxLayout * m_MainLayout; | ||
812 | QGridLayout * m_IntensityLayout; | ||
813 | QSpinBox * m_Intensity; | ||
814 | QLabel * m_IntensityLabel; | ||
815 | |||
816 | m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout"); | ||
817 | m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); | ||
818 | m_Intensity = new QSpinBox( &dlg, "m_Intensity" ); | ||
819 | m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); | ||
820 | m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); | ||
821 | m_Intensity->setMaxValue( max ); | ||
822 | m_Intensity->setMinValue(min); | ||
823 | m_Intensity->setValue( current ); | ||
824 | m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); | ||
825 | m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" ); | ||
826 | m_IntensityLabel->setText(QObject::tr("Display brightness:")); | ||
827 | m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); | ||
828 | m_MainLayout->addLayout(m_IntensityLayout); | ||
829 | if (dlg.exec()) { | ||
830 | store = m_Intensity->value(); | ||
831 | return true; | ||
832 | } | ||
833 | return false; | ||
834 | } | ||