1 /***************************************************************************
2 keducaprefs.cpp - description
5 copyright : (C) 2001 by Javier Campos
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include "keducaprefs.h"
19 #include "keducaprefs.moc"
22 #include <kiconloader.h>
27 #include <qbuttongroup.h>
30 KEducaPrefs::KEducaPrefs(QWidget
*parent
, const char *name
, bool modal
) : KDialogBase(IconList
, i18n("Configure"), Ok
|Cancel
, Ok
, parent
, name
, modal
, true)
36 KEducaPrefs::~KEducaPrefs(){}
38 /** Set page general */
39 void KEducaPrefs::setPageGeneral()
41 QVBox
*mainFrame
= addVBoxPage( i18n("Miscellaneous"), i18n("Various Settings"), DesktopIcon("misc"));
45 QButtonGroup
*buttonGroup1
= new QButtonGroup( mainFrame
, "ButtonGroup1" );
46 buttonGroup1
->setTitle( i18n( "General" ) );
47 buttonGroup1
->setColumnLayout(0, Qt::Vertical
);
48 buttonGroup1
->layout()->setSpacing( 0 );
49 buttonGroup1
->layout()->setMargin( 0 );
50 QVBoxLayout
*buttonGroup1Layout
= new QVBoxLayout( buttonGroup1
->layout() );
51 buttonGroup1Layout
->setAlignment( Qt::AlignTop
);
52 buttonGroup1Layout
->setSpacing( 6 );
53 buttonGroup1Layout
->setMargin( 11 );
55 _resultAfterNext
= new QRadioButton( buttonGroup1
, "RadioButton1" );
56 _resultAfterNext
->setText( i18n( "Show results of the answer after press next" ) );
57 buttonGroup1Layout
->addWidget( _resultAfterNext
);
59 _resultAfterFinish
= new QRadioButton( buttonGroup1
, "RadioButton2" );
60 _resultAfterFinish
->setText( i18n( "Show results when finish the test" ) );
61 buttonGroup1Layout
->addWidget( _resultAfterFinish
);
63 QGroupBox
*GroupBox1
= new QGroupBox( mainFrame
, "GroupBox7" );
64 GroupBox1
->setTitle( i18n( "Order" ) );
65 GroupBox1
->setColumnLayout(0, Qt::Vertical
);
66 GroupBox1
->layout()->setSpacing( 0 );
67 GroupBox1
->layout()->setMargin( 0 );
68 QVBoxLayout
*GroupBox1Layout
= new QVBoxLayout( GroupBox1
->layout() );
69 GroupBox1Layout
->setAlignment( Qt::AlignTop
);
70 GroupBox1Layout
->setSpacing( 6 );
71 GroupBox1Layout
->setMargin( 11 );
73 _randomQuestions
= new QCheckBox( GroupBox1
, "CheckBox1" );
74 _randomQuestions
->setText( i18n( "Show questions in random order" ) );
75 GroupBox1Layout
->addWidget( _randomQuestions
);
77 _randomAnswers
= new QCheckBox( GroupBox1
, "CheckBox2" );
78 _randomAnswers
->setText( i18n( "Show answers in random order" ) );
79 GroupBox1Layout
->addWidget( _randomAnswers
);
83 void KEducaPrefs::configRead()
85 KConfig
*config
= KGlobal::config();
86 config
->setGroup("Options");
87 QSize
defaultSize(500,400);
88 resize( config
->readSizeEntry("Geometry", &defaultSize
) );
89 config
->readBoolEntry("ResultFinish", true ) ? _resultAfterFinish
->setChecked(true) : _resultAfterNext
->setChecked(true);
90 config
->readBoolEntry("RandomQuestions", false ) ? _randomQuestions
->setChecked(true) : _randomQuestions
->setChecked(false);
91 config
->readBoolEntry("RandomAnswers", false ) ? _randomAnswers
->setChecked(true) : _randomAnswers
->setChecked(false);
95 void KEducaPrefs::configWrite()
97 KConfig
*config
= KGlobal::config();
98 config
->setGroup("Options");
99 config
->writeEntry("Geometry", size() );
100 config
->writeEntry("ResultFinish", _resultAfterFinish
->isChecked() );
101 config
->writeEntry("RandomQuestions", _randomQuestions
->isChecked() );
102 config
->writeEntry("RandomAnswers", _randomAnswers
->isChecked() );
106 /** Push ok button */
107 void KEducaPrefs::slotOk()