annotate libgui/src/settings-dialog.cc @ 33634:4a70f390c85e default tip @

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 28 May 2024 15:25:54 +0200
parents 7f18c537e101
children
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 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32519
diff changeset
3 // Copyright (C) 2011-2024 The Octave Project Developers
27923
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>
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
42 #include <QThread>
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>
29165
617d3aa713a4 add java file support in gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29162
diff changeset
59 # include <Qsci/qscilexerjava.h>
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
60 # include <Qsci/qscilexerbash.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
61 # include <Qsci/qscilexerperl.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
62 # include <Qsci/qscilexerbatch.h>
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21045
diff changeset
63 # include <Qsci/qscilexerdiff.h>
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
64 #endif
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
65
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents: 27412
diff changeset
66 #include "gui-preferences-all.h"
31690
1a1f47f17ed4 eliminate resource_manager class
John W. Eaton <jwe@octave.org>
parents: 31649
diff changeset
67 #include "gui-settings.h"
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27276
diff changeset
68 #include "settings-dialog.h"
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
69 #include "shortcuts-tree-widget.h"
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27276
diff changeset
70 #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
71 #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
72
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
73 OCTAVE_BEGIN_NAMESPACE(octave)
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
74
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
75 settings_dialog::settings_dialog (QWidget *p, const QString& desired_tab)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
76 : QDialog (p), Ui::settings_dialog ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
77 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
78 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
79
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
80 QMessageBox *info = wait_message_box (
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
81 tr ("Loading current preferences ... "), this);
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
82
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
83 read_settings (true); // it's the first read, prepare everything
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
84
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
85 close_wait_message_box (info);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
86
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
87 // which tab is the desired one?
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
88 show_tab (desired_tab);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
89
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
90 // connect button box signal
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
91 connect (button_box, &QDialogButtonBox::clicked,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
92 this, &settings_dialog::button_clicked);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
93
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
94 // restore last geometry
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
95 gui_settings 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
96
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
97 if (settings.contains (sd_geometry.settings_key ()))
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
98 restoreGeometry (settings.byte_array_value (sd_geometry));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
99 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
100 setGeometry (QRect (10, 50, 1000, 600));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
101
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
102 // show as non-modal dialog
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
103 setModal (false);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
104 setAttribute (Qt::WA_DeleteOnClose);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
105 show ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
106 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
107
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
108 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
109 settings_dialog::read_settings (bool first)
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
110 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
111 gui_settings 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
112
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
113 if (first)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
114 {
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
115 // look for available language files and the actual settings
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
116 QString qm_dir_name = settings.get_gui_translation_dir ();
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
117
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
118 QDir qm_dir (qm_dir_name);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
119 QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"),
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
120 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
121
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
122 for (int i = 0; i < qm_files.length (); i++) // insert available languages
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
123 comboBox_language->addItem (qm_files.at (i).baseName ());
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
124 // System at beginning
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
125 comboBox_language->insertItem (0, tr ("System setting"));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
126 comboBox_language->insertSeparator (1); // separator after System
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
127 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
128
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
129 QString language = settings.string_value (global_language);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
130 if (language == global_language.def ().toString ())
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
131 language = tr ("System setting");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
132 int selected = comboBox_language->findText (language);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
133 if (selected >= 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
134 comboBox_language->setCurrentIndex (selected);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
135 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
136 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
137
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
138 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
139 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
140 // Global style
33359
689d4d069bbf maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents: 33239
diff changeset
141 QStringList styles = QStyleFactory::keys ();
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
142 styles.append (global_extra_styles);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
143 combo_styles->addItems (styles);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
144 combo_styles->insertItem (0, global_style.def ().toString ());
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
145 combo_styles->insertSeparator (1);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
146 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
147
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
148 QString current_style = settings.string_value (global_style);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
149 if (current_style == global_style.def ().toString ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
150 current_style = global_style.def ().toString ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
151 selected = combo_styles->findText (current_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
152 if (selected >= 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
153 combo_styles->setCurrentIndex (selected);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
154 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
155 combo_styles->setCurrentIndex (0);
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
156
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
157 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
158 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
159 // icon size and theme
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
160 QButtonGroup *icon_size_group = new QButtonGroup (this);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
161 icon_size_group->addButton (icon_size_small);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
162 icon_size_group->addButton (icon_size_normal);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
163 icon_size_group->addButton (icon_size_large);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
164 }
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
165 int icon_size = settings.int_value (global_icon_size);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
166 icon_size_normal->setChecked (true); // the default
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
167 icon_size_small->setChecked (icon_size < 0);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
168 icon_size_large->setChecked (icon_size > 0);
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
169
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
170 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
171 combo_box_icon_theme->addItems (global_all_icon_theme_names);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
172 int theme = settings.value (global_icon_theme_index.settings_key ()).toInt ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
173 combo_box_icon_theme->setCurrentIndex (theme);
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
174
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
175 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
176 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
177 // which icon has to be selected
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
178 QButtonGroup *icon_group = new QButtonGroup (this);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
179 icon_group->addButton (general_icon_octave);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
180 icon_group->addButton (general_icon_graphic);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
181 icon_group->addButton (general_icon_letter);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
182 }
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
183 QString widget_icon_set =
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
184 settings.string_value (dw_icon_set);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
185 general_icon_octave->setChecked (true); // the default (if invalid set)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
186 general_icon_octave->setChecked (widget_icon_set == "NONE");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
187 general_icon_graphic->setChecked (widget_icon_set == "GRAPHIC");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
188 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
189
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
190 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
191 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
192 // custom title bar of dock widget
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
193 m_widget_title_bg_color = new color_picker ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
194 m_widget_title_bg_color->setEnabled (false);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
195 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
196
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
197 connect (cb_widget_custom_style, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
198 m_widget_title_bg_color, &color_picker::setEnabled);
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
199
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
200 m_widget_title_bg_color_active = new color_picker ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
201 m_widget_title_bg_color_active->setEnabled (false);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
202 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
203
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
204 connect (cb_widget_custom_style, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
205 m_widget_title_bg_color_active, &color_picker::setEnabled);
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
206
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
207 m_widget_title_fg_color = new color_picker ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
208 m_widget_title_fg_color->setEnabled (false);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
209 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
210
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
211 connect (cb_widget_custom_style, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
212 m_widget_title_fg_color, &color_picker::setEnabled);
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
213
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
214 m_widget_title_fg_color_active = new color_picker ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
215 m_widget_title_fg_color_active->setEnabled (false);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
216 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
217
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
218 connect (cb_widget_custom_style, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
219 m_widget_title_fg_color_active, &color_picker::setEnabled);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
220 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
221
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
222 m_widget_title_bg_color->set_color (settings.color_value (dw_title_bg_color));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
223 m_widget_title_bg_color_active->set_color (settings.color_value (dw_title_bg_color_active));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
224 m_widget_title_fg_color->set_color (settings.color_value (dw_title_fg_color));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
225 m_widget_title_fg_color_active->set_color (settings.color_value (dw_title_fg_color_active));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
226
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
227 sb_3d_title->setValue (settings.int_value (dw_title_3d));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
228 cb_widget_custom_style->setChecked (settings.bool_value (dw_title_custom_style));
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
230 // Native file dialogs.
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
231 // FIXME: This preference can be deprecated / removed if all display
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
232 // managers, especially KDE, run those dialogs without hangs or
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
233 // delays from the start (bug #54607).
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
234 cb_use_native_file_dialogs->setChecked (settings.bool_value (global_use_native_dialogs));
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
235
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
236 // Cursor blinking: consider old terminal related setting if not yet set
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
237 // FIXME: This pref. can be deprecated / removed if Qt adds support for
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
238 // getting the cursor blink preferences from all OS environments
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
239 if (settings.contains (global_cursor_blinking.settings_key ()))
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
240 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
241 // Preference exists, read its value
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
242 cb_cursor_blinking->setChecked (settings.bool_value (global_cursor_blinking));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
243 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
244 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
245 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
246 // Pref. does not exist, so take old terminal related pref.
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
247 cb_cursor_blinking->setChecked (settings.bool_value (cs_cursor_blinking));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
248 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
249
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
250 // focus follows mouse
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
251 cb_focus_follows_mouse->setChecked (settings.bool_value (dw_focus_follows_mouse));
29202
66af654b3485 provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29165
diff changeset
252
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
253 // prompt on exit
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
254 cb_prompt_to_exit->setChecked (settings.bool_value (global_prompt_to_exit));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
255
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
256 // Main status bar
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
257 cb_status_bar->setChecked (settings.bool_value (global_status_bar));
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
259 // Octave startup
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
260 cb_restore_octave_dir->setChecked (settings.bool_value (global_restore_ov_dir));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
261 le_octave_dir->setText (settings.string_value (global_ov_startup_dir));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
262
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
263 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
264 connect (pb_octave_dir, &QPushButton::pressed,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
265 this, &settings_dialog::get_octave_dir);
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
266
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
267 //
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
268 // editor
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
269 //
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
270 useCustomFileEditor->setChecked (settings.bool_value (global_use_custom_editor));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
271 customFileEditor->setText (settings.string_value (global_custom_editor));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
272 editor_showLineNumbers->setChecked (settings.bool_value (ed_show_line_numbers));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
273 editor_linenr_size->setValue (settings.int_value (ed_line_numbers_size));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
274
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
275 settings.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
276
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
277 editor_highlightCurrentLine->setChecked (settings.bool_value (ed_highlight_current_line));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
278 editor_long_line_marker->setChecked (settings.bool_value (ed_long_line_marker));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
279 bool long_line =
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
280 settings.bool_value (ed_long_line_marker_line);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
281 editor_long_line_marker_line->setChecked (long_line);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
282 bool long_back =
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
283 settings.bool_value (ed_long_line_marker_background);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
284 editor_long_line_marker_background->setChecked (long_back);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
285 if (! (long_line || long_back))
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
286 editor_long_line_marker_line->setChecked (true);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
287 editor_long_line_column->setValue (settings.int_value (ed_long_line_column));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
288 editor_break_checkbox->setChecked (settings.bool_value (ed_break_lines));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
289 editor_break_comments_checkbox->setChecked (settings.bool_value (ed_break_lines_comments));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
290 editor_wrap_checkbox->setChecked (settings.bool_value (ed_wrap_lines));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
291 cb_edit_status_bar->setChecked (settings.bool_value (ed_show_edit_status_bar));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
292 cb_edit_tool_bar->setChecked (settings.bool_value (ed_show_toolbar));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
293 cb_code_folding->setChecked (settings.bool_value (ed_code_folding));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
294 editor_highlight_all_occurrences->setChecked (settings.bool_value (ed_highlight_all_occurrences));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
295
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
296 editor_auto_endif->setCurrentIndex (settings.int_value (ed_auto_endif) );
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
297 editor_codeCompletion->setChecked (settings.bool_value (ed_code_completion));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
298 editor_spinbox_ac_threshold->setValue (settings.int_value (ed_code_completion_threshold));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
299 editor_checkbox_ac_keywords->setChecked (settings.bool_value (ed_code_completion_keywords));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
300 editor_checkbox_ac_builtins->setEnabled (editor_checkbox_ac_keywords->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
301 editor_checkbox_ac_functions->setEnabled (editor_checkbox_ac_keywords->isChecked ());
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
302 editor_checkbox_ac_builtins->setChecked (settings.bool_value (ed_code_completion_octave_builtins));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
303 editor_checkbox_ac_functions->setChecked (settings.bool_value (ed_code_completion_octave_functions));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
304 editor_checkbox_ac_document->setChecked (settings.bool_value (ed_code_completion_document));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
305 editor_checkbox_ac_case->setChecked (settings.bool_value (ed_code_completion_case));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
306 editor_checkbox_ac_replace->setChecked (settings.bool_value (ed_code_completion_replace));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
307 editor_ws_checkbox->setChecked (settings.bool_value (ed_show_white_space));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
308 editor_ws_indent_checkbox->setChecked (settings.bool_value (ed_show_white_space_indent));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
309 cb_show_eol->setChecked (settings.bool_value (ed_show_eol_chars));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
310 cb_show_hscrollbar->setChecked (settings.bool_value (ed_show_hscroll_bar));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
311
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
312 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
313 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
314 for (int i = 0; i < ed_tab_position_names.length (); i++)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
315 editor_combox_tab_pos->insertItem (i,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
316 tr (ed_tab_position_names.at (i).toStdString ().data ()));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
317 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
318 editor_combox_tab_pos->setCurrentIndex (settings.int_value (ed_tab_position));
27055
b38807a23fd2 add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26530
diff changeset
319
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
320 editor_cb_tabs_rotated->setChecked (settings.bool_value (ed_tabs_rotated));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
321 editor_sb_tabs_max_width->setValue (settings.int_value (ed_tabs_max_width));
29467
80457383d5e1 allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
322
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
323 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
324
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
325 if (settings.contains (ed_comment_str.settings_key ())) // new version (radio buttons)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
326 selected_comment_string = settings.int_value (ed_comment_str);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
327 else // old version (combo box)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
328 selected_comment_string = settings.value (ed_comment_str_old.settings_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
329
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
330 selected_uncomment_string = settings.int_value (ed_uncomment_str);
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
332 for (int i = 0; i < ed_comment_strings_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
333 {
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
334 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
335 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
336 m_rb_comment_strings[i] = new QRadioButton ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
337 m_rb_uncomment_strings[i] = new QCheckBox ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
338 layout_comment_strings->addWidget (m_rb_comment_strings[i]);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
339 layout_uncomment_strings->addWidget (m_rb_uncomment_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
340
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
341 connect (m_rb_comment_strings[i], &QRadioButton::clicked,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
342 m_rb_uncomment_strings[i], &QCheckBox::setChecked);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
343 connect (m_rb_comment_strings[i], &QRadioButton::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
344 m_rb_uncomment_strings[i], &QCheckBox::setDisabled);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
345 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
346
33359
689d4d069bbf maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents: 33239
diff changeset
347 m_rb_comment_strings[i]->setText (ed_comment_strings.at (i));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
348 m_rb_comment_strings[i]->setChecked (i == selected_comment_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
349
33359
689d4d069bbf maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents: 33239
diff changeset
350 m_rb_uncomment_strings[i]->setText (ed_comment_strings.at (i));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
351 m_rb_uncomment_strings[i]->setAutoExclusive (false);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
352 m_rb_uncomment_strings[i]->setChecked ( 1 << i & selected_uncomment_string);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
353 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
354
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
355 combo_eol_mode->setCurrentIndex (settings.int_value (ed_default_eol_mode));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
356 editor_auto_ind_checkbox->setChecked (settings.bool_value (ed_auto_indent));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
357 editor_tab_ind_checkbox->setChecked (settings.bool_value (ed_tab_indents_line));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
358 editor_bs_unind_checkbox->setChecked (settings.bool_value (ed_backspace_unindents_line));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
359 editor_ind_guides_checkbox->setChecked (settings.bool_value (ed_show_indent_guides));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
360 editor_ind_width_spinbox->setValue (settings.int_value (ed_indent_width));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
361 editor_ind_uses_tabs_checkbox->setChecked (settings.bool_value (ed_indent_uses_tabs));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
362 editor_tab_width_spinbox->setValue (settings.int_value (ed_tab_width));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
363 editor_restoreSession->setChecked (settings.bool_value (ed_restore_session));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
364 editor_create_new_file->setChecked (settings.bool_value (ed_create_new_file));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
365 editor_reload_changed_files->setChecked (settings.bool_value (ed_always_reload_changed_files));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
366 editor_force_newline->setChecked (settings.bool_value (ed_force_newline));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
367 editor_remove_trailing_spaces->setChecked (settings.bool_value (ed_rm_trailing_spaces));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
368 editor_hiding_closes_files->setChecked (settings.bool_value (ed_hiding_closes_files));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
369 editor_show_dbg_file->setChecked (settings.bool_value (ed_show_dbg_file));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
370
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
371 // terminal
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
372 QString default_font = settings.string_value (global_mono_font);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
373 terminal_fontName->setCurrentFont (QFont (settings.value (cs_font.settings_key (), default_font).toString ()));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
374 terminal_fontSize->setValue (settings.int_value (cs_font_size));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
375 terminal_history_buffer->setValue (settings.int_value (cs_hist_buffer));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
376 terminal_cursorUseForegroundColor->setChecked (settings.bool_value (cs_cursor_use_fgcol));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
377 terminal_focus_command->setChecked (settings.bool_value (cs_focus_cmd));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
378 terminal_print_dbg_location->setChecked (settings.bool_value (cs_dbg_location));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
379
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
380 QString cursor_type = settings.string_value (cs_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
381
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
382 QStringList items;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
383 items << QString ("0") << QString ("1") << QString ("2");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
384 terminal_cursorType->addItems (items);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
385 terminal_cursorType->setItemText (0, tr ("IBeam Cursor"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
386 terminal_cursorType->setItemText (1, tr ("Block Cursor"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
387 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
388
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
389 for (unsigned int i = 0; i < cs_cursor_types.size (); i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
390 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
391 if (cursor_type.toStdString () == cs_cursor_types[i])
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
392 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
393 terminal_cursorType->setCurrentIndex (i);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
394 break;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
395 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
396 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
397
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
398 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
399 read_terminal_colors ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
400 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
401 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
402 QCheckBox *cb_color_mode
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
403 = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
31980
b6ba853c70d6 maint: Remove extra spaces in front of '='.
Rik <rik@octave.org>
parents: 31903
diff changeset
404 bool sec_color_mode = settings.bool_value (cs_color_mode);
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
405 if (cb_color_mode->isChecked () == sec_color_mode)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
406 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
407 // color mode does not change, update colors manually
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
408 update_terminal_colors ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
409 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
410 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
411 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
412 // toggling check-state calls related slot updating colors
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
413 cb_color_mode->setChecked (sec_color_mode);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
414 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
415 }
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
416
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
417 // file browser
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
418 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
419 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
420 connect (sync_octave_directory, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
421 this, &settings_dialog::set_disabled_pref_file_browser_dir);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
422 connect (pb_file_browser_dir, &QPushButton::pressed,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
423 this, &settings_dialog::get_file_browser_dir);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
424 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
425
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
426 sync_octave_directory->setChecked (settings.bool_value (fb_sync_octdir));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
427 cb_restore_file_browser_dir->setChecked (settings.bool_value (fb_restore_last_dir));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
428 le_file_browser_dir->setText (settings.value (fb_startup_dir.settings_key ()).toString ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
429 le_file_browser_extensions->setText (settings.string_value (fb_txt_file_ext));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
430 checkbox_allow_web_connect->setChecked (settings.bool_value (nr_allow_connection));
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
431
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
432 // Proxy
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
433 bool use_proxy = settings.bool_value (global_use_proxy);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
434 use_proxy_server->setChecked (use_proxy);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
435 // Fill combo box and activate current one
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
436 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
437 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
438 proxy_type->addItems (global_proxy_all_types);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
439 // Connect relevant signals for dis-/enabling some elements
33239
775dde0cb3e5 use qOverload<T>(fptr) instead of QOverload<T>::of(fptr)
John W. Eaton <jwe@octave.org>
parents: 33034
diff changeset
440 connect (proxy_type, qOverload<int> (&QComboBox::currentIndexChanged),
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
441 this, &settings_dialog::proxy_items_update);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
442 connect (use_proxy_server, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
443 this, &settings_dialog::proxy_items_update);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
444 }
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
445 QString proxy_type_string = settings.string_value (global_proxy_type);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
446 for (int i = 0; i < global_proxy_all_types.length (); i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
447 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
448 if (proxy_type->itemText (i) == proxy_type_string)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
449 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
450 proxy_type->setCurrentIndex (i);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
451 break;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
452 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
453 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
454 // Fill all line edits
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
455 proxy_host_name->setText (settings.string_value (global_proxy_host));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
456 proxy_port->setText (settings.string_value (global_proxy_port));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
457 proxy_username->setText (settings.string_value (global_proxy_user));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
458 proxy_password->setText (settings.string_value (global_proxy_pass));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
459 // Check whehter line edits have to be enabled
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
460 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
461
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
462 // Workspace
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
463 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
464 read_workspace_colors ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
465 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
466 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
467 m_ws_enable_colors->setChecked (settings.bool_value (ws_enable_colors));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
468 QCheckBox *cb_color_mode
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
469 = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
31980
b6ba853c70d6 maint: Remove extra spaces in front of '='.
Rik <rik@octave.org>
parents: 31903
diff changeset
470 bool sec_color_mode = settings.bool_value (ws_color_mode);
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
471 if (cb_color_mode->isChecked () == sec_color_mode)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
472 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
473 // color mode does not change, update colors manually
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
474 update_workspace_colors ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
475 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
476 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
477 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
478 // toggling check-state calls related slot updating colors
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
479 cb_color_mode->setChecked (sec_color_mode);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
480 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
481 }
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
483 // variable editor
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
484 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
485 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
486 connect (varedit_useTerminalFont, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
487 varedit_font, &QFontComboBox::setDisabled);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
488 connect (varedit_useTerminalFont, &QCheckBox::toggled,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
489 varedit_fontSize, &QSpinBox::setDisabled);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
490 }
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
491 varedit_columnWidth->setValue (settings.int_value (ve_column_width));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
492 varedit_rowHeight->setValue (settings.int_value (ve_row_height));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
493 varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.settings_key (),
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
494 settings.value (cs_font.settings_key (), default_font)).toString ()));
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
495 varedit_fontSize->setValue (settings.int_value (ve_font_size));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
496 varedit_useTerminalFont->setChecked (settings.bool_value (ve_use_terminal_font));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
497 varedit_font->setDisabled (varedit_useTerminalFont->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
498 varedit_fontSize->setDisabled (varedit_useTerminalFont->isChecked ());
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
499 varedit_alternate->setChecked (settings.bool_value (ve_alternate_rows));
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
501 // variable editor colors
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
502 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
503 read_varedit_colors ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
504 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
505 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
506 QCheckBox *cb_color_mode
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
507 = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
31980
b6ba853c70d6 maint: Remove extra spaces in front of '='.
Rik <rik@octave.org>
parents: 31903
diff changeset
508 bool sec_color_mode = settings.bool_value (ve_color_mode);
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
509 if (cb_color_mode->isChecked () == sec_color_mode)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
510 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
511 // color mode does not change, update colors manually
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
512 update_varedit_colors ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
513 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
514 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
515 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
516 // toggling check-state calls related slot updating colors
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
517 cb_color_mode->setChecked (sec_color_mode);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
518 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
519 }
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
521 // 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
522
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
523 cb_prevent_readline_conflicts->setChecked (settings.bool_value (sc_prevent_rl_conflicts));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
524 cb_prevent_readline_conflicts_menu->setChecked (settings.bool_value (sc_prevent_rl_conflicts_menu));
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
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
526 // connect the buttons for import/export of the shortcut sets
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
527 // FIXME: Should there also be a button to discard changes?
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
528
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
529 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
530 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
531 connect (btn_import_shortcut_set, &QPushButton::clicked,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
532 this, &settings_dialog::import_shortcut_set);
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
533
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
534 connect (btn_export_shortcut_set, &QPushButton::clicked,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
535 this, &settings_dialog::export_shortcut_set);
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
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
537 connect (btn_default_shortcut_set, &QPushButton::clicked,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
538 this, &settings_dialog::default_shortcut_set);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
539 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
540
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
541 #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
542
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
543 if (first)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
544 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
545 int mode = settings.int_value (ed_color_mode);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
546
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
547 QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()),
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
548 group_box_editor_styles);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
549 cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
550 cb_color_mode->setChecked (mode > 0);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
551 cb_color_mode->setObjectName (ed_color_mode.settings_key ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
552
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
553 QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_styles.toStdString ().data ()));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
554 pb_reload_default_colors->setToolTip (tr (settings_reload_styles_tooltip.toStdString ().data ()));
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
555
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
556 color_picker *current_line_color = new color_picker (
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
557 settings.value (ed_highlight_current_line_color.settings_key ()
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
558 + settings_color_modes_ext[mode],
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
559 ed_highlight_current_line_color.def ()).value<QColor> ());
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
560 current_line_color->setObjectName (ed_highlight_current_line_color.settings_key ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
561
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
562 QLabel *current_line_color_label
33359
689d4d069bbf maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents: 33239
diff changeset
563 = new QLabel (tr("Color of highlighted current line (magenta (255,0,255) for automatic color)"));
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
564
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
565 QHBoxLayout *color_mode = new QHBoxLayout ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
566 color_mode->addWidget (cb_color_mode);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
567 color_mode->addItem (new QSpacerItem (5, 5, QSizePolicy::Expanding));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
568 color_mode->addWidget (pb_reload_default_colors);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
569
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
570 QHBoxLayout *current_line = new QHBoxLayout ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
571 current_line->addWidget (current_line_color_label);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
572 current_line->addWidget (current_line_color);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
573 current_line->addItem (new QSpacerItem (5, 5, QSizePolicy::Expanding));
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
574
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
575 editor_styles_layout->addLayout (color_mode);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
576 editor_styles_layout->addLayout (current_line);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
577
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
578 // update colors depending on second theme selection
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
579 connect (cb_color_mode, &QCheckBox::stateChanged,
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
580 this, &settings_dialog::update_editor_lexers);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
581 connect (pb_reload_default_colors, &QPushButton::clicked,
33034
49128bdb9eb2 use explicit lambda-expression captures (bug #65318)
John W. Eaton <jwe@octave.org>
parents: 33033
diff changeset
582 [this] () { update_editor_lexers (settings_reload_default_colors_flag); });
31304
d3231a604a62 re-enable user preferences for current editor line color (bug #62984)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30965
diff changeset
583
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
584 // finally read the lexer colors using the update slot
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
585 update_editor_lexers ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
586 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
587 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
588 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
589 QCheckBox *cb_color_mode
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
590 = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
31980
b6ba853c70d6 maint: Remove extra spaces in front of '='.
Rik <rik@octave.org>
parents: 31903
diff changeset
591 bool sec_color_mode = settings.bool_value (ed_color_mode);
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
592 if (cb_color_mode->isChecked () == sec_color_mode)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
593 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
594 // color mode does not change, update colors manually
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
595 update_editor_lexers ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
596 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
597 else
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
598 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
599 // toggling check-state calls related slot updating colors
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
600 cb_color_mode->setChecked (sec_color_mode);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
601 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
602 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
603
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
604 #endif
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
605 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
606
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
607 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
608 settings_dialog::show_tab (const QString& tab)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
609 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
610 gui_settings 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
611
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
612 if (tab.isEmpty ())
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
613 tabWidget->setCurrentIndex (settings.int_value (sd_last_tab));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
614 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
615 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
616 QHash <QString, QWidget *> tab_hash;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
617 tab_hash["editor"] = tab_editor;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
618 tab_hash["editor_styles"] = tab_editor;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
619 tabWidget->setCurrentIndex (tabWidget->indexOf (tab_hash.value (tab)));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
620 if (tab == "editor_styles")
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
621 tab_editor_scroll_area->ensureWidgetVisible (group_box_editor_styles);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
622 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
623 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
624
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
625 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
626 settings_dialog::get_octave_dir ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
627 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
628 get_dir (le_octave_dir, tr ("Set Octave Startup Directory"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
629 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
630
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
631 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
632 settings_dialog::get_file_browser_dir ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
633 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
634 get_dir (le_file_browser_dir, tr ("Set File Browser Startup Directory"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
635 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
636
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
637 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
638 settings_dialog::get_dir (QLineEdit *line_edit, const QString& title)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
639 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
640 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
641 int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks;
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
642
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
643 gui_settings settings;
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
644
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
645 if (! settings.bool_value (global_use_native_dialogs))
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
646 opts |= QFileDialog::DontUseNativeDialog;
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26008
diff changeset
647
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
648 QString dir = QFileDialog::getExistingDirectory
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
649 (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
650
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
651 line_edit->setText (dir);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
652 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
653
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
654 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
655 settings_dialog::button_clicked (QAbstractButton *button)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
656 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
657 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
658
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
659 if (button_role == QDialogButtonBox::ApplyRole
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
660 || button_role == QDialogButtonBox::AcceptRole)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
661 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
662 write_changed_settings ();
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
663 if (button_role == QDialogButtonBox::AcceptRole)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
664 hide (); // already hide here, reloading settings takes some time
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
665
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
666 QMessageBox *info = wait_message_box (tr ("Applying preferences ... "), this);
33599
7f18c537e101 maint: Update Qt macros to avoid name collisions
Arun Giridhar <arungiridhar@gmail.com>
parents: 33359
diff changeset
667 Q_EMIT apply_new_settings ();
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
668 close_wait_message_box (info);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
669 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
670
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
671 if (button_role == QDialogButtonBox::RejectRole
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
672 || button_role == QDialogButtonBox::AcceptRole)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
673 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
674 // save last settings dialog's geometry and close
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
675
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
676 gui_settings settings;
31559
26f1ef8fa1ce save settings dialog geometry and last tab also when cancelled
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31558
diff changeset
677
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
678 settings.setValue (sd_last_tab.settings_key (), tabWidget->currentIndex ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
679 settings.setValue (sd_geometry.settings_key (), saveGeometry ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
680 settings.sync ();
31559
26f1ef8fa1ce save settings dialog geometry and last tab also when cancelled
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31558
diff changeset
681
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
682 close ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
683 }
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
684
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
685 if (button_role == QDialogButtonBox::ResetRole)
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
686 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
687 read_settings (false); // not the first read, only update existing items
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
688 }
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
689 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
690
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
691 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
692 settings_dialog::set_disabled_pref_file_browser_dir (bool disable)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
693 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
694 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
695
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
696 if (! disable)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
697 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
698 le_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
699 pb_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
700 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
701 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
702 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
703 le_file_browser_dir->setDisabled (disable);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
704 pb_file_browser_dir->setDisabled (disable);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
705 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
706 }
25954
f2406585a974 move settings_dialog class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 25953
diff changeset
707
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
708 // slot for updating enabled state of proxy settings
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
709 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
710 settings_dialog::proxy_items_update ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
711 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
712 bool use_proxy = use_proxy_server->isChecked ();
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
713
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
714 bool manual = false;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
715 for (int i = 0; i < global_proxy_manual_types.length (); i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
716 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
717 if (proxy_type->currentIndex () == global_proxy_manual_types.at (i))
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
718 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
719 manual = true;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
720 break;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
721 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
722 }
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
723
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
724 proxy_type->setEnabled (use_proxy);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
725 proxy_host_name_label->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
726 proxy_host_name->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
727 proxy_port_label->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
728 proxy_port->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
729 proxy_username_label->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
730 proxy_username->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
731 proxy_password_label->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
732 proxy_password->setEnabled (use_proxy && manual);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
733 }
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
734
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
735 // 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
736
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
737 // Prompt for file name and import shortcuts from it. Importing will
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
738 // change values in tree view but does not apply values to
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
739 // gui_settings_object so that the user may choose to apply or cancel
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
740 // the action.
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
741
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
742 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
743 settings_dialog::import_shortcut_set ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
744 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
745 if (! overwrite_all_shortcuts ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
746 return;
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
747
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
748 QString file = get_shortcuts_file_name (OSC_IMPORT);
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
749
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
750 gui_settings osc_settings (file, QSettings::IniFormat);
28409
ed8d11b1027d reorganize network preferences in settings dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28340
diff changeset
751
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
752 if (osc_settings.status () == QSettings::NoError)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
753 shortcuts_treewidget->import_shortcuts (osc_settings);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
754 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
755 qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
756 .arg (file));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
757 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
758
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
759 // Prompt for file name and export shortcuts to it.
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
760
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
761 // FIXME: Should exported settings values come from the gui_settings
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
762 // object or the tree view? If modified values in the tree view have
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
763 // not been applied, should we offer to apply them first? Offer a
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
764 // choice to save current application settings or the modified values
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
765 // in the dialog?
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
766
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
767 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
768 settings_dialog::export_shortcut_set ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
769 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
770 QString file = get_shortcuts_file_name (OSC_EXPORT);
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
771
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
772 gui_settings osc_settings (file, QSettings::IniFormat);
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
773
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
774 if (osc_settings.status () == QSettings::NoError)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
775 shortcuts_treewidget->export_shortcuts (osc_settings);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
776 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
777 qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
778 .arg (file));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
779 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
780
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
781 // Reset the tree view to default values. Does not apply values to
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
782 // gui_settings object so that the user may choose to apply or cancel
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
783 // the action.
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
784
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
785 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
786 settings_dialog::default_shortcut_set ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
787 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
788 if (! overwrite_all_shortcuts ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
789 return;
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
790
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
791 shortcuts_treewidget->set_default_shortcuts ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
792 }
25953
526b51129c06 inherit Ui class in settings dialog instead of using pointer to member
John W. Eaton <jwe@octave.org>
parents: 25870
diff changeset
793
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
794 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
795 settings_dialog::update_editor_lexers (int def)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
796 {
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
797 #if defined (HAVE_QSCINTILLA)
30426
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
798
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
799 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
800 = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
801
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
802 int m = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
803 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
804 m = 1;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
805
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
806 color_picker *c_picker = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
807 if (c_picker)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
808 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
809 gui_settings settings;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
810
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
811 if (def != settings_reload_default_colors_flag)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
812 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
813 // Get current value from settings or the default
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
814 c_picker->set_color (settings.color_value (ed_highlight_current_line_color, m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
815 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
816 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
817 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
818 // Get the default value
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
819 c_picker->set_color (settings.get_color_value (ed_highlight_current_line_color.def (), m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
820 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
821 }
31304
d3231a604a62 re-enable user preferences for current editor line color (bug #62984)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30965
diff changeset
822
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
823 // editor styles: create lexer, read settings, and
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
824 // create or update dialog elements
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
825 QsciLexer *lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
826
30426
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
827 # if defined (HAVE_LEXER_OCTAVE)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
828 lexer = new QsciLexerOctave ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
829 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
830 delete lexer;
30426
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
831 # elif defined (HAVE_LEXER_MATLAB)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
832 lexer = new QsciLexerMatlab ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
833 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
834 delete lexer;
30426
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
835 # endif
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
836
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
837 lexer = new QsciLexerCPP ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
838 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
839 delete lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
840
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
841 lexer = new QsciLexerJava ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
842 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
843 delete lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
844
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
845 lexer = new QsciLexerPerl ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
846 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
847 delete lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
848
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
849 lexer = new QsciLexerBatch ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
850 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
851 delete lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
852
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
853 lexer = new QsciLexerDiff ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
854 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
855 delete lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
856
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
857 lexer = new QsciLexerBash ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
858 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
859 delete lexer;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
860
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
861 lexer = new octave_txt_lexer ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
862 update_lexer (lexer, m, def);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
863 delete lexer;
30426
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
864
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
865 #else
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
866
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
867 octave_unused_parameter (def);
30426
8d303ace1aff build: Include QScintilla header conditionally on configure result
Markus Mützel <markus.muetzel@gmx.de>
parents: 30398
diff changeset
868
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
869 #endif
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
870 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
871
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
872 #if defined (HAVE_QSCINTILLA)
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
873
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
874 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
875 settings_dialog::update_lexer (QsciLexer *lexer, int mode, int def)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
876 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
877 // Get lexer settings and copy from default settings if not yet
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
878 // available in normal settings file
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
879 gui_settings settings;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
880 settings.read_lexer_settings (lexer, mode, def);
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
881
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
882 // When reloading default styles, the style tabs do already exists.
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
883 // Otherwise, check if they exist or not.
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
884 QString lexer_name = lexer->language ();
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
885
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
886 int index = -1;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
887 for (int i = 0; i < tabs_editor_lexers->count (); i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
888 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
889 if (tabs_editor_lexers->tabText (i) == lexer_name)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
890 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
891 index = i;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
892 break;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
893 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
894 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
895
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
896 if (index == -1)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
897 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
898 // This is not an update, call get_lexer_settings for building
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
899 // the settings tab
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
900 get_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
901 return;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
902 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
903
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
904 // Update the styles elements in all styles
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
905 int styles[ed_max_lexer_styles]; // array for saving valid styles
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
906 int max_style = settings.get_valid_lexer_styles (lexer, styles);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
907 QWidget *tab = tabs_editor_lexers->widget (index);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
908 int default_size = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
909 QString default_family;
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
910
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
911 for (int i = 0; i < max_style; i++) // create dialog elements for all styles
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
912 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
913 QString actual_name = lexer->description (styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
914 color_picker *bg_color
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
915 = tab->findChild <color_picker *> (actual_name + "_bg_color");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
916 if (bg_color)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
917 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
918 // Update
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
919 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
920 bg_color->set_color (lexer->defaultPaper ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
921 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
922 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
923 if (lexer->paper (styles[i]) == lexer->defaultPaper ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
924 bg_color->set_color (settings_color_no_change);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
925 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
926 bg_color->set_color (lexer->paper (styles[i]));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
927 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
928 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
929
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
930 color_picker *color = tab->findChild <color_picker *> (actual_name + "_color");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
931 if (color)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
932 color->set_color (lexer->color (styles[i]));
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
933
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
934 QFont font = lexer->font (styles[i]);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
935
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
936 QCheckBox *cb = tab->findChild <QCheckBox *> (actual_name + "_bold");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
937 if (cb)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
938 cb->setChecked (font.bold ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
939 cb = tab->findChild <QCheckBox *> (actual_name + "_italic");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
940 if (cb)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
941 cb->setChecked (font.italic ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
942 cb = tab->findChild <QCheckBox *> (actual_name + "_underline");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
943 if (cb)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
944 cb->setChecked (font.underline ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
945
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
946 QFontComboBox *fcb = tab->findChild <QFontComboBox *> (actual_name + "_font");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
947 if (fcb)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
948 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
949 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
950 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
951 default_family = font.family ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
952 fcb->setEditText (default_family);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
953 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
954 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
955 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
956 if (font.family () == default_family)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
957 fcb->setEditText (lexer->description (0));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
958 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
959 fcb->setEditText (font.family ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
960 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
961 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
962 QSpinBox *fs = tab->findChild <QSpinBox *> (actual_name + "_size");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
963 if (fs)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
964 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
965 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
966 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
967 default_size = font.pointSize ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
968 fs->setValue (default_size);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
969 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
970 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
971 fs->setValue (font.pointSize () - default_size);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
972 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
973 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
974
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
975 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
976
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
977 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
978 settings_dialog::get_lexer_settings (QsciLexer *lexer)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
979 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
980 gui_settings 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
981
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
982 int styles[ed_max_lexer_styles]; // array for saving valid styles
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
983 // (enum is not continuous)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
984 int max_style = settings.get_valid_lexer_styles (lexer, styles);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
985 QGridLayout *style_grid = new QGridLayout ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
986 QVector<QLabel *> description (max_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
987 QVector<QFontComboBox *> select_font (max_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
988 QVector<QSpinBox *> font_size (max_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
989 QVector<QCheckBox *> attrib_font (3 * max_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
990 QVector<color_picker *> color (max_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
991 QVector<color_picker *> bg_color (max_style);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
992 int default_size = 10;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
993 QFont default_font = QFont ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
994 int label_width;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
995 QColor default_color = QColor ();
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
996
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
997 for (int i = 0; i < max_style; i++) // create dialog elements for all styles
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
998 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
999 QString actual_name = lexer->description (styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1000 QFont actual_font = lexer->font (styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1001 description[i] = new QLabel (actual_name);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1002 description[i]->setWordWrap (true);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1003 label_width = 24*description[i]->fontMetrics ().averageCharWidth ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1004 description[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1005 description[i]->setMinimumSize (label_width, 1);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1006 select_font[i] = new QFontComboBox ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1007 select_font[i]->setObjectName (actual_name + "_font");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1008 select_font[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1009 select_font[i]->setMinimumSize (label_width, 1);
31902
75ef035f851e speedup loading and saving preferences dialog (bug #63909)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31706
diff changeset
1010 select_font[i]->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1011 font_size[i] = new QSpinBox ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1012 font_size[i]->setObjectName (actual_name + "_size");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1013 if (styles[i] == 0) // the default
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1014 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1015 select_font[i]->setCurrentFont (actual_font);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1016 default_font = actual_font;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1017 font_size[i]->setRange (6, 24);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1018 default_size = actual_font.pointSize ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1019 font_size[i]->setValue (default_size);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1020 default_color = lexer->defaultPaper ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1021 bg_color[i] = new color_picker (default_color);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1022 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1023 else // other styles
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1024 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1025 select_font[i]->setCurrentFont (actual_font);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1026 if (actual_font.family () == default_font.family ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1027 select_font[i]->setEditText (lexer->description (0));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1028 font_size[i]->setRange (-4, 4);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1029 font_size[i]->setValue (actual_font.pointSize ()-default_size);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1030 font_size[i]->setToolTip (QObject::tr ("Difference to the default size"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1031 if (lexer->paper (styles[i]) == default_color)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1032 bg_color[i] = new color_picker (settings_color_no_change);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1033 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1034 bg_color[i] = new color_picker (lexer->paper (styles[i]));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1035 bg_color[i]->setToolTip
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1036 (QObject::tr ("Background color, magenta (255, 0, 255) means default"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1037 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1038 attrib_font[0+3*i] = new QCheckBox (QObject::tr ("b", "short form for bold"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1039 attrib_font[1+3*i] = new QCheckBox (QObject::tr ("i", "short form for italic"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1040 attrib_font[2+3*i] = new QCheckBox (QObject::tr ("u", "short form for underlined"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1041 attrib_font[0+3*i]->setChecked (actual_font.bold ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1042 attrib_font[0+3*i]->setObjectName (actual_name + "_bold");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1043 attrib_font[1+3*i]->setChecked (actual_font.italic ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1044 attrib_font[1+3*i]->setObjectName (actual_name + "_italic");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1045 attrib_font[2+3*i]->setChecked (actual_font.underline ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1046 attrib_font[2+3*i]->setObjectName (actual_name + "_underline");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1047 color[i] = new color_picker (lexer->color (styles[i]));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1048 color[i]->setObjectName (actual_name + "_color");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1049 bg_color[i]->setObjectName (actual_name + "_bg_color");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1050 int column = 1;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1051 style_grid->addWidget (description[i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1052 style_grid->addWidget (select_font[i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1053 style_grid->addWidget (font_size[i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1054 style_grid->addWidget (attrib_font[0+3*i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1055 style_grid->addWidget (attrib_font[1+3*i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1056 style_grid->addWidget (attrib_font[2+3*i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1057 style_grid->addWidget (color[i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1058 style_grid->addWidget (bg_color[i], i, column++);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1059 }
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
1060
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1061 // place grid with elements into the tab
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1062 QScrollArea *scroll_area = new QScrollArea ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1063 QWidget *scroll_area_contents = new QWidget ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1064 scroll_area_contents->setObjectName (QString (lexer->language ()) + "_styles");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1065 scroll_area_contents->setLayout (style_grid);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1066 scroll_area->setWidget (scroll_area_contents);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1067 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
1068
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1069 tabs_editor_lexers->setCurrentIndex (settings.int_value (sd_last_editor_styles_tab));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1070 }
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
1071
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1072 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1073 settings_dialog::write_lexer_settings (QsciLexer *lexer)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1074 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1075 gui_settings 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
1076
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1077 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1078 = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1079 int mode = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1080 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1081 mode = 1;
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1082
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1083 settings.setValue (ed_color_mode.settings_key (), mode);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1084
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1085 QWidget *tab = tabs_editor_lexers->
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1086 findChild <QWidget *> (QString (lexer->language ()) + "_styles");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1087 int styles[ed_max_lexer_styles]; // array for saving valid styles
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1088 // (enum is not continuous)
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
1089
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1090 int max_style = settings.get_valid_lexer_styles (lexer, styles);
26008
38a881b8fbec do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents: 25974
diff changeset
1091
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1092 QFontComboBox *select_font;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1093 QSpinBox *font_size;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1094 QCheckBox *attrib_font[3];
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1095 color_picker *color;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1096 color_picker *bg_color;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1097 int default_size = 10;
26008
38a881b8fbec do not use courier new as default font (bug #54086)
Torsten <mttl@mailbox.org>
parents: 25974
diff changeset
1098
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1099 color = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1100 if (color)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1101 settings.setValue (ed_highlight_current_line_color.settings_key ()
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1102 + settings_color_modes_ext[mode], color->color ());
31304
d3231a604a62 re-enable user preferences for current editor line color (bug #62984)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30965
diff changeset
1103
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1104 QString default_font_name
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1105 = settings.string_value (global_mono_font);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1106 QFont default_font = QFont (default_font_name, 10, -1, 0);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1107 QColor default_color = QColor ();
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
1108
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1109 for (int i = 0; i < max_style; i++) // get dialog elements and their contents
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1110 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1111 QString actual_name = lexer->description (styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1112 select_font = tab->findChild <QFontComboBox *> (actual_name + "_font");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1113 font_size = tab->findChild <QSpinBox *> (actual_name + "_size");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1114 attrib_font[0] = tab->findChild <QCheckBox *> (actual_name + "_bold");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1115 attrib_font[1] = tab->findChild <QCheckBox *> (actual_name + "_italic");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1116 attrib_font[2] = tab->findChild <QCheckBox *> (actual_name + "_underline");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1117 color = tab->findChild <color_picker *> (actual_name + "_color");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1118 bg_color = tab->findChild <color_picker *> (actual_name + "_bg_color");
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1119 QFont new_font = default_font;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1120 if (select_font)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1121 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1122 new_font = select_font->currentFont ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1123 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1124 default_font = new_font;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1125 else if (select_font->currentText () == lexer->description (0))
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1126 new_font = default_font;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1127 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1128 if (font_size)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1129 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1130 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1131 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1132 default_size = font_size->value ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1133 new_font.setPointSize (font_size->value ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1134 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1135 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1136 new_font.setPointSize (font_size->value ()+default_size);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1137 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1138 if (attrib_font[0])
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1139 new_font.setBold (attrib_font[0]->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1140 if (attrib_font[1])
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1141 new_font.setItalic (attrib_font[1]->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1142 if (attrib_font[2])
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1143 new_font.setUnderline (attrib_font[2]->isChecked ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1144 lexer->setFont (new_font, styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1145 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1146 lexer->setDefaultFont (new_font);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1147 if (color)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1148 lexer->setColor (color->color (), styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1149 if (bg_color)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1150 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1151 if (styles[i] == 0)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1152 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1153 default_color = bg_color->color ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1154 lexer->setPaper (default_color, styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1155 lexer->setDefaultPaper (default_color);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1156 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1157 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1158 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1159 if (bg_color->color () == settings_color_no_change)
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1160 lexer->setPaper (default_color, styles[i]);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1161 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1162 lexer->setPaper (bg_color->color (), styles[i]);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1163 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1164 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1165 }
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
1166
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1167 const std::string group =
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1168 QString ("Scintilla" + settings_color_modes_ext[mode]).toStdString ();
29498
5384bb4efc51 rearrange default lexer settings and add second color mode to gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29488
diff changeset
1169
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1170 lexer->writeSettings (settings, group.c_str ());
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
1171
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1172 settings.setValue (sd_last_editor_styles_tab.settings_key (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1173 tabs_editor_lexers->currentIndex ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1174 settings.sync ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1175 }
20279
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
1176
3a745710eaca Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 19913
diff changeset
1177 #endif
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1178
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1179 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1180 settings_dialog::write_changed_settings ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1181 {
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1182
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1183 gui_settings settings;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1184
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1185 // the icon set
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1186 QString widget_icon_set = "NONE";
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1187 if (general_icon_letter->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1188 widget_icon_set = "LETTER";
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1189 else if (general_icon_graphic->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1190 widget_icon_set = "GRAPHIC";
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1191 settings.setValue (dw_icon_set.settings_key (), widget_icon_set);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1192
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1193 // language
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1194 QString language = comboBox_language->currentText ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1195 if (language == tr ("System setting"))
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1196 language = global_language.def ().toString ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1197 settings.setValue (global_language.settings_key (), language);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1198
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1199 // style
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1200 QString selected_style = combo_styles->currentText ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1201 if (selected_style == global_style.def ().toString ())
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1202 selected_style = global_style.def ().toString ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1203 settings.setValue (global_style.settings_key (), selected_style);
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26140
diff changeset
1204
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1205 // dock widget title bar
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1206 settings.setValue (dw_title_custom_style.settings_key (), cb_widget_custom_style->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1207 settings.setValue (dw_title_3d.settings_key (), sb_3d_title->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1208 settings.setValue (dw_title_bg_color.settings_key (), m_widget_title_bg_color->color ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1209 settings.setValue (dw_title_bg_color_active.settings_key (), m_widget_title_bg_color_active->color ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1210 settings.setValue (dw_title_fg_color.settings_key (), m_widget_title_fg_color->color ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1211 settings.setValue (dw_title_fg_color_active.settings_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
1212
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1213 // icon size and theme
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1214 int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1215 settings.setValue (global_icon_size.settings_key (), icon_size);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1216 settings.setValue (global_icon_theme_index.settings_key (), combo_box_icon_theme->currentIndex ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1217
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1218 // native file dialogs
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1219 settings.setValue (global_use_native_dialogs.settings_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
1220
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1221 // cursor blinking
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1222 settings.setValue (global_cursor_blinking.settings_key (), cb_cursor_blinking->isChecked ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1223
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1224 // focus follows mouse
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1225 settings.setValue (dw_focus_follows_mouse.settings_key (), cb_focus_follows_mouse->isChecked ());
29202
66af654b3485 provide focus follows mouse for widgets in the main window (bug #59701)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29165
diff changeset
1226
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1227 // promp to exit
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1228 settings.setValue (global_prompt_to_exit.settings_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
1229
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1230 // status bar
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1231 settings.setValue (global_status_bar.settings_key (), cb_status_bar->isChecked ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1232
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1233 // Octave startup
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1234 settings.setValue (global_restore_ov_dir.settings_key (), cb_restore_octave_dir->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1235 settings.setValue (global_ov_startup_dir.settings_key (), le_octave_dir->text ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1236
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1237 //editor
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1238 settings.setValue (global_use_custom_editor.settings_key (), useCustomFileEditor->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1239 settings.setValue (global_custom_editor.settings_key (), customFileEditor->text ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1240 settings.setValue (ed_show_line_numbers.settings_key (), editor_showLineNumbers->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1241 settings.setValue (ed_line_numbers_size.settings_key (), editor_linenr_size->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1242 settings.setValue (ed_highlight_current_line.settings_key (), editor_highlightCurrentLine->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1243 settings.setValue (ed_long_line_marker.settings_key (), editor_long_line_marker->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1244 settings.setValue (ed_long_line_marker_line.settings_key (), editor_long_line_marker_line->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1245 settings.setValue (ed_long_line_marker_background.settings_key (), editor_long_line_marker_background->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1246 settings.setValue (ed_long_line_column.settings_key (), editor_long_line_column->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1247 settings.setValue (ed_break_lines.settings_key (), editor_break_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1248 settings.setValue (ed_break_lines_comments.settings_key (), editor_break_comments_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1249 settings.setValue (ed_wrap_lines.settings_key (), editor_wrap_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1250 settings.setValue (ed_code_folding.settings_key (), cb_code_folding->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1251 settings.setValue (ed_show_edit_status_bar.settings_key (), cb_edit_status_bar->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1252 settings.setValue (ed_show_toolbar.settings_key (), cb_edit_tool_bar->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1253 settings.setValue (ed_highlight_all_occurrences.settings_key (), editor_highlight_all_occurrences->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1254 settings.setValue (ed_code_completion.settings_key (), editor_codeCompletion->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1255 settings.setValue (ed_code_completion_threshold.settings_key (), editor_spinbox_ac_threshold->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1256 settings.setValue (ed_code_completion_keywords.settings_key (), editor_checkbox_ac_keywords->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1257 settings.setValue (ed_code_completion_octave_builtins.settings_key (), editor_checkbox_ac_builtins->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1258 settings.setValue (ed_code_completion_octave_functions.settings_key (), editor_checkbox_ac_functions->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1259 settings.setValue (ed_code_completion_document.settings_key (), editor_checkbox_ac_document->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1260 settings.setValue (ed_code_completion_case.settings_key (), editor_checkbox_ac_case->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1261 settings.setValue (ed_code_completion_replace.settings_key (), editor_checkbox_ac_replace->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1262 settings.setValue (ed_auto_endif.settings_key (), editor_auto_endif->currentIndex ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1263 settings.setValue (ed_show_white_space.settings_key (), editor_ws_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1264 settings.setValue (ed_show_white_space_indent.settings_key (), editor_ws_indent_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1265 settings.setValue (ed_show_eol_chars.settings_key (), cb_show_eol->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1266 settings.setValue (ed_show_hscroll_bar.settings_key (), cb_show_hscrollbar->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1267 settings.setValue (ed_default_eol_mode.settings_key (), combo_eol_mode->currentIndex ());
24475
8cb985e362f3 Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents: 24290
diff changeset
1268
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1269 settings.setValue (ed_tab_position.settings_key (), editor_combox_tab_pos->currentIndex ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1270 settings.setValue (ed_tabs_rotated.settings_key (), editor_cb_tabs_rotated->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1271 settings.setValue (ed_tabs_max_width.settings_key (), editor_sb_tabs_max_width->value ());
27055
b38807a23fd2 add a preference for the tab positions in the editor (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26530
diff changeset
1272
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1273 // Comment strings
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1274 int rb_uncomment = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1275 for (int i = 0; i < ed_comment_strings_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1276 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1277 if (m_rb_comment_strings[i]->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1278 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1279 settings.setValue (ed_comment_str.settings_key (), i);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1280 if (i < 3)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1281 settings.setValue (ed_comment_str_old.settings_key (), i);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1282 else
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1283 settings.setValue (ed_comment_str_old.settings_key (), ed_comment_str.def ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1284 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1285 if (m_rb_uncomment_strings[i]->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1286 rb_uncomment = rb_uncomment + (1 << i);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1287 }
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1288 settings.setValue (ed_uncomment_str.settings_key (), rb_uncomment);
24475
8cb985e362f3 Allow uncommenting with any kind of comment (bug #52695):
Torsten <mttl@mailbox.org>
parents: 24290
diff changeset
1289
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1290 settings.setValue (ed_default_enc.settings_key (), editor_combo_encoding->currentText ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1291 settings.setValue (ed_auto_indent.settings_key (), editor_auto_ind_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1292 settings.setValue (ed_tab_indents_line.settings_key (), editor_tab_ind_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1293 settings.setValue (ed_backspace_unindents_line.settings_key (), editor_bs_unind_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1294 settings.setValue (ed_show_indent_guides.settings_key (), editor_ind_guides_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1295 settings.setValue (ed_indent_width.settings_key (), editor_ind_width_spinbox->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1296 settings.setValue (ed_indent_uses_tabs.settings_key (), editor_ind_uses_tabs_checkbox->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1297 settings.setValue (ed_tab_width.settings_key (), editor_tab_width_spinbox->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1298 settings.setValue (ed_restore_session.settings_key (), editor_restoreSession->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1299 settings.setValue (ed_create_new_file.settings_key (), editor_create_new_file->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1300 settings.setValue (ed_hiding_closes_files.settings_key (), editor_hiding_closes_files->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1301 settings.setValue (ed_always_reload_changed_files.settings_key (), editor_reload_changed_files->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1302 settings.setValue (ed_force_newline.settings_key (), editor_force_newline->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1303 settings.setValue (ed_rm_trailing_spaces.settings_key (), editor_remove_trailing_spaces->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1304 settings.setValue (ed_show_dbg_file.settings_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
1305
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1306 // file browser
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1307 settings.setValue (fb_sync_octdir.settings_key (), sync_octave_directory->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1308 settings.setValue (fb_restore_last_dir.settings_key (), cb_restore_file_browser_dir->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1309 settings.setValue (fb_startup_dir.settings_key (), le_file_browser_dir->text ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1310 settings.setValue (fb_txt_file_ext.settings_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
1311
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1312 // network
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1313 settings.setValue (nr_allow_connection.settings_key (), checkbox_allow_web_connect->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1314 settings.setValue (global_use_proxy.settings_key (), use_proxy_server->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1315 settings.setValue (global_proxy_type.settings_key (), proxy_type->currentText ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1316 settings.setValue (global_proxy_host.settings_key (), proxy_host_name->text ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1317 settings.setValue (global_proxy_port.settings_key (), proxy_port->text ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1318 settings.setValue (global_proxy_user.settings_key (), proxy_username->text ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1319 settings.setValue (global_proxy_pass.settings_key (), proxy_password->text ());
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1320
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1321 // command window
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1322 settings.setValue (cs_font_size.settings_key (), terminal_fontSize->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1323 settings.setValue (cs_font.settings_key (), terminal_fontName->currentFont ().family ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1324 settings.setValue (cs_cursor_use_fgcol.settings_key (), terminal_cursorUseForegroundColor->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1325 settings.setValue (cs_focus_cmd.settings_key (), terminal_focus_command->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1326 settings.setValue (cs_dbg_location.settings_key (), terminal_print_dbg_location->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1327 settings.setValue (cs_hist_buffer.settings_key (), terminal_history_buffer->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1328 write_terminal_colors ();
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1329
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1330 // the cursor
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1331 QString cursor_type;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1332 unsigned int cursor_int = terminal_cursorType->currentIndex ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1333 if ((cursor_int > 0) && (cursor_int < cs_cursor_types.size ()))
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1334 cursor_type = QString (cs_cursor_types[cursor_int].data ());
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1335 else
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1336 cursor_type = cs_cursor.def ().toString ();
27583
315c35e6037c use symbolic constants for command widget preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27570
diff changeset
1337
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1338 settings.setValue (cs_cursor.settings_key (), cursor_type);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1339
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1340 #if defined (HAVE_QSCINTILLA)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1341 // editor styles: create lexer, get dialog contents, and write settings
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1342 QsciLexer *lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1343
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1344 #if defined (HAVE_LEXER_OCTAVE)
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1345
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1346 lexer = new QsciLexerOctave ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1347 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1348 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1349
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1350 #elif defined (HAVE_LEXER_MATLAB)
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1351
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1352 lexer = new QsciLexerMatlab ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1353 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1354 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1355
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1356 #endif
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1357
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1358 lexer = new QsciLexerCPP ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1359 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1360 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1361
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1362 lexer = new QsciLexerJava ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1363 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1364 delete lexer;
29165
617d3aa713a4 add java file support in gui editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29162
diff changeset
1365
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1366 lexer = new QsciLexerPerl ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1367 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1368 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1369
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1370 lexer = new QsciLexerBatch ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1371 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1372 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1373
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1374 lexer = new QsciLexerDiff ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1375 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1376 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1377
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1378 lexer = new QsciLexerBash ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1379 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1380 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1381
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1382 lexer = new octave_txt_lexer ();
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1383 write_lexer_settings (lexer);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1384 delete lexer;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1385
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1386 #endif
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1387
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1388 // Workspace
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1389 write_workspace_colors ();
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1390
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1391 // Variable editor
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1392 settings.setValue (ve_column_width.settings_key (), varedit_columnWidth->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1393 settings.setValue (ve_row_height.settings_key (), varedit_rowHeight->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1394 settings.setValue (ve_use_terminal_font.settings_key (), varedit_useTerminalFont->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1395 settings.setValue (ve_alternate_rows.settings_key (), varedit_alternate->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1396 settings.setValue (ve_font_name.settings_key (), varedit_font->currentFont ().family ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1397 settings.setValue (ve_font_size.settings_key (), varedit_fontSize->value ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1398 write_varedit_colors ();
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1399
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1400 // shortcuts
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
1401
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1402 settings.setValue (sc_prevent_rl_conflicts.settings_key (), cb_prevent_readline_conflicts->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1403 settings.setValue (sc_prevent_rl_conflicts_menu.settings_key (), cb_prevent_readline_conflicts_menu->isChecked ());
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1404
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1405 shortcuts_treewidget->write_settings ();
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1406
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1407 settings.sync ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1408 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1409
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1410 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1411 settings_dialog::read_workspace_colors ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1412 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1413 gui_settings settings;
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27629
diff changeset
1414
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1415 // Construct the grid with all color related settings
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1416 QGridLayout *style_grid = new QGridLayout ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1417 QVector<QLabel *> description (ws_colors_count);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1418 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
1419
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1420 int column = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1421 const int color_columns = 3; // place colors in so many columns
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1422 int row = 0;
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1423 int mode = settings.int_value (ws_color_mode);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1424
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1425 m_ws_enable_colors = new QCheckBox (tr ("Enable attribute colors"));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1426 style_grid->addWidget (m_ws_enable_colors, row++, column, 1, 4);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1427
32519
6ff63f154144 maint: Review and update strings that appear in GUI.
Rik <rik@octave.org>
parents: 32049
diff changeset
1428 m_ws_hide_tool_tips = new QCheckBox (tr ("Hide tool tips"));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1429 style_grid->addWidget (m_ws_hide_tool_tips, row++, column, 1, 4);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1430 connect (m_ws_enable_colors, &QCheckBox::toggled,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1431 m_ws_hide_tool_tips, &QCheckBox::setEnabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1432 m_ws_hide_tool_tips->setChecked
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1433 (settings.bool_value (ws_hide_tool_tips));
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1434
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1435 QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1436 cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1437 cb_color_mode->setChecked (mode == 1);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1438 cb_color_mode->setObjectName (ws_color_mode.settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1439 connect (m_ws_enable_colors, &QCheckBox::toggled,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1440 cb_color_mode, &QCheckBox::setEnabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1441 style_grid->addWidget (cb_color_mode, row, column);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1442
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1443 QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1444 pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1445 connect (m_ws_enable_colors, &QCheckBox::toggled,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1446 pb_reload_default_colors, &QPushButton::setEnabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1447 style_grid->addWidget (pb_reload_default_colors, row+1, column++);
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1448
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1449 bool colors_enabled = settings.bool_value (ws_enable_colors);
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1450
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1451 for (int i = 0; i < ws_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1452 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1453 description[i] = new QLabel (" "
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1454 + tr (ws_color_names.at (i).toStdString ().data ()));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1455 description[i]->setAlignment (Qt::AlignRight);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1456 description[i]->setEnabled (colors_enabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1457 connect (m_ws_enable_colors, &QCheckBox::toggled,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1458 description[i], &QLabel::setEnabled);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1459
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1460 QColor setting_color = settings.color_value (ws_colors[i], mode);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1461 color[i] = new color_picker (setting_color);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1462 color[i]->setObjectName (ws_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1463 color[i]->setMinimumSize (30, 10);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1464 color[i]->setEnabled (colors_enabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1465 connect (m_ws_enable_colors, &QCheckBox::toggled,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1466 color[i], &color_picker::setEnabled);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1467
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1468 style_grid->addWidget (description[i], row, 3*column);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1469 style_grid->addWidget (color[i], row, 3*column+1);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1470 if (++column > color_columns)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1471 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1472 style_grid->setColumnStretch (4*column, 10);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1473 row++;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1474 column = 1;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1475 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1476 }
16610
a1f613e5066d workspace view colors based upon variable scope (derived from Dan's patch #8013)
Torsten <ttl@justmail.de>
parents: 16525
diff changeset
1477
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1478 // Load enable settings at the end for having signals already connected
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1479 m_ws_enable_colors->setChecked (colors_enabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1480 m_ws_hide_tool_tips->setEnabled (colors_enabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1481 cb_color_mode->setEnabled (colors_enabled);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1482 pb_reload_default_colors->setEnabled (colors_enabled);
25974
c3cd63006870 add preference for disabling workspace colors for different attributes
Torsten <mttl@mailbox.org>
parents: 25954
diff changeset
1483
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1484 // place grid with elements into the tab
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1485 workspace_colors_box->setLayout (style_grid);
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1486
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1487 // update colors depending on second theme selection or reloading
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1488 // the dfault values
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1489 connect (cb_color_mode, &QCheckBox::stateChanged,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1490 this, &settings_dialog::update_workspace_colors);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1491 connect (pb_reload_default_colors, &QPushButton::clicked,
33034
49128bdb9eb2 use explicit lambda-expression captures (bug #65318)
John W. Eaton <jwe@octave.org>
parents: 33033
diff changeset
1492 [this] () { update_workspace_colors (settings_reload_default_colors_flag); });
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1493 }
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1494
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1495 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1496 settings_dialog::update_workspace_colors (int def)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1497 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1498 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1499 = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1500
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1501 int m = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1502 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1503 m = 1;
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1504
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1505 gui_settings settings;
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1506
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1507 color_picker *c_picker;
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1508
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1509 for (unsigned int i = 0; i < ws_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1510 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1511 c_picker = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1512 if (c_picker)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1513 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1514 if (def != settings_reload_default_colors_flag)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1515 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1516 // Get current value from settings or the default
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1517 c_picker->set_color (settings.color_value (ws_colors[i], m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1518 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1519 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1520 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1521 // Get the default value
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1522 c_picker->set_color (settings.get_color_value (ws_colors[i].def (), m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1523 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1524 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1525 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1526 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1527
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1528 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1529 settings_dialog::write_workspace_colors ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1530 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1531 gui_settings settings;
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1532
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1533 settings.setValue (ws_enable_colors.settings_key (), m_ws_enable_colors->isChecked ());
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1534 settings.setValue (ws_hide_tool_tips.settings_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
1535
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1536 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1537 = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1538
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1539 int mode = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1540 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1541 mode = 1;
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1542
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1543 color_picker *color;
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1544
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1545 for (int i = 0; i < ws_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1546 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1547 color = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1548 if (color)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1549 settings.set_color_value (ws_colors[i], color->color (), mode);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1550 }
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1551
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1552 settings.setValue (ws_color_mode.settings_key (), mode);
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1553
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1554 settings.sync ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1555 }
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23996
diff changeset
1556
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1557 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1558 settings_dialog::read_terminal_colors ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1559 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1560 gui_settings settings;
29487
00674bc1446d provide second color mode for workspace view
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29484
diff changeset
1561
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1562 QGridLayout *style_grid = new QGridLayout ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1563 QVector<QLabel *> description (cs_colors_count);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1564 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
1565
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1566 int mode = settings.int_value (cs_color_mode);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1567
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1568 QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1569 cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1570 cb_color_mode->setChecked (mode == 1);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1571 cb_color_mode->setObjectName (cs_color_mode.settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1572 style_grid->addWidget (cb_color_mode, 0, 0);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1573
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1574 QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1575 pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1576 style_grid->addWidget (pb_reload_default_colors, 1, 0);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1577
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1578 int column = 1; // column 0 is for the color mode checkbox
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1579 const int color_columns = 2; // place colors in so many columns
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1580 int row = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1581 for (unsigned int i = 0; i < cs_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1582 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1583 description[i] = new QLabel (" "
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1584 + tr (cs_color_names.at (i).toStdString ().data ()));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1585 description[i]->setAlignment (Qt::AlignRight);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1586 QColor setting_color = settings.color_value (cs_colors[i], mode);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1587 color[i] = new color_picker (setting_color);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1588 color[i]->setObjectName (cs_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1589 color[i]->setMinimumSize (30, 10);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1590 style_grid->addWidget (description[i], row, 2*column);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1591 style_grid->addWidget (color[i], row, 2*column+1);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1592 if (++column > color_columns)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1593 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1594 style_grid->setColumnStretch (3*column, 10);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1595 row++;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1596 column = 1;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1597 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1598 }
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16610
diff changeset
1599
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1600 // place grid with elements into the tab
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1601 terminal_colors_box->setLayout (style_grid);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1602
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1603 // update colors depending on second theme selection
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1604 connect (cb_color_mode, &QCheckBox::stateChanged,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1605 this, &settings_dialog::update_terminal_colors);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1606 connect (pb_reload_default_colors, &QPushButton::clicked,
33034
49128bdb9eb2 use explicit lambda-expression captures (bug #65318)
John W. Eaton <jwe@octave.org>
parents: 33033
diff changeset
1607 [this] () { update_terminal_colors (settings_reload_default_colors_flag); });
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1608 }
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1609
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1610 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1611 settings_dialog::update_terminal_colors (int def)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1612 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1613 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1614 = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1615
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1616 int m = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1617 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1618 m = 1;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1619
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1620 gui_settings settings;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1621
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1622 color_picker *c_picker;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1623
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1624 for (unsigned int i = 0; i < cs_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1625 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1626 c_picker = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1627 if (c_picker)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1628 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1629 if (def != settings_reload_default_colors_flag)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1630 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1631 // Get current value from settings or the default
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1632 c_picker->set_color (settings.color_value (cs_colors[i], m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1633 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1634 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1635 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1636 // Get the default value
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1637 c_picker->set_color (settings.get_color_value (cs_colors[i].def (), m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1638 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1639 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1640 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1641 }
16402
7fa90eb41240 gui: individually configurable styles of the editor lexers
Torsten <ttl@justmail.de>
parents: 16379
diff changeset
1642
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1643 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1644 settings_dialog::write_terminal_colors ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1645 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1646 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1647 = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1648
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1649 int mode = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1650 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1651 mode = 1;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1652
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1653 gui_settings settings;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1654
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1655 color_picker *color;
16620
818eef7b2618 allow terminal colors to be set from preferences dialog
John W. Eaton <jwe@octave.org>
parents: 16610
diff changeset
1656
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1657 for (int i = 0; i < cs_color_names.size (); i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1658 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1659 color = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1660 if (color)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1661 settings.set_color_value (cs_colors[i], color->color (), mode);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1662 }
19632
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
1663
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1664 settings.setValue (cs_color_mode.settings_key (), mode);
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1665
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1666 settings.sync ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1667 }
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
1668
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1669 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1670 settings_dialog::read_varedit_colors ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1671 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1672 gui_settings settings;
29484
bed2fd5b8263 allow a second color theme for the console window (dark mode)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29468
diff changeset
1673
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1674 QGridLayout *style_grid = new QGridLayout ();
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1675 QVector<QLabel *> description (ve_colors_count);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1676 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
1677
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1678 int mode = settings.int_value (ve_color_mode);
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1679
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1680 QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1681 cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1682 cb_color_mode->setChecked (mode == 1);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1683 cb_color_mode->setObjectName (ve_color_mode.settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1684 style_grid->addWidget (cb_color_mode, 0, 0);
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1685
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1686 QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1687 pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1688 style_grid->addWidget (pb_reload_default_colors, 1, 0);
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1689
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1690 int column = 1;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1691 int color_columns = 2;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1692 int row = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1693 for (int i = 0; i < ve_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1694 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1695 description[i] = new QLabel (" "
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1696 + tr (ve_color_names.at (i).toStdString ().data ()));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1697 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
1698
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1699 QColor setting_color = settings.color_value (ve_colors[i], mode);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1700 color[i] = new color_picker (setting_color);
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1701 color[i]->setObjectName (ve_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1702 color[i]->setMinimumSize (30, 10);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1703 style_grid->addWidget (description[i], row, 2*column);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1704 style_grid->addWidget (color[i], row, 2*column+1);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1705 if (++column > color_columns)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1706 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1707 style_grid->setColumnStretch (3*column, 10);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1708 row++;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1709 column = 1;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1710 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1711 }
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23810
diff changeset
1712
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1713 // place grid with elements into the tab
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1714 varedit_colors_box->setLayout (style_grid);
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1715
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1716 // update colors depending on second theme selection
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1717 connect (cb_color_mode, &QCheckBox::stateChanged,
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1718 this, &settings_dialog::update_varedit_colors);
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1719 connect (pb_reload_default_colors, &QPushButton::clicked,
33034
49128bdb9eb2 use explicit lambda-expression captures (bug #65318)
John W. Eaton <jwe@octave.org>
parents: 33033
diff changeset
1720 [this] () { update_varedit_colors (settings_reload_default_colors_flag); });
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1721 }
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1722
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1723 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1724 settings_dialog::update_varedit_colors (int def)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1725 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1726 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1727 = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1728
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1729 int m = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1730 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1731 m = 1;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1732
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1733 gui_settings settings;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1734
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1735 color_picker *c_picker;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1736
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1737 for (unsigned int i = 0; i < ve_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1738 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1739 c_picker = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1740 if (c_picker)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1741 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1742 if (def != settings_reload_default_colors_flag)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1743 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1744 // Get current value from settings or the default
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1745 c_picker->set_color (settings.color_value (ve_colors[i], m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1746 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1747 else
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1748 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1749 // Get the default value
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1750 c_picker->set_color (settings.get_color_value (ve_colors[i].def (), m));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1751 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1752 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1753 }
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1754 }
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
1755
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1756 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1757 settings_dialog::write_varedit_colors ()
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1758 {
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1759 QCheckBox *cb_color_mode
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1760 = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1761
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1762 int mode = 0;
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1763 if (cb_color_mode && cb_color_mode->isChecked ())
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1764 mode = 1;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1765
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1766 gui_settings settings;
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27660
diff changeset
1767
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1768 color_picker *color;
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18733
diff changeset
1769
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1770 for (int i = 0; i < ve_colors_count; i++)
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1771 {
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1772 color = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ());
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1773 if (color)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1774 settings.set_color_value (ve_colors[i], color->color (), mode);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1775 }
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18733
diff changeset
1776
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1777 settings.setValue (ve_color_mode.settings_key (), mode);
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1778
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1779 settings.sync ();
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1780 }
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23810
diff changeset
1781
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1782 QString
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1783 settings_dialog::get_shortcuts_file_name (import_export_action action)
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1784 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1785 QString file;
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1786
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1787 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1788 int opts = 0; // No options by default.
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1789
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1790 gui_settings settings;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1791
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1792 if (! settings.bool_value (global_use_native_dialogs))
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1793 opts = QFileDialog::DontUseNativeDialog;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1794
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1795 if (action == OSC_IMPORT)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1796 file = QFileDialog::getOpenFileName
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1797 (this, tr ("Import shortcuts from file..."), QString (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1798 tr ("Octave Shortcut Files (*.osc);;All Files (*)"),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1799 nullptr, QFileDialog::Option (opts));
29524
730cac3d6d5a allow reloading default colors and styles in the preferences dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29498
diff changeset
1800
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1801 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1802 file = QFileDialog::getSaveFileName
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1803 (this, tr ("Export shortcuts to file..."), QString (),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1804 tr ("Octave Shortcut Files (*.osc);;All Files (*)"),
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1805 nullptr, QFileDialog::Option (opts));
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1806
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1807 return file;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1808 }
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1809
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1810 // Ask whether to overwrite current shortcuts with settings from an
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1811 // imported file. Optionally allow current shortcuts to be saved to a
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1812 // file.
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1813
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1814 // FIXME: If the tree view contains changes that have not yet been
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1815 // saved to the application settings object, should we
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1816 //
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1817 // * allow the user to choose whether to
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1818 // - cancel the operation (X)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1819 // - save the modified settings (X)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1820 // - save the current application settings (XX)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1821 //
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1822 // * unconditionally display an error dialog and cancel the
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1823 // export operation
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1824 //
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1825 // (X) - already an option, but not based on whether the tree view
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1826 // contains unsaved changes
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1827 // (XX) - already possible (cancel operation, cancel settings
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1828 // dialog, re-open settings dialog and export changes).
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1829
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1830 bool
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1831 settings_dialog::overwrite_all_shortcuts ()
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1832 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1833 QMessageBox msg_box;
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1834
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1835 msg_box.setWindowTitle (tr ("Overwriting Shortcuts"));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1836 msg_box.setIcon (QMessageBox::Warning);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1837 msg_box.setText (tr ("You are about to overwrite all shortcuts.\n"
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1838 "Would you like to save the current shortcut set or cancel the action?"));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1839 msg_box.setStandardButtons (QMessageBox::Save | QMessageBox::Cancel);
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1840
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1841 QPushButton *discard
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1842 = msg_box.addButton (tr ("Don't save"), QMessageBox::DestructiveRole);
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1843
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1844 msg_box.setDefaultButton (QMessageBox::Save);
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1845
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1846 int ret = msg_box.exec ();
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
1847
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1848 if (msg_box.clickedButton () == discard)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1849 return true;
18310
03a8428adef7 gui: provide prefernces for the file browser's directory at startup
Torsten <ttl@justmail.de>
parents: 18309
diff changeset
1850
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1851 if (ret == QMessageBox::Save)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1852 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1853 QString file = get_shortcuts_file_name (OSC_EXPORT);
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29487
diff changeset
1854
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1855 gui_settings osc_settings (file, QSettings::IniFormat);
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18733
diff changeset
1856
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1857 if (osc_settings.status () == QSettings::NoError)
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1858 {
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1859 shortcuts_treewidget->export_shortcuts (osc_settings);
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1860 return true;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1861 }
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1862 else
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1863 qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1864 .arg (file));
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1865 }
18822
3f6280d0a36b allow export and import of shortcut sets
Torsten <ttl@justmail.de>
parents: 18733
diff changeset
1866
31808
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1867 return false;
90621682cc03 maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents: 31771
diff changeset
1868 }
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
1869
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1870 QMessageBox *
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1871 settings_dialog::wait_message_box (const QString& text, QWidget *p)
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1872 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1873 QMessageBox *info = new QMessageBox (p);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1874
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1875 info->setIcon (QMessageBox::Information);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1876 info->setWindowTitle (tr ("Octave GUI preferences"));
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1877 info->setText (text);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1878 info->setStandardButtons (QMessageBox::Ok);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1879 info->setAttribute (Qt::WA_DeleteOnClose);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1880 info->setWindowModality (Qt::NonModal);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1881
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1882 info->show ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1883 QThread::msleep (100);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1884 QCoreApplication::processEvents ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1885
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1886 QApplication::setOverrideCursor (Qt::WaitCursor);
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1887
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1888 return info;
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1889 }
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1890
32592
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1891 void
094a296b3ba1 maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents: 32519
diff changeset
1892 settings_dialog::close_wait_message_box (QMessageBox *mbox)
31861
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1893 {
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1894 QApplication::restoreOverrideCursor ();
5943f65d06c4 improve settings dialog: load/appy info dialog, reset button
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31808
diff changeset
1895 mbox->close ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1896 }
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
1897
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31569
diff changeset
1898 OCTAVE_END_NAMESPACE(octave)