-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.cpp | 11 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 22 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.h | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.cpp | 37 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/imageview.h | 12 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 16 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 3 |
7 files changed, 84 insertions, 21 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp index b0fefbf..fe51321 100644 --- a/noncore/graphics/opie-eye/gui/basesetup.cpp +++ b/noncore/graphics/opie-eye/gui/basesetup.cpp @@ -49,4 +49,4 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n m_Intensity->setButtonSymbols( QSpinBox::PlusMinus ); - m_Intensity->setMaxValue( 255 ); - m_Intensity->setMinValue(-255); + m_Intensity->setMaxValue( 100 ); + m_Intensity->setMinValue(-100); m_Intensity->setValue( 0 ); @@ -76,8 +76,9 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n stime = m_cfg->readNumEntry("iconsize", 32); + /* must equal to s(MAX/MIN_ICONSIZE) in iconview.cpp! */ if (stime<12)stime = 12; - if (stime>64)stime = 64; + if (stime>128)stime = 128; m_Iconsize->setValue(stime); stime = m_cfg->readNumEntry("intensity",0); - if (stime<-255) stime = -255; - if (stime>255) stime = 255; + if (stime<-100) stime = -100; + if (stime>100) stime = 100; m_Intensity->setValue(stime); diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index b2443e8..59091a8 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -38,2 +38,6 @@ using Opie::Core::OKeyConfigItem; +const int PIconView::sMAX_ICON_SIZE = 128; +const int PIconView::sMIN_ICON_SIZE = 12; +const int PIconView::sDEF_ICON_SIZE = 64; + /* @@ -224,4 +228,4 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) m_iconsize = m_cfg->readNumEntry("iconsize", 32); - if (m_iconsize<12)m_iconsize = 12; - if (m_iconsize>64)m_iconsize = 64; + if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; + if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; @@ -410,4 +414,4 @@ void PIconView::resetView() { m_iconsize = m_cfg->readNumEntry("iconsize", 32); - if (m_iconsize<12)m_iconsize = 12; - if (m_iconsize>64)m_iconsize = 64; + if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; + if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; if (osize != m_iconsize) { @@ -424,3 +428,3 @@ void PIconView::resetView() { } else { - m_iconsize = 64; + m_iconsize = sDEF_ICON_SIZE; } @@ -835,7 +839,7 @@ void PIconView::slotChangeMode( int mode ) { if (m_mode==1) { - m_iconsize = 64; + m_iconsize = sDEF_ICON_SIZE; } else { m_iconsize = m_cfg->readNumEntry("iconsize", 32); - if (m_iconsize<12)m_iconsize = 12; - if (m_iconsize>64)m_iconsize = 64; + if (m_iconsize<sMIN_ICON_SIZE)m_iconsize = sMIN_ICON_SIZE; + if (m_iconsize>sMAX_ICON_SIZE)m_iconsize = sMAX_ICON_SIZE; } @@ -890,3 +894,3 @@ void PIconView::calculateGrid(QResizeEvent* re) m_view->setGridY(-1); - cache = (int)((double)64/(double)m_iconsize*40.0); + cache = (int)((double)sDEF_ICON_SIZE/(double)m_iconsize*80.0); odebug << "cache size: " << cache << oendl; diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h index 6e08fd8..a546b88 100644 --- a/noncore/graphics/opie-eye/gui/iconview.h +++ b/noncore/graphics/opie-eye/gui/iconview.h @@ -39,2 +39,6 @@ public: + static const int sMAX_ICON_SIZE; + static const int sMIN_ICON_SIZE; + static const int sDEF_ICON_SIZE; + signals: 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 @@ -31,2 +31,3 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_hGroup = 0; + m_gBright = 0; m_Rotated = false; @@ -41,2 +42,5 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name } + connect(this,SIGNAL(incBrightness()),this,SLOT(slotIncBrightness())); + connect(this,SIGNAL(decBrightness()),this,SLOT(slotDecBrightness())); + m_sysChannel = new QCopChannel( "QPE/System", this ); @@ -46,2 +50,16 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name +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 ) @@ -62,3 +80,3 @@ 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) { @@ -67,2 +85,3 @@ void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, Q m_hGroup = hGroup; + m_gBright = brightGroup; } @@ -176,2 +195,11 @@ void ImageView::initKeys() 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 ); @@ -225,2 +253,6 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) } + if (m_gBright) { + m->insertSeparator(); + m_gBright->addTo(m); + } } @@ -237,2 +269,5 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) } + if (m_gBright) { + m_gBright->removeFrom(m); + } delete m; diff --git a/noncore/graphics/opie-eye/gui/imageview.h b/noncore/graphics/opie-eye/gui/imageview.h index e8c8df7..b5801a6 100644 --- a/noncore/graphics/opie-eye/gui/imageview.h +++ b/noncore/graphics/opie-eye/gui/imageview.h @@ -31,3 +31,5 @@ class ImageView:public Opie::MM::OImageScrollView Autorotate, - Autoscale + Autoscale, + Incbrightness, + Decbrightness }; @@ -42,3 +44,3 @@ public: void stopSlide(); - void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); + void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup); void setCloseIfHide(bool); @@ -54,2 +56,4 @@ signals: void toggleAutorotate(); + void incBrightness(); + void decBrightness(); @@ -67,3 +71,3 @@ protected: virtual void focusInEvent ( QFocusEvent * ); - QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; + QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup,*m_gBright; bool closeIfHide:1; @@ -77,2 +81,4 @@ public slots: virtual void systemMessage( const QCString&, const QByteArray& ); + virtual void slotIncBrightness(); + virtual void slotDecBrightness(); 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 @@ -267,3 +267,3 @@ void PMainWindow::initDisp() { // } - m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType); + m_disp->setMenuActions(m_hGroup,m_gPrevNext,m_gDisplayType,m_hBright); m_disp->setAutoScale(!m_aUnscaled->isOn()); @@ -281,2 +281,4 @@ void PMainWindow::initDisp() { connect(m_view,SIGNAL(sig_startslide(int)),m_disp,SLOT(startSlide(int))); + connect(m_IncBrightness,SIGNAL(activated()),m_disp,SLOT(slotIncBrightness())); + connect(m_DecBrightness,SIGNAL(activated()),m_disp,SLOT(slotDecBrightness())); slotFullScreenToggled(m_aFullScreen->isOn()); @@ -382,2 +384,3 @@ void PMainWindow::slotDisplay( const QString& inf ) { m_setCurrentBrightness->setEnabled(true); + m_hBright->setEnabled(true); } @@ -645,2 +648,7 @@ void PMainWindow::setupActions() connect(m_setCurrentBrightness,SIGNAL(activated()),this,SLOT(setupBrightness())); + m_IncBrightness = new QAction(tr("Increase brightness by 5"),Resource::loadIconSet( "up" ),0, 0, this, 0, false); + m_DecBrightness = new QAction(tr("Decrease brightness by 5"),Resource::loadIconSet( "down" ),0, 0, this, 0, false); + m_hBright = new QActionGroup(this,"actioncollection",false), + m_hBright->insert(m_IncBrightness); + m_hBright->insert(m_DecBrightness); } @@ -653,3 +661,3 @@ void PMainWindow::setupBrightness() int lb = m_disp->Intensity(); - if (Valuebox(0,-255,255,lb,lb)) { + if (Valuebox(0,-100,100,lb,lb)) { m_disp->setIntensity(lb,true); @@ -726,2 +734,6 @@ void PMainWindow::setupMenu() m_setCurrentBrightness->setEnabled(false); + dispMenu->insertSeparator(); + m_hBright->addTo(dispMenu); + m_hBright->setEnabled(false); + if (m_aForceSmall) { diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index 62b446b..c3b51f6 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -93,5 +93,6 @@ private: QAction*m_aHideToolbar,*m_aSetup,*m_aDirName,*m_aDirShort,*m_aDirLong; - QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup; + QActionGroup *m_gListViewMode,*m_gDisplayType,*m_gPrevNext,*m_hGroup,*m_hBright; QAction *m_aNext,*m_aPrevious,*m_aFullScreen; QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall,*m_setCurrentBrightness; + QAction *m_IncBrightness,*m_DecBrightness; |