src/PreferencesDialog/PreferencesDialog.cpp

Go to the documentation of this file.
00001 #include "PreferencesDialog.h"
00002 #include <QFileDialog>
00003 
00004 CPreferences::CPreferences() {
00005         setupUi(this);
00006 
00007         connect(listWidget, SIGNAL( currentRowChanged( int ) ),
00008                         stackedWidget, SLOT( setCurrentIndex( int ) ));
00009         connect(languageCheckBox, SIGNAL ( toggled( bool ) ),
00010                         languageGroupBox, SLOT( setEnabled( bool ) ));
00011         connect(CanclePushButton, SIGNAL( clicked() ),
00012                         this, SLOT( close() ));
00013         connect(ApplyPushButton, SIGNAL( clicked() ),
00014                         this, SLOT( writeConfig() ));
00015         connect(languageBrowsePushButton, SIGNAL( clicked() ),
00016                         this, SLOT( browseLanguage() ));
00017 
00018         configuration = new CSettings;
00019         loadSettings();
00020 }
00021 
00022 CPreferences::~CPreferences() {
00023         delete configuration;
00024 }
00025 
00026 void CPreferences::writeConfig() {
00027         // other
00028         configuration->settings.firstrun = false;
00029         // general
00030         configuration->settings.systemTray = SystemTrayCheckBox->isChecked();
00031         // language
00032         configuration->settings.otherLanuage = languageCheckBox->isChecked();
00033         configuration->settings.language = languageLocationLineEdit->text();
00034 
00035         configuration->write();
00036         accept();
00037 }
00038 
00039 void CPreferences::loadSettings() {
00040         // general
00041         SystemTrayCheckBox->setChecked(configuration->settings.systemTray);
00042         // language
00043         languageCheckBox->setChecked(configuration->settings.otherLanuage);
00044         languageLocationLineEdit->setText(configuration->settings.language);
00045 }
00046 
00047 void CPreferences::browseLanguage() {
00048 
00049         QString file = QFileDialog::getOpenFileName(this, tr("Choose language"), "/usr/share/apps/ccln-client/translations/", tr("Language Files (*.qm)"));
00050 
00051         languageLocationLineEdit->setText(file);
00052 }

Generated on Fri Feb 29 10:20:46 2008 for QConfigControl by  doxygen 1.5.4