annotate gui/src/SettingsDialog.cpp @ 13672:c9501268a194

filename with or without full path in tabs of the editor
author ttl <ttl@justmail.de>
date Tue, 13 Sep 2011 17:44:34 +0200
parents d98c6ef06dff
children c0e66d6e3dc8
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 ());
13659
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
19 ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () );
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
20 ui->editor_highlightActualLine->setChecked (settings->value ("editor/highlightActualLine",true).toBool () );
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
21 ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () );
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
22 ui->editor_fontName->setCurrentFont (QFont (settings->value ("editor/fontName","Courier").toString()) );
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
23 ui->editor_fontSize->setValue (settings->value ("editor/fontSize",10).toInt ());
13672
c9501268a194 filename with or without full path in tabs of the editor
ttl <ttl@justmail.de>
parents: 13659
diff changeset
24 ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",true).toBool ());
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
25 ui->showFilenames->setChecked (settings->value ("showFilenames").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
26 ui->showFileSize->setChecked (settings->value ("showFileSize").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
27 ui->showFileType->setChecked (settings->value ("showFileType").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
28 ui->showLastModified->setChecked (settings->value ("showLastModified").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
29 ui->showHiddenFiles->setChecked (settings->value ("showHiddenFiles").toBool());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
30 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
31 ui->useProxyServer->setChecked (settings->value ("useProxyServer").toBool ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
32 ui->proxyHostName->setText (settings->value ("proxyHostName").toString ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
33
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
34 int currentIndex = 0;
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
35 QString proxyTypeString = settings->value ("proxyType").toString ();
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
36 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
37 {
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
38 currentIndex++;
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
39 ui->proxyType->setCurrentIndex (currentIndex);
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
40 }
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
41
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
42 ui->proxyPort->setText (settings->value ("proxyPort").toString ());
13609
b355901aade4 Added username and password field to proxy settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13607
diff changeset
43 ui->proxyUserName->setText (settings->value ("proxyUserName").toString ());
b355901aade4 Added username and password field to proxy settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13607
diff changeset
44 ui->proxyPassword->setText (settings->value ("proxyPassword").toString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
45 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
46
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
47 SettingsDialog::~SettingsDialog ()
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
48 {
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
49 QSettings *settings = ResourceManager::instance ()->settings ();
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
50 settings->setValue ("connectOnStartup", ui->connectOnStartup->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
51 settings->setValue ("showMessageOfTheDay", ui->showMessageOfTheDay->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
52 settings->setValue ("showTopic", ui->showTopic->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
53 settings->setValue ("autoIdentification", ui->autoIdentification->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
54 settings->setValue ("nickServPassword", ui->nickServPassword->text ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
55 settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
56 settings->setValue ("customFileEditor", ui->customFileEditor->text ());
13659
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
57 settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
58 settings->setValue ("editor/highlightActualLine", ui->editor_highlightActualLine->isChecked ());
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
59 settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ());
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
60 settings->setValue ("editor/fontName", ui->editor_fontName->currentFont().family());
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
61 settings->setValue ("editor/fontSize", ui->editor_fontSize->value());
13672
c9501268a194 filename with or without full path in tabs of the editor
ttl <ttl@justmail.de>
parents: 13659
diff changeset
62 settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked());
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
63 settings->setValue ("showFilenames", ui->showFilenames->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
64 settings->setValue ("showFileSize", ui->showFileSize->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
65 settings->setValue ("showFileType", ui->showFileType->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
66 settings->setValue ("showLastModified", ui->showLastModified->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
67 settings->setValue ("showHiddenFiles", ui->showHiddenFiles->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
68 settings->setValue ("useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ());
13607
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
69 settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
70 settings->setValue ("proxyType", ui->proxyType->currentText ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
71 settings->setValue ("proxyHostName", ui->proxyHostName->text ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
72 settings->setValue ("proxyPort", ui->proxyPort->text ());
13609
b355901aade4 Added username and password field to proxy settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13607
diff changeset
73 settings->setValue ("proxyUserName", ui->proxyUserName->text ());
b355901aade4 Added username and password field to proxy settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13607
diff changeset
74 settings->setValue ("proxyPassword", ui->proxyPassword->text ());
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
diff changeset
75 delete ui;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
76 }