annotate libgui/src/settings-dialog.cc @ 16402:7fa90eb41240

gui: individually configurable styles of the editor lexers * color-picker.cc/.h: new class for a simple color picker * libgui/src/module.mk: added color-picker.cc/.h * file-editor-tab.cc(update_lexer): read config of the lexer from settings file * file-editor-tab(notice_settings): editor font not directly configured from the settings file but via the lexer settings in update_lexer * lexer-octave-gui.cc(constructor): inherits from QsciLexerOctave instaead of QsciLexer, code cleanup * lexer-octave-gui.cc(language,lexer,defaultFont,defaultColor,description): removed, original methods used and configured via settings * lexer-octave-gui.h: removed functions language,lexer,defaultFont,defaultColor, description and enum; using methods of octave lexer instead * settings-dialog.cc(constructor): editor font not configured from settings, defining lexers for supported languages and reading their actual settings from the settings file (via read_lexer_settings) * settings-dialog.cc(read_lexer_settings): new function for reading the lexers settings from settings file and creating the tabs with interactive elements for configuring these settings * settings-dialog.cc(write_changed_settings): remove settings for editor font, defining lexers for supported languages and writing the settings from the dialog into the settings file (via write_lexer_settings) * settings-dialog.cc(write_lexer_settings): new funciton for getting the new lexer settings from the interactive elements and write them into the settings file * settings-dialog.h: new functiond read_lexer_settings, write_lexer_settings * settings-dialog.ui: new tab for the editor styles which contents is dynamically created in settings_dialog ()
author Torsten <ttl@justmail.de>
date Sun, 31 Mar 2013 23:56:11 +0200
parents 4bb1b82076e5
children f62163bed4dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
3 Copyright (C) 2011-2012 Jacob Dawid
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21 */
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13672
diff changeset
22
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
23 #ifdef HAVE_CONFIG_H
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
24 #include <config.h>
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
25 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
26
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
27 #include "resource-manager.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
28 #include "settings-dialog.h"
15156
141b0b108292 allow building without gui to work
John W. Eaton <jwe@octave.org>
parents: 14998
diff changeset
29 #include "ui-settings-dialog.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30 #include <QSettings>
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
31 #include <QDir>
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
32 #include <QFileInfo>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
34 #ifdef HAVE_QSCINTILLA
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
35 #include <QScrollArea>
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
36 #include "color-picker.h"
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
37 #include <Qsci/qscilexercpp.h>
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
38 #include <Qsci/qscilexerbash.h>
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
39 #include <Qsci/qscilexerperl.h>
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
40 #include <Qsci/qscilexerbatch.h>
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
41 #include <Qsci/qscilexerdiff.h>
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
42 #endif
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
43
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
44 settings_dialog::settings_dialog (QWidget *p):
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
45 QDialog (p), ui (new Ui::settings_dialog)
13501
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 ui->setupUi (this);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
48
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15156
diff changeset
49 QSettings *settings = resource_manager::get_settings ();
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15156
diff changeset
50 // FIXME -- what should happen if settings is 0?
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15156
diff changeset
51
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
52 // look for available language files and the actual settings
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
53 QString qm_dir_name = resource_manager::get_gui_translation_dir ();
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
54 QDir qm_dir (qm_dir_name);
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
55 QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"),
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
56 QDir::Files | QDir::Readable,
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
57 QDir::Name);
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
58 for (int i = 0; i < qm_files.length (); i++) // insert available languages
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
59 ui->comboBox_language->addItem (qm_files.at (i).baseName ());
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
60 ui->comboBox_language->insertItem (0,tr("System setting")); // System at beginning
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
61 ui->comboBox_language->insertSeparator (1); // separator after System
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
62 QString language = settings->value ("language","SYSTEM").toString ();
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
63 if (language == "SYSTEM")
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
64 language = tr("System setting");
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
65 int selected = ui->comboBox_language->findText (language);
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
66 if (selected >= 0)
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
67 ui->comboBox_language->setCurrentIndex (selected);
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
68 else
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
69 ui->comboBox_language->setCurrentIndex (0); // System is default
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
70
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
71 // which icon has to be selected
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
72 QString widget_icon_set =
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
73 settings->value ("DockWidgets/widget_icon_set","NONE").toString ();
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
74 ui->general_icon_octave-> setChecked (true); // the default (if invalid set)
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
75 ui->general_icon_octave-> setChecked (widget_icon_set == "NONE");
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
76 ui->general_icon_graphic-> setChecked (widget_icon_set == "GRAPHIC");
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
77 ui->general_icon_letter-> setChecked (widget_icon_set == "LETTER");
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
78
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
79 ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor",false).toBool ());
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
80 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
81 ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () );
14307
be3e1a14a6de Added an interface settings tab to the settings dialog. Made a few improvements on the editor. Wrote a small welcome text in the welcome wizard. Moved configuration file to ~/.config/octave-gui/settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14290
diff changeset
82 ui->editor_highlightCurrentLine->setChecked (settings->value ("editor/highlightCurrentLine",true).toBool () );
13659
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
83 ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () );
15355
a9fd6821eedf GUI: recognize editor prefences for long title names; changed default value to false
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15286
diff changeset
84 ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",false).toBool ());
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15355
diff changeset
85 ui->editor_restoreSession->setChecked (settings->value ("editor/restoreSession",true).toBool ());
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
86 ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName","Courier New").toString()) );
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14308
diff changeset
87 ui->terminal_fontSize->setValue (settings->value ("terminal/fontSize",10).toInt ());
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
88 ui->showFilenames->setChecked (settings->value ("showFilenames",true).toBool());
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
89 ui->showFileSize->setChecked (settings->value ("showFileSize",false).toBool());
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
90 ui->showFileType->setChecked (settings->value ("showFileType",false).toBool());
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
91 ui->showLastModified->setChecked (settings->value ("showLastModified",false).toBool());
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
92 ui->showHiddenFiles->setChecked (settings->value ("showHiddenFiles",false).toBool());
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
93 ui->useAlternatingRowColors->setChecked (settings->value ("useAlternatingRowColors",true).toBool());
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
94 ui->useProxyServer->setChecked (settings->value ("useProxyServer",false).toBool ());
13607
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
95 ui->proxyHostName->setText (settings->value ("proxyHostName").toString ());
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
96 ui->terminal_cursorBlinking->setChecked (settings->value ("terminal/cursorBlinking",true).toBool ());
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
97
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 15972
diff changeset
98 QString cursorType = settings->value ("terminal/cursorType","ibeam").toString ();
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
99
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
100 QStringList items;
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
101 items << QString("0") << QString("1") << QString("2");
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
102 ui->terminal_cursorType->addItems(items);
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
103 ui->terminal_cursorType->setItemText (0, "IBeam Cursor");
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
104 ui->terminal_cursorType->setItemText (1, "Block Cursor");
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
105 ui->terminal_cursorType->setItemText (2, "Underline Cursor");
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
106
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
107 if (cursorType == "ibeam")
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
108 ui->terminal_cursorType->setCurrentIndex (0);
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
109 else if (cursorType == "block")
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
110 ui->terminal_cursorType->setCurrentIndex (1);
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
111 else if (cursorType == "underline")
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
112 ui->terminal_cursorType->setCurrentIndex (2);
13607
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
113
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
114 int currentIndex = 0;
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
115 QString proxyTypeString = settings->value ("proxyType").toString ();
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
116 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
117 {
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
118 currentIndex++;
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
119 ui->proxyType->setCurrentIndex (currentIndex);
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
120 }
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
121
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
122 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
123 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
124 ui->proxyPassword->setText (settings->value ("proxyPassword").toString ());
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
125
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
126 #ifdef HAVE_QSCINTILLA
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
127 // editor styles: create lexer, read settings, and create dialog elements
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
128 QsciLexer *lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
129 lexer = new lexer_octave_gui ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
130 read_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
131 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
132 lexer = new QsciLexerCPP ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
133 read_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
134 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
135 lexer = new QsciLexerPerl ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
136 read_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
137 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
138 lexer = new QsciLexerBatch ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
139 read_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
140 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
141 lexer = new QsciLexerDiff ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
142 read_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
143 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
144 lexer = new QsciLexerBash ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
145 read_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
146 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
147 #endif
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
148 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
149
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
150 settings_dialog::~settings_dialog ()
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
151 {
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15204
diff changeset
152 delete ui;
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15204
diff changeset
153 }
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15204
diff changeset
154
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
155
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
156 #ifdef HAVE_QSCINTILLA
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
157 void
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
158 settings_dialog::read_lexer_settings (QsciLexer *lexer, QSettings *settings)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
159 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
160 lexer->readSettings (*settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
161 int styles = 0;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
162 while (lexer->description(styles) != "")
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
163 styles++;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
164 QGridLayout *style_grid = new QGridLayout ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
165 QLabel *description[styles];
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
166 QFontComboBox *select_font[styles];
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
167 QSpinBox *font_size[styles];
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
168 QCheckBox *attrib_font[3][styles];
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
169 color_picker *color[styles];
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
170 int default_size = 10;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
171 QFont default_font = QFont ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
172 for (int i = 0; i < styles; i++) // create dialog elements for all styles
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
173 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
174 QString actual_name = lexer->description (i);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
175 QFont actual_font = lexer->font (i);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
176 description[i] = new QLabel (actual_name);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
177 select_font[i] = new QFontComboBox ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
178 select_font[i]->setObjectName (actual_name+"_font");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
179 font_size[i] = new QSpinBox ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
180 font_size[i]->setObjectName (actual_name+"_size");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
181 if (i == 0) // the default
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
182 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
183 select_font[i]->setCurrentFont (actual_font);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
184 default_font = actual_font;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
185 font_size[i]->setRange (6,24);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
186 default_size = actual_font.pointSize ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
187 font_size[i]->setValue (default_size);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
188 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
189 else // other styles
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
190 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
191 select_font[i]->setCurrentFont (actual_font);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
192 if (actual_font.family () == default_font.family ())
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
193 select_font[i]->setEditText (lexer->description (0));
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
194 font_size[i]->setRange (-4,4);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
195 font_size[i]->setValue (actual_font.pointSize ()-default_size);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
196 font_size[i]->setToolTip ("Difference to the defalt size");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
197 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
198 attrib_font[0][i] = new QCheckBox (tr("b"));
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
199 attrib_font[1][i] = new QCheckBox (tr("i"));
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
200 attrib_font[2][i] = new QCheckBox (tr("u"));
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
201 attrib_font[0][i]->setChecked(Qt::Checked && actual_font.bold ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
202 attrib_font[0][i]->setObjectName (actual_name+"_bold");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
203 attrib_font[1][i]->setChecked(Qt::Checked && actual_font.italic ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
204 attrib_font[1][i]->setObjectName (actual_name+"_italic");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
205 attrib_font[2][i]->setChecked(Qt::Checked && actual_font.underline ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
206 attrib_font[2][i]->setObjectName (actual_name+"_underline");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
207 color[i] = new color_picker (lexer->color (i));
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
208 color[i]->setObjectName (actual_name+"_color");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
209 int column = 1;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
210 style_grid->addWidget (description[i], i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
211 style_grid->addWidget (select_font[i], i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
212 style_grid->addWidget (font_size[i], i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
213 style_grid->addWidget (attrib_font[0][i],i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
214 style_grid->addWidget (attrib_font[1][i],i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
215 style_grid->addWidget (attrib_font[2][i],i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
216 style_grid->addWidget (color[i], i,column++);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
217 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
218 // place grid with elements into the tab
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
219 QScrollArea *scroll_area = new QScrollArea ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
220 QWidget *scroll_area_contents = new QWidget ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
221 scroll_area_contents->setObjectName (QString (lexer->language ())+"_styles");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
222 scroll_area_contents->setLayout (style_grid);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
223 scroll_area->setWidget (scroll_area_contents);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
224 ui->tabs_editor_styles->addTab (scroll_area,lexer->language ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
225 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
226 #endif
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
227
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
228
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15204
diff changeset
229 void
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15204
diff changeset
230 settings_dialog::write_changed_settings ()
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15204
diff changeset
231 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15156
diff changeset
232 QSettings *settings = resource_manager::get_settings ();
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15156
diff changeset
233 // FIXME -- what should happen if settings is 0?
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15156
diff changeset
234
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
235 // the icon set
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
236 QString widget_icon_set = "NONE";
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
237 if (ui->general_icon_letter->isChecked ())
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
238 widget_icon_set = "LETTER";
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
239 else if (ui->general_icon_graphic->isChecked ())
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15787
diff changeset
240 widget_icon_set = "GRAPHIC";
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15368
diff changeset
241 settings->setValue ("DockWidgets/widget_icon_set",widget_icon_set);
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
242
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
243 // language
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
244 QString language = ui->comboBox_language->currentText ();
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
245 if (language == tr("System setting"))
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
246 language = "SYSTEM";
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
247 settings->setValue ("language", language);
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
248
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
249 // other settings
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
250 settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
251 settings->setValue ("customFileEditor", ui->customFileEditor->text ());
13659
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
252 settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
14307
be3e1a14a6de Added an interface settings tab to the settings dialog. Made a few improvements on the editor. Wrote a small welcome text in the welcome wizard. Moved configuration file to ~/.config/octave-gui/settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14290
diff changeset
253 settings->setValue ("editor/highlightCurrentLine", ui->editor_highlightCurrentLine->isChecked ());
13659
d98c6ef06dff included some editor setting into the setting dialog
ttl <ttl@justmail.de>
parents: 13609
diff changeset
254 settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ());
13672
c9501268a194 filename with or without full path in tabs of the editor
ttl <ttl@justmail.de>
parents: 13659
diff changeset
255 settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked());
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15355
diff changeset
256 settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ());
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14308
diff changeset
257 settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value());
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14308
diff changeset
258 settings->setValue ("terminal/fontName", ui->terminal_fontName->currentFont().family());
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
259 settings->setValue ("showFilenames", ui->showFilenames->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
260 settings->setValue ("showFileSize", ui->showFileSize->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
261 settings->setValue ("showFileType", ui->showFileType->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
262 settings->setValue ("showLastModified", ui->showLastModified->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
263 settings->setValue ("showHiddenFiles", ui->showHiddenFiles->isChecked ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
264 settings->setValue ("useAlternatingRowColors", ui->useAlternatingRowColors->isChecked ());
13607
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
265 settings->setValue ("useProxyServer", ui->useProxyServer->isChecked ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
266 settings->setValue ("proxyType", ui->proxyType->currentText ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
267 settings->setValue ("proxyHostName", ui->proxyHostName->text ());
fd31226d4c3a Proxy settings can now be configured.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13537
diff changeset
268 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
269 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
270 settings->setValue ("proxyPassword", ui->proxyPassword->text ());
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
271 settings->setValue ("terminal/cursorBlinking", ui->terminal_cursorBlinking->isChecked ());
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
272
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
273 // the cursor
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
274 QString cursorType;
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
275 switch (ui->terminal_cursorType->currentIndex ())
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
276 {
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
277 case 0: cursorType = "ibeam"; break;
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
278 case 1: cursorType = "block"; break;
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
279 case 2: cursorType = "underline"; break;
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
280 }
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
281 settings->setValue ("terminal/cursorType", cursorType);
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14712
diff changeset
282 settings->sync ();
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
283
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
284 #ifdef HAVE_QSCINTILLA
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
285 // editor styles: create lexer, get dialog contents, and write settings
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
286 QsciLexer *lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
287 lexer = new lexer_octave_gui ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
288 write_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
289 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
290 lexer = new QsciLexerCPP ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
291 write_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
292 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
293 lexer = new QsciLexerPerl ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
294 write_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
295 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
296 lexer = new QsciLexerBatch ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
297 write_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
298 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
299 lexer = new QsciLexerDiff ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
300 write_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
301 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
302 lexer = new QsciLexerBash ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
303 write_lexer_settings (lexer,settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
304 delete lexer;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
305 #endif
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
306 }
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
307
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
308 #ifdef HAVE_QSCINTILLA
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
309 void
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
310 settings_dialog::write_lexer_settings (QsciLexer *lexer, QSettings *settings)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
311 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
312 QWidget *tab = ui->tabs_editor_styles->
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
313 findChild <QWidget *>(QString (lexer->language ())+"_styles");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
314 int styles = 0;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
315 while (lexer->description(styles) != "")
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
316 styles++;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
317 QFontComboBox *select_font;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
318 QSpinBox *font_size;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
319 QCheckBox *attrib_font[3];
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
320 color_picker *color;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
321 int default_size = 10;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
322 QFont default_font = QFont ("Courier New",10,-1,0);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
323 for (int i = 0; i < styles; i++) // get dialog elements and their contents
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
324 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
325 QString actual_name = lexer->description (i);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
326 select_font = tab->findChild <QFontComboBox *>(actual_name+"_font");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
327 font_size = tab->findChild <QSpinBox *>(actual_name+"_size");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
328 attrib_font[0] = tab->findChild <QCheckBox *>(actual_name+"_bold");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
329 attrib_font[1] = tab->findChild <QCheckBox *>(actual_name+"_italic");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
330 attrib_font[2] = tab->findChild <QCheckBox *>(actual_name+"_underline");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
331 color = tab->findChild <color_picker *>(actual_name+"_color");
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
332 QFont new_font = default_font;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
333 if (select_font)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
334 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
335 new_font = select_font->currentFont ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
336 if (i == 0)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
337 default_font = new_font;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
338 else
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
339 if (select_font->currentText () == lexer->description (0))
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
340 new_font = default_font;
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
341 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
342 if (font_size)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
343 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
344 if (i == 0)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
345 {
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
346 default_size = font_size->value ();
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
347 new_font.setPointSize (font_size->value ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
348 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
349 else
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
350 new_font.setPointSize (font_size->value ()+default_size);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
351 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
352 if (attrib_font[0])
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
353 new_font.setBold (attrib_font[0]->isChecked ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
354 if (attrib_font[1])
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
355 new_font.setItalic (attrib_font[1]->isChecked ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
356 if (attrib_font[2])
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
357 new_font.setUnderline (attrib_font[2]->isChecked ());
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
358 lexer->setFont (new_font,i);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
359 if (i == 0)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
360 lexer->setDefaultFont (new_font);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
361 if (color)
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
362 lexer->setColor (color->color (),i);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
363 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
364 lexer->writeSettings (*settings);
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
365 }
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
366 #endif