-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.cpp | 19 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.h | 5 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 68 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.h | 5 |
4 files changed, 95 insertions, 2 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp index fdf3466..b0fefbf 100644 --- a/noncore/graphics/opie-eye/gui/basesetup.cpp +++ b/noncore/graphics/opie-eye/gui/basesetup.cpp @@ -1,80 +1,97 @@ #include "basesetup.h" #include <qlabel.h> #include <qlayout.h> #include <qspinbox.h> #include <qcheckbox.h> BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f) :QFrame(parent,name,f) { setFrameStyle(Box|Raised); m_cfg = a_cfg; m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout"); m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout"); m_IconsizeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IconsizeLayout"); + m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout"); m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" ); m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus ); m_SlideShowTime->setMaxValue( 60 ); m_SlideShowTime->setMinValue(0); m_SlideShowTime->setValue( 2 ); m_SlideShowTime->setSuffix(tr(" seconds")); 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( 64 ); + 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->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); if (stime<12)stime = 12; if (stime>64)stime = 64; m_Iconsize->setValue(stime); + stime = m_cfg->readNumEntry("intensity",0); + if (stime<-255) stime = -255; + if (stime>255) stime = 255; + 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/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h index 95929f2..cda6777 100644 --- a/noncore/graphics/opie-eye/gui/basesetup.h +++ b/noncore/graphics/opie-eye/gui/basesetup.h @@ -20,19 +20,24 @@ public: virtual ~BaseSetup(); public slots: virtual void save_values(); protected: Opie::Core::OConfig *m_cfg; QVBoxLayout * m_MainLayout; QGridLayout * m_SlidetimeLayout; QSpinBox * m_SlideShowTime; QLabel * m_SlidetimeLabel; QCheckBox *m_SaveStateAuto; QSpacerItem *spacer1; QGridLayout * m_IconsizeLayout; QSpinBox * m_Iconsize; QLabel * m_IconsizeLabel; + + QGridLayout * m_IntensityLayout; + QSpinBox * m_Intensity; + QLabel * m_IntensityLabel; + }; #endif 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 @@ -6,48 +6,51 @@ #include "imageview.h" #include "iconview.h" #include "filesystem.h" #include "imageinfoui.h" #include "viewmodebutton.h" #include "basesetup.h" #include <iface/ifaceinfo.h> #include <iface/dirview.h> #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> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qlayout.h> #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 ) { setCaption( QObject::tr("Opie Eye" ) ); m_cfg = new Opie::Core::OConfig("opie-eye"); m_cfg->setGroup("main" ); readConfig(); m_setDocCalled = false; m_polishDone = false; m_SmallWindow = QApplication::desktop()->size().width()<330; m_storage = new StorageInfo(); @@ -213,32 +216,35 @@ void PMainWindow::slotConfig() { m_disp->manager()->save(); m_info->manager()->save(); m_view->manager()->save(); bSetup->save_values(); m_view->resetView(); readConfig(); } delete keyWid; m_stack->raiseWidget(w); 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 */ template<class T> 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 ); @@ -356,37 +362,55 @@ void PMainWindow::slotShowInfo( const QString& 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; + 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(); } } 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()) { @@ -617,32 +641,45 @@ void PMainWindow::setupActions() } 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())); +} + +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); 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& ) ) ); @@ -685,59 +722,62 @@ void PMainWindow::setupMenu() 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); 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); } void PMainWindow::readConfig() { autoSave =m_cfg->readBoolEntry("savestatus",true); + m_Intensity = m_cfg->readNumEntry("intensity",0); } void PMainWindow::polish() { if (m_disp) { odebug << "======================\n" << "Called via setdocument\n" << "======================" << oendl; m_setDocCalled = true; m_view->setDoccalled(true); m_disp->setCloseIfHide(true); } else { m_setDocCalled = false; m_view->setDoccalled(false); } m_polishDone = true; @@ -751,16 +791,44 @@ void PMainWindow::polish() } void PMainWindow::slotForceSmall(bool how) { odebug << "Disable separate windows: " << how << oendl; if (m_stack) { if (how) { m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); } else { m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); } } 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; +} diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h index a49a9d3..62b446b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.h +++ b/noncore/graphics/opie-eye/gui/mainwindow.h @@ -54,59 +54,62 @@ public slots: void slotZoomerToggled(bool); void slotToggleZoomer(); void slotToggleAutorotate(); void slotToggleAutoscale(); void setDocument( const QString& ); virtual void slotToggleFullScreen(); virtual void slotFullScreenToggled(bool); virtual void polish(); protected slots: void raiseIconView(); void closeEvent( QCloseEvent* ); void showToolbar(bool); void listviewselected(QAction*); void slotFullScreenButton(bool); void check_view_fullscreen(); + 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; QAction *m_aNext,*m_aPrevious,*m_aFullScreen; - QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall; + QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer,*m_aForceSmall,*m_setCurrentBrightness; /* 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 |