-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.cpp | 56 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/basesetup.h | 35 |
2 files changed, 91 insertions, 0 deletions
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 @@ | |||
1 | #include "basesetup.h" | ||
2 | |||
3 | #include <qlabel.h> | ||
4 | #include <qlayout.h> | ||
5 | #include <qspinbox.h> | ||
6 | #include <qcheckbox.h> | ||
7 | |||
8 | BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f) | ||
9 | :QWidget(parent,name,f) | ||
10 | { | ||
11 | m_cfg = a_cfg; | ||
12 | m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout"); | ||
13 | |||
14 | m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout"); | ||
15 | |||
16 | m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" ); | ||
17 | m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); | ||
18 | m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus ); | ||
19 | m_SlideShowTime->setMaxValue( 60 ); | ||
20 | m_SlideShowTime->setMinValue(0); | ||
21 | m_SlideShowTime->setValue( 2 ); | ||
22 | m_SlideShowTime->setSuffix(tr(" seconds")); | ||
23 | |||
24 | m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 ); | ||
25 | |||
26 | m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" ); | ||
27 | m_SlidetimeLabel->setText(tr("Slideshow timeout:")); | ||
28 | m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 ); | ||
29 | m_MainLayout->addLayout( m_SlidetimeLayout ); | ||
30 | |||
31 | m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" ); | ||
32 | m_ShowToolBar->setText(tr("Show toolbar on startup")); | ||
33 | m_MainLayout->addWidget( m_ShowToolBar ); | ||
34 | |||
35 | spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
36 | m_MainLayout->addItem( spacer1 ); | ||
37 | |||
38 | int stime = m_cfg->readNumEntry("base_slideshowtimeout",2); | ||
39 | if (stime<0) stime=2; | ||
40 | if (stime>60) stime=60; | ||
41 | m_SlideShowTime->setValue(stime); | ||
42 | |||
43 | bool stoolbar = m_cfg->readBoolEntry("base_showtoolbar",true); | ||
44 | m_ShowToolBar->setChecked(stoolbar); | ||
45 | } | ||
46 | |||
47 | BaseSetup::~BaseSetup() | ||
48 | { | ||
49 | } | ||
50 | |||
51 | void BaseSetup::save_values() | ||
52 | { | ||
53 | if (!m_cfg) return; | ||
54 | m_cfg->writeEntry("base_slideshowtimeout",m_SlideShowTime->value()); | ||
55 | m_cfg->writeEntry("base_showtoolbar",m_ShowToolBar->isChecked()); | ||
56 | } | ||
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 @@ | |||
1 | #ifndef _BASESETUP_H | ||
2 | #define _BASESETUP_H | ||
3 | |||
4 | #include <opie2/oconfig.h> | ||
5 | |||
6 | #include <qwidget.h> | ||
7 | |||
8 | class QVBoxLayout; | ||
9 | class QGridLayout; | ||
10 | class QSpinBox; | ||
11 | class QLabel; | ||
12 | class QCheckBox; | ||
13 | class QSpacerItem; | ||
14 | |||
15 | class BaseSetup:public QWidget | ||
16 | { | ||
17 | Q_OBJECT | ||
18 | public: | ||
19 | BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent=0, const char * name=0, WFlags f=0); | ||
20 | virtual ~BaseSetup(); | ||
21 | |||
22 | public slots: | ||
23 | virtual void save_values(); | ||
24 | |||
25 | protected: | ||
26 | Opie::Core::OConfig *m_cfg; | ||
27 | QVBoxLayout * m_MainLayout; | ||
28 | QGridLayout * m_SlidetimeLayout; | ||
29 | QSpinBox * m_SlideShowTime; | ||
30 | QLabel * m_SlidetimeLabel; | ||
31 | QCheckBox *m_ShowToolBar; | ||
32 | QSpacerItem *spacer1; | ||
33 | }; | ||
34 | |||
35 | #endif | ||