BALL
1.4.79
|
#include <BALL/VIEW/KERNEL/preferencesEntry.h>
Classes | |
class | ExtendedPreferencesObject |
Public Types | |
typedef std::list< std::pair < QWidget *, String > > | StackPages |
Public Member Functions | |
PreferencesEntry () | |
virtual | ~PreferencesEntry () |
virtual void | writePreferenceEntries (INIFile &inifile) |
Store the settings of all registered objects. More... | |
virtual void | readPreferenceEntries (const INIFile &inifile) |
Restore the settings of all registered objects. More... | |
void | setINIFileSectionName (const String &name) |
Set the name for the section in the INIFile. More... | |
const String & | getINIFileSectionName () const |
Get the name for the section in the INIFile. More... | |
void | setWidgetStackName (const String &name) |
StackPages & | getStackPages () |
Return all pages, that are to be shown in a parent QStackedWidget. More... | |
void | setWidgetStack (QStackedWidget *stack) |
virtual void | showStackPage (Position nr) |
Show the specified page in the QStackedWidget. More... | |
virtual void | showStackPage (QWidget *widget) |
Show the specified page in the QStackedWidget. More... | |
virtual Position | currentStackPage () const |
Get the currently shown page in the QStackedWidget. More... | |
virtual void | restoreDefaultValues (bool all=false) |
Set all registered objects to their default values. More... | |
virtual void | storeValues () |
virtual void | restoreValues (bool all=false) |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
virtual bool | setValueAllowed (QObject *) |
Allows to prevent restoring of widgets. More... | |
Protected Types | |
typedef HashMap< const QObject *, String > | ValueMap |
Protected Member Functions | |
void | registerWidgets_ () |
void | registerObject_ (QObject *widget) |
void | unregisterObject_ (QObject *widget) |
void | registerWidgetForHelpSystem_ (const QWidget *widget, const String &url) |
void | restoreValues_ (bool all, const ValueMap &map) |
void | insertStackEntry_ (QWidget *, const String &name) |
bool | isSupported_ (QObject &widget) |
bool | getValue_ (const QObject *widget, String &value) |
bool | setValue_ (QObject *widget, const String &value) |
Protected Attributes | |
String | inifile_section_name_ |
HashSet< QObject * > | registered_objects_ |
ValueMap | default_values_ |
ValueMap | last_values_ |
QStackedWidget * | widget_stack_ |
StackPages | stack_pages_ |
Base class for a dialog or a Preferences page. It allows to register child widgets to support reading and writing their data into a INIFile. Also restoring of a default value and the last applied value is supported. Currently the following Qt widgets are supported:
To support more sophisticated items, e.g. color tables, a base class is provided to derive from (see ExtendedPreferencesObject). This object only needs to be a QObject with the PreferencesEntry as parent. \ Furthermore this class allows to use QStackedWidget items, like e.g. in the Preferences, where all individual child widgets are then also entries in a QListView. \ \ How to use this class:
Definition at line 68 of file preferencesEntry.h.
typedef std::list<std::pair<QWidget*, String> > BALL::VIEW::PreferencesEntry::StackPages |
Definition at line 96 of file preferencesEntry.h.
|
protected |
Definition at line 165 of file preferencesEntry.h.
BALL::VIEW::PreferencesEntry::PreferencesEntry | ( | ) |
|
virtual |
|
virtual |
Get the currently shown page in the QStackedWidget.
|
virtual |
Internal state dump. Dump the current internal state of this mainControl to the output ostream s with dumping depth depth.
s | output stream where to output the internal state |
depth | the dumping depth |
|
inline |
Get the name for the section in the INIFile.
Definition at line 114 of file preferencesEntry.h.
|
inline |
Return all pages, that are to be shown in a parent QStackedWidget.
Definition at line 122 of file preferencesEntry.h.
|
virtual |
Restore the settings of all registered objects.
Reimplemented in BALL::VIEW::PluginDialog, BALL::VIEW::MainControlPreferences, and BALL::VIEW::PythonSettings.
|
protected |
|
protected |
Register a widget for the internal help system
|
protected |
Register all supported child objects for the storing of their data. Must be called at the end of the child classes constructor.
|
virtual |
Set all registered objects to their default values.
Reimplemented in BALL::VIEW::LightSettings.
|
virtual |
Restore the values of the child widgets. Called e.g. when a user presses a Cancel button.
Reimplemented in BALL::VIEW::LightSettings.
|
inline |
Set the name for the section in the INIFile.
Definition at line 111 of file preferencesEntry.h.
Allows to prevent restoring of widgets.
Reimplemented in BALL::VIEW::StageSettings.
Definition at line 160 of file preferencesEntry.h.
void BALL::VIEW::PreferencesEntry::setWidgetStack | ( | QStackedWidget * | stack | ) |
Call this method in the constructor of the derived class has its own QStackedWidget.
void BALL::VIEW::PreferencesEntry::setWidgetStackName | ( | const String & | name | ) |
If the derived class is to be shown in a QStackedWidget, call this method to set the name for its entry.
|
virtual |
Show the specified page in the QStackedWidget.
|
virtual |
Show the specified page in the QStackedWidget.
|
virtual |
Store the values for later restoration by the restoreValues method. Called e.g. by the Preferences dialog apply button.
Reimplemented in BALL::VIEW::OpenSavePreferences.
|
protected |
|
virtual |
Store the settings of all registered objects.
Reimplemented in BALL::VIEW::PluginDialog, BALL::VIEW::MainControlPreferences, BALL::VIEW::ColoringSettingsDialog, and BALL::VIEW::PythonSettings.
|
protected |
Definition at line 210 of file preferencesEntry.h.
|
protected |
Definition at line 204 of file preferencesEntry.h.
|
protected |
Definition at line 210 of file preferencesEntry.h.
Definition at line 207 of file preferencesEntry.h.
|
protected |
Definition at line 215 of file preferencesEntry.h.
|
protected |
Definition at line 213 of file preferencesEntry.h.