summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.cpp11
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp22
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h4
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp37
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.h12
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp16
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h3
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
@@ -26,72 +26,73 @@ BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * n
m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 );
m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" );
m_SlidetimeLabel->setText(tr("Slideshow timeout:"));
m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 );
m_MainLayout->addLayout( m_SlidetimeLayout );
m_Iconsize = new QSpinBox( this, "m_Iconsize" );
m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus );
m_Iconsize->setMaxValue( 128 );
m_Iconsize->setMinValue(12);
m_Iconsize->setValue( 32 );
m_Iconsize->setSuffix(tr(" pixel"));
m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 );
m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" );
m_IconsizeLabel->setText(tr("Size of thumbnails:"));
m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 );
m_MainLayout->addLayout(m_IconsizeLayout);
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->setMaxValue( 100 );
+ m_Intensity->setMinValue(-100);
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);
#if 0
m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" );
m_ShowToolBar->setText(tr("Show toolbar on startup"));
m_MainLayout->addWidget( m_ShowToolBar );
#endif
m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" );
m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate"));
m_MainLayout->addWidget( m_SaveStateAuto );
spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
m_MainLayout->addItem( spacer1 );
int stime = m_cfg->readNumEntry("slideshowtimeout",2);
if (stime<0) stime=2;
if (stime>60) stime=60;
m_SlideShowTime->setValue(stime);
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);
}
BaseSetup::~BaseSetup()
{
}
void BaseSetup::save_values()
{
if (!m_cfg) return;
m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value());
m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked());
m_cfg->writeEntry("iconsize",m_Iconsize->value());
m_cfg->writeEntry("intensity",m_Intensity->value());
}
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
@@ -15,48 +15,52 @@
#include <opie2/oconfig.h>
#include <opie2/okeyconfigwidget.h>
#include <opie2/odebug.h>
#include <opie2/oimagescrollview.h>
#include <qpe/resource.h>
#include <qpe/qpemessagebox.h>
#include <qpe/ir.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qiconview.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qcombobox.h>
#include <qdir.h>
#include <qapplication.h>
#include <qmainwindow.h>
#include <qtimer.h>
#include <qstyle.h>
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
*/
namespace {
static QPixmap* _dirPix = 0;
static QPixmap* _unkPix = 0;
static QPixmap* _cpyPix = 0;
static QPixmap* _emptyPix = 0;
class IconViewItem : public QIconViewItem {
public:
IconViewItem( QIconView*, const QString& path, const QString& name,int a_iconsize, bool isDir = false);
QPixmap* pixmap()const;
QString path()const { return m_path; }
bool isDir()const { return m_isDir; }
void setText( const QString& );
bool textOnly()const{return m_textOnly;}
void setTextOnly(bool how){m_textOnly=how;}
/* just for starting recalc of item rect! */
virtual void setPixmap( const QPixmap & icon, bool recalc, bool redraw = TRUE );
/* just for starting recalc of item rect! */
virtual void setPixmap( const QPixmap & icon);
protected:
mutable QPixmap* m_pix;
@@ -201,50 +205,50 @@ PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
m_hbox = new QHBox( this );
QLabel* lbl = new QLabel( m_hbox );
lbl->setText( tr("View as" ) );
m_views = new QComboBox( m_hbox, "View As" );
m_view= new QIconView( this );
connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
this, SLOT(slotClicked(QIconViewItem*)) );
connect(m_view, SIGNAL(returnPressed(QIconViewItem*)),
this, SLOT(slotClicked(QIconViewItem*)) );
m_view->setArrangement( QIconView::LeftToRight );
m_mode = m_cfg->readNumEntry("ListViewMode", 1);
if (m_mode < 1 || m_mode>3) m_mode = 1;
m_view->setItemTextPos( QIconView::Right );
if (m_mode >1) {
m_view->setResizeMode(QIconView::Adjust);
} else {
m_view->setResizeMode(QIconView::Fixed);
}
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();
initKeys();
loadViews();
}
void PIconView::setDoccalled(bool how)
{
m_setDocCalled = how;
}
/*
* Unref the slave and save the keyboard manager
*/
PIconView::~PIconView() {
{
QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
}
m_viewManager->save();
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* PIconView::manager() {
return m_viewManager;
@@ -387,63 +391,63 @@ void PIconView::slotTrash() {
currentView()->dirLister()->deleteImage( pa );
delete m_view->currentItem();
}
/*
* see what views are available
*/
void PIconView::loadViews() {
ViewMap::Iterator it;
ViewMap* map = viewMap();
for ( it = map->begin(); it != map->end(); ++it )
m_views->insertItem( it.key() );
}
void PIconView::resetView() {
m_internalReset = true;
// Also invalidate the cache. We can't cancel the operations anyway
g_stringPix.clear();
g_stringInf.clear();
if (m_mode>1) {
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){
delete _dirPix;
_dirPix = 0;
}
if (_cpyPix){
delete _cpyPix;
_cpyPix = 0;
}
calculateGrid();
}
} else {
- m_iconsize = 64;
+ m_iconsize = sDEF_ICON_SIZE;
}
slotViewChanged(m_views->currentItem());
m_internalReset = false;
}
void PIconView::polish()
{
QVBox::polish();
QString lastView = m_cfg->readEntry("LastView","");
int cc=0;
for (; cc<m_views->count();++cc) {
if (m_views->text(cc)==lastView) {
break;
}
}
if (cc<m_views->count()) {
m_views->setCurrentItem(cc);
slotViewChanged(cc);
} else {
slotViewChanged(m_views->currentItem());
}
connect( m_views, SIGNAL(activated(int)),
this, SLOT(slotViewChanged(int)) );
@@ -812,53 +816,53 @@ void PIconView::slotImageInfo() {
QString name = currentFileName(isDir);
if (isDir) return;
slotImageInfo( name );
}
void PIconView::slotImageInfo( const QString& name) {
PDirLister *lister = currentView()->dirLister();
QString r_name = lister->nameToFname(name);
emit sig_showInfo(r_name );
}
void PIconView::slotChangeMode( int mode ) {
if ( mode >= 1 && mode <= 3 ) {
m_mode = mode;
m_cfg->writeEntry("ListViewMode", m_mode);
/* performance! */
m_view->clear();
if (m_mode >1) {
m_view->setResizeMode(QIconView::Adjust);
} else {
m_view->setResizeMode(QIconView::Fixed);
}
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){
delete _dirPix;
_dirPix = 0;
}
if (_cpyPix){
delete _cpyPix;
_cpyPix = 0;
}
calculateGrid();
slotReloadDir();
}
}
void PIconView::resizeEvent( QResizeEvent* re ) {
calculateGrid(re);
QVBox::resizeEvent( re );
//calculateGrid();
}
void PIconView::calculateGrid(QResizeEvent* re)
{
@@ -867,43 +871,43 @@ void PIconView::calculateGrid(QResizeEvent* re)
viewerWidth=re->size().width();
} else {
int dw = QApplication::desktop()->width();
viewerWidth = dw-style().scrollBarExtent().width();
}
QIconView::ItemTextPos pos;
switch( m_mode ) {
case 2:
pos = QIconView::Bottom;
break;
case 3:
case 1:
default:
pos = QIconView::Right;
break;
}
int cache = 0;
m_view->setItemTextPos( pos );
switch (m_mode) {
case 2:
m_view->setSpacing(2);
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);
break;
case 3:
m_view->setSpacing(10);
m_view->setGridX( fontMetrics().width("testimage.jpg")+20);
m_view->setGridY(8);
PPixmapCache::self()->setMaxImages(2);
break;
case 1:
default:
m_view->setSpacing(10);
m_view->setGridX( viewerWidth-3*m_view->spacing());
m_view->setGridY( fontMetrics().height()*2+40 );
PPixmapCache::self()->setMaxImages(20);
break;
}
}
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
@@ -16,48 +16,52 @@ class PIconViewItem;
class PDirLister;
class Ir;
namespace Opie {
namespace Core{
class OConfig;
class OKeyConfigManager;
}
}
class PIconView : public QVBox {
Q_OBJECT
friend class PIconViewItem;
enum ActionIds {
BeamItem, DeleteItem, ViewItem, InfoItem,SlideItem
};
public:
PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
~PIconView();
void resetView();
Opie::Core::OKeyConfigManager* manager();
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& );
void sig_display(const QString&);
void sig_startslide(int timeout);
public slots:
virtual void slotShowNext();
virtual void slotShowPrev();
virtual void slotShowLast();
virtual bool slotShowFirst();
virtual void polish();
protected:
void resizeEvent( QResizeEvent* );
private:
void initKeys();
QString currentFileName(bool &isDir)const;
QString nextFileName(bool &isDir)const;
QString prevFileName(bool &isDir)const;
void loadViews();
void calculateGrid(QResizeEvent*e = 0);
bool m_setDocCalled:1;
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
@@ -8,84 +8,103 @@
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpopupmenu.h>
#include <qtimer.h>
#include <qaction.h>
using namespace Opie::Core;
ImageView::ImageView(Opie::Core::OConfig *cfg, QWidget* parent, const char* name, WFlags fl )
: Opie::MM::OImageScrollView(parent,name,fl)
{
m_viewManager = 0;
focus_in_count = 0;
m_cfg = cfg;
m_isFullScreen = false;
m_ignore_next_in = false;
m_slideTimer = 0;
QPEApplication::setStylusOperation(viewport(),QPEApplication::RightOnHold);
initKeys();
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();
if (min>320) {
// bigscreen
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 );
odebug << "received system message: " << msg << oendl;
if ( msg == "setCurrentRotation(int)" )
{
stream >> _newrotation;
odebug << "received setCurrentRotation(" << _newrotation << ")" << oendl;
if (!fullScreen()) {
m_rotation = _newrotation;
return;
}
}
}
-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()
{
odebug << "Destructor imageview" << oendl;
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* ImageView::manager()
{
if (!m_viewManager) {
initKeys();
}
return m_viewManager;
}
void ImageView::startSlide(int value)
{
if (!m_slideTimer) {
m_slideTimer = new QTimer(this);
}
m_slideValue=value;
connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
/* this "+1" is one millisecond. with that we can setup a slideshowvalue
@@ -153,48 +172,57 @@ void ImageView::initKeys()
Resource::loadPixmap("rotate"), Autorotate,
Opie::Core::OKeyPair(Qt::Key_R,0),
this, SIGNAL(toggleAutorotate())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle autoscale"), "imageautoscale",
Resource::loadPixmap("1to1"), Autoscale,
Opie::Core::OKeyPair(Qt::Key_S,0),
this, SIGNAL(toggleAutoscale())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to next image"), "imageshownext",
Resource::loadPixmap("forward"), ShowNext,
Opie::Core::OKeyPair(Qt::Key_Return,0),
this, SIGNAL(dispNext())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Switch to previous image"), "imageshowprev",
Resource::loadPixmap("back"), ShowPrevious,
Opie::Core::OKeyPair(Qt::Key_P,0),
this, SIGNAL(dispPrev())));
m_viewManager->addKeyConfig( Opie::Core::OKeyConfigItem(tr("Toggle fullscreen"), "imagefullscreen",
Resource::loadPixmap("fullscreen"), FullScreen,
Opie::Core::OKeyPair(Qt::Key_F,0),
this, SIGNAL(toggleFullScreen())));
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();
}
void ImageView::keyReleaseEvent(QKeyEvent * e)
{
if (!e || e->state()!=0) {
return;
}
if (e->key()==Qt::Key_Escape) {
if (fullScreen()) {
emit hideMe();
}
if (closeIfHide) {
QTimer::singleShot(0, qApp, SLOT(closeAllWindows()));
}
}
}
void ImageView::setCloseIfHide(bool how)
{
closeIfHide = how;
}
@@ -202,60 +230,67 @@ void ImageView::slotShowImageInfo()
{
emit dispImageInfo(m_lastName);
}
void ImageView::contentsMousePressEvent ( QMouseEvent * e)
{
if (e->button()==1) {
return OImageScrollView::contentsMousePressEvent(e);
}
odebug << "Popup " << oendl;
QPopupMenu *m = new QPopupMenu(this);
if (!m) return;
if (m_hGroup) {
m_hGroup->addTo(m);
}
if (fullScreen()) {
if (m_gPrevNext) {
m->insertSeparator();
m_gPrevNext->addTo(m);
}
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) {
m_hGroup->removeFrom(m);
}
if (m_gPrevNext) {
m_gPrevNext->removeFrom(m);
}
if (m_gDisplayType) {
m_gDisplayType->removeFrom(m);
}
+ if (m_gBright) {
+ m_gBright->removeFrom(m);
+ }
delete m;
}
void ImageView::setFullScreen(bool how,bool force)
{
m_isFullScreen = how;
if (how) {
m_ignore_next_in = true;
// setFixedSize(qApp->desktop()->size());
setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height());
if (force) showFullScreen();
} else {
// setMinimumSize(10,10);
}
}
void ImageView::focusInEvent(QFocusEvent *)
{
// Always do it here, no matter the size.
odebug << "Focus in (view)" << oendl;
//if (fullScreen()) parentWidget()->showNormal();
if (m_ignore_next_in){m_ignore_next_in=false;return;}
if (fullScreen()) enableFullscreen();
}
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
@@ -8,78 +8,84 @@
class QTimer;
class QActionGroup;
class QAction;
class QCopChannel;
namespace Opie {
namespace Core {
class OConfig;
class OKeyConfigManager;
}
}
class ImageView:public Opie::MM::OImageScrollView
{
Q_OBJECT
enum ActionIds {
ViewInfo,
FullScreen,
ShowNext,
ShowPrevious,
Zoomer,
Autorotate,
- Autoscale
+ Autoscale,
+ Incbrightness,
+ Decbrightness
};
public:
ImageView(Opie::Core::OConfig *cfg,QWidget* parent,const char* name = 0, WFlags fl = 0 );
virtual ~ImageView();
Opie::Core::OKeyConfigManager* manager();
void setFullScreen(bool how,bool force=true);
bool fullScreen(){return m_isFullScreen;}
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);
signals:
void dispImageInfo(const QString&);
void dispNext();
void dispPrev();
void toggleFullScreen();
void hideMe();
void toggleZoomer();
void toggleAutoscale();
void toggleAutorotate();
+ void incBrightness();
+ void decBrightness();
protected:
Opie::Core::OConfig * m_cfg;
Opie::Core::OKeyConfigManager*m_viewManager;
void initKeys();
bool m_isFullScreen:1;
bool m_ignore_next_in:1;
bool m_Rotated:1;
int focus_in_count;
QTimer*m_slideTimer;
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;
int m_rotation;
public slots:
virtual void hide();
virtual void startSlide(int);
virtual void nextSlide();
virtual void systemMessage( const QCString&, const QByteArray& );
+ virtual void slotIncBrightness();
+ virtual void slotDecBrightness();
protected slots:
virtual void slotShowImageInfo();
virtual void keyReleaseEvent(QKeyEvent * e);
virtual void contentsMousePressEvent ( QMouseEvent * e);
};
#endif
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
@@ -244,62 +244,64 @@ void PMainWindow::initT( const char* name, T** ptr, int id) {
if ( *ptr ) {
(*ptr)->disconnect(this, SLOT(slotReturn()));
(*ptr)->setDestructiveClose();
m_stack->removeWidget( *ptr );
}
*ptr = new T(m_cfg, m_stack, name );
m_stack->addWidget( *ptr, id );
connect(*ptr, SIGNAL(sig_return()),
this,SLOT(slotReturn()));
}
void PMainWindow::initInfo() {
initT<imageinfo>( "Image Info", &m_info, ImageInfo );
connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
}
void PMainWindow::initDisp() {
initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
if (m_disp) {
// if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
//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());
m_disp->setShowZoomer(m_aZoomer->isOn());
m_disp->setBackgroundColor(white);
connect(m_disp,SIGNAL(dispImageInfo(const QString&)),this,SLOT(slotShowInfo(const QString&)));
connect(m_disp,SIGNAL(dispNext()),m_view,SLOT(slotShowNext()));
connect(m_disp,SIGNAL(dispPrev()),m_view,SLOT(slotShowPrev()));
connect(m_disp,SIGNAL(toggleFullScreen()),this,SLOT(slotToggleFullScreen()));
connect(m_disp,SIGNAL(hideMe()),this,SLOT(raiseIconView()));
connect(m_disp,SIGNAL(toggleZoomer()),this,SLOT(slotToggleZoomer()));
connect(m_disp,SIGNAL(toggleAutoscale()),this,SLOT(slotToggleAutoscale()));
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());
}
}
void PMainWindow::slotToggleFullScreen()
{
bool current = !m_aFullScreen->isOn();
m_aFullScreen->setOn(current);
}
void PMainWindow::slotFullScreenButton(bool current)
{
if (autoSave) {
m_cfg->writeEntry("fullscreen",current);
}
if (!m_disp) return;
if (m_disp->isVisible()) {
setupViewWindow(current, true);
}
}
void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
{
if (!m_disp) {
@@ -359,48 +361,49 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
initInfo();
}
m_info->setPath( inf );
if (m_SmallWindow) {
m_aNext->removeFrom(toolBar);
m_aPrevious->removeFrom(toolBar);
fsButton->hide();
}
m_aNext->setEnabled(false);
m_aPrevious->setEnabled(false);
m_aDirUp->setEnabled(false);
m_aShowInfo->setEnabled(false);
m_aViewfile->setEnabled(true);
m_aStartSlide->setEnabled(false);
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
bool nwindow = false;
if ( !m_disp ) {
nwindow = true;
initDisp();
m_disp->setIntensity(m_Intensity);
m_setCurrentBrightness->setEnabled(true);
+ m_hBright->setEnabled(true);
}
m_disp->setImage( inf );
if (m_SmallWindow) {
if (m_gPrevNext->isEnabled()==false) {
m_gPrevNext->addTo(toolBar);
fsButton->hide();
}
}
m_gPrevNext->setEnabled(true);
m_aDirUp->setEnabled(false);
m_aShowInfo->setEnabled(true);
m_aViewfile->setEnabled(false);
m_aStartSlide->setEnabled(false);
if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) {
slotFullScreenToggled(m_aFullScreen->isOn());
}
if (m_disp->fullScreen()) {
if (!m_disp->isVisible()) {
m_disp->showFullScreen();
qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
}
} else {
m_stack->raiseWidget( ImageDisplay );
@@ -622,57 +625,62 @@ void PMainWindow::setupActions()
m_aZoomer = new QAction( tr( "Show zoomer window when unscaled" ), Resource::loadIconSet( "mag" ), 0, 0, this, 0, true );
m_aZoomer->setToggleAction(true);
if (autoSave) {
m_aZoomer->setOn(m_cfg->readBoolEntry("zoomeron",true));
} else {
m_aZoomer->setOn (true);
}
connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
m_gDisplayType->insert(m_aAutoRotate);
m_gDisplayType->insert(m_aUnscaled);
m_gDisplayType->insert(m_aZoomer);
m_hGroup = new QActionGroup(this,"actioncollection",false);
m_hGroup->insert(m_aFullScreen);
if (!m_SmallWindow) {
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()));
+ 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);
}
void PMainWindow::setupBrightness()
{
if (!m_disp) {
return;
}
int lb = m_disp->Intensity();
- if (Valuebox(0,-255,255,lb,lb)) {
+ if (Valuebox(0,-100,100,lb,lb)) {
m_disp->setIntensity(lb,true);
}
}
void PMainWindow::setupToolbar()
{
toolBar = new QToolBar( this );
addToolBar(toolBar);
toolBar->setHorizontalStretchable( true );
setToolBarsMovable( false );
m_aDirUp->addTo( toolBar );
fsButton = new PFileSystem( toolBar );
connect( fsButton, SIGNAL( changeDir( const QString& ) ),
m_view, SLOT(slotChangeDir( const QString& ) ) );
connect( this, SIGNAL( changeDir( const QString& ) ),
m_view, SLOT(slotChangeDir( const QString& ) ) );
if (m_aBeam) {
m_aBeam->addTo( toolBar );
}
m_aShowInfo->addTo(toolBar);
m_aTrash->addTo(toolBar);
// m_aSetup->addTo(toolBar);
@@ -703,48 +711,52 @@ void PMainWindow::setupMenu()
m_aDirUp->addTo( fileMenu );
fsMenu = new QPopupMenu(fileMenu);
fileMenu->insertItem(Resource::loadIconSet( "cardmon/pcmcia" ),tr("Select filesystem"),fsMenu);
connect( fsMenu, SIGNAL( activated( int ) ), this, SLOT(slotSelectDir( int ) ) );
dirChanged();
if ( m_aBeam ) {
fileMenu->insertSeparator();
m_aBeam->addTo( fileMenu );
}
fileMenu->insertSeparator();
m_aTrash->addTo(fileMenu);
listviewMenu = new QPopupMenu(dispMenu);
dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
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);
+ dispMenu->insertSeparator();
+ m_hBright->addTo(dispMenu);
+ m_hBright->setEnabled(false);
+
if (m_aForceSmall) {
dispMenu->insertSeparator();
m_aForceSmall->addTo(dispMenu);
}
m_aSetup->addTo(settingsMenu);
m_aHideToolbar->addTo(settingsMenu);
}
void PMainWindow::listviewselected(QAction*which)
{
if (!which || which->isOn()==false) return;
int val = 1;
if (which==m_aDirName) {
val = 3;
} else if (which==m_aDirShort) {
val = 2;
} else if (which==m_aDirLong) {
val = 1;
}
emit changeListMode(val);
}
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
@@ -70,46 +70,47 @@ protected slots:
virtual void setupBrightness();
private:
template<class T> void initT( const char* name, T**, int );
void initInfo();
void initDisp();
void setupViewWindow(bool full, bool forceDisplay);
private:
Opie::Core::OConfig *m_cfg;
Opie::Ui::OWidgetStack *m_stack;
PIconView* m_view;
imageinfo *m_info;
ImageView *m_disp;
bool autoSave:1;
bool m_setDocCalled:1;
bool m_polishDone:1;
bool m_SmallWindow:1;
int m_Intensity;
QToolButton*fsButton;
QToolBar *toolBar;
QPopupMenu *fileMenu,*dispMenu,*fsMenu,*listviewMenu,*settingsMenu;
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 */
void readConfig();
void setupActions();
void setupToolbar();
void setupMenu();
/* for the device submenu - ToDo: Merge with the special button */
StorageInfo *m_storage;
QMap<QString, QString> m_dev;
static bool Valuebox(QWidget*parent,int min, int max, int current,int&store);
private slots:
void slotConfig();
void slotSelectDir(int);
void dirChanged();
void slotForceSmall(bool);
};
#endif