annotate gui/src/SettingsDialog.cpp @ 13607:fd31226d4c3a

Proxy settings can now be configured.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Wed, 17 Aug 2011 00:36:10 +0200
parents a43ecce77eec
children b355901aade4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
1 #include "ResourceManager.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2 #include "SettingsDialog.h"
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
3 #include "ui_SettingsDialog.h"
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
4 #include <QSettings>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
5
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
6 SettingsDialog::SettingsDialog (QWidget * parent):
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
7 QDialog (parent), ui (new Ui::SettingsDialog)
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
8 {
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
9 ui->setupUi (this);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
10
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
11 QSettings *settings = ResourceManager::instance ()->settings ();
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
12 ui->connectOnStartup->setChecked (settings->value ("connectOnStartup").toBool ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
13 ui->showMessageOfTheDay->setChecked (settings->value ("showMessageOfTheDay").toBool ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
14 ui->showTopic->setChecked (settings->value ("showTopic").toBool ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
15 ui->autoIdentification->setChecked (settings->value ("autoIdentification").toBool ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
16 ui->nickServPassword->setText (settings->value ("nickServPassword").toString ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
17 ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
18 ui->customFileEditor->setText (settings->value ("customFileEditor").toString ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
19 ui->showFilenames->setChecked (settings->value ("showFilenames").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
20 ui->showFileSize->setChecked (settings->value ("showFileSize").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
21 ui->showFileType->setChecked (settings->value ("showFileType").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
22 ui->showLastModified->setChecked (settings->value ("showLastModified").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
23 ui->showHiddenFiles->setChecked (settings->value ("showHiddenFiles").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
24 ui->useAlternatingRowColors->setChecked (settings->value ("useAlternatingRowColors").toBool());
13607
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
25 ui->useProxyServer->setChecked (settings->value ("useProxyServer").toBool ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
26 ui->proxyHostName->setText (settings->value ("proxyHostName").toString ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
27
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
28 int currentIndex = 0;
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
29 QString proxyTypeString = settings->value ("proxyType").toString ();
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
30 while ( (currentIndex < ui->proxyType->count ()) && (ui->proxyType->currentText () != proxyTypeString))
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
31 {
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
32 currentIndex++;
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
33 ui->proxyType->setCurrentIndex (currentIndex);
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
34 }
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
35
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
36 ui->proxyPort->setText (settings->value ("proxyPort").toString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
37 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
39 SettingsDialog::~SettingsDialog ()
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40 {
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
41 QSettings *settings = ResourceManager::instance ()->settings ();
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
42 settings->setValue ("connectOnStartup", ui->connectOnStartup->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
43 settings->setValue ("showMessageOfTheDay", ui->showMessageOfTheDay->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
44 settings->setValue ("showTopic", ui->showTopic->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
45 settings->setValue ("autoIdentification", ui->autoIdentification->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
46 settings->setValue ("nickServPassword", ui->nickServPassword->text ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
47 settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
48 settings->setValue ("customFileEditor", ui->customFileEditor->text ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
49 settings->setValue ("showFilenames", ui->showFilenames->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
50 settings->setValue ("showFileSize", ui->showFileSize->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
51 settings->setValue ("showFileType", ui->showFileType->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
52 settings->setValue ("showLastModified", ui->showLastModified->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
53 settings->setValue ("showHiddenFiles", ui->showHiddenFiles->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
54 settings->setValue ("useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ());
13607
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
55 settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
56 settings->setValue ("proxyType", ui->proxyType->currentText ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
57 settings->setValue ("proxyHostName", ui->proxyHostName->text ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
58 settings->setValue ("proxyPort", ui->proxyPort->text ());
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
59 delete ui;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
60 }