summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-01 16:41:11 (UTC)
committer alwin <alwin>2004-11-01 16:41:11 (UTC)
commit5a41dcd5901badbd2e258b0a916fb012b6351eeb (patch) (side-by-side diff)
treebf1821746491c996f20d9ecbf3952a94e96e422f
parente28f024b5d0d70dd22d7beacfd693b75e2fcf39e (diff)
downloadopie-5a41dcd5901badbd2e258b0a916fb012b6351eeb.zip
opie-5a41dcd5901badbd2e258b0a916fb012b6351eeb.tar.gz
opie-5a41dcd5901badbd2e258b0a916fb012b6351eeb.tar.bz2
some layout work
work on saving default values some fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.cpp18
-rw-r--r--noncore/graphics/opie-eye/gui/basesetup.h6
-rw-r--r--noncore/graphics/opie-eye/gui/imageview.cpp6
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp124
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h7
-rw-r--r--noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp12
6 files changed, 113 insertions, 60 deletions
diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp
index 1a354a5..20dda5a 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.cpp
+++ b/noncore/graphics/opie-eye/gui/basesetup.cpp
@@ -1,56 +1,60 @@
#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)
- :QWidget(parent,name,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_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(1);
+ 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 );
+#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("base_slideshowtimeout",2);
- if (stime<1) stime=2;
+ if (stime<0) stime=2;
if (stime>60) stime=60;
m_SlideShowTime->setValue(stime);
-
- bool stoolbar = m_cfg->readBoolEntry("base_showtoolbar",true);
- m_ShowToolBar->setChecked(stoolbar);
+ m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("base_savestatus",false));
}
BaseSetup::~BaseSetup()
{
}
void BaseSetup::save_values()
{
if (!m_cfg) return;
m_cfg->writeEntry("base_slideshowtimeout",m_SlideShowTime->value());
- m_cfg->writeEntry("base_showtoolbar",m_ShowToolBar->isChecked());
+ m_cfg->writeEntry("base_savestatus",m_SaveStateAuto->isChecked());
}
diff --git a/noncore/graphics/opie-eye/gui/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h
index c13e2af..c343f88 100644
--- a/noncore/graphics/opie-eye/gui/basesetup.h
+++ b/noncore/graphics/opie-eye/gui/basesetup.h
@@ -1,35 +1,35 @@
#ifndef _BASESETUP_H
#define _BASESETUP_H
#include <opie2/oconfig.h>
-#include <qwidget.h>
+#include <qframe.h>
class QVBoxLayout;
class QGridLayout;
class QSpinBox;
class QLabel;
class QCheckBox;
class QSpacerItem;
-class BaseSetup:public QWidget
+class BaseSetup:public QFrame
{
Q_OBJECT
public:
BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0);
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_ShowToolBar;
+ QCheckBox *m_SaveStateAuto;
QSpacerItem *spacer1;
};
#endif
diff --git a/noncore/graphics/opie-eye/gui/imageview.cpp b/noncore/graphics/opie-eye/gui/imageview.cpp
index 86db732..be58c72 100644
--- a/noncore/graphics/opie-eye/gui/imageview.cpp
+++ b/noncore/graphics/opie-eye/gui/imageview.cpp
@@ -33,17 +33,16 @@ void ImageView::setMenuActions(QActionGroup*hGroup,QActionGroup*nextprevGroup, Q
{
m_gDisplayType = disptypeGroup;
m_gPrevNext = nextprevGroup;
m_hGroup = hGroup;
}
ImageView::~ImageView()
{
- odebug << "Delete Imageview" << oendl;
delete m_viewManager;
}
Opie::Core::OKeyConfigManager* ImageView::manager()
{
if (!m_viewManager) {
initKeys();
}
@@ -52,17 +51,20 @@ Opie::Core::OKeyConfigManager* ImageView::manager()
void ImageView::startSlide(int value)
{
if (!m_slideTimer) {
m_slideTimer = new QTimer(this);
}
m_slideValue=value;
connect(m_slideTimer,SIGNAL(timeout()),SLOT(nextSlide()));
- m_slideTimer->start(m_slideValue*1000,true);
+ /* this "+1" is one millisecond. with that we can setup a slideshowvalue
+ of 0. eg "as fast as possible".
+ */
+ m_slideTimer->start(m_slideValue*1000+1,true);
}
void ImageView::stopSlide()
{
if (!m_slideTimer) {
return;
}
m_slideTimer->stop();
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index ece51a1..5eb065f 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -40,16 +40,17 @@
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 Caramba" ) );
m_cfg = new Opie::Core::OConfig("opie-eye");
m_cfg->setGroup("main" );
+ readConfig();
m_storage = new StorageInfo();
connect(m_storage, SIGNAL(disksChanged() ),
this, SLOT( dirChanged() ) );
m_stack = new Opie::Ui::OWidgetStack( this );
setCentralWidget( m_stack );
@@ -65,83 +66,84 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce);
listviewMenu = 0;
/* setup menu and toolbar */
setupActions();
setupToolbar();
setupMenu();
- m_aHideToolbar->setOn(m_cfg->readBoolEntry("base_showtoolbar",true));
+ m_aHideToolbar->setOn(m_cfg->readBoolEntry("showtoolbar",true));
+ m_aAutoRotate->setEnabled(!m_aUnscaled->isOn());
}
PMainWindow::~PMainWindow() {
}
void PMainWindow::slotToggleZoomer()
{
- if (!m_disp) return;
- bool cur = m_aZoomer->isOn();
- m_aZoomer->setOn(!cur);
+ m_aZoomer->setOn(!m_aZoomer->isOn());
}
void PMainWindow::slotZoomerToggled(bool how)
{
- zoomerOn = how;
if (m_disp) {
- m_disp->setShowZoomer(zoomerOn);
+ m_disp->setShowZoomer(how);
+ }
+ if (autoSave) {
+ m_cfg->writeEntry("zoomeron",how);
}
}
void PMainWindow::slotToggleAutorotate()
{
- if (!m_disp) return;
if (!m_aAutoRotate->isEnabled()) return;
- bool cur = m_aAutoRotate->isOn();
- m_aAutoRotate->setOn(!cur);
+ m_aAutoRotate->setOn(!m_aAutoRotate->isOn());
}
void PMainWindow::slotToggleAutoscale()
{
- if (!m_disp) return;
- bool cur = m_aAutoScale->isOn();
- m_aAutoScale->setOn(!cur);
+ m_aUnscaled->setOn(!m_aUnscaled->isOn());
}
void PMainWindow::slotRotateToggled(bool how)
{
- autoRotate = how;
+ if (autoSave) {
+ m_cfg->writeEntry("autorotate",how);
+ }
if (m_disp) {
- m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
+ m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),how);
}
}
void PMainWindow::slotScaleToggled(bool how)
{
- autoScale = !how;
- if (!how) {
- autoRotate = how;
+ if (autoSave) {
+ m_cfg->writeEntry("unscaled",how);
}
- if (!autoScale) {
+ odebug << "Unscaled: " << m_aUnscaled->isOn() << oendl;
+ odebug << "How: " << how << oendl;
+ if (how) {
m_aAutoRotate->setOn(false);
}
if (m_disp) {
- m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
+ m_disp->setAutoScaleRotate(!m_aUnscaled->isOn(),m_aAutoRotate->isOn());
}
m_aAutoRotate->setEnabled(!how);
+ odebug << "Autorotate: " << m_aAutoRotate->isOn() << oendl;
}
void PMainWindow::slotConfig() {
/*
* have a tab with the possible views
* a tab for globals image cache size.. scaled loading
* and one tab for the KeyConfigs
*/
QDialog dlg(this, 0, true);
- dlg.setCaption( tr("Phunk View - Config" ) );
+ dlg.setCaption( tr("Opie Eye - Config" ) );
QHBoxLayout *lay = new QHBoxLayout(&dlg);
Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
lay->addWidget( wid );
BaseSetup*bSetup = new BaseSetup(m_cfg,wid);
wid->addTab(bSetup,"SettingsIcon","Basics setup");
@@ -160,31 +162,35 @@ void PMainWindow::slotConfig() {
}
/*
* Add the KeyConfigWidget
*/
Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" );
keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() );
+ QWidget*w = m_stack->visibleWidget();
+ bool reminfo = false;
if ( !m_info ) {
+ reminfo = true;
initInfo();
}
keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() );
+ bool remdisp = false;
if ( !m_disp ) {
+ remdisp = true;
initDisp();
}
keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() );
keyWid->load();
wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") );
-
-
+ wid->setCurrentTab(0);
bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
/*
* clean up
*apply changes
*/
QMap<PDirView*, QWidget*>::Iterator it;
@@ -197,18 +203,33 @@ void PMainWindow::slotConfig() {
if ( act ) {
m_view->resetView();
keyWid->save();
m_disp->manager()->save();
m_info->manager()->save();
m_view->manager()->save();
bSetup->save_values();
+ readConfig();
}
delete keyWid;
+
+ m_stack->raiseWidget(w);
+ if (remdisp) {
+ m_disp->disconnect(this, SLOT(slotReturn()));
+ m_disp->setDestructiveClose();
+ m_stack->removeWidget(m_disp);
+ m_disp = 0;
+ }
+ if (reminfo) {
+ m_info->disconnect(this, SLOT(slotReturn()));
+ m_info->setDestructiveClose();
+ m_stack->removeWidget(m_info);
+ m_info = 0;
+ }
}
/*
* create a new image info component
* and detach the current one
* we will make the other delete on exit
*/
template<class T>
@@ -233,17 +254,17 @@ void PMainWindow::initInfo() {
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->setAutoScale(!m_aAutoScale->isOn());
+ 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()));
@@ -258,29 +279,27 @@ void PMainWindow::initDisp() {
void PMainWindow::slotToggleFullScreen()
{
bool current = !m_aFullScreen->isOn();
m_aFullScreen->setOn(current);
}
void PMainWindow::slotFullScreenButton(bool current)
{
- if (m_disp) odebug << "Disp fenster ist hidden: "<<m_disp->isHidden()<<oendl;
+ if (autoSave) {
+ m_cfg->writeEntry("fullscreen",current);
+ }
if (!m_disp) return;
- /* I can not solve this effects here - it seems that we require some
- status variable, too. so we will live with some interesting effects
- meanwhile */
-#if 0
- bool th = m_disp->isHidden();
- setupViewWindow(current, false);
- /* realy - after setting up the fullscreenmode while the window is hidden
- it is unvisibile not hidden!!!!! Hell. */
- if (th) m_disp->hide();
-#endif
+ if (m_disp->isHidden()) {
+ /* it must get some setups for switch we can just do if the window is visible.
+ so we must delete the imageview window and re-create it when displaying new
+ image */
+ return;
+ }
setupViewWindow(current, true);
}
void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
{
if (!m_disp) return;
if (current) {
m_disp->setBackgroundColor(black);
@@ -452,16 +471,19 @@ void PMainWindow::dirChanged()
fsMenu->insertItem( disk );
}
}
void PMainWindow::showToolbar(bool how)
{
if (!how) toolBar->hide();
else toolBar->show();
+ if (autoSave) {
+ m_cfg->writeEntry("showtoolbar",how);
+ }
}
void PMainWindow::setupActions()
{
m_aDirUp = new QAction( tr( "Go dir up" ), Resource::loadIconSet( "up" ), 0, 0, this, 0, true );
m_aDirUp->setToggleAction(false);
connect(m_aDirUp,SIGNAL(activated()),m_view,SLOT(slotDirUp()));
@@ -531,43 +553,56 @@ void PMainWindow::setupActions()
m_aPrevious->setToggleAction(false);
connect(m_aPrevious,SIGNAL(activated()),m_view,SLOT(slotShowPrev()));
m_gPrevNext->insert(m_aPrevious);
m_gPrevNext->insert(m_aNext);
m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
m_aFullScreen->setToggleAction(true);
+ if (autoSave) {
+ m_aFullScreen->setOn(m_cfg->readBoolEntry("fullscreen",false));
+ } else {
m_aFullScreen->setOn(false);
+ }
connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
m_aAutoRotate->setToggleAction(true);
+
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
m_aAutoRotate->setOn(true);
- autoRotate = true;
} else {
m_aAutoRotate->setOn(false);
- autoRotate = false;
+ }
+ if (autoSave) {
+ m_aAutoRotate->setOn(m_cfg->readBoolEntry("autorotate",m_aAutoRotate->isOn()));
}
connect(m_aAutoRotate,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool)));
- m_aAutoScale = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
- m_aAutoScale->setToggleAction(true);
- m_aAutoScale->setOn (false);
- connect(m_aAutoScale,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
+ m_aUnscaled = new QAction( tr( "Show images unscaled" ), Resource::loadIconSet( "1to1" ), 0, 0, this, 0, true );
+ m_aUnscaled->setToggleAction(true);
+ connect(m_aUnscaled,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool)));
+ if (autoSave) {
+ m_aUnscaled->setOn(m_cfg->readBoolEntry("unscaled",false));
+ } else {
+ m_aUnscaled->setOn(false);
+ }
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);
- zoomerOn = true;
+ }
connect(m_aZoomer,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool)));
m_gDisplayType->insert(m_aAutoRotate);
- m_gDisplayType->insert(m_aAutoScale);
+ m_gDisplayType->insert(m_aUnscaled);
m_gDisplayType->insert(m_aZoomer);
m_hGroup = new QActionGroup(this,"actioncollection",false);
m_hGroup->insert(m_aFullScreen);
}
void PMainWindow::setupToolbar()
{
@@ -653,8 +688,13 @@ void PMainWindow::listviewselected(QAction*which)
val = 2;
// name = "opie-eye/opie-eye-thumbonly";
} else if (which==m_aDirLong) {
val = 1;
// name = "opie-eye/opie-eye-thumb";
}
emit changeListMode(val);
}
+
+void PMainWindow::readConfig()
+{
+ autoSave =m_cfg->readBoolEntry("base_savestatus",true);
+}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 703965b..5707568 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -73,29 +73,28 @@ private:
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 autoRotate;
- bool autoScale;
- bool zoomerOn;
+ bool autoSave;
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_aAutoScale,*m_aZoomer;
+ QAction *m_aAutoRotate,*m_aUnscaled,*m_aZoomer;
/* 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;
private slots:
diff --git a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
index f4a6a87..9c69ce5 100644
--- a/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
+++ b/noncore/graphics/opie-eye/impl/dir/dir_ifaceinfo.cpp
@@ -7,24 +7,32 @@
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/config.h>
/* QT */
#include <qwidget.h>
#include <qcheckbox.h>
+#include <qframe.h>
#include <qhbox.h>
#include <qlabel.h>
+#include <qlayout.h>
namespace {
- class DirImageWidget : public QHBox {
+ class DirImageWidget : public QFrame {
public:
- DirImageWidget() {
+ DirImageWidget(): QFrame() {
+ setFrameStyle(Box|Raised);
+ QVBoxLayout *m_MainLayout = new QVBoxLayout( this, 6, 2, "m_MainLayout");
chkbox = new QCheckBox( QObject::tr("Show all files"), this );
+ m_MainLayout->addWidget(chkbox);
+ QSpacerItem *spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ m_MainLayout->addItem( spacer1 );
+
}
~DirImageWidget() {}
QCheckBox* chkbox;
};
}
DirInterfaceInfo::DirInterfaceInfo() {