annotate libgui/src/gui-preferences-ve.h @ 31599:50a225732661 stable

use initializer lists instead of insertion operators * gui-preferences-cs.h, gui-preferences-ed.h, gui-preferences-global.h, gui-preferences-ve.h, gui-preferences-ws.h, main-window.cc: Where possible, use initializer lists ({ a, b, ... }) instead of insertion operators (QStringList () << a << b << ...).
author John W. Eaton <jwe@octave.org>
date Thu, 01 Dec 2022 12:50:48 -0500
parents 796f54d4ddbf
children aae24eaf89ad 597f3ee61a48
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 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29488
diff changeset
3 // Copyright (C) 2017-2022 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 ////////////////////////////////////////////////////////////////////////
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_gui_preferences_ve_h)
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_gui_preferences_ve_h 1
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include "gui-preferences.h"
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
31 #include <QApplication>
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
32
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 // Variable Editor preferences
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 const gui_pref
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
36 ve_use_terminal_font ("variable_editor/use_terminal_font", QVariant (true));
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
37
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
38 const gui_pref
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
39 ve_font_name ("variable_editor/font_name", QVariant ());
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
40
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
41 const gui_pref
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
42 ve_font_size ("variable_editor/font_size", QVariant (10));
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
43
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
44 const gui_pref
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
45 ve_column_width ("variable_editor/column_width", QVariant (100));
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
46
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
47 const gui_pref
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
48 ve_row_height ("variable_editor/row_height", QVariant (10));
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
49
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
50 const gui_pref
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
51 ve_alternate_rows ("variable_editor/alternate_rows", QVariant (false));
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
52
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
53 const gui_pref
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
54 ve_color_mode ("variable_editor/color_mode", QVariant (0));
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
55
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
56 const QString ve_color_chars ("fbsha");
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
57
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
58 const int ve_colors_count = 5;
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
59 const gui_pref ve_colors[2*ve_colors_count] =
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
60 {
29488
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
61 {"variable_editor/color_f" + settings_color_modes_ext[0], QVariant (QPalette::WindowText)},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
62 {"variable_editor/color_b" + settings_color_modes_ext[0], QVariant (QPalette::Base)},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
63 {"variable_editor/color_s" + settings_color_modes_ext[0], QVariant (QPalette::HighlightedText)},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
64 {"variable_editor/color_h" + settings_color_modes_ext[0], QVariant (QPalette::Highlight)},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
65 {"variable_editor/color_a" + settings_color_modes_ext[0], QVariant (QPalette::AlternateBase)},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
66 {"variable_editor/color_f" + settings_color_modes_ext[1], QVariant ()},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
67 {"variable_editor/color_b" + settings_color_modes_ext[1], QVariant ()},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
68 {"variable_editor/color_s" + settings_color_modes_ext[1], QVariant ()},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
69 {"variable_editor/color_h" + settings_color_modes_ext[1], QVariant ()},
2a251de6c1a5 provide second color mode for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
70 {"variable_editor/color_a" + settings_color_modes_ext[1], QVariant ()}
27662
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
71 };
3b078b750181 replace preference literals by symbolic constants for variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27562
diff changeset
72
31599
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
73 const QStringList ve_color_names = {
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
74 QT_TRANSLATE_NOOP ("octave::settings_dialog", "Foreground"),
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
75 QT_TRANSLATE_NOOP ("octave::settings_dialog", "Background"),
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
76 QT_TRANSLATE_NOOP ("octave::settings_dialog", "Selected Foreground"),
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
77 QT_TRANSLATE_NOOP ("octave::settings_dialog", "Selected Background"),
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
78 QT_TRANSLATE_NOOP ("octave::settings_dialog", "Alternate Background")
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
79 };
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
31599
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
81 const QStringList ve_save_formats = {
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
82 "ascii",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
83 "binary",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
84 "float-binary",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
85 "hdf5",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
86 "float-hdf5",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
87 "text",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
88 "mat7-binary",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
89 "mat-binary",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
90 "mat4-binary",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
91 "zip"
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
92 };
29250
3ad713d82d18 improve saving a variable in the variable editor (bug #59570)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
93
3ad713d82d18 improve saving a variable in the variable editor (bug #59570)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
94 // The following list is a relation between save format and fiel extension.
3ad713d82d18 improve saving a variable in the variable editor (bug #59570)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
95 // The format string are case insensitive.
31599
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
96 const QStringList ve_save_formats_ext = {
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
97 "-ascii", "dat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
98 "-hdf5", "h5",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
99 "-text", "txt",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
100 "-v7.3", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
101 "-7.3", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
102 "-v7", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
103 "-7", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
104 "-mat7-binary", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
105 "-v6", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
106 "-6", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
107 "-mat-binary", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
108 "-v4", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
109 "-4", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
110 "-mat4-binary", "mat",
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
111 "-binary", "bin", // after other fmt incl. "-binary"
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
112 "-z", "txt.gz" // gzipped -text
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
113 };
29250
3ad713d82d18 improve saving a variable in the variable editor (bug #59570)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
114
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 #endif