author | alwin <alwin> | 2005-03-22 22:18:58 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-22 22:18:58 (UTC) |
commit | d7b39880bb7de4908e8a1239d37bb48d83c4a0ba (patch) (side-by-side diff) | |
tree | 64ffc1750d149f52c1c48c676f7ecc29cc442b23 /noncore/graphics/opie-eye/gui/mainwindow.cpp | |
parent | 31035d399edaaaff64976705fd44468b6357c863 (diff) | |
download | opie-d7b39880bb7de4908e8a1239d37bb48d83c4a0ba.zip opie-d7b39880bb7de4908e8a1239d37bb48d83c4a0ba.tar.gz opie-d7b39880bb7de4908e8a1239d37bb48d83c4a0ba.tar.bz2 |
-fixed some strange display bugs depending of switch to qte 2.3.10
-inserted the missed (and asked for) feature setting a display brightness
on the fly.
Known Bugs left: When starting with setting a document the image will not
displayed if too large. It is since switch to qte 2.3.10 eg. seems to be
a timing problem when loading cost too much time. I have no idea how to fix
it this moment.
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 @@ -16,12 +16,14 @@ #include <opie2/odebug.h> #include <opie2/owidgetstack.h> #include <opie2/oapplicationfactory.h> #include <opie2/otabwidget.h> #include <opie2/okeyconfigwidget.h> +#include <opie2/owait.h> +#include <opie2/oapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/ir.h> #include <qpe/storage.h> #include <qpe/applnk.h> @@ -32,12 +34,13 @@ #include <qdialog.h> #include <qmap.h> #include <qtimer.h> #include <qframe.h> #include <qmenubar.h> #include <qaction.h> +#include <qspinbox.h> //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) @@ -223,12 +226,15 @@ void PMainWindow::slotConfig() { if (remdisp) { m_disp->hide(); } if (reminfo) { m_info->hide(); } + if (m_disp) { + m_disp->setIntensity(m_Intensity,true); + } } /* * create a new image info component * and detach the current one * we will make the other delete on exit @@ -366,17 +372,35 @@ void PMainWindow::slotShowInfo( const QString& inf ) { m_aStartSlide->setEnabled(false); m_stack->raiseWidget( ImageInfo ); } 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 ) { nwindow = true; 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) { if (m_gPrevNext->isEnabled()==false) { m_gPrevNext->addTo(toolBar); fsButton->hide(); } } @@ -627,12 +651,25 @@ void PMainWindow::setupActions() m_aForceSmall = new QAction(tr("Dont show seperate windows"),Resource::loadIconSet( "AppsIcon" ), 0, 0, this, 0, true); m_aForceSmall->setToggleAction(true); connect(m_aForceSmall,SIGNAL(toggled(bool)),this,SLOT(slotForceSmall(bool))); } else { m_aForceSmall = 0; } + 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); + } } void PMainWindow::setupToolbar() { toolBar = new QToolBar( this ); addToolBar(toolBar); @@ -695,12 +732,14 @@ void PMainWindow::setupMenu() m_gListViewMode->addTo(listviewMenu); dispMenu->insertSeparator(); m_aFullScreen->addTo(dispMenu); m_gDisplayType->addTo(dispMenu); dispMenu->insertSeparator(); m_gPrevNext->addTo(dispMenu); + m_setCurrentBrightness->addTo(dispMenu); + m_setCurrentBrightness->setEnabled(false); if (m_aForceSmall) { dispMenu->insertSeparator(); m_aForceSmall->addTo(dispMenu); } m_aSetup->addTo(settingsMenu); @@ -722,12 +761,13 @@ void PMainWindow::listviewselected(QAction*which) emit changeListMode(val); } void PMainWindow::readConfig() { autoSave =m_cfg->readBoolEntry("savestatus",true); + m_Intensity = m_cfg->readNumEntry("intensity",0); } void PMainWindow::polish() { if (m_disp) { odebug << "======================\n" @@ -761,6 +801,34 @@ void PMainWindow::slotForceSmall(bool how) } } if (autoSave) { m_cfg->writeEntry("dontshowseperate",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; +} |