Diffstat (limited to 'noncore/graphics/opie-eye/gui/imageview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp index 6c3f9cb..994fe12 100644 --- a/noncore/graphics/opie-eye/gui/imageview.cpp +++ b/noncore/graphics/opie-eye/gui/imageview.cpp @@ -28,8 +28,9 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_slideValue = 5; m_gDisplayType = 0; m_gPrevNext = 0; m_hGroup = 0; + m_gBright = 0; m_Rotated = false; closeIfHide = false; int min = QApplication::desktop()->size().width()>QApplication::desktop()->size().height()? QApplication::desktop()->size().height():QApplication::desktop()->size().width(); @@ -38,13 +39,30 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name setMinimumSize(min/3,min/3); } else { setMinimumSize(10,10); } + connect(this,SIGNAL(incBrightness()),this,SLOT(slotIncBrightness())); + connect(this,SIGNAL(decBrightness()),this,SLOT(slotDecBrightness())); + m_sysChannel = new QCopChannel( "QPE/System", this ); connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); } +void ImageView::slotIncBrightness() +{ + int lb = Intensity()+5; + if (lb>100) lb=100; + setIntensity(lb,true); +} + +void ImageView::slotDecBrightness() +{ + int lb = Intensity()-5; + if (lb<-100) lb=-100; + setIntensity(lb,true); +} + void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) { int _newrotation; QDataStream stream( data, IO_ReadOnly ); @@ -59,13 +77,14 @@ void ImageView::systemMessage( const QCString& msg, const QByteArray& data ) } } } -void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup) +void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup) { m_gDisplayType = disptypeGroup; m_gPrevNext = nextprevGroup; m_hGroup = hGroup; + m_gBright = brightGroup; } ImageView::~ImageView() { @@ -173,8 +192,17 @@ void ImageView::initKeys() m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle thumbnail"), "imagezoomer", Resource::loadPixmap("mag"), Zoomer, Opie::Core::OKeyPair(Qt::Key_T,0), this, SIGNAL(toggleZoomer()))); + + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Increase brightness"), "incbrightness", + Resource::loadPixmap("up"), Incbrightness, + Opie::Core::OKeyPair(Qt::Key_B,0), + this, SIGNAL(incBrightness()))); + m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Decrease brightness"), "decbrightness", + Resource::loadPixmap("down"), Decbrightness, + Opie::Core::OKeyPair(Qt::Key_D,0), + this, SIGNAL(decBrightness()))); m_viewManager->handleWidget( this ); m_viewManager->load(); } @@ -222,8 +250,12 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) if (m_gDisplayType) { m->insertSeparator(); m_gDisplayType->addTo(m); } + if (m_gBright) { + m->insertSeparator(); + m_gBright->addTo(m); + } } m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); if (m_hGroup) { @@ -234,8 +266,11 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) } if (m_gDisplayType) { m_gDisplayType->removeFrom(m); } + if (m_gBright) { + m_gBright->removeFrom(m); + } delete m; } void ImageView::setFullScreen(bool how,bool force) |