annotate libgui/src/settings-dialog.cc @ 29148:d9ac99164c18

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 06 Dec 2020 14:56:04 +0100
parents 2a70a068c4ab a43cf0300dcd
children bb6bb306b8a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 // Copyright (C) 2011-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
13674
c0e66d6e3dc8 Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13672
diff changeset
25
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
26 // 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
27 // 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
28 // 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
29
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
30 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21213
diff changeset
31 # include "config.h"
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
32 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
33
25410
cdaa884568b1 add Qt include needed to build against Qt 5.11 (bug #53978)
Mike Miller <mtmiller@octave.org>
parents: 25103
diff changeset
34 #include <QButtonGroup>
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
35 #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
36 #include <QFileDialog>
15972
22ab4fe661d7 gui: selectable language in settings dialog
Torsten <ttl@justmail.de>
parents: 15914
diff changeset
37 #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
38 #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
39 #include <QMessageBox>
25480
00bfb85bfb28 improve panes in gui preferences dialog
Torsten <mttl@mailbox.org>
parents: 25469
diff changeset
40 #include <QScrollBar>
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
41 #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
42 #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
43 #include <QVector>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
44
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
45 #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
46 # include "octave-qscintilla.h"
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
47 # 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
48 # include <QScrollArea>
16667
7f6f0b3f7369 Allow build to continue without QScintilla lexer for Octave
Ben Abbott <bpabbott@mac.com>
parents: 16646
diff changeset
49
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
50 # if defined (HAVE_QSCI_QSCILEXEROCTAVE_H)
21213
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21203
diff changeset
51 # 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
52 # include <Qsci/qscilexeroctave.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
53 # elif defined (HAVE_QSCI_QSCILEXERMATLAB_H)
21213
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21203
diff changeset
54 # 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
55 # include <Qsci/qscilexermatlab.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
56 # endif
16677
f6dfc7705623 * settings-dialog.cc: enable octave lexer editor styles if lexer is present
Torsten <ttl@justmail.de>
parents: 16667
diff changeset
57
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
58 # include <Qsci/qscilexercpp.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
59 # include <Qsci/qscilexerbash.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
60 # include <Qsci/qscilexerperl.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
61 # include <Qsci/qscilexerbatch.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
62 # include <Qsci/qscilexerdiff.h>
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
63 #endif
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
64
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents: 27412
diff changeset
65 #include "gui-preferences-all.h"
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
66 #include "octave-qobject.h"
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27276
diff changeset
67 #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
68 #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
69 #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
70
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
71 namespace octave
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
72 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
73 #if defined (HAVE_QSCINTILLA)
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
74
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
75 static const int MaxLexerStyles = 64;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
76 static const int MaxStyleNumber = 128;
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
77
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
78 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
79 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
80 int max_style = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
81 int actual_style = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
82 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
83 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
84 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
85 styles[max_style++] = actual_style;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
86 actual_style++;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
87 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
88 return max_style;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
89 }
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
90
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
91 #endif
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
92
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
93 settings_dialog::settings_dialog (QWidget *p, base_qobject& oct_qobj,
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27613
diff changeset
94 const QString& desired_tab)
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
95 : QDialog (p), Ui::settings_dialog (), m_octave_qobj (oct_qobj)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
96 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
97 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
98
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
99 resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
100 gui_settings *settings = rmgr.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
101
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
102 if (! settings)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
103 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
104 QMessageBox msgBox
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
105 (QMessageBox::Warning, tr ("Octave Preferences"),
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
106 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
107
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
108 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
109
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
110 return;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
111 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
112
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
113 // look for available language files and the actual settings
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
114 QString qm_dir_name = rmgr.get_gui_translation_dir ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
115 QDir qm_dir (qm_dir_name);
27935
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
116 QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"),
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
117 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
118
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
119 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
120 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
121 // System at beginning
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
122 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
123 comboBox_language->insertSeparator (1); // separator after System
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
124 QString language = settings->value (global_language.key,
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
125 global_language.def).toString ();
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
126 if (language == global_language.def.toString ())
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
127 language = tr ("System setting");
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
128 int selected = comboBox_language->findText (language);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
129 if (selected >= 0)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
130 comboBox_language->setCurrentIndex (selected);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
131 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
132 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
133
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
134 // Global style
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
135 QStringList styles = QStyleFactory::keys();
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
136 combo_styles->addItems (styles);
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
137 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
138 combo_styles->insertSeparator (1);
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
139 QString current_style = settings->value (global_style).toString ();
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
140 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
141 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
142 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
143 if (selected >= 0)
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
144 combo_styles->setCurrentIndex (selected);
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
145 else
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
146 combo_styles->setCurrentIndex (0);
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
147
26140
8fb8cb4a03f8 preference for (not) using system icon theme
Torsten <mttl@mailbox.org>
parents: 26135
diff changeset
148 // icon size and theme
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
149 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
150 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
151 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
152 icon_size_group->addButton (icon_size_large);
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
153 int icon_size = settings->value (global_icon_size).toInt ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
154 icon_size_normal->setChecked (true); // the default
26135
a332d83cc659 fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents: 26096
diff changeset
155 icon_size_small->setChecked (icon_size < 0);
a332d83cc659 fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents: 26096
diff changeset
156 icon_size_large->setChecked (icon_size > 0);
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
157 cb_system_icon_theme->setChecked (settings->value (global_icon_theme).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
158
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
159 // which icon has to be selected
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
160 QButtonGroup *icon_group = new QButtonGroup (this);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
161 icon_group->addButton (general_icon_octave);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
162 icon_group->addButton (general_icon_graphic);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
163 icon_group->addButton (general_icon_letter);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
164 QString widget_icon_set =
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
165 settings->value (dw_icon_set).toString ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
166 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
167 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
168 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
169 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
170
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
171 // custom title bar of dock widget
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
172 QColor bg_color = settings->value (dw_title_bg_color).value<QColor> ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
173 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
174 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
175 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
176
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
177 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
178 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
179
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
180 QColor bg_color_active = settings->value (dw_title_bg_color_active).value<QColor> ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
181 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
182 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
183 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
184
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
185 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
186 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
187
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
188 QColor fg_color = settings->value (dw_title_fg_color).value<QColor> ();
25954
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
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
196 QColor fg_color_active = settings->value (dw_title_fg_color_active).value<QColor> ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
197 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
198 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
199 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
200
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
201 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
202 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
203
27935
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
204 sb_3d_title->setValue (settings->value (dw_title_3d.key,
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
205 dw_title_3d.def).toInt ());
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
206 cb_widget_custom_style->setChecked (settings->value (dw_title_custom_style).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
207
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
208 // Native file dialogs.
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
209 // 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
210 // 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
211 // delays from the start (bug #54607).
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
212 cb_use_native_file_dialogs->setChecked (settings->value (global_use_native_dialogs).toBool ());
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
213
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
214 // 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
215 // 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
216 // getting the cursor blink preferences from all OS environments
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
217 if (settings->contains (global_cursor_blinking.key))
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
218 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
219 // Preference exists, read its value
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
220 cb_cursor_blinking->setChecked (settings->value
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
221 (global_cursor_blinking.key, global_cursor_blinking.def).toBool ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
222 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
223 else
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 // Pref. does not exist, so take old terminal related pref.
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
226 cb_cursor_blinking->setChecked (settings->value
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
227 (cs_cursor_blinking.key, cs_cursor_blinking.def).toBool ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
228 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
229
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
230 // prompt on exit
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
231 cb_prompt_to_exit->setChecked (
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
232 settings->value (global_prompt_to_exit.key, global_prompt_to_exit.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
233
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
234 // Main status bar
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
235 cb_status_bar->setChecked (
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
236 settings->value (global_status_bar.key, global_status_bar.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
237
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
238 // Octave startup
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
239 cb_restore_octave_dir->setChecked (
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
240 settings->value (global_restore_ov_dir.key, global_restore_ov_dir.def).toBool ());
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
241 le_octave_dir->setText (settings->value (global_ov_startup_dir.key,
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
242 global_ov_startup_dir.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
243
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
244 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
245 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
246
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
247 //
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
248 // editor
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
249 //
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
250 useCustomFileEditor->setChecked (
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
251 settings->value (global_use_custom_editor.key, global_use_custom_editor.def).toBool ());
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
252 customFileEditor->setText (
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
253 settings->value (global_custom_editor.key, global_custom_editor.def).toString ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
254 editor_showLineNumbers->setChecked (settings->value (ed_show_line_numbers).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
255 editor_linenr_size->setValue (settings->value (ed_line_numbers_size).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
256
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
257 rmgr.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
258
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
259 QColor setting_color = settings->value (ed_highlight_current_line_color).value<QColor> ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
260 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
261 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
262 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
263 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
264
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
265 connect (editor_highlightCurrentLine, SIGNAL (toggled (bool)),
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
266 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
267
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
268 editor_highlightCurrentLine->setChecked (settings->value (ed_highlight_current_line).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
269 editor_long_line_marker->setChecked (settings->value (ed_long_line_marker).toBool ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
270 bool long_line =
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
271 settings->value (ed_long_line_marker_line).toBool ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
272 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
273 bool long_back =
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
274 settings->value (ed_long_line_marker_background).toBool ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
275 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
276 if (! (long_line || long_back))
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
277 editor_long_line_marker_line->setChecked (true);
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
278 editor_long_line_column->setValue (settings->value (ed_long_line_column).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
279 editor_break_checkbox->setChecked (settings->value (ed_break_lines).toBool ());
28334
f54cc65a487b fix break long editor lines preference (bug #58396)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27935
diff changeset
280 editor_break_comments_checkbox->setChecked (settings->value (ed_break_lines_comments).toBool ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
281 editor_wrap_checkbox->setChecked (settings->value (ed_wrap_lines).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
282 cb_edit_status_bar->setChecked (settings->value (ed_show_edit_status_bar).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
283 cb_edit_tool_bar->setChecked (settings->value (ed_show_toolbar).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
284 cb_code_folding->setChecked (settings->value (ed_code_folding).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
285 editor_highlight_all_occurrences->setChecked (settings->value (ed_highlight_all_occurrences).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
286
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
287 editor_auto_endif->setCurrentIndex (settings->value (ed_auto_endif).toInt () );
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
288 editor_codeCompletion->setChecked (settings->value (ed_code_completion).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
289 editor_spinbox_ac_threshold->setValue (settings->value (ed_code_completion_threshold).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
290 editor_checkbox_ac_keywords->setChecked (settings->value (ed_code_completion_keywords).toBool ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
291 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
292 editor_checkbox_ac_functions->setEnabled (editor_checkbox_ac_keywords->isChecked ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
293 editor_checkbox_ac_builtins->setChecked (settings->value (ed_code_completion_octave_builtins).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
294 editor_checkbox_ac_functions->setChecked (settings->value (ed_code_completion_octave_functions).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
295 editor_checkbox_ac_document->setChecked (settings->value (ed_code_completion_document).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
296 editor_checkbox_ac_case->setChecked (settings->value (ed_code_completion_case).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
297 editor_checkbox_ac_replace->setChecked (settings->value (ed_code_completion_replace).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
298 editor_ws_checkbox->setChecked (settings->value (ed_show_white_space).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
299 editor_ws_indent_checkbox->setChecked (settings->value (ed_show_white_space_indent).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
300 cb_show_eol->setChecked (settings->value (ed_show_eol_chars).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
301 cb_show_hscrollbar->setChecked (settings->value (ed_show_hscroll_bar).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
302
27890
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
303 for (int i = 0; i < ed_tab_position_names.length (); i++)
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
304 editor_combox_tab_pos->insertItem (i,
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
305 tr (ed_tab_position_names.at (i).toStdString ().data ()));
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
306 editor_combox_tab_pos->setCurrentIndex
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
307 (settings->value (ed_tab_position).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
308
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
309 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
310
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
311 if (settings->contains (ed_comment_str.key)) // new version (radio buttons)
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
312 selected_comment_string = settings->value (ed_comment_str).toInt ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
313 else // old version (combo box)
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
314 selected_comment_string = settings->value (ed_comment_str_old.key, 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
315
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
316 selected_uncomment_string = settings->value (ed_uncomment_str).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
317
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
318 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
319 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
320 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
321 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
322
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
323 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
324 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
325 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
326 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
327
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
328 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
329 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
330 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
331
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
332 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
333 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
334 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
335 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
336 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
337
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
338
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
339 combo_eol_mode->setCurrentIndex (settings->value (ed_default_eol_mode).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
340 editor_auto_ind_checkbox->setChecked (settings->value (ed_auto_indent).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
341 editor_tab_ind_checkbox->setChecked (settings->value (ed_tab_indents_line).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
342 editor_bs_unind_checkbox->setChecked (settings->value (ed_backspace_unindents_line).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
343 editor_ind_guides_checkbox->setChecked (settings->value (ed_show_indent_guides).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
344 editor_ind_width_spinbox->setValue (settings->value (ed_indent_width).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
345 editor_ind_uses_tabs_checkbox->setChecked (settings->value (ed_indent_uses_tabs).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
346 editor_tab_width_spinbox->setValue (settings->value (ed_tab_width).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
347 editor_longWindowTitle->setChecked (settings->value (ed_long_window_title).toBool ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
348 editor_notebook_tab_width_min->setValue (settings->value (ed_notebook_tab_width_min).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
349 editor_notebook_tab_width_max->setValue (settings->value (ed_notebook_tab_width_max).toInt ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
350 editor_restoreSession->setChecked (settings->value (ed_restore_session).toBool ());
27849
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27818
diff changeset
351 editor_create_new_file->setChecked (settings->value (ed_create_new_file).toBool ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
352 editor_reload_changed_files->setChecked (settings->value (ed_always_reload_changed_files).toBool ());
28132
4cfe24f56336 add editor prefs for forcing coding standards (bug #57860, bug #57861)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27935
diff changeset
353 editor_force_newline->setChecked (settings->value (ed_force_newline).toBool ());
4cfe24f56336 add editor prefs for forcing coding standards (bug #57860, bug #57861)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27935
diff changeset
354 editor_remove_trailing_spaces->setChecked (settings->value (ed_rm_trailing_spaces).toBool ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
355 editor_hiding_closes_files->setChecked (settings->value (ed_hiding_closes_files).toBool ());
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
356 editor_show_dbg_file->setChecked (settings->value (ed_show_dbg_file).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
357
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
358 // terminal
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
359 QString default_font = settings->value (global_mono_font).toString ();
26008
38a881b8fbec do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents: 25974
diff changeset
360 terminal_fontName->setCurrentFont (QFont (settings->value (cs_font.key, default_font).toString ()));
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
361 terminal_fontSize->setValue (settings->value (cs_font_size).toInt ());
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
362 terminal_history_buffer->setValue (settings->value (cs_hist_buffer).toInt ());
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
363 terminal_cursorUseForegroundColor->setChecked (settings->value (cs_cursor_use_fgcol).toBool ());
27849
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27818
diff changeset
364 terminal_focus_command->setChecked (settings->value (cs_focus_cmd).toBool ());
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27818
diff changeset
365 terminal_print_dbg_location->setChecked (settings->value (cs_dbg_location).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
366
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
367 QString cursor_type
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
368 = settings->value (cs_cursor).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
369
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
370 QStringList items;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
371 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
372 terminal_cursorType->addItems (items);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
373 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
374 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
375 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
376
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
377 for (unsigned int i = 0; i < cs_cursor_types.size (); i++)
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
378 {
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
379 if (cursor_type.toStdString () == cs_cursor_types[i])
27935
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
380 {
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
381 terminal_cursorType->setCurrentIndex (i);
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
382 break;
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
383 }
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
384 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
385
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
386 // file browser
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
387 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
388 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
389
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
390 sync_octave_directory->setChecked (settings->value (fb_sync_octdir).toBool ());
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
391 cb_restore_file_browser_dir->setChecked (settings->value (fb_restore_last_dir).toBool ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
392 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
393
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
394 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
395 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
396
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
397 le_file_browser_extensions->setText (settings->value (fb_txt_file_ext).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
398
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
399 checkbox_allow_web_connect->setChecked (settings->value (nr_allow_connection).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
400
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
401 // Proxy
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
402 bool use_proxy = settings->value (global_use_proxy.key, global_use_proxy.def).toBool ();
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
403 use_proxy_server->setChecked (use_proxy);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
404 // Fill combo box and activate current one
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
405 QString proxy_type_string = settings->value (global_proxy_type.key, global_proxy_type.def).toString ();
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
406 proxy_type->addItems (global_proxy_all_types);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
407 for (int i = 0; i < global_proxy_all_types.length (); i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
408 {
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
409 if (proxy_type->itemText (i) == proxy_type_string)
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
410 {
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
411 proxy_type->setCurrentIndex (i);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
412 break;
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
413 }
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
414 }
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
415 // Fill all line edits
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
416 proxy_host_name->setText (settings->value (global_proxy_host.key, global_proxy_host.def).toString ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
417 proxy_port->setText (settings->value (global_proxy_port.key, global_proxy_port.def).toString ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
418 proxy_username->setText (settings->value (global_proxy_user.key, global_proxy_user.def).toString ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
419 proxy_password->setText (settings->value (global_proxy_pass.key, global_proxy_pass.def).toString ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
420 // Connect relevant signals for dis-/enabling some elements
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
421 connect (proxy_type, SIGNAL (currentIndexChanged (int)),
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
422 this, SLOT (proxy_items_update (void)));
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
423 connect (use_proxy_server, SIGNAL (toggled (bool)),
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
424 this, SLOT (proxy_items_update (void)));
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
425 // Check whehter line edits have to be enabled
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
426 proxy_items_update ();
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
427
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
428 // Workspace
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
429 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
430
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
431 // terminal colors
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
432 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
433
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
434 // variable editor
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
435 varedit_columnWidth->setValue (settings->value (ve_column_width).toInt ());
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
436 varedit_rowHeight->setValue (settings->value (ve_row_height).toInt ());
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
437
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
438 varedit_font->setCurrentFont (QFont (settings->value (ve_font_name.key,
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
439 settings->value (cs_font.key, default_font)).toString ()));
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
440 varedit_fontSize->setValue (settings->value (ve_font_size).toInt ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
441 connect (varedit_useTerminalFont, SIGNAL (toggled (bool)),
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
442 varedit_font, SLOT (setDisabled (bool)));
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
443 connect (varedit_useTerminalFont, SIGNAL (toggled (bool)),
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
444 varedit_fontSize, SLOT (setDisabled (bool)));
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
445 varedit_useTerminalFont->setChecked (settings->value (ve_use_terminal_font).toBool ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
446 varedit_font->setDisabled (varedit_useTerminalFont->isChecked ());
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
447 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
448
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
449 varedit_alternate->setChecked (settings->value (ve_alternate_rows).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
450
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
451 // variable editor colors
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
452 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
453
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
454 // 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
455
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
456 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
457
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27805
diff changeset
458 cb_prevent_readline_conflicts->setChecked (
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27805
diff changeset
459 settings->value (sc_prevent_rl_conflicts.key,
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27805
diff changeset
460 sc_prevent_rl_conflicts.def).toBool ());
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28409
diff changeset
461 cb_prevent_readline_conflicts_menu->setChecked (
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28409
diff changeset
462 settings->value (sc_prevent_rl_conflicts_menu.key,
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28409
diff changeset
463 sc_prevent_rl_conflicts_menu.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
464
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
465 // initialize the tree view with all shortcut data
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
466 scmgr.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
467
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
468 // 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
469 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
470 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
471
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
472 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
473 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
474
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
475 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
476 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
477
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
478 #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
479
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
480 // 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
481 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
482
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
483 #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
484
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
485 lexer = new QsciLexerOctave ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
486 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
487 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
488
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
489 #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
490
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
491 lexer = new QsciLexerMatlab ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
492 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
493 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
494
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
495 #endif
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
496
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
497 lexer = new QsciLexerCPP ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
498 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
499 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
500
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
501 lexer = new QsciLexerPerl ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
502 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
503 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
504
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
505 lexer = new QsciLexerBatch ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
506 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
507 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
508
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
509 lexer = new QsciLexerDiff ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
510 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
511 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
512
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
513 lexer = new QsciLexerBash ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
514 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
515 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
516
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27055
diff changeset
517 lexer = new octave_txt_lexer ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
518 read_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
519 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
520
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
521 #endif
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
522
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
523 // which tab is the desired one?
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
524 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
525
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
526 // connect button box signal
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
527 connect (button_box, SIGNAL (clicked (QAbstractButton *)),
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
528 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
529
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
530 // restore last geometry
27867
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
531 if (settings->contains (sd_geometry.key))
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
532 restoreGeometry (settings->value (sd_geometry).toByteArray ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
533 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
534 setGeometry (QRect (10,50,1000,600));
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
535 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
536
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
537 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
538 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
539 if (tab.isEmpty ())
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
540 {
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
541 resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
542 gui_settings *settings = rmgr.get_settings ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
543 if (settings)
27867
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
544 tabWidget->setCurrentIndex (settings->value (sd_last_tab).toInt ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
545 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
546 else
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 QHash <QString, QWidget*> tab_hash;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
549 tab_hash["editor"] = tab_editor;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
550 tab_hash["editor_styles"] = tab_editor;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
551 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
552 if (tab == "editor_styles")
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
553 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
554 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
555 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
556
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
557 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
558 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
559 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
560 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
561
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
562 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
563 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
564 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
565 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
566
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
567 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
568 {
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
569 // 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
570 int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks;
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
571 resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
572 gui_settings *settings = rmgr.get_settings ();
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
573 if (! settings->value (global_use_native_dialogs).toBool ())
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
574 opts |= QFileDialog::DontUseNativeDialog;
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
575
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
576 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
577 (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
578
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
579 line_edit->setText (dir);
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::button_clicked (QAbstractButton *button)
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 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
585
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
586 if (button_role == QDialogButtonBox::ApplyRole
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
587 || button_role == QDialogButtonBox::AcceptRole)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
588 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
589 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
590 emit apply_new_settings ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
591 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
592
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
593 if (button_role == QDialogButtonBox::RejectRole
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
594 || button_role == QDialogButtonBox::AcceptRole)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
595 close ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
596 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
597
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
598 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
599 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
600 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
601
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
602 if (! disable)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
603 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
604 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
605 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
606 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
607 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
608 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
609 le_file_browser_dir->setDisabled (disable);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
610 pb_file_browser_dir->setDisabled (disable);
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 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
613
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
614 // slot for updating enabled state of proxy settings
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
615 void settings_dialog::proxy_items_update (void)
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
616 {
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
617 bool use_proxy = use_proxy_server->isChecked ();
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
618
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
619 bool manual = false;
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
620 for (int i = 0; i < global_proxy_manual_types.length (); i++)
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
621 {
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
622 if (proxy_type->currentIndex () == global_proxy_manual_types.at (i))
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
623 {
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
624 manual = true;
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
625 break;
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
626 }
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
627 }
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
628
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
629 proxy_type->setEnabled (use_proxy);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
630 proxy_host_name_label->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
631 proxy_host_name->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
632 proxy_port_label->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
633 proxy_port->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
634 proxy_username_label->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
635 proxy_username->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
636 proxy_password_label->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
637 proxy_password->setEnabled (use_proxy && manual);
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
638 }
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
639
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
640 // 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
641
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
642 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
643 {
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
644 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
645
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
646 scmgr.import_export (shortcut_manager::OSC_IMPORT);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
647 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
648
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
649 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
650 {
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
651 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
652
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
653 scmgr.import_export (shortcut_manager::OSC_EXPORT);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
654 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
655
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
656 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
657 {
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
658 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
659
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
660 scmgr.import_export (shortcut_manager::OSC_DEFAULT);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
661 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
662
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
663 void settings_dialog::read_lexer_settings (QsciLexer *lexer,
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
664 gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
665 {
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
666 #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
667
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
668 lexer->readSettings (*settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
669 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
670 // (enum is not continuous)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
671 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
672 QGridLayout *style_grid = new QGridLayout ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
673 QVector<QLabel*> description (max_style);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
674 QVector<QFontComboBox*> select_font (max_style);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
675 QVector<QSpinBox*> font_size (max_style);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
676 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
677 QVector<color_picker*> color (max_style);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
678 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
679 int default_size = 10;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
680 QFont default_font = QFont ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
681 int label_width;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
682 QColor default_color = QColor ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
683 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
684
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
685 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
686 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
687 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
688 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
689 description[i] = new QLabel (actual_name);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
690 description[i]->setWordWrap (true);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
691 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
692 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
693 description[i]->setMinimumSize (label_width, 1);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
694 select_font[i] = new QFontComboBox ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
695 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
696 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
697 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
698 font_size[i] = new QSpinBox ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
699 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
700 if (styles[i] == 0) // the default
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
701 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
702 select_font[i]->setCurrentFont (actual_font);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
703 default_font = actual_font;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
704 font_size[i]->setRange (6, 24);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
705 default_size = actual_font.pointSize ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
706 font_size[i]->setValue (default_size);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
707 default_color = lexer->defaultPaper ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
708 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
709 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
710 else // other styles
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
711 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
712 select_font[i]->setCurrentFont (actual_font);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
713 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
714 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
715 font_size[i]->setRange (-4, 4);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
716 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
717 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
718 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
719 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
720 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
721 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
722 bg_color[i]->setToolTip
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
723 (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
724 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
725 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
726 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
727 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
728 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
729 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
730 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
731 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
732 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
733 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
734 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
735 color[i]->setObjectName (actual_name + "_color");
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
736 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
737 int column = 1;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
738 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
739 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
740 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
741 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
742 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
743 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
744 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
745 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
746 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
747 // 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
748 QScrollArea *scroll_area = new QScrollArea ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
749 QWidget *scroll_area_contents = new QWidget ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
750 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
751 scroll_area_contents->setLayout (style_grid);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
752 scroll_area->setWidget (scroll_area_contents);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
753 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
754
27867
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
755 tabs_editor_lexers->setCurrentIndex (settings->value (sd_last_editor_styles_tab).toInt ());
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
756
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
757 #else
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
758
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
759 octave_unused_parameter (lexer);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
760 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
761
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
762 #endif
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
763 }
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
764
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
765 void settings_dialog::write_lexer_settings (QsciLexer *lexer,
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
766 gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
767 {
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
768 #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
769
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
770 QWidget *tab = tabs_editor_lexers->
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
771 findChild <QWidget *> (QString (lexer->language ()) + "_styles");
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
772 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
773 // (enum is not continuous)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
774 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
775 QFontComboBox *select_font;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
776 QSpinBox *font_size;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
777 QCheckBox *attrib_font[3];
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
778 color_picker *color;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
779 color_picker *bg_color;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
780 int default_size = 10;
26008
38a881b8fbec do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents: 25974
diff changeset
781
38a881b8fbec do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents: 25974
diff changeset
782 QString default_font_name
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
783 = settings->value (global_mono_font).toString ();
26008
38a881b8fbec do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents: 25974
diff changeset
784 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
785 QColor default_color = QColor ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
786 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
787
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
788 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
789 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
790 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
791 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
792 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
793 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
794 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
795 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
796 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
797 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
798 QFont new_font = default_font;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
799 if (select_font)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
800 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
801 new_font = select_font->currentFont ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
802 if (styles[i] == 0)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
803 default_font = new_font;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
804 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
805 new_font = default_font;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
806 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
807 if (font_size)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
808 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
809 if (styles[i] == 0)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
810 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
811 default_size = font_size->value ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
812 new_font.setPointSize (font_size->value ());
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 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
815 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
816 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
817 if (attrib_font[0])
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
818 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
819 if (attrib_font[1])
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
820 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
821 if (attrib_font[2])
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
822 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
823 lexer->setFont (new_font, styles[i]);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
824 if (styles[i] == 0)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
825 lexer->setDefaultFont (new_font);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
826 if (color)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
827 lexer->setColor (color->color (), styles[i]);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
828 if (bg_color)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
829 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
830 if (styles[i] == 0)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
831 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
832 default_color = bg_color->color ();
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
833 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
834 lexer->setDefaultPaper (default_color);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
835 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
836 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
837 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
838 if (bg_color->color () == dummy_color)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
839 lexer->setPaper (default_color, styles[i]);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
840 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
841 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
842 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
843 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
844 }
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
845
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
846 lexer->writeSettings (*settings);
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
847
27867
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
848 settings->setValue (sd_last_editor_styles_tab.key,
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
849 tabs_editor_lexers->currentIndex ());
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
850 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
851
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
852 #else
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
853
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
854 octave_unused_parameter (lexer);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
855 octave_unused_parameter (settings);
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
856
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
857 #endif
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
858 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
859
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
860 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
861 {
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
862 resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
863 gui_settings *settings = rmgr.get_settings ();
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 // the icon set
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
866 QString widget_icon_set = "NONE";
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
867 if (general_icon_letter->isChecked ())
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
868 widget_icon_set = "LETTER";
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
869 else if (general_icon_graphic->isChecked ())
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
870 widget_icon_set = "GRAPHIC";
27665
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
871 settings->setValue (dw_icon_set.key, widget_icon_set);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
872
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
873 // language
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
874 QString language = comboBox_language->currentText ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
875 if (language == tr ("System setting"))
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
876 language = global_language.def.toString ();
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
877 settings->setValue (global_language.key, language);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
878
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
879 // style
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
880 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
881 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
882 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
883 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
884
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
885 // dock widget title bar
27665
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
886 settings->setValue (dw_title_custom_style.key, cb_widget_custom_style->isChecked ());
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
887 settings->setValue (dw_title_3d.key, sb_3d_title->value ());
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
888 settings->setValue (dw_title_bg_color.key, m_widget_title_bg_color->color ());
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
889 settings->setValue (dw_title_bg_color_active.key, m_widget_title_bg_color_active->color ());
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
890 settings->setValue (dw_title_fg_color.key, m_widget_title_fg_color->color ());
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27663
diff changeset
891 settings->setValue (dw_title_fg_color_active.key, 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
892
26140
8fb8cb4a03f8 preference for (not) using system icon theme
Torsten <mttl@mailbox.org>
parents: 26135
diff changeset
893 // icon size and theme
26135
a332d83cc659 fix use of icon size preferences
Torsten <mttl@mailbox.org>
parents: 26096
diff changeset
894 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
895 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
896 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
897
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
898 // native file dialogs
27570
775412096ae4 use symbolic constants for file dock widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27563
diff changeset
899 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
900
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
901 // cursor blinking
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
902 settings->setValue (global_cursor_blinking.key, cb_cursor_blinking->isChecked ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
903
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
904 // promp to exit
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
905 settings->setValue (global_prompt_to_exit.key, cb_prompt_to_exit->isChecked ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
906
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
907 // status bar
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
908 settings->setValue (global_status_bar.key, cb_status_bar->isChecked ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
909
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
910 // Octave startup
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
911 settings->setValue (global_restore_ov_dir.key, cb_restore_octave_dir->isChecked ());
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
912 settings->setValue (global_ov_startup_dir.key, le_octave_dir->text ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
913
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
914 //editor
27805
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
915 settings->setValue (global_use_custom_editor.key, useCustomFileEditor->isChecked ());
dccc551aa83b replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27726
diff changeset
916 settings->setValue (global_custom_editor.key, customFileEditor->text ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
917 settings->setValue (ed_show_line_numbers.key, editor_showLineNumbers->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
918 settings->setValue (ed_line_numbers_size.key, editor_linenr_size->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
919 settings->setValue (ed_highlight_current_line.key, editor_highlightCurrentLine->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
920 settings->setValue (ed_highlight_current_line_color.key, m_editor_current_line_color->color ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
921 settings->setValue (ed_long_line_marker.key, editor_long_line_marker->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
922 settings->setValue (ed_long_line_marker_line.key, editor_long_line_marker_line->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
923 settings->setValue (ed_long_line_marker_background.key, editor_long_line_marker_background->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
924 settings->setValue (ed_long_line_column.key, editor_long_line_column->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
925 settings->setValue (ed_break_lines.key, editor_break_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
926 settings->setValue (ed_break_lines_comments.key, editor_break_comments_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
927 settings->setValue (ed_wrap_lines.key, editor_wrap_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
928 settings->setValue (ed_code_folding.key, cb_code_folding->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
929 settings->setValue (ed_show_edit_status_bar.key, cb_edit_status_bar->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
930 settings->setValue (ed_show_toolbar.key, cb_edit_tool_bar->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
931 settings->setValue (ed_highlight_all_occurrences.key, editor_highlight_all_occurrences->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
932 settings->setValue (ed_code_completion.key, editor_codeCompletion->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
933 settings->setValue (ed_code_completion_threshold.key, editor_spinbox_ac_threshold->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
934 settings->setValue (ed_code_completion_keywords.key, editor_checkbox_ac_keywords->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
935 settings->setValue (ed_code_completion_octave_builtins.key, editor_checkbox_ac_builtins->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
936 settings->setValue (ed_code_completion_octave_functions.key, editor_checkbox_ac_functions->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
937 settings->setValue (ed_code_completion_document.key, editor_checkbox_ac_document->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
938 settings->setValue (ed_code_completion_case.key, editor_checkbox_ac_case->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
939 settings->setValue (ed_code_completion_replace.key, editor_checkbox_ac_replace->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
940 settings->setValue (ed_auto_endif.key, editor_auto_endif->currentIndex ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
941 settings->setValue (ed_show_white_space.key, editor_ws_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
942 settings->setValue (ed_show_white_space_indent.key, editor_ws_indent_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
943 settings->setValue (ed_show_eol_chars.key, cb_show_eol->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
944 settings->setValue (ed_show_hscroll_bar.key, cb_show_hscrollbar->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
945 settings->setValue (ed_default_eol_mode.key, combo_eol_mode->currentIndex ());
24475
8cb985e362f3 Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents: 24290
diff changeset
946
27055
b38807a23fd2 add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26530
diff changeset
947 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
948
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
949 // Comment strings
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
950 int rb_uncomment = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
951 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
952 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
953 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
954 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
955 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
956 if (i < 3)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
957 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
958 else
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
959 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
960 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
961 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
962 rb_uncomment = rb_uncomment + (1 << i);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
963 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
964 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
965
27562
d7876110e854 use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
966 settings->setValue (ed_default_enc.key, editor_combo_encoding->currentText ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
967 settings->setValue (ed_auto_indent.key, editor_auto_ind_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
968 settings->setValue (ed_tab_indents_line.key, editor_tab_ind_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
969 settings->setValue (ed_backspace_unindents_line.key, editor_bs_unind_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
970 settings->setValue (ed_show_indent_guides.key, editor_ind_guides_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
971 settings->setValue (ed_indent_width.key, editor_ind_width_spinbox->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
972 settings->setValue (ed_indent_uses_tabs.key, editor_ind_uses_tabs_checkbox->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
973 settings->setValue (ed_tab_width.key, editor_tab_width_spinbox->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
974 settings->setValue (ed_long_window_title.key, editor_longWindowTitle->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
975 settings->setValue (ed_notebook_tab_width_min.key, editor_notebook_tab_width_min->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
976 settings->setValue (ed_notebook_tab_width_max.key, editor_notebook_tab_width_max->value ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
977 settings->setValue (ed_restore_session.key, editor_restoreSession->isChecked ());
27849
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27818
diff changeset
978 settings->setValue (ed_create_new_file.key, editor_create_new_file->isChecked ());
27861
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
979 settings->setValue (ed_hiding_closes_files.key, editor_hiding_closes_files->isChecked ());
3fada47cc58a replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
980 settings->setValue (ed_always_reload_changed_files.key, editor_reload_changed_files->isChecked ());
28132
4cfe24f56336 add editor prefs for forcing coding standards (bug #57860, bug #57861)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27935
diff changeset
981 settings->setValue (ed_force_newline.key, editor_force_newline->isChecked ());
4cfe24f56336 add editor prefs for forcing coding standards (bug #57860, bug #57861)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27935
diff changeset
982 settings->setValue (ed_rm_trailing_spaces.key, editor_remove_trailing_spaces->isChecked ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
983 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
984
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
985 settings->setValue (cs_font_size.key, terminal_fontSize->value ());
27562
d7876110e854 use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
986 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
987
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
988 // file browser
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
989 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
990 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
991 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
992 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
993
27613
deb8877f2c34 use symbolic constants for preferences key and default values in news reader
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27611
diff changeset
994 settings->setValue (nr_allow_connection.key, checkbox_allow_web_connect->isChecked ());
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
995 settings->setValue (global_use_proxy.key, use_proxy_server->isChecked ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
996 settings->setValue (global_proxy_type.key, proxy_type->currentText ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
997 settings->setValue (global_proxy_host.key, proxy_host_name->text ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
998 settings->setValue (global_proxy_port.key, proxy_port->text ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
999 settings->setValue (global_proxy_user.key, proxy_username->text ());
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
1000 settings->setValue (global_proxy_pass.key, proxy_password->text ());
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1001 settings->setValue (cs_cursor_use_fgcol.key, terminal_cursorUseForegroundColor->isChecked ());
29143
a43cf0300dcd fix focus command window after command execution (bug #59609)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28334
diff changeset
1002 settings->setValue (cs_focus_cmd.key, terminal_focus_command->isChecked ());
27849
28d7ec92bae6 replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27818
diff changeset
1003 settings->setValue (cs_dbg_location.key, terminal_print_dbg_location->isChecked ());
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1004 settings->setValue (cs_hist_buffer.key, terminal_history_buffer->value ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1005
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1006 // the cursor
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1007 QString cursor_type;
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1008 unsigned int cursor_int = terminal_cursorType->currentIndex ();
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1009 if ((cursor_int > 0) && (cursor_int < cs_cursor_types.size ()))
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1010 cursor_type = QString (cs_cursor_types[cursor_int].data ());
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1011 else
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1012 cursor_type = cs_cursor.def.toString ();
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1013
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1014 settings->setValue (cs_cursor.key, cursor_type);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1015
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1016 #if defined (HAVE_QSCINTILLA)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1017 // 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
1018 QsciLexer *lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1019
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1020 #if defined (HAVE_LEXER_OCTAVE)
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1021
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1022 lexer = new QsciLexerOctave ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1023 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1024 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1025
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1026 #elif defined (HAVE_LEXER_MATLAB)
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1027
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1028 lexer = new QsciLexerMatlab ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1029 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1030 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1031
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1032 #endif
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1033
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1034 lexer = new QsciLexerCPP ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1035 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1036 delete lexer;
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 lexer = new QsciLexerPerl ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1039 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1040 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1041
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1042 lexer = new QsciLexerBatch ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1043 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1044 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1045
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1046 lexer = new QsciLexerDiff ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1047 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1048 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1049
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1050 lexer = new QsciLexerBash ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1051 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1052 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1053
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27055
diff changeset
1054 lexer = new octave_txt_lexer ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1055 write_lexer_settings (lexer, settings);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1056 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1057
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1058 #endif
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1059
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1060 // Workspace
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1061 write_workspace_colors (settings);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1062
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1063 // Terminal
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1064 write_terminal_colors (settings);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1065
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1066 // Variable editor
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1067 settings->setValue (ve_column_width.key, varedit_columnWidth->value ());
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1068 settings->setValue (ve_row_height.key, varedit_rowHeight->value ());
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1069 settings->setValue (ve_use_terminal_font.key, varedit_useTerminalFont->isChecked ());
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1070 settings->setValue (ve_alternate_rows.key, varedit_alternate->isChecked ());
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1071 settings->setValue (ve_font_name.key, varedit_font->currentFont ().family ());
27562
d7876110e854 use symbolic preference keys if available
John W. Eaton <jwe@octave.org>
parents: 27560
diff changeset
1072 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
1073 write_varedit_colors (settings);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1074
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1075 // shortcuts
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
1076
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27805
diff changeset
1077 settings->setValue (sc_prevent_rl_conflicts.key, cb_prevent_readline_conflicts->isChecked ());
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28409
diff changeset
1078 settings->setValue (sc_prevent_rl_conflicts_menu.key, cb_prevent_readline_conflicts_menu->isChecked ());
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
1079 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
1080 scmgr.write_shortcuts (settings, closing);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1081
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1082 // settings dialog's geometry
27867
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
1083 settings->setValue (sd_last_tab.key, tabWidget->currentIndex ());
99371079780f use symbolic constants for settings dialogs prefs
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27861
diff changeset
1084 settings->setValue (sd_geometry.key, saveGeometry ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1085
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1086 settings->sync ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1087 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1088
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
1089 void settings_dialog::read_workspace_colors (gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1090 {
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1091 // 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
1092 QGridLayout *style_grid = new QGridLayout ();
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1093 QVector<QLabel*> description (ws_colors_count);
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1094 QVector<color_picker*> color (ws_colors_count);
16610
a1f613e5066d workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents: 16525
diff changeset
1095
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1096 int column = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1097 int row = 0;
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1098
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1099 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
1100 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
1101
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1102 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
1103 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
1104 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
1105 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
1106 m_ws_hide_tool_tips->setChecked
27672
a36443e94f8a simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents: 27668
diff changeset
1107 (settings->value (ws_hide_tool_tips).toBool ());
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1108
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1109 for (int i = 0; i < ws_colors_count; i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1110 {
27890
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
1111 description[i] = new QLabel (" "
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
1112 + tr (ws_color_names.at (i).toStdString ().data ()));
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1113 description[i]->setAlignment (Qt::AlignRight);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1114 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
1115 description[i], SLOT(setEnabled (bool)));
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1116
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1117 QColor setting_color = settings->value (ws_colors[i].key,
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1118 ws_colors[i].def).value<QColor> ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1119 color[i] = new color_picker (setting_color);
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1120 color[i]->setObjectName (ws_colors[i].key);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1121 color[i]->setMinimumSize (30, 10);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1122 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
1123 color[i], SLOT(setEnabled (bool)));
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1124
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1125 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
1126 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
1127 if (++column == 3)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1128 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1129 style_grid->setColumnStretch (4*column, 10);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1130 row++;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1131 column = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1132 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1133 }
16610
a1f613e5066d workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents: 16525
diff changeset
1134
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1135 // 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
1136 bool colors_enabled =
27935
f1844e33f621 maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents: 27923
diff changeset
1137 settings->value (ws_enable_colors).toBool ();
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1138 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
1139 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
1140
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1141 // 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
1142 workspace_colors_box->setLayout (style_grid);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1143 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1144
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
1145 void settings_dialog::write_workspace_colors (gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1146 {
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1147 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
1148 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
1149
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1150 color_picker *color;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1151
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1152 for (int i = 0; i < ws_colors_count; i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1153 {
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1154 color = workspace_colors_box->findChild <color_picker *> (ws_colors[i].key);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1155 if (color)
27660
30e84a3d58e5 replace preference literals by symbolic constants for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27630
diff changeset
1156 settings->setValue (ws_colors[i].key, color->color ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1157 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1158 settings->sync ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1159 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1160
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
1161 void settings_dialog::read_terminal_colors (gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1162 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1163 QGridLayout *style_grid = new QGridLayout ();
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1164 QVector<QLabel*> description (cs_colors_count);
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1165 QVector<color_picker*> color (cs_colors_count);
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16610
diff changeset
1166
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1167 int column = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1168 int row = 0;
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1169 for (unsigned int i = 0; i < cs_colors_count; i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1170 {
27890
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
1171 description[i] = new QLabel (" "
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
1172 + tr (cs_color_names.at (i).toStdString ().data ()));
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1173 description[i]->setAlignment (Qt::AlignRight);
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1174 QVariant default_var = cs_colors[i].def;
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1175 QColor setting_color = settings->value (cs_colors[i].key, cs_colors[i].def).value<QColor> ();
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1176 color[i] = new color_picker (setting_color);
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1177 color[i]->setObjectName (cs_colors[i].key);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1178 color[i]->setMinimumSize (30, 10);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1179 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
1180 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
1181 if (++column == 2)
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 style_grid->setColumnStretch (3*column, 10);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1184 row++;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1185 column = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1186 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1187 }
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16610
diff changeset
1188
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1189 // 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
1190 terminal_colors_box->setLayout (style_grid);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1191 }
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
1192
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
1193 void settings_dialog::write_terminal_colors (gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1194 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1195 color_picker *color;
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16610
diff changeset
1196
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1197 for (int i = 0; i < cs_color_names.size (); i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1198 {
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1199 color = terminal_colors_box->findChild <color_picker *> (cs_colors[i].key);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1200 if (color)
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1201 settings->setValue (cs_colors[i].key, color->color ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1202 }
19632
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
1203
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1204 settings->sync ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1205 }
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
1206
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
1207 void settings_dialog::read_varedit_colors (gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1208 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1209 QGridLayout *style_grid = new QGridLayout ();
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1210 QVector<QLabel*> description (ve_colors_count);
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1211 QVector<color_picker*> color (ve_colors_count);
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
1212
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1213 int column = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1214 int row = 0;
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1215 for (int i = 0; i < ve_colors_count; i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1216 {
27890
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
1217 description[i] = new QLabel (" "
5ca326b3c0d5 fix missing translations due to new symbolic constants for prefs (bug #57490)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27867
diff changeset
1218 + tr (ve_color_names.at (i).toStdString ().data ()));
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1219 description[i]->setAlignment (Qt::AlignRight);
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1220
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1221 // The default colors are given as color roles for
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1222 // the application's palette
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1223 QColor default_color = qApp->palette ().color
27668
7ffe081140ef fix compilation warning for old style cast (bug #57203)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27667
diff changeset
1224 (static_cast<QPalette::ColorRole> (ve_colors[i].def.toInt ()));
27726
b2c11742b7ec add FIXMEs for replacing static casts by Qvariants value<T> after Qt 5.4
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
1225 // FIXME: use value<QPalette::ColorRole> instead of static cast after
b2c11742b7ec add FIXMEs for replacing static casts by Qvariants value<T> after Qt 5.4
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
1226 // dropping support of Qt 5.4
b2c11742b7ec add FIXMEs for replacing static casts by Qvariants value<T> after Qt 5.4
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27672
diff changeset
1227
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1228 QColor setting_color =
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1229 settings->value (ve_colors[i].key, default_color).value<QColor> ();
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1230
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1231 color[i] = new color_picker (setting_color);
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1232 color[i]->setObjectName (ve_colors[i].key);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1233 color[i]->setMinimumSize (30, 10);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1234 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
1235 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
1236 if (++column == 2)
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1237 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1238 style_grid->setColumnStretch (3*column, 10);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1239 row++;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1240 column = 0;
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1241 }
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1242 }
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23810
diff changeset
1243
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1244 // 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
1245 varedit_colors_box->setLayout (style_grid);
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1246 }
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
1247
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
1248 void settings_dialog::write_varedit_colors (gui_settings *settings)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1249 {
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1250 color_picker *color;
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18733
diff changeset
1251
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1252 for (int i = 0; i < ve_colors_count; i++)
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1253 {
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1254 color = varedit_colors_box->findChild <color_picker *> (ve_colors[i].key);
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1255 if (color)
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1256 settings->setValue (ve_colors[i].key, color->color ());
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1257 }
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18733
diff changeset
1258
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1259 settings->sync ();
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
1260 }
20702
b6b16d8c8b57 possibility to set all shortcuts to default values and check overwriting
Torsten <ttl@justmail.de>
parents: 20685
diff changeset
1261 }