00001 #include "basesetup.h"
00002
00003 #include <qlabel.h>
00004 #include <qlayout.h>
00005 #include <qspinbox.h>
00006 #include <qcheckbox.h>
00007
00008 BaseSetup::BaseSetup(Opie::Core::OConfig *a_cfg,QWidget * parent, const char * name, WFlags f)
00009 :QFrame(parent,name,f)
00010 {
00011 setFrameStyle(Box|Raised);
00012 m_cfg = a_cfg;
00013 m_MainLayout = new QVBoxLayout( this, 11, 6, "m_MainLayout");
00014
00015 m_SlidetimeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_SlidetimeLayout");
00016 m_IconsizeLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IconsizeLayout");
00017 m_IntensityLayout = new QGridLayout( 0, 1, 1, 0, 6, "m_IntensityLayout");
00018
00019 m_SlideShowTime = new QSpinBox( this, "m_SlideShowTime" );
00020 m_SlideShowTime->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
00021 m_SlideShowTime->setButtonSymbols( QSpinBox::PlusMinus );
00022 m_SlideShowTime->setMaxValue( 60 );
00023 m_SlideShowTime->setMinValue(0);
00024 m_SlideShowTime->setValue( 2 );
00025 m_SlideShowTime->setSuffix(tr(" seconds"));
00026
00027 m_SlidetimeLayout->addWidget( m_SlideShowTime, 0, 1 );
00028
00029 m_SlidetimeLabel = new QLabel( this, "m_SlidetimeLabel" );
00030 m_SlidetimeLabel->setText(tr("Slideshow timeout:"));
00031 m_SlidetimeLayout->addWidget( m_SlidetimeLabel, 0, 0 );
00032 m_MainLayout->addLayout( m_SlidetimeLayout );
00033
00034 m_Iconsize = new QSpinBox( this, "m_Iconsize" );
00035 m_Iconsize->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
00036 m_Iconsize->setButtonSymbols( QSpinBox::PlusMinus );
00037 m_Iconsize->setMaxValue( 128 );
00038 m_Iconsize->setMinValue(12);
00039 m_Iconsize->setValue( 32 );
00040 m_Iconsize->setSuffix(tr(" pixel"));
00041 m_IconsizeLayout->addWidget( m_Iconsize, 0, 1 );
00042 m_IconsizeLabel = new QLabel( this, "m_IconsizeLabel" );
00043 m_IconsizeLabel->setText(tr("Size of thumbnails:"));
00044 m_IconsizeLayout->addWidget( m_IconsizeLabel, 0, 0 );
00045 m_MainLayout->addLayout(m_IconsizeLayout);
00046
00047 m_Intensity = new QSpinBox( this, "m_Intensity" );
00048 m_Intensity->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
00049 m_Intensity->setButtonSymbols( QSpinBox::PlusMinus );
00050 m_Intensity->setMaxValue( 100 );
00051 m_Intensity->setMinValue(-100);
00052 m_Intensity->setValue( 0 );
00053 m_IntensityLayout->addWidget( m_Intensity, 0, 1 );
00054 m_IntensityLabel = new QLabel( this, "m_IntensityLabel" );
00055 m_IntensityLabel->setText(tr("Default display brightness:"));
00056 m_IntensityLayout->addWidget(m_IntensityLabel, 0, 0 );
00057 m_MainLayout->addLayout(m_IntensityLayout);
00058
00059 #if 0
00060 m_ShowToolBar = new QCheckBox( this, "m_ShowToolBar" );
00061 m_ShowToolBar->setText(tr("Show toolbar on startup"));
00062 m_MainLayout->addWidget( m_ShowToolBar );
00063 #endif
00064 m_SaveStateAuto = new QCheckBox( this, "m_SaveStateAuto" );
00065 m_SaveStateAuto->setText(tr("Save status of fullscreen/autorotate"));
00066 m_MainLayout->addWidget( m_SaveStateAuto );
00067
00068 spacer1 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
00069 m_MainLayout->addItem( spacer1 );
00070
00071 int stime = m_cfg->readNumEntry("slideshowtimeout",2);
00072 if (stime<0) stime=2;
00073 if (stime>60) stime=60;
00074 m_SlideShowTime->setValue(stime);
00075 m_SaveStateAuto->setChecked(m_cfg->readBoolEntry("savestatus",true));
00076 stime = m_cfg->readNumEntry("iconsize", 32);
00077
00078 if (stime<12)stime = 12;
00079 if (stime>128)stime = 128;
00080 m_Iconsize->setValue(stime);
00081 stime = m_cfg->readNumEntry("intensity",0);
00082 if (stime<-100) stime = -100;
00083 if (stime>100) stime = 100;
00084 m_Intensity->setValue(stime);
00085 }
00086
00087 BaseSetup::~BaseSetup()
00088 {
00089 }
00090
00091 void BaseSetup::save_values()
00092 {
00093 if (!m_cfg) return;
00094 m_cfg->writeEntry("slideshowtimeout",m_SlideShowTime->value());
00095 m_cfg->writeEntry("savestatus",m_SaveStateAuto->isChecked());
00096 m_cfg->writeEntry("iconsize",m_Iconsize->value());
00097 m_cfg->writeEntry("intensity",m_Intensity->value());
00098 }