Mercurial > octave
view libgui/src/gui-preferences.h @ 26227:2355f66cf91d
allow to select the gui style in the preferences dialog
* gui-preferences.h: add new constants for key and default of new preference
* main-window.cc (main_window): initialize new class variable for the qt app,
get name of default style;
(notice_settings): get desired style from preferences or take the default
one if the desired one is not found;
(octave_qt_app::octave_qt_app): do not set windows style by default
* main-window.h: new class variables in main_window for qt app and the name
of the default style, new public method for getting the qt app in
octave_qt_app
* settings-dialog.cc (settings_dialog): fill new combo box for style selection
with available styles and select the one from the settings file or the
default one;
(write_changed_settings): store the style name from the new combo box
* settings-dialog.ui: add new combo box for selecting the gui style
author | Torsten <mttl@mailbox.org> |
---|---|
date | Thu, 13 Dec 2018 21:53:32 +0100 |
parents | 8fb8cb4a03f8 |
children | c95884eed1cf |
line wrap: on
line source
/* Copyright (C) 2017-2018 Torsten <mttl@mailbox.de> This file is part of Octave. Octave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see <https://www.gnu.org/licenses/>. */ #if ! defined (octave_editor_settings_h) #define octave_editor_settings_h 1 //#if defined (HAVE_CONFIG_H) //# include "config.h" //#endif #include <QStringList> #include <QVariant> #include <QStyle> // Structure for the definition of pairs: key and default value struct gui_pref { gui_pref (const QString& key_, QVariant def_): key (key_), def (def_) {} QString key; // the key name QVariant def; // the default value }; // Global preferences // Get the default monospaced font #if defined (Q_WS_X11) const QString global_font_family = "Monospace"; #elif defined (Q_WS_WIN) || defined (Q_WS_MAC) const QString global_font_family = "Courier"; #else const QString global_font_family = "Courier"; #endif const gui_pref global_mono_font ("monospace_font", global_font_family); // Icon size (in preferences: values -1, 0, 1) const QStyle::PixelMetric global_icon_sizes[3] = { QStyle::PM_SmallIconSize, QStyle::PM_ToolBarIconSize, QStyle::PM_LargeIconSize }; const gui_pref global_icon_size ("toolbar_icon_size", QVariant (0)); const gui_pref global_icon_theme ("use_system_icon_theme", QVariant (true)); // Style const gui_pref global_style ("style", QVariant ("default")); // Console preferences const gui_pref cs_font ("terminal/fontName", QVariant ()); // Variable Editor preferences const gui_pref ve_font ("variable_editor/font_size", QVariant ()); // Editor preferences // Octave comment strings const gui_pref ed_comment_str_old ("editor/octave_comment_string", QVariant (0)); const gui_pref ed_comment_str ("editor/oct_comment_str", QVariant (0)); const gui_pref ed_uncomment_str ("editor/oct_uncomment_str", QVariant (1 + 2 + 4 + 8)); const QString ed_last_comment_str ("editor/oct_last_comment_str"); const QStringList ed_comment_strings (QStringList () << "##" << "#" << "%"<< "%%" << "%!"); const int ed_comment_strings_count = 5; // Session data const gui_pref ed_session_names ("editor/savedSessionTabs", QVariant (QStringList ())); const gui_pref ed_session_enc ("editor/saved_session_encodings", QVariant (QStringList ())); const gui_pref ed_session_ind ("editor/saved_session_tab_index", QVariant (QStringList ())); const gui_pref ed_session_lines ("editor/saved_session_lines", QVariant (QStringList ())); // File handling const gui_pref ed_show_dbg_file ("editor/show_dbg_file", QVariant (true)); #if defined (Q_OS_WIN32) const gui_pref ed_default_enc ("editor/default_encoding", QVariant ("SYSTEM")); #else const gui_pref ed_default_enc ("editor/default_encoding", QVariant ("UTF-8")); #endif // Files dock widget const gui_pref fb_column_state ("filesdockwidget/column_state", QVariant ()); const gui_pref fb_show_ ("filesdockwidget/column_state", QVariant ()); const gui_pref fb_mru_list ("filesdockwidget/mru_dir_list", QVariant (QStringList ())); const gui_pref fb_show_size ("filesdockwidget/showFileSize", QVariant (false)); const gui_pref fb_show_type ("filesdockwidget/showFileType", QVariant (false)); const gui_pref fb_show_date ("filesdockwidget/showLastModified", QVariant (false)); const gui_pref fb_show_hidden ("filesdockwidget/showHiddenFiles", QVariant (false)); const gui_pref fb_show_altcol ("filesdockwidget/useAlternatingRowColors", QVariant (true)); const gui_pref fb_sort_column ("filesdockwidget/sort_files_by_column", QVariant (0)); const gui_pref fb_sort_order ("filesdockwidget/sort_files_by_order", QVariant (Qt::AscendingOrder)); const gui_pref fb_sync_octdir ("filesdockwidget/sync_octave_directory", QVariant (true)); const gui_pref fb_restore_last_dir ("filesdockwidget/restore_last_dir", QVariant (false)); const gui_pref fb_startup_dir ("filesdockwidget/startup_dir", QVariant (QString ())); const gui_pref fb_txt_file_ext ("filesdockwidget/txt_file_extensions", QVariant ("m;c;cc;cpp;h;txt")); // Workspace view const gui_pref ws_enable_colors ("workspaceview/enable_colors", QVariant (false)); const gui_pref ws_hide_tool_tips ("workspaceview/hide_tools_tips", QVariant (false)); #endif