GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
resource-manager.cc
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 (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <unistd.h>
31 
32 #include <algorithm>
33 #include <array>
34 #include <string>
35 
36 #include <QDir>
37 #include <QFile>
38 #include <QFontComboBox>
39 #include <QFontDatabase>
40 #include <QLibraryInfo>
41 #include <QMessageBox>
42 #include <QNetworkProxy>
43 #include <QStandardPaths>
44 
45 #include <QTextCodec>
46 
47 #include "QTerminal.h"
48 #include "gui-preferences-cs.h"
49 #include "gui-preferences-ed.h"
50 #include "gui-preferences-global.h"
51 #include "octave-qobject.h"
52 #include "resource-manager.h"
53 #include "variable-editor.h"
54 #include "workspace-model.h"
55 
56 #include "file-ops.h"
57 #include "localcharset-wrapper.h"
58 #include "oct-env.h"
59 
60 #include "defaults.h"
61 #include "error.h"
62 #include "help.h"
63 
65 
67 : m_settings_directory (), m_settings_file (), m_settings (nullptr),
68  m_default_settings (nullptr), m_temporary_files (), m_icon_fallbacks ()
69 {
70  // Let gui_settings decide where to put the ini file with gui preferences
71  m_default_settings
72  = new gui_settings (QSettings::IniFormat, QSettings::UserScope,
73  "octave", "octave-gui");
74 
75  m_settings_file = m_default_settings->fileName ();
76 
77  QFileInfo sfile (m_settings_file);
78  m_settings_directory = sfile.absolutePath ();
79 
80  QString xdg_config_home
81  = QString::fromLocal8Bit (qgetenv ("XDG_CONFIG_HOME"));
82 
83  if ((! sfile.exists ()) && xdg_config_home.isEmpty ())
84  {
85  // File does not exist yet: Look for a settings file at the old
86  // location ($HOME/.config/octave/qt-settings) for impoting all
87  // available keys into the new settings file.
88  // Do not look for an old settings file if XDG_CONFIG_HOME is set,
89  // since then a nonexistent new settings file does not necessarily
90  // indicate a first run of octave with new config file locations.
91 #if defined (HAVE_QSTANDARDPATHS)
92  QString home_path
93  = QStandardPaths::writableLocation (QStandardPaths::HomeLocation);
94 #else
95  QString home_path
96  = QDesktopServices::storageLocation (QDesktopServices::HomeLocation);
97 #endif
98 
99  QString old_settings_directory = home_path + "/.config/octave";
100  QString old_settings_file = old_settings_directory + "/qt-settings";
101 
102  QFile ofile (old_settings_file);
103 
104  if (ofile.exists ())
105  {
106  // Old settings file exists; create a gui_settings object related
107  // to it and copy all available keys to the new settings
108  gui_settings old_settings (old_settings_file, QSettings::IniFormat);
109 
110  QStringList keys = old_settings.allKeys ();
111  for (int i = 0; i < keys.count(); i++)
112  m_default_settings->setValue (keys.at(i),
113  old_settings.value(keys.at(i)));
114 
115  m_default_settings->sync (); // Done, make sure keys are written
116  }
117  }
118 }
119 
121 {
122  delete m_settings;
123  delete m_default_settings;
124 
125  for (int i = m_temporary_files.count () - 1; i >=0; i--)
127 }
128 
130 {
131  // get environment variable for the locale dir (e.g. from run-octave)
132  std::string dldir = sys::env::getenv ("OCTAVE_LOCALE_DIR");
133  if (dldir.empty ())
134  dldir = config::oct_locale_dir (); // env-var empty, load the default location
135  return QString::fromStdString (dldir);
136 }
137 
138 void resource_manager::config_translators (QTranslator *qt_tr,
139  QTranslator *qsci_tr,
140  QTranslator *gui_tr)
141 {
142  bool loaded;
143 
144  QString qt_trans_dir
145  = QLibraryInfo::location (QLibraryInfo::TranslationsPath);
146 
147  QString language = "SYSTEM"; // take system language per default
148 
149  // FIXME: can we somehow ensure that the settings object will always
150  // be initialize and valid?
151 
152  if (m_settings)
153  {
154  // get the locale from the settings if already available
155  language = m_settings->value (global_language.key,
156  global_language.def).toString ();
157  }
158 
159  // load the translations depending on the settings
160  if (language == "SYSTEM")
161  {
162  // get the system locale and pass it to the translators for loading
163  // the suitable translation files
164  QLocale sys_locale = QLocale::system ();
165 
166  qt_tr->load (sys_locale, "qt", "_", qt_trans_dir);
167  qsci_tr->load (sys_locale, "qscintilla", "_", qt_trans_dir);
168  gui_tr->load (sys_locale, "", "", get_gui_translation_dir ());
169  }
170  else
171  {
172  // load the translation files depending on the given locale name
173  loaded = qt_tr->load ("qt_" + language, qt_trans_dir);
174  if (! loaded) // try lower case
175  qt_tr->load ("qt_" + language.toLower (), qt_trans_dir);
176 
177  loaded = qsci_tr->load ("qscintilla_" + language, qt_trans_dir);
178  if (! loaded) // try lower case
179  qsci_tr->load ("qscintilla_" + language.toLower (), qt_trans_dir);
180 
181  gui_tr->load (language, get_gui_translation_dir ());
182  }
183 
184 }
185 
187 {
188  m_icon_fallbacks.clear ();
189 
190  int theme = global_icon_theme_index.def.toInt ();
191 
192  if (m_settings)
193  {
194  // check for new and old setting and use old if required
195  if (! m_settings->contains (global_icon_theme_index.key))
196  {
197  // new pref does not exist
198  if (m_settings->value (global_icon_theme).toBool ())
199  theme = ICON_THEME_SYSTEM;
200  else
201  theme = ICON_THEME_OCTAVE;
202  m_settings->setValue (global_icon_theme_index.key, theme); // add new
203  m_settings->remove (global_icon_theme.key); // remove deprecated key
204  }
205  else
206  {
207  // get new settings
208  theme = m_settings->value (global_icon_theme_index).toInt ();
209  }
210  }
211 
212  QIcon::setThemeName (global_all_icon_themes.at (theme));
213 
214  // set the required fallback search paths
215  switch (theme)
216  {
217  case ICON_THEME_SYSTEM:
220  break;
221  case ICON_THEME_TANGO:
223  break;
224  case ICON_THEME_OCTAVE:
226  break;
227  }
228 
230 }
231 
233 {
234  if (! m_settings)
235  {
236  QString msg (QT_TR_NOOP ("Octave has lost its settings.\n"
237  "This should not happen.\n\n"
238  "Please report this bug.\n\n"
239  "Octave GUI must be closed now."));
240 
241  QMessageBox::critical (nullptr,
242  QString (QT_TR_NOOP ("Octave Critical Error")),
243  msg);
244  exit (1);
245  }
246 
247  return m_settings;
248 }
249 
251 {
252  if (! m_default_settings)
253  {
254  QString msg (QT_TR_NOOP ("Octave has lost its default settings.\n"
255  "This should not happen.\n"
256  "Please report this bug.\n\n"
257  "Octave GUI must be closed now."));
258 
259  QMessageBox::critical (nullptr,
260  QString (QT_TR_NOOP ("Octave Critical Error")),
261  msg);
262  exit (1);
263  }
264 
265  return m_default_settings;
266 }
267 
269 {
270  return m_settings_directory;
271 }
272 
274 {
275  return m_settings_file;
276 }
277 
279 {
280  QString default_family;
281 
282  // Get all available fixed width fonts via a font combobox
283  QFontComboBox font_combo_box;
284  font_combo_box.setFontFilters (QFontComboBox::MonospacedFonts);
285  QStringList fonts;
286 
287  for (int index = 0; index < font_combo_box.count(); index++)
288  fonts << font_combo_box.itemText(index);
289 
290 #if defined (Q_OS_MAC)
291  // Use hard coded default on macOS, since selection of fixed width
292  // default font is unreliable (see bug #59128).
293  // Test for macOS default fixed width font
294  if (fonts.contains (global_mono_font.def.toString ()))
295  default_family = global_mono_font.def.toString ();
296 #endif
297 
298  // If default font is still empty (on all other platforms or
299  // if macOS default font is not available): use QFontDatabase
300  if (default_family.isEmpty ())
301  {
302  // Get the system's default monospaced font
303  QFont fixed_font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
304  default_family = fixed_font.defaultFamily ();
305 
306  // Since this might be unreliable, test all available fixed width fonts
307  if (! fonts.contains (default_family))
308  {
309  // Font returned by QFontDatabase is not in fixed fonts list.
310  // Fallback: take first from this list
311  default_family = fonts[0];
312  }
313  }
314 
315  // Test env variable which has preference
316  std::string env_default_family = sys::env::getenv ("OCTAVE_DEFAULT_FONT");
317  if (! env_default_family.empty ())
318  default_family = QString::fromStdString (env_default_family);
319 
320  return default_family;
321 }
322 
324 {
325  QString default_family = get_default_font_family ();
326 
327  // determine the fefault font size of the system
328  // FIXME: QApplication::font () does not return the monospace font,
329  // but the size should be probably near to the monospace font
330  QFont font = QApplication::font ();
331 
332  int font_size = font.pointSize ();
333  if (font_size == -1)
334  font_size = static_cast <int> (std::floor(font.pointSizeF ()));
335 
336  // check for valid font size, otherwise take default 10
337  QString default_font_size = "10";
338  if (font_size > 0)
339  default_font_size = QString::number (font_size);
340 
341  std::string env_default_font_size
342  = sys::env::getenv ("OCTAVE_DEFAULT_FONT_SIZE");
343 
344  if (! env_default_font_size.empty ())
345  default_font_size = QString::fromStdString (env_default_font_size);
346 
347  QStringList result;
348  result << default_family;
349  result << default_font_size;
350  return result;
351 }
352 
354 {
355  // Declare some empty options, which may be set at first startup for
356  // writing them into the newly created settings file
357  QString custom_editor;
358  QStringList def_font;
359 
360  // Check whether the settings file does not yet exist
361  if (! QFile::exists (m_settings_file))
362  {
363  // Get the default font (for terminal)
364  def_font = get_default_font ();
365 
366  // Get a custom editor defined as env variable
367  std::string env_default_editor
368  = sys::env::getenv ("OCTAVE_DEFAULT_EDITOR");
369 
370  if (! env_default_editor.empty ())
371  custom_editor = QString::fromStdString (env_default_editor);
372  }
373 
375 
376  // Write some settings that were dynamically determined at first startup
377  if (m_settings)
378  {
379  // Custom editor
380  if (! custom_editor.isEmpty ())
381  m_settings->setValue (global_custom_editor.key, custom_editor);
382 
383  // Default monospace font for the terminal
384  if (def_font.count () > 1)
385  {
386  m_settings->setValue (cs_font.key, def_font[0]);
387  m_settings->setValue (cs_font_size.key, def_font[1].toInt ());
388  }
389 
390  // Write the default monospace font into the settings for later use by
391  // console and editor as fallbacks of their font preferences.
393  }
394 }
395 
396 #if defined (HAVE_QSCINTILLA)
398 {
399  int max_style = 0;
400  int actual_style = 0;
401  while (actual_style < ed_max_style_number && max_style < ed_max_lexer_styles)
402  {
403  if ((lexer->description (actual_style)) != "") // valid style
404  styles[max_style++] = actual_style;
405  actual_style++;
406  }
407  return max_style;
408 }
409 #endif
410 
411 QFont resource_manager::copy_font_attributes (const QFont& attr,
412  const QFont& base) const
413 {
414  QFont dest (base);
415 
416  dest.setBold (attr.bold ());
417  dest.setItalic (attr.italic ());
418  dest.setUnderline (attr.underline ());
419 
420  return dest;
421 }
422 
423 #if defined (HAVE_QSCINTILLA)
426  int mode, int def)
427 {
428  // Test whether the settings for lexer is already contained in the
429  // given gui settings file. If yes, load them, if not copy them from the
430  // default settings file.
431  // This is useful when a new language support is implemented and the
432  // existing settings file is used (which is of course the common case).
433  int m = mode;
434  if (m > 1)
435  m = 1;
436 
437  QString group ("Scintilla" + settings_color_modes_ext[m]);
438 
439  settings->beginGroup (group);
440  settings->beginGroup (lexer->language ());
441 
442  QStringList lexer_keys = settings->allKeys ();
443 
444  settings->endGroup ();
445  settings->endGroup ();
446 
447  if (def == settings_reload_default_colors_flag || lexer_keys.count () == 0)
448  {
449  // We have to reload the default values or no Lexer keys found:
450  // If mode == 0, take all settings except font from default lexer
451  // If Mode == 1, take all settings except font from default lexer
452  // and convert the color by inverting the lightness
453 
454  // Get the default font
455  QStringList def_font = get_default_font ();
456  QFont df (def_font[0], def_font[1].toInt ());
457  QFont dfa = copy_font_attributes (lexer->defaultFont (), df);
458  lexer->setDefaultFont (dfa);
459 
460  QColor c, p;
461 
462  int styles[ed_max_lexer_styles]; // array for saving valid styles
463  int max_style = get_valid_lexer_styles (lexer, styles);
464 
465  for (int i = 0; i < max_style; i++)
466  {
467  c = settings->get_color_value (QVariant (lexer->color (styles[i])), m);
468  lexer->setColor (c, styles[i]);
469  p = settings->get_color_value (QVariant (lexer->paper (styles[i])), m);
470  lexer->setPaper (p, styles[i]);
471  dfa = copy_font_attributes (lexer->font (styles[i]), df);
472  lexer->setFont (dfa, styles[i]);
473  }
474  // Set defaults last for not changing the defaults of the styles
475  lexer->setDefaultColor (lexer->color (styles[0]));
476  lexer->setDefaultPaper (lexer->paper (styles[0]));
477 
478  // Write settings if not just reload the default values
480  {
481  const std::string group_str = group.toStdString ();
482  lexer->writeSettings (*settings, group_str.c_str ());
483  settings->sync ();
484  }
485  }
486  else
487  {
488  // Found lexer keys, read the settings
489  const std::string group_str = group.toStdString ();
490  lexer->readSettings (*settings, group_str.c_str ());
491  }
492 }
493 #endif
494 
495 void resource_manager::set_settings (const QString& file)
496 {
497  delete m_settings;
498  m_settings = new gui_settings (file, QSettings::IniFormat);
499 
500  if (m_settings->status () == QSettings::NoError)
501  {
502  // Test usability (force file to be really created)
503  m_settings->setValue ("dummy", 0);
504  m_settings->sync ();
505  }
506 
507  if (! (QFile::exists (m_settings->fileName ())
508  && m_settings->isWritable ()
509  && m_settings->status () == QSettings::NoError))
510  {
511  QString msg
512  = QString (QT_TR_NOOP ("The settings file\n%1\n"
513  "does not exist and can not be created.\n"
514  "Make sure you have read and write permissions to\n%2\n\n"
515  "Octave GUI must be closed now."));
516 
517  QMessageBox::critical (nullptr,
518  QString (QT_TR_NOOP ("Octave Critical Error")),
519  msg.arg (get_settings_file ()).arg (get_settings_directory ()));
520 
521  exit (1);
522  }
523  else
524  m_settings->remove ("dummy"); // Remove test entry
525 }
526 
527 bool resource_manager::update_settings_key (const QString& old_key,
528  const QString& new_key)
529 {
530  if (m_settings->contains (old_key))
531  {
532  QVariant preference = m_settings->value (old_key);
533  m_settings->setValue (new_key, preference);
534  m_settings->remove (old_key);
535  return true;
536  }
537 
538  return false;
539 }
540 
542 {
543  return ! QFile::exists (m_settings_file);
544 }
545 
547 {
548  if (! m_settings)
549  return;
550 
551  QNetworkProxy proxy;
552 
553  // Assume no proxy and empty proxy data
554  QNetworkProxy::ProxyType proxy_type = QNetworkProxy::NoProxy;
555  QString scheme;
556  QString host;
557  int port = 0;
558  QString user;
559  QString pass;
560  QUrl proxy_url = QUrl ();
561 
563  {
564  // Use a proxy, collect all required information
565  QString proxy_type_string
567 
568  // The proxy type for the Qt proxy settings
569  if (proxy_type_string == "Socks5Proxy")
570  proxy_type = QNetworkProxy::Socks5Proxy;
571  else if (proxy_type_string == "HttpProxy")
572  proxy_type = QNetworkProxy::HttpProxy;
573 
574  // The proxy data from the settings
575  if (proxy_type_string == "HttpProxy"
576  || proxy_type_string == "Socks5Proxy")
577  {
579  global_proxy_host.def).toString ();
581  global_proxy_port.def).toInt ();
583  global_proxy_user.def).toString ();
585  global_proxy_pass.def).toString ();
586  if (proxy_type_string == "HttpProxy")
587  scheme = "http";
588  else if (proxy_type_string == "Socks5Proxy")
589  scheme = "socks5";
590 
591  QUrl env_var_url = QUrl ();
592  proxy_url.setScheme (scheme);
593  proxy_url.setHost (host);
594  proxy_url.setPort (port);
595  if (! user.isEmpty ())
596  proxy_url.setUserName (user);
597  if (! pass.isEmpty ())
598  proxy_url.setPassword (pass);
599  }
600 
601  // The proxy data from environment variables
602  if (proxy_type_string == global_proxy_all_types.at (2))
603  {
604  const std::array<std::string, 6> env_vars =
605  {
606  "ALL_PROXY", "all_proxy",
607  "HTTP_PROXY", "http_proxy",
608  "HTTPS_PROXY", "https_proxy"
609  };
610 
611  unsigned int count = 0;
612  while (! proxy_url.isValid () && count < env_vars.size ())
613  {
614  proxy_url = QUrl (QString::fromStdString
615  (sys::env::getenv (env_vars[count])));
616  count++;
617  }
618 
619  if (proxy_url.isValid ())
620  {
621  // Found an entry, get the data from the string
622  scheme = proxy_url.scheme ();
623 
624  if (scheme.contains ("socks", Qt::CaseInsensitive))
625  proxy_type = QNetworkProxy::Socks5Proxy;
626  else
627  proxy_type = QNetworkProxy::HttpProxy;
628 
629  host = proxy_url.host ();
630  port = proxy_url.port ();
631  user = proxy_url.userName ();
632  pass = proxy_url.password ();
633  }
634  }
635  }
636 
637  // Set proxy for Qt framework
638  proxy.setType (proxy_type);
639  proxy.setHostName (host);
640  proxy.setPort (port);
641  proxy.setUser (user);
642  proxy.setPassword (pass);
643 
644  QNetworkProxy::setApplicationProxy (proxy);
645 
646  // Set proxy for curl library if not based on environment variables
647  std::string proxy_url_str = proxy_url.toString().toStdString ();
648  sys::env::putenv ("http_proxy", proxy_url_str);
649  sys::env::putenv ("HTTP_PROXY", proxy_url_str);
650  sys::env::putenv ("https_proxy", proxy_url_str);
651  sys::env::putenv ("HTTPS_PROXY", proxy_url_str);
652 }
653 
654 QIcon resource_manager::icon (const QString& icon_name, bool octave_only,
655  const QString& icon_alt_name)
656 {
657  if (octave_only)
658  return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png");
659 
660  if (QIcon::hasThemeIcon (icon_name))
661  return QIcon (QIcon::fromTheme (icon_name));
662  else if ((! icon_alt_name.isEmpty ()) && QIcon::hasThemeIcon (icon_alt_name))
663  return QIcon (QIcon::fromTheme (icon_alt_name));
664 
665  for (int i = 0; i < m_icon_fallbacks.length (); i++ )
666  {
667  QString icon_file (m_icon_fallbacks.at (i) + icon_name + ".png");
668  if (QFile (icon_file).exists ())
669  return QIcon (icon_file);
670  }
671 
672  //QIcon::setThemeName (current_theme);
673  return QIcon ();
674 }
675 
676 // get a list of all available encodings
677 void resource_manager::get_codecs (QStringList *codecs)
678 {
679  // get the codec name for each mib
680  QList<int> all_mibs = QTextCodec::availableMibs ();
681  for (auto mib : all_mibs)
682  {
683  QTextCodec *c = QTextCodec::codecForMib (mib);
684  codecs->append (c->name ().toUpper ());
685  }
686 
687  // Append SYSTEM
688  codecs->append (QString ("SYSTEM (") +
689  QString (octave_locale_charset_wrapper ()).toUpper () +
690  QString (")"));
691 
692  // Clean up and sort list of codecs
693  codecs->removeDuplicates ();
694  std::sort (codecs->begin (), codecs->end ());
695 }
696 
697 // initialize a given combo box with available text encodings
698 void resource_manager::combo_encoding (QComboBox *combo,
699  const QString& current)
700 {
701  QStringList all_codecs;
702  get_codecs (&all_codecs);
703 
704  // get the value from the settings file if no current encoding is given
705  QString enc = current;
706 
707  // Check for valid codec for the default. If this fails, "SYSTEM" (i.e.
708  // locale_charset) will be chosen.
709  // FIXME: The default is "SYSTEM" on all platforms. So can this fallback
710  // logic be removed completely?
711  bool default_exists = false;
712  bool show_system = false;
713  if (ed_default_enc.def.toString ().startsWith ("SYSTEM"))
714  show_system = true;
715  else if (QTextCodec::codecForName (ed_default_enc.def.toString ().toLatin1 ()))
716  default_exists = true;
717 
718  QString default_enc =
719  QString ("SYSTEM (") +
720  QString (octave_locale_charset_wrapper ()).toUpper () + QString (")");
721 
722  if (enc.isEmpty ())
723  {
724  enc = m_settings->value (ed_default_enc).toString ();
725 
726  if (enc.isEmpty ()) // still empty?
727  {
728  if (default_exists)
729  enc = ed_default_enc.def.toString ();
730  else
731  enc = default_enc;
732  }
733  }
734 
735  // fill the combo box
736  for (const auto& c : all_codecs)
737  combo->addItem (c);
738 
739  // prepend the default item
740  combo->insertSeparator (0);
741  if (show_system || ! default_exists)
742  combo->insertItem (0, default_enc);
743  else
744  combo->insertItem (0, ed_default_enc.def.toString ());
745 
746  // select the default or the current one
747  int idx = combo->findText (enc, Qt::MatchExactly);
748  if (idx >= 0)
749  combo->setCurrentIndex (idx);
750  else
751  combo->setCurrentIndex (0);
752 
753  combo->setMaxVisibleItems (12);
754 }
755 
756 QPointer<QTemporaryFile>
757 resource_manager::create_tmp_file (const QString& extension,
758  const QString& contents)
759 {
760  QString ext = extension;
761  if ((! ext.isEmpty ()) && (! ext.startsWith ('.')))
762  ext = QString (".") + ext;
763 
764  // Create octave dir within temp. dir
766 
767  // Create temp. file
768  QPointer<QTemporaryFile> tmp_file
769  = new QTemporaryFile (tmp_dir + QDir::separator() +
770  "octave_XXXXXX" + ext, this);
771 
772  if (tmp_file->open ())
773  {
774  tmp_file->write (contents.toUtf8 ());
775  tmp_file->close ();
776 
777  m_temporary_files << tmp_file;
778  }
779 
780  return tmp_file;
781 }
782 
783 void resource_manager::remove_tmp_file (QPointer<QTemporaryFile> tmp_file)
784 {
785  if (tmp_file)
786  {
787  if (tmp_file->exists ())
788  tmp_file->remove ();
789 
790  m_temporary_files.removeAll (tmp_file);
791  }
792 }
793 
OCTAVE_END_NAMESPACE(octave)
QVariant value(const gui_pref &pref) const
Definition: gui-settings.h:65
Definition: lex.h:766
void update_network_settings(void)
bool update_settings_key(const QString &new_key, const QString &old_key)
QPointer< QTemporaryFile > create_tmp_file(const QString &extension=QString(), const QString &contents=QString())
QString m_settings_directory
gui_settings * m_settings
gui_settings * get_settings(void) const
void set_settings(const QString &file)
void read_lexer_settings(QsciLexer *lexer, gui_settings *settings, int mode=0, int def=0)
QString get_settings_file(void)
void config_translators(QTranslator *qt_tr, QTranslator *qsci_tr, QTranslator *gui_tr)
void get_codecs(QStringList *codecs)
QList< QTemporaryFile * > m_temporary_files
QString get_gui_translation_dir(void)
QFont copy_font_attributes(const QFont &attr, const QFont &base) const
void config_icon_theme(void)
QIcon icon(const QString &icon_name, bool octave_only=false, const QString &icon_alt_name=QString())
void remove_tmp_file(QPointer< QTemporaryFile > tmp_file)
QStringList get_default_font(void)
QString get_settings_directory(void)
gui_settings * m_default_settings
bool is_first_run(void) const
void combo_encoding(QComboBox *combo, const QString &current=QString())
void reload_settings(void)
gui_settings * get_default_settings(void) const
int get_valid_lexer_styles(QsciLexer *lexer, int *styles)
QStringList m_icon_fallbacks
QString get_default_font_family(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::string oct_locale_dir(void)
Definition: defaults.cc:371
const gui_pref cs_font_size("terminal/fontSize", QVariant(10))
const gui_pref cs_font("terminal/fontName", QVariant())
const int ed_max_lexer_styles
const gui_pref ed_default_enc("editor/default_encoding", QVariant("UTF-8"))
const int ed_max_style_number
const gui_pref global_icon_theme_index("icon_theme", QVariant(ICON_THEME_SYSTEM))
const gui_pref global_use_proxy("useProxyServer", QVariant(false))
const gui_pref global_mono_font("monospace_font", global_font_family)
const gui_pref global_proxy_pass("proxyPassword", QVariant(QString()))
const gui_pref global_proxy_host("proxyHostName", QVariant(QString()))
const QStringList global_icon_paths
const gui_pref global_proxy_type("proxyType", QVariant(QString()))
const gui_pref global_proxy_user("proxyUserName", QVariant(QString()))
const gui_pref global_icon_theme("use_system_icon_theme", QVariant(true))
const QStringList global_proxy_all_types
const gui_pref global_custom_editor("customFileEditor", QVariant("emacs +%l %f"))
@ ICON_THEME_CURSORS
@ ICON_THEME_SYSTEM
@ ICON_THEME_OCTAVE
@ ICON_THEME_TANGO
const gui_pref global_proxy_port("proxyPort", QVariant(80))
const QStringList global_all_icon_themes
const gui_pref global_language("language", QVariant("SYSTEM"))
const QStringList settings_color_modes_ext(QStringList()<< ""<< "_2")
const int settings_reload_default_colors_flag
Definition: gui-settings.h:134
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:130
int system(const std::string &cmd_str)
Definition: lo-sysdep.cc:59
const char * octave_locale_charset_wrapper(void)
static std::string get_temp_directory(void)
T octave_idx_type m
Definition: mx-inlines.cc:773
QString fromStdString(const std::string &s)
const QString key
const QVariant def