Mercurial > hg > octave-nkf
annotate gui/src/SettingsDialog.cpp @ 13674:c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sun, 25 Sep 2011 10:52:42 +0200 |
parents | c9501268a194 |
children | faece6b2ab90 |
rev | line source |
---|---|
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
3 * |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
4 * This program is free software: you can redistribute it and/or modify |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
5 * it under the terms of the GNU Affero General Public License as |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
7 * License, or (at your option) any later version. |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
8 * |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
12 * GNU Affero General Public License for more details. |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
13 * |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
14 * You should have received a copy of the GNU Affero General Public License |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
16 */ |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
17 |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
18 #include "ResourceManager.h" |
13501 | 19 #include "SettingsDialog.h" |
20 #include "ui_SettingsDialog.h" | |
21 #include <QSettings> | |
22 | |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
23 SettingsDialog::SettingsDialog (QWidget * parent): |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
24 QDialog (parent), ui (new Ui::SettingsDialog) |
13501 | 25 { |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
26 ui->setupUi (this); |
13501 | 27 |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
28 QSettings *settings = ResourceManager::instance ()->settings (); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
29 ui->connectOnStartup->setChecked (settings->value ("connectOnStartup").toBool ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
30 ui->showMessageOfTheDay->setChecked (settings->value ("showMessageOfTheDay").toBool ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
31 ui->showTopic->setChecked (settings->value ("showTopic").toBool ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
32 ui->autoIdentification->setChecked (settings->value ("autoIdentification").toBool ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
33 ui->nickServPassword->setText (settings->value ("nickServPassword").toString ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
34 ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 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
|
42 ui->showFilenames->setChecked (settings->value ("showFilenames").toBool()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
43 ui->showFileSize->setChecked (settings->value ("showFileSize").toBool()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
44 ui->showFileType->setChecked (settings->value ("showFileType").toBool()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
45 ui->showLastModified->setChecked (settings->value ("showLastModified").toBool()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
46 ui->showHiddenFiles->setChecked (settings->value ("showHiddenFiles").toBool()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
47 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
|
48 ui->useProxyServer->setChecked (settings->value ("useProxyServer").toBool ()); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
49 ui->proxyHostName->setText (settings->value ("proxyHostName").toString ()); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
50 |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
51 int currentIndex = 0; |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
52 QString proxyTypeString = settings->value ("proxyType").toString (); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
53 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
|
54 { |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
55 currentIndex++; |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
56 ui->proxyType->setCurrentIndex (currentIndex); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
57 } |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
58 |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
59 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
|
60 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
|
61 ui->proxyPassword->setText (settings->value ("proxyPassword").toString ()); |
13501 | 62 } |
63 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
64 SettingsDialog::~SettingsDialog () |
13501 | 65 { |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
66 QSettings *settings = ResourceManager::instance ()->settings (); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
67 settings->setValue ("connectOnStartup", ui->connectOnStartup->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
68 settings->setValue ("showMessageOfTheDay", ui->showMessageOfTheDay->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
69 settings->setValue ("showTopic", ui->showTopic->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
70 settings->setValue ("autoIdentification", ui->autoIdentification->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
71 settings->setValue ("nickServPassword", ui->nickServPassword->text ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
72 settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
73 settings->setValue ("customFileEditor", ui->customFileEditor->text ()); |
13659
d98c6ef06dff
included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents:
13609
diff
changeset
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 settings->setValue ("showFilenames", ui->showFilenames->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
81 settings->setValue ("showFileSize", ui->showFileSize->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
82 settings->setValue ("showFileType", ui->showFileType->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
83 settings->setValue ("showLastModified", ui->showLastModified->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
84 settings->setValue ("showHiddenFiles", ui->showHiddenFiles->isChecked ()); |
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
85 settings->setValue ("useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ()); |
13607
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
86 settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ()); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
87 settings->setValue ("proxyType", ui->proxyType->currentText ()); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
88 settings->setValue ("proxyHostName", ui->proxyHostName->text ()); |
fd31226d4c3a
Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13537
diff
changeset
|
89 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
|
90 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
|
91 settings->setValue ("proxyPassword", ui->proxyPassword->text ()); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
92 delete ui; |
13501 | 93 } |