author | alwin <alwin> | 2005-03-24 12:16:23 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-24 12:16:23 (UTC) |
commit | 4fbd94e2fd6432bb15e24e40be59426b309cbb9d (patch) (side-by-side diff) | |
tree | b78ecad37012bb66d956e22dbaa8cfcdb8cf67fc /noncore | |
parent | c635023dd68edd0cb0cbb2827b926f33e27e0404 (diff) | |
download | opie-4fbd94e2fd6432bb15e24e40be59426b309cbb9d.zip opie-4fbd94e2fd6432bb15e24e40be59426b309cbb9d.tar.gz opie-4fbd94e2fd6432bb15e24e40be59426b309cbb9d.tar.bz2 |
- increased max-thumbnail-size
- shortcuts for inc/dec brightness
- make max thumbnail size as a static so there is one point in code
where it is stored and not 4 time over the whole code
-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 @@ -48,6 +48,6 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); 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 ); m_IntensityLayout->addWidget( m_Intensity, 0, 1 ); @@ -75,10 +75,11 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true)); 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 @@ -37,4 +37,8 @@ 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; + /* * The Icons, Request Cache and IconViewItem for the IconView @@ -223,6 +227,6 @@ 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; calculateGrid(); @@ -409,6 +413,6 @@ void PIconView::resetView() { int osize = m_iconsize; 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) { if (_dirPix){ @@ -423,5 +427,5 @@ void PIconView::resetView() { } } else { - m_iconsize = 64; + m_iconsize = sDEF_ICON_SIZE; } slotViewChanged(m_views->currentItem()); @@ -834,9 +838,9 @@ 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; } if (_dirPix){ @@ -889,5 +893,5 @@ void PIconView::calculateGrid(QResizeEvent* re) m_view->setGridX(m_iconsize); 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; PPixmapCache::self()->setMaxImages(cache); 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 @@ -38,4 +38,8 @@ public: void setDoccalled(bool); + static const int sMAX_ICON_SIZE; + static const int sMIN_ICON_SIZE; + static const int sDEF_ICON_SIZE; + signals: void sig_showInfo( const QString& ); 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 @@ -30,4 +30,5 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name m_gPrevNext = 0; m_hGroup = 0; + m_gBright = 0; m_Rotated = false; closeIfHide = false; @@ -40,4 +41,7 @@ ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name 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&) ), @@ -45,4 +49,18 @@ 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 ) { @@ -61,9 +79,10 @@ 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; } @@ -175,4 +194,13 @@ void ImageView::initKeys() 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(); @@ -224,4 +252,8 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) m_gDisplayType->addTo(m); } + if (m_gBright) { + m->insertSeparator(); + m_gBright->addTo(m); + } } m->setFocus(); @@ -236,4 +268,7 @@ void ImageView::contentsMousePressEvent ( QMouseEvent * e) m_gDisplayType->removeFrom(m); } + 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 @@ -30,5 +30,7 @@ class ImageView:public Opie::MM::OImageScrollView Zoomer, Autorotate, - Autoscale + Autoscale, + Incbrightness, + Decbrightness }; @@ -41,5 +43,5 @@ public: virtual void enableFullscreen(); void stopSlide(); - void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup); + void setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, QActionGroup*disptypeGroup,QActionGroup*brightGroup); void setCloseIfHide(bool); @@ -53,4 +55,6 @@ signals: void toggleAutoscale(); void toggleAutorotate(); + void incBrightness(); + void decBrightness(); protected: @@ -66,5 +70,5 @@ protected: int m_slideValue; virtual void focusInEvent ( QFocusEvent * ); - QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup; + QActionGroup *m_gDisplayType,*m_gPrevNext,*m_hGroup,*m_gBright; bool closeIfHide:1; QCopChannel* m_sysChannel; @@ -76,4 +80,6 @@ public slots: virtual void nextSlide(); virtual void systemMessage( const QCString&, const QByteArray& ); + virtual void slotIncBrightness(); + virtual void slotDecBrightness(); protected slots: 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 @@ -266,5 +266,5 @@ void PMainWindow::initDisp() { //m_disp->setMinimumSize(QApplication::desktop()->size()/2); // } - 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()); m_disp->setAutoRotate(m_aAutoRotate->isOn()); @@ -280,4 +280,6 @@ void PMainWindow::initDisp() { connect(m_disp,SIGNAL(toggleAutorotate()),this,SLOT(slotToggleAutorotate())); 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()); } @@ -381,4 +383,5 @@ void PMainWindow::slotDisplay( const QString& inf ) { m_disp->setIntensity(m_Intensity); m_setCurrentBrightness->setEnabled(true); + m_hBright->setEnabled(true); } m_disp->setImage( inf ); @@ -644,4 +647,9 @@ void PMainWindow::setupActions() m_setCurrentBrightness = new QAction(tr("Display brightness..."), 0, 0, this, 0, false); 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); } @@ -652,5 +660,5 @@ 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); } @@ -725,4 +733,8 @@ void PMainWindow::setupMenu() m_setCurrentBrightness->addTo(dispMenu); m_setCurrentBrightness->setEnabled(false); + dispMenu->insertSeparator(); + m_hBright->addTo(dispMenu); + m_hBright->setEnabled(false); + if (m_aForceSmall) { dispMenu->insertSeparator(); 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 @@ -92,7 +92,8 @@ private: QAction*m_aShowInfo,*m_aBeam,*m_aTrash,*m_aViewfile,*m_aDirUp,*m_aStartSlide; 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; /* init funs */ |