# HG changeset patch # User Torsten Lilge # Date 1577032815 -3600 # Node ID b134fc61d89ec6ece96b9aa5f9b87437b1fab6ff # Parent b62ca41f355bdbf2a915cdfe36377cda6c69f6c7 use symbolic constants for prefs of graphics utlilities * annotation-dialog.cc: include gui-preferences-gp.h; (init, button_clicked): replace literals by symbolic constants * gui-preferences-all.h: add gui-preferences-gp.h * gui-preferences-gp.h: new include file with symbilic constants for prefs diff -r b62ca41f355b -r b134fc61d89e libgui/graphics/annotation-dialog.cc --- a/libgui/graphics/annotation-dialog.cc Mon Dec 23 08:01:12 2019 -0800 +++ b/libgui/graphics/annotation-dialog.cc Sun Dec 22 17:40:15 2019 +0100 @@ -29,6 +29,7 @@ #include #include "gui-settings.h" +#include "gui-preferences-gp.h" #include "octave-qobject.h" #include "QtHandlesUtils.h" @@ -56,8 +57,8 @@ octave::gui_settings *settings = rmgr.get_settings (); // restore last geometry - if (settings) - restoreGeometry (settings->value ("annotation/geometry").toByteArray ()); + if (settings && settings->contains (gp_annotation_geometry.key)) + restoreGeometry (settings->value (gp_annotation_geometry).toByteArray ()); // connect signals connect (ui->button_box, SIGNAL (clicked (QAbstractButton *)), @@ -103,7 +104,7 @@ // save position if (settings) - settings->setValue ("annotation/geometry",saveGeometry ()); + settings->setValue (gp_annotation_geometry.key, saveGeometry ()); if (button_role == QDialogButtonBox::ApplyRole || button_role == QDialogButtonBox::AcceptRole) diff -r b62ca41f355b -r b134fc61d89e libgui/src/gui-preferences-all.h --- a/libgui/src/gui-preferences-all.h Mon Dec 23 08:01:12 2019 -0800 +++ b/libgui/src/gui-preferences-all.h Sun Dec 22 17:40:15 2019 +0100 @@ -29,6 +29,7 @@ #include "gui-preferences-fb.h" #include "gui-preferences-ff.h" #include "gui-preferences-global.h" +#include "gui-preferences-gp.h" #include "gui-preferences-hw.h" #include "gui-preferences-mw.h" #include "gui-preferences-nr.h" diff -r b62ca41f355b -r b134fc61d89e libgui/src/gui-preferences-gp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/src/gui-preferences-gp.h Sun Dec 22 17:40:15 2019 +0100 @@ -0,0 +1,33 @@ +/* + +Copyright (C) 2017-2019 Torsten + +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 +. + +*/ + +#if ! defined (octave_gui_preferences_gp_h) +#define octave_gui_preferences_gp_h 1 + +#include "gui-preferences.h" + +// Graphics utilities + +const gui_pref +gp_annotation_geometry ("annotation/geometry", QVariant ()); + +#endif