-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.cpp | 19 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.h | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 68 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 5 |
4 files changed, 95 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp index fdf3466..b0fefbf 100644 --- a/noncore/graphics/opie-eye/gui/basesetup.cpp +++ b/noncore/graphics/opie-eye/gui/basesetup.cpp @@ -16,2 +16,3 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n m_IconsizeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IconsizeLayout"); + m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); @@ -35,3 +36,3 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus ); - m_Iconsize->setMaxValue( 64 ); + m_Iconsize->setMaxValue( 128 ); m_Iconsize->setMinValue(12); @@ -45,2 +46,13 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n + m_Intensity = new QSpinBox( this, "m_Intensity" ); + m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); + m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); + m_Intensity->setMaxValue( 255 ); + m_Intensity->setMinValue(-255); + m_Intensity->setValue( 0 ); + m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); + m_IntensityLabel = new QLabel( this, "m_IntensityLabel" ); + m_IntensityLabel->setText(tr("Default display brightness:")); + m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); + m_MainLayout->addLayout(m_IntensityLayout); @@ -67,2 +79,6 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n m_Iconsize->setValue(stime); + stime = m_cfg->readNumEntry("intensity",0); + if (stime<-255) stime = -255; + if (stime>255) stime = 255; + m_Intensity->setValue(stime); } @@ -79,2 +95,3 @@ void BaseSetup::save_values() m_cfg->writeEntry("iconsize",m_Iconsize->value()); + m_cfg->writeEntry("intensity",m_Intensity->value()); } diff --git a/noncore/graphics/opie-eye/gui/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h index 95929f2..cda6777 100644 --- a/noncore/graphics/opie-eye/gui/basesetup.h +++ b/noncore/graphics/opie-eye/gui/basesetup.h @@ -35,2 +35,7 @@ protected: QLabel * m_IconsizeLabel; + + QGridLayout * m_IntensityLayout; + QSpinBox * m_Intensity; + QLabel * m_IntensityLabel; + }; 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 @@ -21,2 +21,4 @@ #include <opie2/okeyconfigwidget.h> +#include <opie2/owait.h> +#include <opie2/oapplication.h> @@ -37,2 +39,3 @@ #include <qaction.h> +#include <qspinbox.h> @@ -228,2 +231,5 @@ void PMainWindow::slotConfig() { } + if (m_disp) { + m_disp->setIntensity(m_Intensity,true); + } } @@ -371,2 +377,11 @@ void PMainWindow::slotDisplay( const QString& inf ) { bool nwindow = false; + bool disp_hack = false; + int lb; + if (m_disp && m_disp->fullScreen()) { + lb = m_disp->Intensity(); + delete m_disp; + m_disp = 0; + + disp_hack = true; + } if ( !m_disp ) { @@ -374,4 +389,13 @@ void PMainWindow::slotDisplay( const QString& inf ) { initDisp(); + m_disp->setIntensity((disp_hack?lb:m_Intensity)); } + m_setCurrentBrightness->setEnabled(true); + + Opie::Ui::OWait wdlg; + wdlg.setTimerLength(30); + wdlg.show(); + //qApp->processEvents(20); m_disp->setImage( inf ); + wdlg.hide(); + //qApp->processEvents(20); if (m_SmallWindow) { @@ -632,2 +656,15 @@ void PMainWindow::setupActions() } + m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); + connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); +} + +void PMainWindow::setupBrightness() +{ + if (!m_disp) { + return; + } + int lb = m_disp->Intensity(); + if (Valuebox(0,-255,255,lb,lb)) { + m_disp->setIntensity(lb,true); + } } @@ -700,2 +737,4 @@ void PMainWindow::setupMenu() m_gPrevNext->addTo(dispMenu); + m_setCurrentBrightness->addTo(dispMenu); + m_setCurrentBrightness->setEnabled(false); if (m_aForceSmall) { @@ -727,2 +766,3 @@ void PMainWindow::readConfig() autoSave =m_cfg->readBoolEntry("savestatus",true); + m_Intensity = m_cfg->readNumEntry("intensity",0); } @@ -766 +806,29 @@ void PMainWindow::slotForceSmall(bool how) } + +bool PMainWindow::Valuebox(QWidget*parent,int min, int max, int current,int&store) +{ + QDialog dlg(parent,"brightnessbox",true); + QVBoxLayout * m_MainLayout; + QGridLayout * m_IntensityLayout; + QSpinBox * m_Intensity; + QLabel * m_IntensityLabel; + + m_MainLayout = new QVBoxLayout( &dlg, 11, 6, "m_MainLayout"); + m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); + m_Intensity = new QSpinBox( &dlg, "m_Intensity" ); + m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); + m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); + m_Intensity->setMaxValue( max ); + m_Intensity->setMinValue(min); + m_Intensity->setValue( current ); + m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); + m_IntensityLabel = new QLabel( &dlg, "m_IntensityLabel" ); + m_IntensityLabel->setText(QObject::tr("Display brightness:")); + m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 ); + m_MainLayout->addLayout(m_IntensityLayout); + if (dlg.exec()) { + store = m_Intensity->value(); + return true; + } + return false; +} diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index a49a9d3..62b446b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -69,2 +69,3 @@ protected slots: void check_view_fullscreen(); + virtual void setupBrightness(); @@ -86,2 +87,3 @@ private: bool m_SmallWindow:1; + int m_Intensity; QToolButton*fsButton; @@ -93,3 +95,3 @@ private: QAction *m_aNext,*m_aPrevious,*m_aFullScreen; - QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall; + QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall,*m_setCurrentBrightness; @@ -103,2 +105,3 @@ private: QMap<QString, QString> m_dev; + static bool Valuebox(QWidget*parent,int min, int max, int current,int&store); |