GNU Octave 7.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-2022 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
40namespace octave
41{
43 {
44 Q_OBJECT
45
46 protected:
47
48 public:
49
50 resource_manager (void);
51
52 // No copying!
53
55
57
59
60 QString get_gui_translation_dir (void);
61
62 void config_translators (QTranslator *qt_tr, QTranslator *qsci_tr,
63 QTranslator *gui_tr);
64
65 gui_settings * get_settings (void) const;
66
68
69 QString get_settings_directory (void);
70
71 QString get_settings_file (void);
72
73 QString get_default_font_family (void);
74
75 QStringList get_default_font (void);
76
77 QPointer<QTemporaryFile>
78 create_tmp_file (const QString& extension = QString (),
79 const QString& contents = QString ());
80
81 void remove_tmp_file (QPointer<QTemporaryFile> tmp_file);
82
83 void reload_settings (void);
84
85#if defined (HAVE_QSCINTILLA)
86 int get_valid_lexer_styles (QsciLexer *lexer, int *styles);
88 int mode = 0, int def = 0);
89#endif
90
91 void set_settings (const QString& file);
92
93 bool update_settings_key (const QString& new_key, const QString& old_key);
94
95 bool is_first_run (void) const;
96
97 void update_network_settings (void);
98
99 QIcon icon (const QString& icon_name, bool fallback = true);
100
101 void get_codecs (QStringList *codecs);
102
103 void combo_encoding (QComboBox *combo, const QString& current = QString ());
104
105 private:
106
107 /*!
108 * Copys the attributes bold, italic and underline from QFont
109 * @p attr to the font @p base and returns the result without
110 * changing @p base,
111 * @param attr QFont with the desired attributes
112 * @param base QFont with desired family and size
113 */
114 QFont copy_font_attributes (const QFont& attr, const QFont& base) const;
115
117
119
121
123
125 };
126}
127
128#endif
QString get_default_font_family(void)
void combo_encoding(QComboBox *combo, const QString &current=QString())
gui_settings * get_settings(void) const
QStringList get_default_font(void)
resource_manager & operator=(const resource_manager &)=delete
gui_settings * get_default_settings(void) const
void read_lexer_settings(QsciLexer *lexer, gui_settings *settings, int mode=0, int def=0)
void get_codecs(QStringList *codecs)
QFont copy_font_attributes(const QFont &attr, const QFont &base) const
resource_manager(const resource_manager &)=delete
gui_settings * m_default_settings
int get_valid_lexer_styles(QsciLexer *lexer, int *styles)
QString get_gui_translation_dir(void)
bool is_first_run(void) const
QList< QTemporaryFile * > m_temporary_files
QPointer< QTemporaryFile > create_tmp_file(const QString &extension=QString(), const QString &contents=QString())
QIcon icon(const QString &icon_name, bool fallback=true)
void remove_tmp_file(QPointer< QTemporaryFile > tmp_file)
bool update_settings_key(const QString &new_key, const QString &old_key)
QString get_settings_directory(void)
void set_settings(const QString &file)
void config_translators(QTranslator *qt_tr, QTranslator *qsci_tr, QTranslator *gui_tr)