Mercurial > octave
changeset 27615:83c1d4f75a36
use symbolic constants for preferences key/default in history viewer
* gui-preferences-all.h: add new include file with symbolic constants
* history-dock-widget.cc: include new include file;
(save_settings, construct): use symbolic constans instead of literals
for preference key names and default values
* module.mk: add new include file
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Sat, 02 Nov 2019 09:45:09 +0100 |
parents | 8437248a4b17 |
children | 1c13a0f36160 |
files | libgui/src/gui-preferences-all.h libgui/src/gui-preferences-hw.h libgui/src/history-dock-widget.cc libgui/src/module.mk |
diffstat | 4 files changed, 48 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/gui-preferences-all.h Sat Nov 02 08:25:17 2019 +0100 +++ b/libgui/src/gui-preferences-all.h Sat Nov 02 09:45:09 2019 +0100 @@ -27,6 +27,7 @@ #include "gui-preferences-ed.h" #include "gui-preferences-fb.h" #include "gui-preferences-global.h" +#include "gui-preferences-hw.h" #include "gui-preferences-mw.h" #include "gui-preferences-nr.h" #include "gui-preferences-pd.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-hw.h Sat Nov 02 09:45:09 2019 +0100 @@ -0,0 +1,39 @@ +/* + +Copyright (C) 2017-2019 Torsten Lilge <ttl-octave@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_gui_preferences_hw_h) +#define octave_gui_preferences_hw_h 1 + +#include "gui-preferences.h" + +// News Reader properties + +const gui_pref +hw_filter_active ("history_dock_widget/filter_active", QVariant (false)); + +const gui_pref +hw_filter_shown ("history_dock_widget/filter_shown", QVariant (true)); + +const gui_pref +hw_mru_list ("history_dock_widget/mru_list", QVariant ()); + +#endif \ No newline at end of file
--- a/libgui/src/history-dock-widget.cc Sat Nov 02 08:25:17 2019 +0100 +++ b/libgui/src/history-dock-widget.cc Sat Nov 02 09:45:09 2019 +0100 @@ -34,6 +34,7 @@ #include "gui-preferences-cs.h" #include "gui-preferences-global.h" +#include "gui-preferences-hw.h" #include "history-dock-widget.h" #include "resource-manager.h" @@ -94,14 +95,13 @@ if (! settings) return; - settings->setValue ("history_dock_widget/filter_active", - m_filter_checkbox->isChecked ()); - settings->setValue ("history_dock_widget/filter_shown", m_filter_shown); + settings->setValue (hw_filter_active.key, m_filter_checkbox->isChecked ()); + settings->setValue (hw_filter_shown.key, m_filter_shown); QStringList mru; for (int i = 0; i < m_filter->count (); i++) mru.append (m_filter->itemText (i)); - settings->setValue ("history_dock_widget/mru_list", mru); + settings->setValue (hw_mru_list.key, mru); settings->sync (); @@ -318,14 +318,14 @@ gui_settings *settings = resource_manager::get_settings (); m_filter_shown - = settings->value ("history_dock_widget/filter_shown",true).toBool (); + = settings->value (hw_filter_shown.key, hw_filter_shown.def).toBool (); m_filter_widget->setVisible (m_filter_shown); m_filter->addItems - (settings->value ("history_dock_widget/mru_list").toStringList ()); + (settings->value (hw_mru_list.key, hw_mru_list.def).toStringList ()); bool filter_state - = settings->value ("history_dock_widget/filter_active", false).toBool (); + = settings->value (hw_filter_active.key, hw_filter_active.def).toBool (); m_filter_checkbox->setChecked (filter_state); filter_activate (filter_state);
--- a/libgui/src/module.mk Sat Nov 02 08:25:17 2019 +0100 +++ b/libgui/src/module.mk Sat Nov 02 09:45:09 2019 +0100 @@ -192,6 +192,7 @@ %reldir%/gui-preferences-ed.h \ %reldir%/gui-preferences-fb.h \ %reldir%/gui-preferences-global.h \ + %reldir%/gui-preferences-hw.h \ %reldir%/gui-preferences-mw.h \ %reldir%/gui-preferences-nr.h \ %reldir%/gui-preferences-pd.h \