gui::OptionWindow Class Reference

Window for showing/editing program settings. More...

#include <optionwindow.h>

List of all members.

Public Slots

void apply ()
void ok ()

Public Member Functions

 ~OptionWindow ()

Static Public Member Functions

static void optionsDialog (Menu *msystem, const QStringList &units, const QStringList &units_id)

Private Member Functions

 OptionWindow (Menu *msystem, const QStringList &units, const QStringList &units_id, QWidget *parent=0, const char *name=0)
void init ()
QWidget * addTab (const QString name, bool makeSegments=false)
void initGridFrame (QWidget *grid)
void addOption (QWidget *otab, const QString &caption, Option *opt)
void addOption (QWidget *otab, const QString &caption, const QString &key, const QString &defValue=QString::null)
void addOptionFile (QWidget *otab, const QString &caption, const QString &key, const QString &defValue=QString::null)
void addOptionFont (QWidget *otab, const QString &caption, const QString &key, const QString &defValue=QString::null)
void addOptionCombo (QWidget *otab, const QString &caption, const QString &key, const QStringList &values)
void addOptionCombo (QWidget *otab, const QString &caption, const QString &key, const QStringList &values, const QStringList &descriptions)
void addOptionInt (QWidget *otab, const QString &caption, const QString &key, int defValue=0)
void addOptionBool (QWidget *otab, const QString &caption, const QString &key, bool defValue=false)
void addOptionFloat (QWidget *otab, const QString &caption, const QString &key)
void addWidget (QWidget *otab, QWidget *elem)
void addText (QWidget *otab, const QString &text)
QWidget * addBreak (QWidget *otab)
void finishTab (QWidget *otab)

Private Attributes

QStringList * list
Q_Dict< Option > * items
Q_Dict< QLabel > * labels
QTabWidget * tab
QMap< QWidget *, QGridLayout * > gridl
QMap< QWidget *, QFrame * > masterGrid
QMap< QWidget *, int > nObjects
MenumenuSystem
QStringList l_units
QStringList l_units_id

Detailed Description

Window for showing/editing program settings.

Widget for editing program options
Options are arranged to tabs and it is ensured, that only one dialog at once is active (via Private constructor and static method to invoke the dialog, which will focus on existing dialog if it exists, instead of creating second one)


Constructor & Destructor Documentation

gui::OptionWindow::~OptionWindow (  ) 

default destructor

gui::OptionWindow::OptionWindow ( Menu msystem,
const QStringList &  units,
const QStringList &  units_id,
QWidget *  parent = 0,
const char *  name = 0 
) [private]

Default constructor of option window. The window is initially empty

Parameters:
msystem Menu system (Needed for toolbar list)
units list of available length units
units_id list of available length unit identifiers. Same count and order as units
parent parent widget containing this control
name name of widget (currently unused)

Referenced by optionsDialog().


Member Function Documentation

QWidget * gui::OptionWindow::addBreak ( QWidget *  otab  )  [private]

Add break to the option tab, breaking the column alignment at this point.
In fact, break the tab into two separate parts (but only second part can be splitted again).
Can be only applied to tabs that were created with makeSegments=true

See also:
addTab
Parameters:
otab Tab to break
Returns:
new value for tab - the lower half

References gridl, and nObjects.

void gui::OptionWindow::addOption ( QWidget *  otab,
const QString &  caption,
const QString &  key,
const QString &  defValue = QString::null 
) [private]

Add Option to the window (type of option is string)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
defValue Default value if option not found in configuration
void gui::OptionWindow::addOption ( QWidget *  otab,
const QString &  caption,
Option opt 
) [private]

Add Option to the window

Parameters:
otab Tab holding that option
caption Label for this option
opt Option to be added to this widget

References gridl, initGridFrame(), masterGrid, and nObjects.

Referenced by addOptionBool(), addOptionFloat(), and init().

void gui::OptionWindow::addOptionBool ( QWidget *  otab,
const QString &  caption,
const QString &  key,
bool  defValue = false 
) [private]

Add Option to the window (type of option is bool)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
defValue Default value if option not found in configuration

References addOption().

void gui::OptionWindow::addOptionCombo ( QWidget *  otab,
const QString &  caption,
const QString &  key,
const QStringList &  values,
const QStringList &  descriptions 
) [private]

Add Option to the window (type of option is string, edited by combobox)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
values List of allowed values for this combobox
descriptions List of value descriptions for this combobox, must correspond in number and order with values
void gui::OptionWindow::addOptionCombo ( QWidget *  otab,
const QString &  caption,
const QString &  key,
const QStringList &  values 
) [private]

Add Option to the window (type of option is string, edited by combobox)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
values List of allowed values for this combobox
void gui::OptionWindow::addOptionFile ( QWidget *  otab,
const QString &  caption,
const QString &  key,
const QString &  defValue = QString::null 
) [private]

Add Option to the window (type of option is file)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
defValue Default value if option not found in configuration
void gui::OptionWindow::addOptionFloat ( QWidget *  otab,
const QString &  caption,
const QString &  key 
) [private]

Add Option to the window (type of option is float)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option

References addOption().

void gui::OptionWindow::addOptionFont ( QWidget *  otab,
const QString &  caption,
const QString &  key,
const QString &  defValue = QString::null 
) [private]

Add Option to the window (type of option is font)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
defValue Default value if option not found in configuration
void gui::OptionWindow::addOptionInt ( QWidget *  otab,
const QString &  caption,
const QString &  key,
int  defValue = 0 
) [private]

Add Option to the window (type of option is int)

Parameters:
otab Tab holding that option
caption Label for this option
key Key of the given option
defValue Default value if option not found in configuration
QWidget * gui::OptionWindow::addTab ( const QString  name,
bool  makeSegments = false 
) [private]

Add empty tab to option dialog

Parameters:
name Label of the new tab
makeSegments Make it possible to split tab in parts, at cost of using an extra widget
Returns:
Inner widget of the new tab
void gui::OptionWindow::addText ( QWidget *  otab,
const QString &  text 
) [private]

Add description text to option

Parameters:
otab Tab holding that option
text Text to add. Using rich text format, so basically you can use HTML here
void gui::OptionWindow::addWidget ( QWidget *  otab,
QWidget *  elem 
) [private]

Add any widget to option (typically some label) The widget will take one line

Parameters:
otab Tab holding that option
elem element to add
void gui::OptionWindow::apply (  )  [slot]

Called on pushing 'Apply' button

void gui::OptionWindow::finishTab ( QWidget *  otab  )  [private]

Add padding to pad the tab window

Parameters:
otab Tab holding that option
void gui::OptionWindow::init (  )  [private]

Initialize window with options

References addOption().

void gui::OptionWindow::initGridFrame ( QWidget *  grid  )  [private]

Initialize grid for tab widget, so controls can be added there.

Parameters:
grid Widget to initialize with grid layout

Referenced by addOption().

void gui::OptionWindow::ok (  )  [slot]

Called on pushing 'OK' button

void gui::OptionWindow::optionsDialog ( Menu msystem,
const QStringList &  units,
const QStringList &  units_id 
) [static]

Invoke option dialog. Ensure only one copy is running at time

Parameters:
msystem Menu system reference for given option window (needed to get toolbar list)
units list of available length units
units_id list of available length unit identifiers. Same count and order as units

References APP_NAME, debug::DBG_DBG, guiPrintDbg, gui::opt, and OptionWindow().


Member Data Documentation

QMap<QWidget*,QGridLayout*> gui::OptionWindow::gridl [private]

Grid layout for the tab

Referenced by addBreak(), and addOption().

Q_Dict<Option>* gui::OptionWindow::items [private]

Dictionary with option items

QStringList gui::OptionWindow::l_units [private]

Available length units

QStringList gui::OptionWindow::l_units_id [private]

Available length units - identifiers

Q_Dict<QLabel>* gui::OptionWindow::labels [private]

Dictionary with option labels

QStringList* gui::OptionWindow::list [private]

List of option names

QMap<QWidget*,QFrame*> gui::OptionWindow::masterGrid [private]

Master Grid for the tab

Referenced by addOption().

Menu system (for toolbar list ... )

QMap<QWidget*,int> gui::OptionWindow::nObjects [private]

Number of objects in the tab

Referenced by addBreak(), and addOption().

QTabWidget* gui::OptionWindow::tab [private]

Main tab widget


The documentation for this class was generated from the following files: