OpenMW
apps/opencs/view/settings/support.hpp
Go to the documentation of this file.
00001 #ifndef VIEW_SUPPORT_HPP
00002 #define VIEW_SUPPORT_HPP
00003 
00004 #include <QList>
00005 #include <QStringList>
00006 
00007 #include "../../model/settings/support.hpp"
00008 
00009 namespace CSVSettings
00010 {
00011     struct WidgetDef;
00012     class ItemBlock;
00013     class GroupBlock;
00014     struct GroupBlockDef;
00015 
00016     typedef QList<GroupBlockDef *>              GroupBlockDefList;
00017     typedef QList<GroupBlock *>                 GroupBlockList;
00018     typedef QList<ItemBlock *>                  ItemBlockList;
00019     typedef QList<QStringList *>                ProxyList;
00020     typedef QList<WidgetDef *>                  WidgetList;
00021     typedef QMap<QString, ItemBlock *>          ItemBlockMap;
00022 
00023     enum Orientation
00024     {
00025         Orient_Horizontal,
00026         Orient_Vertical
00027     };
00028 
00029     enum WidgetType
00030     {
00031         Widget_CheckBox,
00032         Widget_ComboBox,
00033         Widget_LineEdit,
00034         Widget_ListBox,
00035         Widget_RadioButton,
00036         Widget_SpinBox,
00037         Widget_Undefined
00038     };
00039 
00040     enum Alignment
00041     {
00042         Align_Left    = Qt::AlignLeft,
00043         Align_Center  = Qt::AlignHCenter,
00044         Align_Right   = Qt::AlignRight
00045     };
00046 
00048     struct WidgetDef
00049     {
00051         WidgetType type;
00052 
00054         int labelWidth;
00055 
00057         int widgetWidth;
00058 
00060         Orientation orientation;
00061 
00063         QString inputMask;
00064 
00066         QString caption;
00067 
00069         QString value;
00070 
00072         CSMSettings::QStringPair *minMax;
00073 
00075         QStringList *valueList;
00076 
00078         bool isDefault;
00079 
00081         Alignment valueAlignment;
00082 
00084         Alignment widgetAlignment;
00085 
00086 
00087         WidgetDef() :   labelWidth (-1), widgetWidth (-1),
00088                         orientation (Orient_Horizontal),
00089                         isDefault (true), valueAlignment (Align_Center),
00090                         widgetAlignment (Align_Right),
00091                         inputMask (""), value (""),
00092                         caption (""), valueList (0)
00093         {}
00094 
00095         WidgetDef (WidgetType widgType)
00096             : type (widgType), orientation (Orient_Horizontal),
00097               caption (""), value (""), valueAlignment (Align_Center),
00098               widgetAlignment (Align_Right),
00099               labelWidth (-1), widgetWidth (-1),
00100               valueList (0), isDefault (true)
00101         {}
00102 
00103     };
00104 
00108     struct SettingsItemDef
00109     {
00111         QString name;
00112 
00114         QStringList *valueList;
00115 
00117         QString defaultValue;
00118 
00120         bool hasMultipleValues;
00121 
00123         CSMSettings::QStringPair minMax;
00124 
00126         WidgetDef widget;
00127 
00129         Orientation orientation;
00130 
00132         ProxyList *proxyList;
00133 
00134         SettingsItemDef() : name (""), defaultValue (""), orientation (Orient_Vertical), hasMultipleValues (false)
00135         {}
00136 
00137         SettingsItemDef (QString propName, QString propDefault, Orientation propOrient = Orient_Vertical)
00138             : name (propName), defaultValue (propDefault), orientation (propOrient),
00139               hasMultipleValues(false), valueList (new QStringList), proxyList ( new ProxyList)
00140         {}
00141     };
00142 
00143 
00145     struct GroupBlockDef
00146     {
00148         QString title;
00149 
00151         QStringList captions;
00152 
00154         WidgetList widgets;
00155 
00157         QList<SettingsItemDef *> settingItems;
00158 
00160         Orientation widgetOrientation;
00161 
00163         bool isVisible;
00164 
00166         bool isProxy;
00167 
00169         QString defaultValue;
00170 
00172         bool isZeroMargin;
00173 
00174         GroupBlockDef (): title(""), widgetOrientation (Orient_Vertical), isVisible (true), isProxy (false), defaultValue (""), isZeroMargin (true)
00175         {}
00176 
00177         GroupBlockDef (QString blockTitle)
00178             : title (blockTitle), widgetOrientation (Orient_Vertical), isProxy (false), isVisible (true), defaultValue (""), isZeroMargin (true)
00179         {}
00180     };
00181 
00183     struct CustomBlockDef
00184     {
00186         QString title;
00187 
00189         QString defaultValue;
00190 
00192         GroupBlockDefList blockDefList;
00193 
00195         Orientation blockOrientation;
00196 
00197         CustomBlockDef (): title (""), defaultValue (""), blockOrientation (Orient_Horizontal)
00198         {}
00199 
00200         CustomBlockDef (const QString &blockTitle)
00201             : title (blockTitle), defaultValue (""), blockOrientation (Orient_Horizontal)
00202         {}
00203     };
00204 }
00205 
00206 #endif // VIEW_SUPPORT_HPP