• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

keduca

keducaprefs.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           keducaprefs.cpp  -  description
00003                              -------------------
00004     begin                : Sat Jun 2 2001
00005     copyright            : (C) 2001 by Javier Campos
00006     email                : javi@asyris.org
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "keducaprefs.h"
00019 #include "keducaprefs.moc"
00020 
00021 #include <klocale.h>
00022 #include <kiconloader.h>
00023 #include <kconfig.h>
00024 
00025 #include <qlayout.h>
00026 #include <qvbox.h>
00027 #include <qbuttongroup.h>
00028 
00029 
00030 KEducaPrefs::KEducaPrefs(QWidget *parent, const char *name, bool modal ) : KDialogBase(IconList, i18n("Configure"), Ok|Cancel, Ok, parent, name, modal, true)
00031 {
00032     setPageGeneral();
00033     configRead();
00034 }
00035 
00036 KEducaPrefs::~KEducaPrefs(){}
00037 
00039 void KEducaPrefs::setPageGeneral()
00040 {
00041     QVBox *mainFrame = addVBoxPage( i18n("Miscellaneous"), i18n("Various Settings"), DesktopIcon("misc"));
00042 
00043 
00044     
00045     QButtonGroup *buttonGroup1 = new QButtonGroup( mainFrame, "ButtonGroup1" );
00046     buttonGroup1->setTitle( i18n( "General" ) );
00047     buttonGroup1->setColumnLayout(0, Qt::Vertical );
00048     buttonGroup1->layout()->setSpacing( 0 );
00049     buttonGroup1->layout()->setMargin( 0 );
00050     QVBoxLayout *buttonGroup1Layout = new QVBoxLayout( buttonGroup1->layout() );
00051     buttonGroup1Layout->setAlignment( Qt::AlignTop );
00052     buttonGroup1Layout->setSpacing( 6 );
00053     buttonGroup1Layout->setMargin( 11 );
00054 
00055     _resultAfterNext = new QRadioButton( buttonGroup1, "RadioButton1" );
00056     _resultAfterNext->setText( i18n( "Show results of the answer after press next" ) );
00057     buttonGroup1Layout->addWidget( _resultAfterNext );
00058 
00059     _resultAfterFinish = new QRadioButton( buttonGroup1, "RadioButton2" );
00060     _resultAfterFinish->setText( i18n( "Show results when finish the test" ) );
00061     buttonGroup1Layout->addWidget( _resultAfterFinish );
00062 
00063     QGroupBox *GroupBox1 = new QGroupBox( mainFrame, "GroupBox7" );
00064     GroupBox1->setTitle( i18n( "Order" ) );
00065     GroupBox1->setColumnLayout(0, Qt::Vertical );
00066     GroupBox1->layout()->setSpacing( 0 );
00067     GroupBox1->layout()->setMargin( 0 );
00068     QVBoxLayout *GroupBox1Layout = new QVBoxLayout( GroupBox1->layout() );
00069     GroupBox1Layout->setAlignment( Qt::AlignTop );
00070     GroupBox1Layout->setSpacing( 6 );
00071     GroupBox1Layout->setMargin( 11 );
00072     
00073     _randomQuestions = new QCheckBox( GroupBox1, "CheckBox1" );
00074     _randomQuestions->setText( i18n( "Show questions in random order" ) );
00075     GroupBox1Layout->addWidget( _randomQuestions );
00076 
00077     _randomAnswers = new QCheckBox( GroupBox1, "CheckBox2" );
00078     _randomAnswers->setText( i18n( "Show answers in random order" ) );
00079     GroupBox1Layout->addWidget( _randomAnswers );
00080 }
00081 
00083 void KEducaPrefs::configRead()
00084 {
00085     KConfig *config = KGlobal::config();
00086     config->setGroup("Options");
00087     QSize defaultSize(500,400);
00088     resize( config->readSizeEntry("Geometry", &defaultSize ) );
00089     config->readBoolEntry("ResultFinish", true ) ? _resultAfterFinish->setChecked(true) : _resultAfterNext->setChecked(true);
00090     config->readBoolEntry("RandomQuestions", false ) ? _randomQuestions->setChecked(true) : _randomQuestions->setChecked(false);
00091     config->readBoolEntry("RandomAnswers", false ) ? _randomAnswers->setChecked(true) : _randomAnswers->setChecked(false);
00092 }
00093 
00095 void KEducaPrefs::configWrite()
00096 {
00097     KConfig *config = KGlobal::config();
00098     config->setGroup("Options");
00099     config->writeEntry("Geometry", size() );
00100     config->writeEntry("ResultFinish", _resultAfterFinish->isChecked() );
00101     config->writeEntry("RandomQuestions", _randomQuestions->isChecked() );
00102     config->writeEntry("RandomAnswers", _randomAnswers->isChecked() );
00103     config->sync();
00104 }
00105 
00107 void KEducaPrefs::slotOk()
00108 {
00109     configWrite();
00110     accept();
00111 }
00112 

keduca

Skip menu "keduca"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal