GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
resource-manager.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2011-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_resource_manager_h)
27 #define octave_resource_manager_h 1
28 
29 #include <QComboBox>
30 #include <QIcon>
31 #include <QPointer>
32 #if defined (HAVE_QSCINTILLA)
33 # include <Qsci/qscilexer.h>
34 #endif
35 #include <QTranslator>
36 #include <QTemporaryFile>
37 
38 #include "gui-settings.h"
39 
41 
42 class resource_manager : public QObject
43 {
44  Q_OBJECT
45 
46 protected:
47 
48  public:
49 
50  resource_manager (void);
51 
52  // No copying!
53 
55 
56  resource_manager& operator = (const resource_manager&) = delete;
57 
58  ~resource_manager ();
59 
60  QString get_gui_translation_dir (void);
61 
62  void config_translators (QTranslator *qt_tr, QTranslator *qsci_tr,
63  QTranslator *gui_tr);
64  void config_icon_theme (void);
65 
66  gui_settings * get_settings (void) const;
67 
68  gui_settings * get_default_settings (void) const;
69 
70  QString get_settings_directory (void);
71 
72  QString get_settings_file (void);
73 
74  QString get_default_font_family (void);
75 
76  QStringList get_default_font (void);
77 
78  QPointer<QTemporaryFile>
79  create_tmp_file (const QString& extension = QString (),
80  const QString& contents = QString ());
81 
82  void remove_tmp_file (QPointer<QTemporaryFile> tmp_file);
83 
84  void reload_settings (void);
85 
86 #if defined (HAVE_QSCINTILLA)
87  int get_valid_lexer_styles (QsciLexer *lexer, int *styles);
88  void read_lexer_settings (QsciLexer *lexer, gui_settings *settings,
89  int mode = 0, int def = 0);
90 #endif
91 
92  void set_settings (const QString& file);
93 
94  bool update_settings_key (const QString& new_key, const QString& old_key);
95 
96  bool is_first_run (void) const;
97 
98  void update_network_settings (void);
99 
100  QIcon icon (const QString& icon_name, bool octave_only = false,
101  const QString& icon_alt_name = QString ());
102 
103  void get_codecs (QStringList *codecs);
104 
105  void combo_encoding (QComboBox *combo, const QString& current = QString ());
106 
107 private:
108 
109  /*!
110  * Copys the attributes bold, italic and underline from QFont
111  * @p attr to the font @p base and returns the result without
112  * changing @p base,
113  * @param attr QFont with the desired attributes
114  * @param base QFont with desired family and size
115  */
116  QFont copy_font_attributes (const QFont& attr, const QFont& base) const;
117 
119 
121 
123 
125 
127 
128  QStringList m_icon_fallbacks;
129 };
130 
132 
133 #endif
OCTAVE_END_NAMESPACE(octave)
Definition: lex.h:766
QString m_settings_directory
gui_settings * m_settings
QList< QTemporaryFile * > m_temporary_files
gui_settings * m_default_settings
resource_manager(const resource_manager &)=delete
QStringList m_icon_fallbacks
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn