Mercurial > octave
annotate libgui/src/settings-dialog.cc @ 27570:775412096ae4
use symbolic constants for file dock widget preferences
* files-dock-widget.cc (popdownmenu_search_dir): replace literal by symbolic
constant
* gui-preferences-global.h: add symbolic constant for using native file dialog
* settings-dialog.cc (settings_dialog, get_dir, write_changed_settings):
replace literal by symbolic constant
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Sun, 27 Oct 2019 17:25:36 +0100 |
parents | 3490ea06aba1 |
children | 315c35e6037c |
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 |
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
26309
diff
changeset
|
3 Copyright (C) 2011-2019 Jacob Dawid |
15204
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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24475
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24475
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
10 (at your option) any later version. |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
15 GNU General Public License for more details. |
15204
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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24475
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
15204
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 |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
23 // Programming Note: this file has many lines longer than 80 characters |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
24 // due to long function, variable, and property names. Please don't |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
25 // break those lines as it tends to make this code even harder to read. |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
26 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
27 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21213
diff
changeset
|
28 # include "config.h" |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15274
diff
changeset
|
29 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15274
diff
changeset
|
30 |
25410
cdaa884568b1
add Qt include needed to build against Qt 5.11 (bug #53978)
Mike Miller <mtmiller@octave.org>
parents:
25103
diff
changeset
|
31 #include <QButtonGroup> |
15972
22ab4fe661d7
gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
32 #include <QDir> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
33 #include <QFileDialog> |
15972
22ab4fe661d7
gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
34 #include <QFileInfo> |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
16865
diff
changeset
|
35 #include <QHash> |
22177
6e9f5408c0db
Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
22022
diff
changeset
|
36 #include <QMessageBox> |
25480
00bfb85bfb28
improve panes in gui preferences dialog
Torsten <mttl@mailbox.org>
parents:
25469
diff
changeset
|
37 #include <QScrollBar> |
26227
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
38 #include <QStyleFactory> |
20731
83611b387bc5
provide a user preference for the encoding used by the editor (bug #45597)
Torsten <ttl@justmail.de>
parents:
20706
diff
changeset
|
39 #include <QTextCodec> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
40 #include <QVector> |
13501 | 41 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
42 #if defined (HAVE_QSCINTILLA) |
21203
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
43 # include "octave-qscintilla.h" |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
44 # include "octave-txt-lexer.h" |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
45 # include <QScrollArea> |
16667
7f6f0b3f7369
Allow build to continue without QScintilla lexer for Octave
Ben Abbott <bpabbott@mac.com>
parents:
16646
diff
changeset
|
46 |
21203
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
47 # if defined (HAVE_QSCI_QSCILEXEROCTAVE_H) |
21213
f7d1050b9b53
maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
48 # define HAVE_LEXER_OCTAVE 1 |
21203
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
49 # include <Qsci/qscilexeroctave.h> |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
50 # elif defined (HAVE_QSCI_QSCILEXERMATLAB_H) |
21213
f7d1050b9b53
maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
51 # define HAVE_LEXER_MATLAB 1 |
21203
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
52 # include <Qsci/qscilexermatlab.h> |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
53 # endif |
16677
f6dfc7705623
* settings-dialog.cc: enable octave lexer editor styles if lexer is present
Torsten <ttl@justmail.de>
parents:
16667
diff
changeset
|
54 |
21203
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
55 # include <Qsci/qscilexercpp.h> |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
56 # include <Qsci/qscilexerbash.h> |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
57 # include <Qsci/qscilexerperl.h> |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
58 # include <Qsci/qscilexerbatch.h> |
710e700cdd7f
maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents:
21045
diff
changeset
|
59 # include <Qsci/qscilexerdiff.h> |
16402
7fa90eb41240
gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents:
16379
diff
changeset
|
60 #endif |
7fa90eb41240
gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents:
16379
diff
changeset
|
61 |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
62 #include "gui-preferences-all.h" |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
63 #include "resource-manager.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
64 #include "settings-dialog.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
65 #include "shortcut-manager.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
66 #include "variable-editor.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
67 #include "workspace-model.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
68 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
69 namespace octave |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
70 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
71 #if defined (HAVE_QSCINTILLA) |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
72 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
73 static const int MaxLexerStyles = 64; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
74 static const int MaxStyleNumber = 128; |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
75 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
76 static int get_valid_lexer_styles (QsciLexer *lexer, int *styles) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
77 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
78 int max_style = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
79 int actual_style = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
80 while (actual_style < MaxStyleNumber && max_style < MaxLexerStyles) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
81 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
82 if ((lexer->description (actual_style)) != "") // valid style |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
83 styles[max_style++] = actual_style; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
84 actual_style++; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
85 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
86 return max_style; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
87 } |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
88 |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
89 #endif |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
90 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
91 settings_dialog::settings_dialog (QWidget *p, const QString& desired_tab) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
92 : QDialog (p), Ui::settings_dialog () |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
93 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
94 setupUi (this); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
95 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
96 QSettings *settings = resource_manager::get_settings (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
97 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
98 if (! settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
99 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
100 QMessageBox msgBox |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
101 (QMessageBox::Warning, tr ("Octave Preferences"), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
102 tr ("Unable to save preferences. Missing preferences file or unknown directory.")); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
103 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
104 msgBox.exec (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
105 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
106 return; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
107 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
108 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
109 // look for available language files and the actual settings |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
110 QString qm_dir_name = resource_manager::get_gui_translation_dir (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
111 QDir qm_dir (qm_dir_name); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
112 QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"), QDir::Files | QDir::Readable, QDir::Name); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
113 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
114 for (int i = 0; i < qm_files.length (); i++) // insert available languages |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
115 comboBox_language->addItem (qm_files.at (i).baseName ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
116 // System at beginning |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
117 comboBox_language->insertItem (0, tr ("System setting")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
118 comboBox_language->insertSeparator (1); // separator after System |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
119 QString language = settings->value ("language", "SYSTEM").toString (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
120 if (language == "SYSTEM") |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
121 language = tr ("System setting"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
122 int selected = comboBox_language->findText (language); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
123 if (selected >= 0) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
124 comboBox_language->setCurrentIndex (selected); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
125 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
126 comboBox_language->setCurrentIndex (0); // System is default |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
127 |
26227
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
128 // Global style |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
129 QStringList styles = QStyleFactory::keys(); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
130 combo_styles->addItems (styles); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
131 combo_styles->insertItem (0, global_style.def.toString ()); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
132 combo_styles->insertSeparator (1); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
133 QString current_style = settings->value (global_style.key, global_style.def).toString (); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
134 if (current_style == global_style.def.toString ()) |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
135 current_style = global_style.def.toString (); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
136 selected = combo_styles->findText (current_style); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
137 if (selected >= 0) |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
138 combo_styles->setCurrentIndex (selected); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
139 else |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
140 combo_styles->setCurrentIndex (0); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
141 |
26140
8fb8cb4a03f8
preference for (not) using system icon theme
Torsten <mttl@mailbox.org>
parents:
26135
diff
changeset
|
142 // icon size and theme |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
143 QButtonGroup *icon_size_group = new QButtonGroup (this); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
144 icon_size_group->addButton (icon_size_small); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
145 icon_size_group->addButton (icon_size_normal); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
146 icon_size_group->addButton (icon_size_large); |
26135
a332d83cc659
fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents:
26096
diff
changeset
|
147 int icon_size = settings->value (global_icon_size.key, global_icon_size.def).toInt (); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
148 icon_size_normal->setChecked (true); // the default |
26135
a332d83cc659
fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents:
26096
diff
changeset
|
149 icon_size_small->setChecked (icon_size < 0); |
a332d83cc659
fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents:
26096
diff
changeset
|
150 icon_size_large->setChecked (icon_size > 0); |
26140
8fb8cb4a03f8
preference for (not) using system icon theme
Torsten <mttl@mailbox.org>
parents:
26135
diff
changeset
|
151 cb_system_icon_theme->setChecked (settings->value (global_icon_theme.key, global_icon_theme.def).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
152 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
153 // which icon has to be selected |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
154 QButtonGroup *icon_group = new QButtonGroup (this); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
155 icon_group->addButton (general_icon_octave); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
156 icon_group->addButton (general_icon_graphic); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
157 icon_group->addButton (general_icon_letter); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
158 QString widget_icon_set = |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
159 settings->value ("DockWidgets/widget_icon_set", "NONE").toString (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
160 general_icon_octave->setChecked (true); // the default (if invalid set) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
161 general_icon_octave->setChecked (widget_icon_set == "NONE"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
162 general_icon_graphic->setChecked (widget_icon_set == "GRAPHIC"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
163 general_icon_letter->setChecked (widget_icon_set == "LETTER"); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
164 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
165 // custom title bar of dock widget |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
166 QVariant default_var = QColor (255, 255, 255); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
167 QColor bg_color = settings->value ("DockWidgets/title_bg_color", |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
168 default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
169 m_widget_title_bg_color = new color_picker (bg_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
170 m_widget_title_bg_color->setEnabled (false); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
171 layout_widget_bgtitle->addWidget (m_widget_title_bg_color, 0); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
172 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
173 connect (cb_widget_custom_style, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
174 m_widget_title_bg_color, SLOT (setEnabled (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
175 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
176 default_var = QColor (192, 192, 192); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
177 QColor bg_color_active = settings->value ("DockWidgets/title_bg_color_active", |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
178 default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
179 m_widget_title_bg_color_active = new color_picker (bg_color_active); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
180 m_widget_title_bg_color_active->setEnabled (false); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
181 layout_widget_bgtitle_active->addWidget (m_widget_title_bg_color_active, 0); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
182 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
183 connect (cb_widget_custom_style, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
184 m_widget_title_bg_color_active, SLOT (setEnabled (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
185 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
186 default_var = QColor (0, 0, 0); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
187 QColor fg_color = settings->value ("DockWidgets/title_fg_color", |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
188 default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
189 m_widget_title_fg_color = new color_picker (fg_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
190 m_widget_title_fg_color->setEnabled (false); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
191 layout_widget_fgtitle->addWidget (m_widget_title_fg_color, 0); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
192 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
193 connect (cb_widget_custom_style, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
194 m_widget_title_fg_color, SLOT (setEnabled (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
195 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
196 default_var = QColor (0, 0, 0); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
197 QColor fg_color_active = settings->value ("DockWidgets/title_fg_color_active", |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
198 default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
199 m_widget_title_fg_color_active = new color_picker (fg_color_active); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
200 m_widget_title_fg_color_active->setEnabled (false); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
201 layout_widget_fgtitle_active->addWidget (m_widget_title_fg_color_active, 0); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
202 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
203 connect (cb_widget_custom_style, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
204 m_widget_title_fg_color_active, SLOT (setEnabled (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
205 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
206 sb_3d_title->setValue (settings->value ("DockWidgets/widget_title_3d", 50).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
207 cb_widget_custom_style->setChecked (settings->value ("DockWidgets/widget_title_custom_style", false).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
208 |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
209 // Native file dialogs. |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
210 // FIXME: This preference can be deprecated / removed if all display |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
211 // managers, especially KDE, run those dialogs without hangs or |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
212 // delays from the start (bug #54607). |
27570
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
213 cb_use_native_file_dialogs->setChecked (settings->value ( |
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
214 global_use_native_dialogs.key, |
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
215 global_use_native_dialogs.def).toBool ()); |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
216 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
217 // Cursor blinking: consider old terminal related setting if not yet set |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
218 // FIXME: This pref. can be deprecated / removed if Qt adds support for |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
219 // getting the cursor blink preferences from all OS environments |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
220 if (settings->contains ("cursor_blinking")) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
221 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
222 // Preference exists, read its value |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
223 cb_cursor_blinking->setChecked (settings->value ("cursor_blinking", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
224 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
225 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
226 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
227 // Pref. does not exist, so take old terminal related pref. |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
228 cb_cursor_blinking->setChecked (settings->value ("terminal/cursorBlinking", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
229 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
230 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
231 // prompt on exit |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
232 cb_prompt_to_exit->setChecked (settings->value ("prompt_to_exit", false).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
233 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
234 // Main status bar |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
235 cb_status_bar->setChecked (settings->value ("show_status_bar", true).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
236 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
237 // Octave startup |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
238 cb_restore_octave_dir->setChecked (settings->value ("restore_octave_dir", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
239 le_octave_dir->setText (settings->value ("octave_startup_dir").toString ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
240 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
241 connect (pb_octave_dir, SIGNAL (pressed (void)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
242 this, SLOT (get_octave_dir (void))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
243 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
244 // |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
245 // editor |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
246 // |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
247 useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
248 customFileEditor->setText (settings->value ("customFileEditor").toString ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
249 editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
250 editor_linenr_size->setValue (settings->value ("editor/line_numbers_size", 0).toInt ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
251 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
252 resource_manager::combo_encoding (editor_combo_encoding); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
253 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
254 default_var = QColor (240, 240, 240); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
255 QColor setting_color = settings->value ("editor/highlight_current_line_color", default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
256 m_editor_current_line_color = new color_picker (setting_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
257 editor_grid_current_line->addWidget (m_editor_current_line_color, 0, 3); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
258 m_editor_current_line_color->setMinimumSize (20, 10); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
259 m_editor_current_line_color->setEnabled (false); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
260 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
261 connect (editor_highlightCurrentLine, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
262 m_editor_current_line_color, SLOT (setEnabled (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
263 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
264 editor_highlightCurrentLine->setChecked (settings->value ("editor/highlightCurrentLine", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
265 editor_long_line_marker->setChecked (settings->value ("editor/long_line_marker", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
266 bool long_line = |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
267 settings->value ("editor/long_line_marker_line", true).toBool (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
268 editor_long_line_marker_line->setChecked (long_line); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
269 bool long_back = |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
270 settings->value ("editor/long_line_marker_background", false).toBool (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
271 editor_long_line_marker_background->setChecked (long_back); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
272 if (! (long_line || long_back)) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
273 editor_long_line_marker_line->setChecked (true); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
274 editor_long_line_column->setValue (settings->value ("editor/long_line_column", 80).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
275 editor_break_checkbox->setChecked (settings->value ("editor/break_lines", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
276 editor_break_checkbox->setChecked (settings->value ("editor/break_lines_comments", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
277 editor_wrap_checkbox->setChecked (settings->value ("editor/wrap_lines", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
278 cb_edit_status_bar->setChecked (settings->value ("editor/show_edit_status_bar", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
279 cb_edit_tool_bar->setChecked (settings->value ("editor/show_toolbar", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
280 cb_code_folding->setChecked (settings->value ("editor/code_folding", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
281 editor_highlight_all_occurrences->setChecked (settings->value ("editor/highlight_all_occurrences", true).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
282 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
283 editor_auto_endif->setCurrentIndex (settings->value ("editor/auto_endif", 1).toInt () ); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
284 editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
285 editor_spinbox_ac_threshold->setValue (settings->value ("editor/codeCompletion_threshold", 2).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
286 editor_checkbox_ac_keywords->setChecked (settings->value ("editor/codeCompletion_keywords", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
287 editor_checkbox_ac_builtins->setEnabled (editor_checkbox_ac_keywords->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
288 editor_checkbox_ac_functions->setEnabled (editor_checkbox_ac_keywords->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
289 editor_checkbox_ac_builtins->setChecked (settings->value ("editor/codeCompletion_octave_builtins", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
290 editor_checkbox_ac_functions->setChecked (settings->value ("editor/codeCompletion_octave_functions", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
291 editor_checkbox_ac_document->setChecked (settings->value ("editor/codeCompletion_document", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
292 editor_checkbox_ac_case->setChecked (settings->value ("editor/codeCompletion_case", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
293 editor_checkbox_ac_replace->setChecked (settings->value ("editor/codeCompletion_replace", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
294 editor_ws_checkbox->setChecked (settings->value ("editor/show_white_space", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
295 editor_ws_indent_checkbox->setChecked (settings->value ("editor/show_white_space_indent", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
296 cb_show_eol->setChecked (settings->value ("editor/show_eol_chars", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
297 cb_show_hscrollbar->setChecked (settings->value ("editor/show_hscroll_bar", true).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
298 |
27055
b38807a23fd2
add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26530
diff
changeset
|
299 editor_combox_tab_pos->insertItems (0, ed_tab_position_names); |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
300 editor_combox_tab_pos->setCurrentIndex |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
301 (settings->value (ed_tab_position.key, ed_tab_position.def).toInt ()); |
27055
b38807a23fd2
add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26530
diff
changeset
|
302 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
303 int selected_comment_string, selected_uncomment_string; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
304 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
305 if (settings->contains (ed_comment_str.key)) // new version (radio buttons) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
306 selected_comment_string = settings->value (ed_comment_str.key, |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
307 ed_comment_str.def).toInt (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
308 else // old version (combo box) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
309 selected_comment_string = settings->value (ed_comment_str_old.key, |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
310 ed_comment_str.def).toInt (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
311 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
312 selected_uncomment_string = settings->value (ed_uncomment_str.key, |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
313 ed_uncomment_str.def).toInt (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
314 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
315 for (int i = 0; i < ed_comment_strings_count; i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
316 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
317 m_rb_comment_strings[i] = new QRadioButton (); |
26530
dc02f20df07d
Use check boxes for "uncommenting text" strings in editor properties (bug #55404).
Markus Mützel <markus.muetzel@gmx.de>
parents:
26518
diff
changeset
|
318 m_rb_uncomment_strings[i] = new QCheckBox (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
319 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
320 connect (m_rb_comment_strings[i], SIGNAL (clicked (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
321 m_rb_uncomment_strings[i], SLOT (setChecked (bool))); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
322 connect (m_rb_comment_strings[i], SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
323 m_rb_uncomment_strings[i], SLOT (setDisabled (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
324 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
325 m_rb_comment_strings[i]->setText (ed_comment_strings.at(i)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
326 m_rb_comment_strings[i]->setChecked (i == selected_comment_string); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
327 layout_comment_strings->addWidget (m_rb_comment_strings[i]); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
328 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
329 m_rb_uncomment_strings[i]->setText (ed_comment_strings.at(i)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
330 m_rb_uncomment_strings[i]->setAutoExclusive (false); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
331 m_rb_uncomment_strings[i]->setChecked ( 1 << i & selected_uncomment_string); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
332 layout_uncomment_strings->addWidget (m_rb_uncomment_strings[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
333 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
334 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
335 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
336 #if defined (HAVE_QSCINTILLA) |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
337 # if defined (Q_OS_WIN32) |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
338 int eol_mode = QsciScintilla::EolWindows; |
26518
80e69933b6c0
Use LF as default EOL character on MacOS.
Markus Mützel <markus.muetzel@gmx.de>
parents:
26376
diff
changeset
|
339 # else |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
340 int eol_mode = QsciScintilla::EolUnix; |
26518
80e69933b6c0
Use LF as default EOL character on MacOS.
Markus Mützel <markus.muetzel@gmx.de>
parents:
26376
diff
changeset
|
341 # endif |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
342 #else |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
343 int eol_mode = 2; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
344 #endif |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
345 combo_eol_mode->setCurrentIndex (settings->value ("editor/default_eol_mode", eol_mode).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
346 editor_auto_ind_checkbox->setChecked (settings->value ("editor/auto_indent", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
347 editor_tab_ind_checkbox->setChecked (settings->value ("editor/tab_indents_line", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
348 editor_bs_unind_checkbox->setChecked (settings->value ("editor/backspace_unindents_line", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
349 editor_ind_guides_checkbox->setChecked (settings->value ("editor/show_indent_guides", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
350 editor_ind_width_spinbox->setValue (settings->value ("editor/indent_width", 2).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
351 editor_ind_uses_tabs_checkbox->setChecked (settings->value ("editor/indent_uses_tabs", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
352 editor_tab_width_spinbox->setValue (settings->value ("editor/tab_width", 2).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
353 editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
354 editor_notebook_tab_width_min->setValue (settings->value ("editor/notebook_tab_width_min", 160).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
355 editor_notebook_tab_width_max->setValue (settings->value ("editor/notebook_tab_width_max", 300).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
356 editor_restoreSession->setChecked (settings->value ("editor/restoreSession", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
357 editor_create_new_file->setChecked (settings->value ("editor/create_new_file", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
358 editor_reload_changed_files->setChecked (settings->value ("editor/always_reload_changed_files", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
359 editor_hiding_closes_files->setChecked (settings->value ("editor/hiding_closes_files", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
360 editor_show_dbg_file->setChecked (settings->value (ed_show_dbg_file.key, ed_show_dbg_file.def).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
361 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
362 // terminal |
26008
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
363 QString default_font = settings->value (global_mono_font.key, global_mono_font.def).toString (); |
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
364 terminal_fontName->setCurrentFont (QFont (settings->value (cs_font.key, default_font).toString ())); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
365 terminal_fontSize->setValue (settings->value ("terminal/fontSize", 10).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
366 terminal_history_buffer->setValue (settings->value ("terminal/history_buffer", 1000).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
367 terminal_cursorUseForegroundColor->setChecked (settings->value ("terminal/cursorUseForegroundColor", true).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
368 terminal_focus_command->setChecked (settings->value ("terminal/focus_after_command", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
369 terminal_print_dbg_location->setChecked (settings->value ("terminal/print_debug_location", false).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
370 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
371 QString cursorType |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
372 = settings->value ("terminal/cursorType", "ibeam").toString (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
373 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
374 QStringList items; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
375 items << QString ("0") << QString ("1") << QString ("2"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
376 terminal_cursorType->addItems (items); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
377 terminal_cursorType->setItemText (0, tr ("IBeam Cursor")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
378 terminal_cursorType->setItemText (1, tr ("Block Cursor")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
379 terminal_cursorType->setItemText (2, tr ("Underline Cursor")); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
380 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
381 if (cursorType == "ibeam") |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
382 terminal_cursorType->setCurrentIndex (0); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
383 else if (cursorType == "block") |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
384 terminal_cursorType->setCurrentIndex (1); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
385 else if (cursorType == "underline") |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
386 terminal_cursorType->setCurrentIndex (2); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
387 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
388 // file browser |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
389 connect (sync_octave_directory, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
390 this, SLOT (set_disabled_pref_file_browser_dir (bool))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
391 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
392 sync_octave_directory->setChecked (settings->value (fb_sync_octdir.key, fb_sync_octdir.def).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
393 cb_restore_file_browser_dir->setChecked (settings->value (fb_restore_last_dir.key, fb_restore_last_dir.def).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
394 le_file_browser_dir->setText (settings->value (fb_startup_dir.key).toString ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
395 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
396 connect (pb_file_browser_dir, SIGNAL (pressed (void)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
397 this, SLOT (get_file_browser_dir (void))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
398 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
399 le_file_browser_extensions->setText (settings->value (fb_txt_file_ext.key, fb_txt_file_ext.def).toString ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
400 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
401 checkbox_allow_web_connect->setChecked (settings->value ("news/allow_web_connection", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
402 useProxyServer->setChecked (settings->value ("useProxyServer", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
403 proxyHostName->setText (settings->value ("proxyHostName").toString ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
404 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
405 int currentIndex = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
406 QString proxyTypeString = settings->value ("proxyType").toString (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
407 while ((currentIndex < proxyType->count ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
408 && (proxyType->currentText () != proxyTypeString)) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
409 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
410 currentIndex++; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
411 proxyType->setCurrentIndex (currentIndex); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
412 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
413 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
414 proxyPort->setText (settings->value ("proxyPort").toString ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
415 proxyUserName->setText (settings->value ("proxyUserName").toString ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
416 proxyPassword->setText (settings->value ("proxyPassword").toString ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
417 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
418 // Workspace |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
419 read_workspace_colors (settings); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
420 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
421 // terminal colors |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
422 read_terminal_colors (settings); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
423 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
424 // variable editor |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
425 varedit_columnWidth->setValue (settings->value ("variable_editor/column_width", 100).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
426 varedit_autoFitColumnWidth->setChecked (settings->value ("variable_editor/autofit_column_width", false).toBool ()); |
27563
3490ea06aba1
fix incorrect gui preference key
John W. Eaton <jwe@octave.org>
parents:
27562
diff
changeset
|
427 varedit_autofitType->setCurrentIndex (settings->value ("variable_editor/autofit_type", 0).toInt ()); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
428 varedit_rowHeight->setValue (settings->value ("variable_editor/row_height", 10).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
429 varedit_rowAutofit->setChecked (settings->value ("variable_editor/autofit_row_height", true).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
430 |
26008
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
431 varedit_font->setCurrentFont (QFont (settings->value ("variable_editor/font_name", settings->value (cs_font.key, default_font)).toString ())); |
27562
d7876110e854
use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
432 varedit_fontSize->setValue (settings->value (ve_font_size.key, ve_font_size.def).toInt ()); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
433 connect (varedit_useTerminalFont, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
434 varedit_font, SLOT (setDisabled (bool))); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
435 connect (varedit_useTerminalFont, SIGNAL (toggled (bool)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
436 varedit_fontSize, SLOT (setDisabled (bool))); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
437 varedit_useTerminalFont->setChecked (settings->value ("variable_editor/use_terminal_font", false).toBool ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
438 varedit_font->setDisabled (varedit_useTerminalFont->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
439 varedit_fontSize->setDisabled (varedit_useTerminalFont->isChecked ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
440 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
441 varedit_alternate->setChecked (settings->value ("variable_editor/alternate_rows", QVariant (false)).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
442 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
443 // variable editor colors |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
444 read_varedit_colors (settings); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
445 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
446 // shortcuts |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
447 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
448 cb_prevent_readline_conflicts->setChecked (settings->value ("shortcuts/prevent_readline_conflicts", true).toBool ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
449 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
450 // initialize the tree view with all shortcut data |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
451 shortcut_manager::fill_treewidget (shortcuts_treewidget); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
452 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
453 // connect the buttons for import/export of the shortcut sets |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
454 connect (btn_import_shortcut_set, SIGNAL (clicked (void)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
455 this, SLOT (import_shortcut_set (void))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
456 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
457 connect (btn_export_shortcut_set, SIGNAL (clicked (void)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
458 this, SLOT (export_shortcut_set (void))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
459 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
460 connect (btn_default_shortcut_set, SIGNAL (clicked (void)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
461 this, SLOT (default_shortcut_set (void))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
462 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
463 #if defined (HAVE_QSCINTILLA) |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
464 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
465 // editor styles: create lexer, read settings, and create dialog elements |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
466 QsciLexer *lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
467 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
468 #if defined (HAVE_LEXER_OCTAVE) |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
469 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
470 lexer = new QsciLexerOctave (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
471 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
472 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
473 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
474 #elif defined (HAVE_LEXER_MATLAB) |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
475 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
476 lexer = new QsciLexerMatlab (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
477 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
478 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
479 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
480 #endif |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
481 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
482 lexer = new QsciLexerCPP (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
483 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
484 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
485 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
486 lexer = new QsciLexerPerl (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
487 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
488 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
489 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
490 lexer = new QsciLexerBatch (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
491 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
492 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
493 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
494 lexer = new QsciLexerDiff (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
495 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
496 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
497 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
498 lexer = new QsciLexerBash (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
499 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
500 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
501 |
27102
84ff9953faa1
where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27055
diff
changeset
|
502 lexer = new octave_txt_lexer (); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
503 read_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
504 delete lexer; |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
505 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
506 #endif |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
507 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
508 // which tab is the desired one? |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
509 show_tab (desired_tab); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
510 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
511 // connect button box signal |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
512 connect (button_box, SIGNAL (clicked (QAbstractButton *)), |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
513 this, SLOT (button_clicked (QAbstractButton *))); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
514 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
515 // restore last geometry |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
516 if (settings->contains ("settings/geometry")) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
517 restoreGeometry (settings->value ("settings/geometry").toByteArray ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
518 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
519 setGeometry (QRect (10,50,1000,600)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
520 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
521 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
522 void settings_dialog::show_tab (const QString& tab) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
523 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
524 if (tab.isEmpty ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
525 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
526 QSettings *settings = resource_manager::get_settings (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
527 if (settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
528 tabWidget->setCurrentIndex (settings->value ("settings/last_tab", 0).toInt ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
529 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
530 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
531 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
532 QHash <QString, QWidget*> tab_hash; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
533 tab_hash["editor"] = tab_editor; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
534 tab_hash["editor_styles"] = tab_editor; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
535 tabWidget->setCurrentIndex (tabWidget->indexOf (tab_hash.value (tab))); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
536 if (tab == "editor_styles") |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
537 tab_editor_scroll_area->ensureWidgetVisible (group_box_editor_styles); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
538 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
539 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
540 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
541 void settings_dialog::get_octave_dir (void) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
542 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
543 get_dir (le_octave_dir, tr ("Set Octave Startup Directory")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
544 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
545 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
546 void settings_dialog::get_file_browser_dir (void) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
547 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
548 get_dir (le_file_browser_dir, tr ("Set File Browser Startup Directory")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
549 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
550 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
551 void settings_dialog::get_dir (QLineEdit *line_edit, const QString& title) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
552 { |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
553 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
554 int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks; |
27570
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
555 if (! resource_manager::get_settings ()->value ( |
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
556 global_use_native_dialogs.key, |
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
557 global_use_native_dialogs.def).toBool ()) |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
558 opts |= QFileDialog::DontUseNativeDialog; |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
559 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
560 QString dir = QFileDialog::getExistingDirectory |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
561 (this, title, line_edit->text (), QFileDialog::Option (opts)); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
562 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
563 line_edit->setText (dir); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
564 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
565 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
566 void settings_dialog::button_clicked (QAbstractButton *button) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
567 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
568 QDialogButtonBox::ButtonRole button_role = button_box->buttonRole (button); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
569 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
570 if (button_role == QDialogButtonBox::ApplyRole |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
571 || button_role == QDialogButtonBox::AcceptRole) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
572 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
573 write_changed_settings (button_role == QDialogButtonBox::AcceptRole); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
574 emit apply_new_settings (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
575 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
576 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
577 if (button_role == QDialogButtonBox::RejectRole |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
578 || button_role == QDialogButtonBox::AcceptRole) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
579 close (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
580 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
581 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
582 void settings_dialog::set_disabled_pref_file_browser_dir (bool disable) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
583 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
584 cb_restore_file_browser_dir->setDisabled (disable); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
585 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
586 if (! disable) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
587 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
588 le_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
589 pb_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
590 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
591 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
592 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
593 le_file_browser_dir->setDisabled (disable); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
594 pb_file_browser_dir->setDisabled (disable); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
595 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
596 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
597 |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
598 // slots for import/export of shortcut sets |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
599 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
600 void settings_dialog::import_shortcut_set (void) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
601 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
602 shortcut_manager::import_export (shortcut_manager::OSC_IMPORT); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
603 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
604 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
605 void settings_dialog::export_shortcut_set (void) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
606 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
607 shortcut_manager::import_export (shortcut_manager::OSC_EXPORT); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
608 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
609 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
610 void settings_dialog::default_shortcut_set (void) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
611 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
612 shortcut_manager::import_export (shortcut_manager::OSC_DEFAULT); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
613 } |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
614 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
615 void settings_dialog::read_lexer_settings (QsciLexer *lexer, |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
616 QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
617 { |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
618 #if defined (HAVE_QSCINTILLA) |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
619 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
620 lexer->readSettings (*settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
621 int styles[MaxLexerStyles]; // array for saving valid styles |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
622 // (enum is not continuous) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
623 int max_style = get_valid_lexer_styles (lexer, styles); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
624 QGridLayout *style_grid = new QGridLayout (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
625 QVector<QLabel*> description (max_style); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
626 QVector<QFontComboBox*> select_font (max_style); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
627 QVector<QSpinBox*> font_size (max_style); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
628 QVector<QCheckBox*> attrib_font (3 * max_style); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
629 QVector<color_picker*> color (max_style); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
630 QVector<color_picker*> bg_color (max_style); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
631 int default_size = 10; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
632 QFont default_font = QFont (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
633 int label_width; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
634 QColor default_color = QColor (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
635 QColor dummy_color = QColor (255, 0, 255); |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
636 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
637 for (int i = 0; i < max_style; i++) // create dialog elements for all styles |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
638 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
639 QString actual_name = lexer->description (styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
640 QFont actual_font = lexer->font (styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
641 description[i] = new QLabel (actual_name); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
642 description[i]->setWordWrap (true); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
643 label_width = 24*description[i]->fontMetrics ().averageCharWidth (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
644 description[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
645 description[i]->setMinimumSize (label_width, 1); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
646 select_font[i] = new QFontComboBox (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
647 select_font[i]->setObjectName (actual_name + "_font"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
648 select_font[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
649 select_font[i]->setMinimumSize (label_width, 1); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
650 font_size[i] = new QSpinBox (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
651 font_size[i]->setObjectName (actual_name + "_size"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
652 if (styles[i] == 0) // the default |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
653 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
654 select_font[i]->setCurrentFont (actual_font); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
655 default_font = actual_font; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
656 font_size[i]->setRange (6, 24); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
657 default_size = actual_font.pointSize (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
658 font_size[i]->setValue (default_size); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
659 default_color = lexer->defaultPaper (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
660 bg_color[i] = new color_picker (default_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
661 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
662 else // other styles |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
663 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
664 select_font[i]->setCurrentFont (actual_font); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
665 if (actual_font.family () == default_font.family ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
666 select_font[i]->setEditText (lexer->description (0)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
667 font_size[i]->setRange (-4, 4); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
668 font_size[i]->setValue (actual_font.pointSize ()-default_size); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
669 font_size[i]->setToolTip (QObject::tr ("Difference to the default size")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
670 if (lexer->paper (styles[i]) == default_color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
671 bg_color[i] = new color_picker (dummy_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
672 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
673 bg_color[i] = new color_picker (lexer->paper (styles[i])); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
674 bg_color[i]->setToolTip |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
675 (QObject::tr ("Background color, pink (255, 0, 255) means default")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
676 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
677 attrib_font[0+3*i] = new QCheckBox (QObject::tr ("b", "short form for bold")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
678 attrib_font[1+3*i] = new QCheckBox (QObject::tr ("i", "short form for italic")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
679 attrib_font[2+3*i] = new QCheckBox (QObject::tr ("u", "short form for underlined")); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
680 attrib_font[0+3*i]->setChecked (actual_font.bold ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
681 attrib_font[0+3*i]->setObjectName (actual_name + "_bold"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
682 attrib_font[1+3*i]->setChecked (actual_font.italic ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
683 attrib_font[1+3*i]->setObjectName (actual_name + "_italic"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
684 attrib_font[2+3*i]->setChecked (actual_font.underline ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
685 attrib_font[2+3*i]->setObjectName (actual_name + "_underline"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
686 color[i] = new color_picker (lexer->color (styles[i])); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
687 color[i]->setObjectName (actual_name + "_color"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
688 bg_color[i]->setObjectName (actual_name + "_bg_color"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
689 int column = 1; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
690 style_grid->addWidget (description[i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
691 style_grid->addWidget (select_font[i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
692 style_grid->addWidget (font_size[i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
693 style_grid->addWidget (attrib_font[0+3*i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
694 style_grid->addWidget (attrib_font[1+3*i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
695 style_grid->addWidget (attrib_font[2+3*i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
696 style_grid->addWidget (color[i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
697 style_grid->addWidget (bg_color[i], i, column++); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
698 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
699 // place grid with elements into the tab |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
700 QScrollArea *scroll_area = new QScrollArea (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
701 QWidget *scroll_area_contents = new QWidget (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
702 scroll_area_contents->setObjectName (QString (lexer->language ()) + "_styles"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
703 scroll_area_contents->setLayout (style_grid); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
704 scroll_area->setWidget (scroll_area_contents); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
705 tabs_editor_lexers->addTab (scroll_area, lexer->language ()); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
706 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
707 tabs_editor_lexers->setCurrentIndex (settings->value ("settings/last_editor_styles_tab", 0).toInt ()); |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
708 |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
709 #else |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
710 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
711 octave_unused_parameter (lexer); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
712 octave_unused_parameter (settings); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
713 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
714 #endif |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
715 } |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
716 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
717 void settings_dialog::write_lexer_settings (QsciLexer *lexer, |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
718 QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
719 { |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
720 #if defined (HAVE_QSCINTILLA) |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
721 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
722 QWidget *tab = tabs_editor_lexers-> |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
723 findChild <QWidget *> (QString (lexer->language ()) + "_styles"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
724 int styles[MaxLexerStyles]; // array for saving valid styles |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
725 // (enum is not continuous) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
726 int max_style = get_valid_lexer_styles (lexer, styles); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
727 QFontComboBox *select_font; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
728 QSpinBox *font_size; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
729 QCheckBox *attrib_font[3]; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
730 color_picker *color; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
731 color_picker *bg_color; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
732 int default_size = 10; |
26008
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
733 |
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
734 QString default_font_name |
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
735 = settings->value (global_mono_font.key, global_mono_font.def).toString (); |
38a881b8fbec
do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents:
25974
diff
changeset
|
736 QFont default_font = QFont (default_font_name, 10, -1, 0); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
737 QColor default_color = QColor (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
738 QColor dummy_color = QColor (255, 0, 255); |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
739 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
740 for (int i = 0; i < max_style; i++) // get dialog elements and their contents |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
741 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
742 QString actual_name = lexer->description (styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
743 select_font = tab->findChild <QFontComboBox *> (actual_name + "_font"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
744 font_size = tab->findChild <QSpinBox *> (actual_name + "_size"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
745 attrib_font[0] = tab->findChild <QCheckBox *> (actual_name + "_bold"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
746 attrib_font[1] = tab->findChild <QCheckBox *> (actual_name + "_italic"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
747 attrib_font[2] = tab->findChild <QCheckBox *> (actual_name + "_underline"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
748 color = tab->findChild <color_picker *> (actual_name + "_color"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
749 bg_color = tab->findChild <color_picker *> (actual_name + "_bg_color"); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
750 QFont new_font = default_font; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
751 if (select_font) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
752 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
753 new_font = select_font->currentFont (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
754 if (styles[i] == 0) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
755 default_font = new_font; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
756 else if (select_font->currentText () == lexer->description (0)) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
757 new_font = default_font; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
758 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
759 if (font_size) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
760 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
761 if (styles[i] == 0) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
762 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
763 default_size = font_size->value (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
764 new_font.setPointSize (font_size->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
765 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
766 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
767 new_font.setPointSize (font_size->value ()+default_size); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
768 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
769 if (attrib_font[0]) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
770 new_font.setBold (attrib_font[0]->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
771 if (attrib_font[1]) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
772 new_font.setItalic (attrib_font[1]->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
773 if (attrib_font[2]) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
774 new_font.setUnderline (attrib_font[2]->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
775 lexer->setFont (new_font, styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
776 if (styles[i] == 0) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
777 lexer->setDefaultFont (new_font); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
778 if (color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
779 lexer->setColor (color->color (), styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
780 if (bg_color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
781 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
782 if (styles[i] == 0) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
783 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
784 default_color = bg_color->color (); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
785 lexer->setPaper (default_color, styles[i]); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
786 lexer->setDefaultPaper (default_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
787 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
788 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
789 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
790 if (bg_color->color () == dummy_color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
791 lexer->setPaper (default_color, styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
792 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
793 lexer->setPaper (bg_color->color (), styles[i]); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
794 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
795 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
796 } |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
797 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
798 lexer->writeSettings (*settings); |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
799 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
800 settings->setValue ("settings/last_editor_styles_tab", |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
801 tabs_editor_lexers->currentIndex ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
802 settings->sync (); |
25953
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
803 |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
804 #else |
526b51129c06
inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents:
25870
diff
changeset
|
805 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
806 octave_unused_parameter (lexer); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
807 octave_unused_parameter (settings); |
20279
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
808 |
3a745710eaca
Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents:
19913
diff
changeset
|
809 #endif |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
810 } |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
811 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
812 void settings_dialog::write_changed_settings (bool closing) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
813 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
814 QSettings *settings = resource_manager::get_settings (); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
815 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
816 // the icon set |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
817 QString widget_icon_set = "NONE"; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
818 if (general_icon_letter->isChecked ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
819 widget_icon_set = "LETTER"; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
820 else if (general_icon_graphic->isChecked ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
821 widget_icon_set = "GRAPHIC"; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
822 settings->setValue ("DockWidgets/widget_icon_set", widget_icon_set); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
823 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
824 // language |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
825 QString language = comboBox_language->currentText (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
826 if (language == tr ("System setting")) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
827 language = "SYSTEM"; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
828 settings->setValue ("language", language); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
829 |
26227
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
830 // style |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
831 QString selected_style = combo_styles->currentText (); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
832 if (selected_style == global_style.def.toString ()) |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
833 selected_style = global_style.def.toString (); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
834 settings->setValue (global_style.key, selected_style); |
2355f66cf91d
allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents:
26140
diff
changeset
|
835 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
836 // dock widget title bar |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
837 settings->setValue ("DockWidgets/widget_title_custom_style", cb_widget_custom_style->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
838 settings->setValue ("DockWidgets/widget_title_3d", sb_3d_title->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
839 settings->setValue ("DockWidgets/title_bg_color", m_widget_title_bg_color->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
840 settings->setValue ("DockWidgets/title_bg_color_active", m_widget_title_bg_color_active->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
841 settings->setValue ("DockWidgets/title_fg_color", m_widget_title_fg_color->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
842 settings->setValue ("DockWidgets/title_fg_color_active", m_widget_title_fg_color_active->color ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
843 |
26140
8fb8cb4a03f8
preference for (not) using system icon theme
Torsten <mttl@mailbox.org>
parents:
26135
diff
changeset
|
844 // icon size and theme |
26135
a332d83cc659
fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents:
26096
diff
changeset
|
845 int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked (); |
a332d83cc659
fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents:
26096
diff
changeset
|
846 settings->setValue (global_icon_size.key, icon_size); |
26140
8fb8cb4a03f8
preference for (not) using system icon theme
Torsten <mttl@mailbox.org>
parents:
26135
diff
changeset
|
847 settings->setValue (global_icon_theme.key, cb_system_icon_theme->isChecked ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
848 |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
849 // native file dialogs |
27570
775412096ae4
use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27563
diff
changeset
|
850 settings->setValue (global_use_native_dialogs.key, cb_use_native_file_dialogs->isChecked ()); |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26008
diff
changeset
|
851 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
852 // cursor blinking |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
853 settings->setValue ("cursor_blinking", cb_cursor_blinking->isChecked ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
854 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
855 // promp to exit |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
856 settings->setValue ("prompt_to_exit", cb_prompt_to_exit->isChecked ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
857 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
858 // status bar |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
859 settings->setValue ("show_status_bar", cb_status_bar->isChecked ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
860 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
861 // Octave startup |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
862 settings->setValue ("restore_octave_dir", cb_restore_octave_dir->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
863 settings->setValue ("octave_startup_dir", le_octave_dir->text ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
864 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
865 //editor |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
866 settings->setValue ("useCustomFileEditor", useCustomFileEditor->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
867 settings->setValue ("customFileEditor", customFileEditor->text ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
868 settings->setValue ("editor/showLineNumbers", editor_showLineNumbers->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
869 settings->setValue ("editor/line_numbers_size", editor_linenr_size->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
870 settings->setValue ("editor/highlightCurrentLine", editor_highlightCurrentLine->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
871 settings->setValue ("editor/highlight_current_line_color", m_editor_current_line_color->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
872 settings->setValue ("editor/long_line_marker", editor_long_line_marker->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
873 settings->setValue ("editor/long_line_marker_line", editor_long_line_marker_line->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
874 settings->setValue ("editor/long_line_marker_background", editor_long_line_marker_background->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
875 settings->setValue ("editor/long_line_column", editor_long_line_column->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
876 settings->setValue ("editor/break_lines", editor_break_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
877 settings->setValue ("editor/break_lines_comments", editor_break_comments_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
878 settings->setValue ("editor/wrap_lines", editor_wrap_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
879 settings->setValue ("editor/code_folding", cb_code_folding->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
880 settings->setValue ("editor/show_edit_status_bar", cb_edit_status_bar->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
881 settings->setValue ("editor/show_toolbar", cb_edit_tool_bar->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
882 settings->setValue ("editor/highlight_all_occurrences", editor_highlight_all_occurrences->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
883 settings->setValue ("editor/codeCompletion", editor_codeCompletion->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
884 settings->setValue ("editor/codeCompletion_threshold", editor_spinbox_ac_threshold->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
885 settings->setValue ("editor/codeCompletion_keywords", editor_checkbox_ac_keywords->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
886 settings->setValue ("editor/codeCompletion_octave_builtins", editor_checkbox_ac_builtins->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
887 settings->setValue ("editor/codeCompletion_octave_functions", editor_checkbox_ac_functions->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
888 settings->setValue ("editor/codeCompletion_document", editor_checkbox_ac_document->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
889 settings->setValue ("editor/codeCompletion_case", editor_checkbox_ac_case->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
890 settings->setValue ("editor/codeCompletion_replace", editor_checkbox_ac_replace->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
891 settings->setValue ("editor/auto_endif", editor_auto_endif->currentIndex ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
892 settings->setValue ("editor/show_white_space", editor_ws_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
893 settings->setValue ("editor/show_white_space_indent", editor_ws_indent_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
894 settings->setValue ("editor/show_eol_chars", cb_show_eol->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
895 settings->setValue ("editor/show_hscroll_bar", cb_show_hscrollbar->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
896 settings->setValue ("editor/default_eol_mode", combo_eol_mode->currentIndex ()); |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
24290
diff
changeset
|
897 |
27055
b38807a23fd2
add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26530
diff
changeset
|
898 settings->setValue (ed_tab_position.key, editor_combox_tab_pos->currentIndex ()); |
b38807a23fd2
add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26530
diff
changeset
|
899 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
900 // Comment strings |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
901 int rb_uncomment = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
902 for (int i = 0; i < ed_comment_strings_count; i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
903 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
904 if (m_rb_comment_strings[i]->isChecked ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
905 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
906 settings->setValue (ed_comment_str.key, i); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
907 if (i < 3) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
908 settings->setValue (ed_comment_str_old.key, i); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
909 else |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
910 settings->setValue (ed_comment_str_old.key, ed_comment_str.def); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
911 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
912 if (m_rb_uncomment_strings[i]->isChecked ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
913 rb_uncomment = rb_uncomment + (1 << i); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
914 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
915 settings->setValue (ed_uncomment_str.key, rb_uncomment); |
24475
8cb985e362f3
Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents:
24290
diff
changeset
|
916 |
27562
d7876110e854
use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
917 settings->setValue (ed_default_enc.key, editor_combo_encoding->currentText ()); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
918 settings->setValue ("editor/auto_indent", editor_auto_ind_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
919 settings->setValue ("editor/tab_indents_line", editor_tab_ind_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
920 settings->setValue ("editor/backspace_unindents_line", editor_bs_unind_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
921 settings->setValue ("editor/show_indent_guides", editor_ind_guides_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
922 settings->setValue ("editor/indent_width", editor_ind_width_spinbox->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
923 settings->setValue ("editor/indent_uses_tabs", editor_ind_uses_tabs_checkbox->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
924 settings->setValue ("editor/tab_width", editor_tab_width_spinbox->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
925 settings->setValue ("editor/longWindowTitle", editor_longWindowTitle->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
926 settings->setValue ("editor/notebook_tab_width_min", editor_notebook_tab_width_min->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
927 settings->setValue ("editor/notebook_tab_width_max", editor_notebook_tab_width_max->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
928 settings->setValue ("editor/restoreSession", editor_restoreSession->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
929 settings->setValue ("editor/create_new_file", editor_create_new_file->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
930 settings->setValue ("editor/hiding_closes_files", editor_hiding_closes_files->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
931 settings->setValue ("editor/always_reload_changed_files", editor_reload_changed_files->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
932 settings->setValue (ed_show_dbg_file.key, editor_show_dbg_file->isChecked ()); |
25622
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25617
diff
changeset
|
933 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
934 settings->setValue ("terminal/fontSize", terminal_fontSize->value ()); |
27562
d7876110e854
use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
935 settings->setValue (cs_font.key, terminal_fontName->currentFont ().family ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
936 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
937 // file browser |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
938 settings->setValue (fb_sync_octdir.key, sync_octave_directory->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
939 settings->setValue (fb_restore_last_dir.key, cb_restore_file_browser_dir->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
940 settings->setValue (fb_startup_dir.key, le_file_browser_dir->text ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
941 settings->setValue (fb_txt_file_ext.key, le_file_browser_extensions->text ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
942 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
943 settings->setValue ("news/allow_web_connection", checkbox_allow_web_connect->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
944 settings->setValue ("useProxyServer", useProxyServer->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
945 settings->setValue ("proxyType", proxyType->currentText ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
946 settings->setValue ("proxyHostName", proxyHostName->text ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
947 settings->setValue ("proxyPort", proxyPort->text ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
948 settings->setValue ("proxyUserName", proxyUserName->text ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
949 settings->setValue ("proxyPassword", proxyPassword->text ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
950 settings->setValue ("terminal/cursorUseForegroundColor", terminal_cursorUseForegroundColor->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
951 settings->setValue ("terminal/focus_after_command", terminal_focus_command->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
952 settings->setValue ("terminal/print_debug_location", terminal_print_dbg_location->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
953 settings->setValue ("terminal/history_buffer", terminal_history_buffer->value ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
954 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
955 // the cursor |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
956 QString cursorType; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
957 switch (terminal_cursorType->currentIndex ()) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
958 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
959 case 0: cursorType = "ibeam"; break; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
960 case 1: cursorType = "block"; break; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
961 case 2: cursorType = "underline"; break; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
962 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
963 settings->setValue ("terminal/cursorType", cursorType); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
964 |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
965 #if defined (HAVE_QSCINTILLA) |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
966 // editor styles: create lexer, get dialog contents, and write settings |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
967 QsciLexer *lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
968 |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
969 #if defined (HAVE_LEXER_OCTAVE) |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
970 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
971 lexer = new QsciLexerOctave (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
972 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
973 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
974 |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
975 #elif defined (HAVE_LEXER_MATLAB) |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
976 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
977 lexer = new QsciLexerMatlab (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
978 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
979 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
980 |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
981 #endif |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
982 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
983 lexer = new QsciLexerCPP (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
984 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
985 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
986 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
987 lexer = new QsciLexerPerl (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
988 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
989 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
990 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
991 lexer = new QsciLexerBatch (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
992 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
993 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
994 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
995 lexer = new QsciLexerDiff (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
996 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
997 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
998 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
999 lexer = new QsciLexerBash (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1000 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1001 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1002 |
27102
84ff9953faa1
where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27055
diff
changeset
|
1003 lexer = new octave_txt_lexer (); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1004 write_lexer_settings (lexer, settings); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1005 delete lexer; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1006 |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1007 #endif |
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1008 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1009 // Workspace |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1010 write_workspace_colors (settings); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1011 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1012 // Terminal |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1013 write_terminal_colors (settings); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1014 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1015 // Variable editor |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1016 settings->setValue ("variable_editor/autofit_column_width", varedit_autoFitColumnWidth->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1017 settings->setValue ("variable_editor/autofit_type", varedit_autofitType->currentIndex ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1018 settings->setValue ("variable_editor/column_width", varedit_columnWidth->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1019 settings->setValue ("variable_editor/row_height", varedit_rowHeight->value ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1020 settings->setValue ("variable_editor/autofit_row_height", varedit_rowAutofit->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1021 settings->setValue ("variable_editor/use_terminal_font", varedit_useTerminalFont->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1022 settings->setValue ("variable_editor/alternate_rows", varedit_alternate->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1023 settings->setValue ("variable_editor/font_name", varedit_font->currentFont ().family ()); |
27562
d7876110e854
use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents:
27560
diff
changeset
|
1024 settings->setValue (ve_font_size.key, varedit_fontSize->value ()); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1025 write_varedit_colors (settings); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1026 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1027 // shortcuts |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1028 settings->setValue ("shortcuts/prevent_readline_conflicts", cb_prevent_readline_conflicts->isChecked ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1029 shortcut_manager::write_shortcuts (settings, closing); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1030 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1031 // settings dialog's geometry |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1032 settings->setValue ("settings/last_tab", tabWidget->currentIndex ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1033 settings->setValue ("settings/geometry", saveGeometry ()); |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1034 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1035 settings->sync (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1036 } |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1037 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1038 void settings_dialog::read_workspace_colors (QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1039 { |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1040 // Construct the grid with all color related settings |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1041 QList<QColor> default_colors = |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1042 resource_manager::storage_class_default_colors (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1043 QStringList class_names = resource_manager::storage_class_names (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1044 QString class_chars = resource_manager::storage_class_chars (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1045 int nr_of_classes = class_chars.length (); |
16610
a1f613e5066d
workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents:
16525
diff
changeset
|
1046 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1047 QGridLayout *style_grid = new QGridLayout (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1048 QVector<QLabel*> description (nr_of_classes); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1049 QVector<color_picker*> color (nr_of_classes); |
16610
a1f613e5066d
workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents:
16525
diff
changeset
|
1050 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1051 int column = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1052 int row = 0; |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1053 |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1054 m_ws_enable_colors = new QCheckBox (tr ("Enable attribute colors")); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1055 style_grid->addWidget (m_ws_enable_colors, row++, column, 1, 4); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1056 |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1057 m_ws_hide_tool_tips = new QCheckBox (tr ("Hide tools tips")); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1058 style_grid->addWidget (m_ws_hide_tool_tips, row++, column, 1, 4); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1059 connect (m_ws_enable_colors, SIGNAL (toggled (bool)), |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1060 m_ws_hide_tool_tips, SLOT(setEnabled (bool))); |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
1061 m_ws_hide_tool_tips->setChecked |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
1062 (settings->value (ws_hide_tool_tips.key, ws_hide_tool_tips.def).toBool ()); |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1063 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1064 for (int i = 0; i < nr_of_classes; i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1065 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1066 description[i] = new QLabel (" " + class_names.at (i)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1067 description[i]->setAlignment (Qt::AlignRight); |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1068 connect (m_ws_enable_colors, SIGNAL (toggled (bool)), |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1069 description[i], SLOT(setEnabled (bool))); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1070 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1071 QVariant default_var = default_colors.at (i); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1072 QColor setting_color = settings->value ("workspaceview/color_" + class_chars.mid (i, 1), default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1073 color[i] = new color_picker (setting_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1074 color[i]->setObjectName ("color_" + class_chars.mid (i, 1)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1075 color[i]->setMinimumSize (30, 10); |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1076 connect (m_ws_enable_colors, SIGNAL (toggled (bool)), |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1077 color[i], SLOT(setEnabled (bool))); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1078 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1079 style_grid->addWidget (description[i], row, 3*column); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1080 style_grid->addWidget (color[i], row, 3*column+1); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1081 if (++column == 3) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1082 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1083 style_grid->setColumnStretch (4*column, 10); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1084 row++; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1085 column = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1086 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1087 } |
16610
a1f613e5066d
workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents:
16525
diff
changeset
|
1088 |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1089 // Load enable settings at the end for having signals already connected |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1090 bool colors_enabled = |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1091 settings->value (ws_enable_colors.key, ws_enable_colors.def).toBool (); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1092 m_ws_enable_colors->setChecked (colors_enabled); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1093 m_ws_hide_tool_tips->setEnabled (colors_enabled); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1094 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1095 // place grid with elements into the tab |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1096 workspace_colors_box->setLayout (style_grid); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1097 } |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1098 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1099 void settings_dialog::write_workspace_colors (QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1100 { |
25974
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1101 settings->setValue (ws_enable_colors.key, m_ws_enable_colors->isChecked ()); |
c3cd63006870
add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents:
25954
diff
changeset
|
1102 settings->setValue (ws_hide_tool_tips.key, m_ws_hide_tool_tips->isChecked ()); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1103 |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1104 QString class_chars = resource_manager::storage_class_chars (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1105 color_picker *color; |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1106 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1107 for (int i = 0; i < class_chars.length (); i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1108 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1109 color = workspace_colors_box->findChild <color_picker *> ("color_" + class_chars.mid (i, 1)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1110 if (color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1111 settings->setValue ("workspaceview/color_" + class_chars.mid (i, 1), color->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1112 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1113 settings->sync (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1114 } |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23996
diff
changeset
|
1115 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1116 void settings_dialog::read_terminal_colors (QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1117 { |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
1118 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1119 QList<QColor> default_colors = resource_manager::terminal_default_colors (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1120 QStringList class_names = resource_manager::terminal_color_names (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1121 QString class_chars = resource_manager::terminal_color_chars (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1122 int nr_of_classes = class_chars.length (); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
1123 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1124 QGridLayout *style_grid = new QGridLayout (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1125 QVector<QLabel*> description (nr_of_classes); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1126 QVector<color_picker*> color (nr_of_classes); |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
1127 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1128 int column = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1129 int row = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1130 for (int i = 0; i < nr_of_classes; i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1131 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1132 description[i] = new QLabel (" " + class_names.at (i)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1133 description[i]->setAlignment (Qt::AlignRight); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1134 QVariant default_var = default_colors.at (i); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1135 QColor setting_color = settings->value ("terminal/color_" + class_chars.mid (i, 1), default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1136 color[i] = new color_picker (setting_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1137 color[i]->setObjectName ("terminal_color_" + class_chars.mid (i, 1)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1138 color[i]->setMinimumSize (30, 10); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1139 style_grid->addWidget (description[i], row, 2*column); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1140 style_grid->addWidget (color[i], row, 2*column+1); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1141 if (++column == 2) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1142 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1143 style_grid->setColumnStretch (3*column, 10); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1144 row++; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1145 column = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1146 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1147 } |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
1148 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1149 // place grid with elements into the tab |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1150 terminal_colors_box->setLayout (style_grid); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1151 } |
16402
7fa90eb41240
gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents:
16379
diff
changeset
|
1152 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1153 void settings_dialog::write_terminal_colors (QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1154 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1155 QString class_chars = resource_manager::terminal_color_chars (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1156 color_picker *color; |
16620
818eef7b2618
allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents:
16610
diff
changeset
|
1157 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1158 for (int i = 0; i < class_chars.length (); i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1159 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1160 color = terminal_colors_box->findChild <color_picker *> ("terminal_color_" + class_chars.mid (i, 1)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1161 if (color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1162 settings->setValue ("terminal/color_" + class_chars.mid (i, 1), color->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1163 } |
19632
101ce4eaa56c
prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents:
19631
diff
changeset
|
1164 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1165 settings->sync (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1166 } |
18310
03a8428adef7
gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents:
18309
diff
changeset
|
1167 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1168 void settings_dialog::read_varedit_colors (QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1169 { |
27102
84ff9953faa1
where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27055
diff
changeset
|
1170 QList<QColor> default_colors = variable_editor::default_colors (); |
84ff9953faa1
where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27055
diff
changeset
|
1171 QStringList class_names = variable_editor::color_names (); |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1172 QString class_chars = resource_manager::varedit_color_chars (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1173 int nr_of_classes = class_chars.length (); |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23810
diff
changeset
|
1174 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1175 QGridLayout *style_grid = new QGridLayout (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1176 QVector<QLabel*> description (nr_of_classes); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1177 QVector<color_picker*> color (nr_of_classes); |
18310
03a8428adef7
gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents:
18309
diff
changeset
|
1178 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1179 int column = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1180 int row = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1181 for (int i = 0; i < nr_of_classes; i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1182 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1183 description[i] = new QLabel (" " + class_names.at (i)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1184 description[i]->setAlignment (Qt::AlignRight); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1185 QVariant default_var = default_colors.at (i); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1186 QColor setting_color = settings->value ("variable_editor/color_" + class_chars.mid (i, 1), default_var).value<QColor> (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1187 color[i] = new color_picker (setting_color); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1188 color[i]->setObjectName ("varedit_color_" + class_chars.mid (i, 1)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1189 color[i]->setMinimumSize (30, 10); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1190 style_grid->addWidget (description[i], row, 2*column); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1191 style_grid->addWidget (color[i], row, 2*column+1); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1192 if (++column == 2) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1193 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1194 style_grid->setColumnStretch (3*column, 10); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1195 row++; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1196 column = 0; |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1197 } |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1198 } |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23810
diff
changeset
|
1199 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1200 // place grid with elements into the tab |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1201 varedit_colors_box->setLayout (style_grid); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1202 } |
18310
03a8428adef7
gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents:
18309
diff
changeset
|
1203 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1204 void settings_dialog::write_varedit_colors (QSettings *settings) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1205 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1206 QString class_chars = resource_manager::varedit_color_chars (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1207 color_picker *color; |
18822
3f6280d0a36b
allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents:
18733
diff
changeset
|
1208 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1209 for (int i = 0; i < class_chars.length (); i++) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1210 { |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1211 color = varedit_colors_box->findChild <color_picker *> ("varedit_color_" + class_chars.mid (i, 1)); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1212 if (color) |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1213 settings->setValue ("variable_editor/color_" + class_chars.mid (i, 1), color->color ()); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1214 } |
18822
3f6280d0a36b
allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents:
18733
diff
changeset
|
1215 |
25954
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1216 settings->sync (); |
f2406585a974
move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25953
diff
changeset
|
1217 } |
20702
b6b16d8c8b57
possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents:
20685
diff
changeset
|
1218 } |