From c0920559a3df4abb8f8c6e58dd769abdb14170ce Mon Sep 17 00:00:00 2001 From: alwin Date: Sun, 31 Oct 2004 21:25:05 +0000 Subject: a widget for some base settings --- diff --git a/noncore/graphics/opie-eye/gui/basesetup.cpp b/noncore/graphics/opie-eye/gui/basesetup.cpp new file mode 100644 index 0000000..11974cf --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/basesetup.cpp @@ -0,0 +1,56 @@ +#include "basesetup.h" + +#include +#include +#include +#include + +BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f) + :QWidget(parent,name,f) +{ + 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(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_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" ); + m_ShowToolBar->setText(tr("Show toolbar on startup")); + m_MainLayout->addWidget( m_ShowToolBar ); + + spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); + m_MainLayout->addItem( spacer1 ); + + int stime = m_cfg->readNumEntry("base_slideshowtimeout",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); +} + +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()); +} diff --git a/noncore/graphics/opie-eye/gui/basesetup.h b/noncore/graphics/opie-eye/gui/basesetup.h new file mode 100644 index 0000000..c13e2af --- a/dev/null +++ b/noncore/graphics/opie-eye/gui/basesetup.h @@ -0,0 +1,35 @@ +#ifndef _BASESETUP_H +#define _BASESETUP_H + +#include + +#include + +class QVBoxLayout; +class QGridLayout; +class QSpinBox; +class QLabel; +class QCheckBox; +class QSpacerItem; + +class BaseSetup:public QWidget +{ + 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; + QSpacerItem *spacer1; +}; + +#endif -- cgit v0.9.0.2