mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
relocate support.hpp / remove support.cpp
This commit is contained in:
parent
331df17b48
commit
e3384e3999
5 changed files with 126 additions and 252 deletions
|
@ -88,34 +88,29 @@ opencs_units_noqt (view/tools
|
|||
)
|
||||
|
||||
opencs_units (view/settings
|
||||
abstractblock
|
||||
proxyblock
|
||||
abstractwidget
|
||||
usersettingsdialog
|
||||
datadisplayformatpage
|
||||
windowpage
|
||||
settingwindow
|
||||
dialog
|
||||
page
|
||||
view
|
||||
booleanview
|
||||
textview
|
||||
listview
|
||||
resizeablestackedwidget
|
||||
)
|
||||
|
||||
opencs_units_noqt (view/settings
|
||||
abstractpage
|
||||
blankpage
|
||||
groupblock
|
||||
customblock
|
||||
groupbox
|
||||
itemblock
|
||||
settingwidget
|
||||
toggleblock
|
||||
support
|
||||
frame
|
||||
)
|
||||
|
||||
opencs_units (model/settings
|
||||
usersettings
|
||||
settingcontainer
|
||||
settingmanager
|
||||
setting
|
||||
connector
|
||||
)
|
||||
|
||||
opencs_units_noqt (model/settings
|
||||
opencs_hdrs_noqt (model/settings
|
||||
support
|
||||
settingsitem
|
||||
)
|
||||
|
||||
opencs_units_noqt (model/filter
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "support.hpp"
|
|
@ -1,39 +1,126 @@
|
|||
#ifndef MODEL_SUPPORT_HPP
|
||||
#define MODEL_SUPPORT_HPP
|
||||
#ifndef SETTING_SUPPORT_HPP
|
||||
#define SETTING_SUPPORT_HPP
|
||||
|
||||
#include <QObject>
|
||||
#include <Qt>
|
||||
#include <QPair>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QStringList>
|
||||
|
||||
class QLayout;
|
||||
class QWidget;
|
||||
class QListWidgetItem;
|
||||
|
||||
//Typedefs
|
||||
namespace CSMSettings
|
||||
{
|
||||
class SettingContainer;
|
||||
// Definition / Declaration model typedefs
|
||||
// "Pair" = Setting name and specific data
|
||||
// "ListItem" = Page name and associated setting pair
|
||||
|
||||
typedef QList<SettingContainer *> SettingList;
|
||||
typedef QMap<QString, SettingContainer *> SettingMap;
|
||||
typedef QMap<QString, SettingMap *> SectionMap;
|
||||
typedef QPair <QString, QString> StringPair;
|
||||
typedef QPair <QString, QStringList> StringListPair;
|
||||
typedef QList <StringListPair> StringListPairs;
|
||||
|
||||
struct QStringPair
|
||||
}
|
||||
|
||||
//Enums
|
||||
namespace CSMSettings
|
||||
{
|
||||
enum SettingProperty
|
||||
{
|
||||
QStringPair(): left (""), right ("")
|
||||
{}
|
||||
Property_Name = 0,
|
||||
Property_Page = 1,
|
||||
Property_ViewType = 2,
|
||||
Property_IsMultiValue = 3,
|
||||
Property_IsMultiLine = 4,
|
||||
Property_WidgetWidth = 5,
|
||||
Property_ViewRow = 6,
|
||||
Property_ViewColumn = 7,
|
||||
Property_Delimiter = 8,
|
||||
Property_Serializable = 9,
|
||||
Property_ColumnSpan = 10,
|
||||
Property_RowSpan = 11,
|
||||
|
||||
QStringPair (const QString &leftValue, const QString &rightValue)
|
||||
: left (leftValue), right(rightValue)
|
||||
{}
|
||||
//Stringlists should always be the last items
|
||||
Property_DefaultValues = 12,
|
||||
Property_DeclaredValues = 13,
|
||||
Property_DefinedValues = 14,
|
||||
Property_Proxies = 15
|
||||
};
|
||||
|
||||
QStringPair (const QStringPair &pair)
|
||||
: left (pair.left), right (pair.right)
|
||||
{}
|
||||
enum SettingType
|
||||
{
|
||||
Type_MultiBool = 0,
|
||||
Type_SingleBool = 1,
|
||||
Type_MultiList = 2,
|
||||
Type_SingleList = 3,
|
||||
Type_MultiRange = 4,
|
||||
Type_SingleRange = 5,
|
||||
Type_MultiText = 6,
|
||||
Type_SingleText = 7
|
||||
};
|
||||
|
||||
QString left;
|
||||
QString right;
|
||||
|
||||
bool isEmpty() const
|
||||
{ return (left.isEmpty() && right.isEmpty()); }
|
||||
enum MergeMethod
|
||||
{
|
||||
Merge_Accept,
|
||||
Merge_Ignore,
|
||||
Merge_Overwrite
|
||||
};
|
||||
}
|
||||
#endif // MODEL_SUPPORT_HPP
|
||||
|
||||
namespace CSVSettings
|
||||
{
|
||||
enum ViewType
|
||||
{
|
||||
ViewType_Boolean = 0,
|
||||
ViewType_List = 1,
|
||||
ViewType_Range = 2,
|
||||
ViewType_Text = 3,
|
||||
ViewType_Undefined = 4
|
||||
};
|
||||
|
||||
enum Alignment
|
||||
{
|
||||
Align_Left = Qt::AlignLeft,
|
||||
Align_Center = Qt::AlignHCenter,
|
||||
Align_Right = Qt::AlignRight
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
namespace CSMSettings
|
||||
{
|
||||
struct PropertyDefaultValues
|
||||
{
|
||||
int id;
|
||||
QString name;
|
||||
QVariant value;
|
||||
};
|
||||
|
||||
const QString sPropertyNames[] =
|
||||
{
|
||||
"name", "page", "view_type", "is_multi_value",
|
||||
"is_multi_line", "widget_width", "view_row", "view_column", "delimiter",
|
||||
"is_serializable","column_span", "row_span",
|
||||
"defaults", "declarations", "definitions", "proxies"
|
||||
};
|
||||
|
||||
const QString sPropertyDefaults[] =
|
||||
{
|
||||
"", //name
|
||||
"", //page
|
||||
"0", //view type
|
||||
"false", //multivalue
|
||||
"false", //multiline
|
||||
"0", //widget width
|
||||
"-1", //view row
|
||||
"-1", //view column
|
||||
",", //delimiter
|
||||
"true", //serialized
|
||||
"1", //column span
|
||||
"1", //row span
|
||||
"", //default values
|
||||
"", //declared values
|
||||
"", //defined values
|
||||
"" //proxy values
|
||||
};
|
||||
}
|
||||
|
||||
#endif // VIEW_SUPPORT_HPP
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "support.hpp"
|
|
@ -1,206 +0,0 @@
|
|||
#ifndef VIEW_SUPPORT_HPP
|
||||
#define VIEW_SUPPORT_HPP
|
||||
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
|
||||
#include "../../model/settings/support.hpp"
|
||||
|
||||
namespace CSVSettings
|
||||
{
|
||||
struct WidgetDef;
|
||||
class ItemBlock;
|
||||
class GroupBlock;
|
||||
struct GroupBlockDef;
|
||||
|
||||
typedef QList<GroupBlockDef *> GroupBlockDefList;
|
||||
typedef QList<GroupBlock *> GroupBlockList;
|
||||
typedef QList<ItemBlock *> ItemBlockList;
|
||||
typedef QList<QStringList *> ProxyList;
|
||||
typedef QList<WidgetDef *> WidgetList;
|
||||
typedef QMap<QString, ItemBlock *> ItemBlockMap;
|
||||
|
||||
enum Orientation
|
||||
{
|
||||
Orient_Horizontal,
|
||||
Orient_Vertical
|
||||
};
|
||||
|
||||
enum WidgetType
|
||||
{
|
||||
Widget_CheckBox,
|
||||
Widget_ComboBox,
|
||||
Widget_LineEdit,
|
||||
Widget_ListBox,
|
||||
Widget_RadioButton,
|
||||
Widget_SpinBox,
|
||||
Widget_Undefined
|
||||
};
|
||||
|
||||
enum Alignment
|
||||
{
|
||||
Align_Left = Qt::AlignLeft,
|
||||
Align_Center = Qt::AlignHCenter,
|
||||
Align_Right = Qt::AlignRight
|
||||
};
|
||||
|
||||
/// definition struct for widgets
|
||||
struct WidgetDef
|
||||
{
|
||||
/// type of widget providing input
|
||||
WidgetType type;
|
||||
|
||||
/// width of caption label
|
||||
int labelWidth;
|
||||
|
||||
/// width of input widget
|
||||
int widgetWidth;
|
||||
|
||||
/// label / widget orientation (horizontal / vertical)
|
||||
Orientation orientation;
|
||||
|
||||
/// input mask (line edit only)
|
||||
QString inputMask;
|
||||
|
||||
/// label caption. Leave empty for multiple items. See BlockDef::captionList
|
||||
QString caption;
|
||||
|
||||
/// widget value. Leave empty for multiple items. See BlockDef::valueList
|
||||
QString value;
|
||||
|
||||
/// Min/Max QString value pair. If empty, assigned to property item value pair.
|
||||
CSMSettings::QStringPair *minMax;
|
||||
|
||||
/// value list for list widgets. If left empty, is assigned to property item value list during block build().
|
||||
QStringList *valueList;
|
||||
|
||||
/// determined at runtime
|
||||
bool isDefault;
|
||||
|
||||
/// left / center / right-justify text in widget
|
||||
Alignment valueAlignment;
|
||||
|
||||
/// left / center / right-justify widget in group box
|
||||
Alignment widgetAlignment;
|
||||
|
||||
|
||||
WidgetDef() : labelWidth (-1), widgetWidth (-1),
|
||||
orientation (Orient_Horizontal),
|
||||
isDefault (true), valueAlignment (Align_Center),
|
||||
widgetAlignment (Align_Right),
|
||||
inputMask (""), value (""),
|
||||
caption (""), valueList (0)
|
||||
{}
|
||||
|
||||
WidgetDef (WidgetType widgType)
|
||||
: type (widgType), orientation (Orient_Horizontal),
|
||||
caption (""), value (""), valueAlignment (Align_Center),
|
||||
widgetAlignment (Align_Right),
|
||||
labelWidth (-1), widgetWidth (-1),
|
||||
valueList (0), isDefault (true)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
/// Defines the attributes of the setting as it is represented in the config file
|
||||
/// as well as the UI elements (group box and widget) that serve it.
|
||||
/// Only one widget may serve as the input widget for the setting.
|
||||
struct SettingsItemDef
|
||||
{
|
||||
/// setting name
|
||||
QString name;
|
||||
|
||||
/// list of valid values for the setting
|
||||
QStringList *valueList;
|
||||
|
||||
/// Used to populate option widget captions or list widget item lists (see WidgetDef::caption / value)
|
||||
QString defaultValue;
|
||||
|
||||
/// flag indicating multi-valued setting
|
||||
bool hasMultipleValues;
|
||||
|
||||
/// minimum / maximum value pair
|
||||
CSMSettings::QStringPair minMax;
|
||||
|
||||
/// definition of the input widget for this setting
|
||||
WidgetDef widget;
|
||||
|
||||
/// general orientation of the widget / label for this setting
|
||||
Orientation orientation;
|
||||
|
||||
/// list of settings and corresponding default values for proxy widget
|
||||
ProxyList *proxyList;
|
||||
|
||||
SettingsItemDef() : name (""), defaultValue (""), orientation (Orient_Vertical), hasMultipleValues (false)
|
||||
{}
|
||||
|
||||
SettingsItemDef (QString propName, QString propDefault, Orientation propOrient = Orient_Vertical)
|
||||
: name (propName), defaultValue (propDefault), orientation (propOrient),
|
||||
hasMultipleValues(false), valueList (new QStringList), proxyList ( new ProxyList)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
/// Generic container block
|
||||
struct GroupBlockDef
|
||||
{
|
||||
/// block title
|
||||
QString title;
|
||||
|
||||
/// list of captions for widgets at the block level (not associated with any particular setting)
|
||||
QStringList captions;
|
||||
|
||||
/// list of widgets at the block level (not associated with any particular setting)
|
||||
WidgetList widgets;
|
||||
|
||||
/// list of the settings which are subordinate to the setting block.
|
||||
QList<SettingsItemDef *> settingItems;
|
||||
|
||||
/// general orientation of widgets in group block
|
||||
Orientation widgetOrientation;
|
||||
|
||||
/// determines whether or not box border/title are visible
|
||||
bool isVisible;
|
||||
|
||||
/// indicates whether or not this block defines a proxy block
|
||||
bool isProxy;
|
||||
|
||||
/// generic default value attribute
|
||||
QString defaultValue;
|
||||
|
||||
/// shows / hides margins
|
||||
bool isZeroMargin;
|
||||
|
||||
GroupBlockDef (): title(""), widgetOrientation (Orient_Vertical), isVisible (true), isProxy (false), defaultValue (""), isZeroMargin (true)
|
||||
{}
|
||||
|
||||
GroupBlockDef (QString blockTitle)
|
||||
: title (blockTitle), widgetOrientation (Orient_Vertical), isProxy (false), isVisible (true), defaultValue (""), isZeroMargin (true)
|
||||
{}
|
||||
};
|
||||
|
||||
/// used to create unique, complex blocks
|
||||
struct CustomBlockDef
|
||||
{
|
||||
/// block title
|
||||
QString title;
|
||||
|
||||
/// default value for widgets unique to the custom block
|
||||
QString defaultValue;
|
||||
|
||||
/// list of settings groups that comprise the settings within the custom block
|
||||
GroupBlockDefList blockDefList;
|
||||
|
||||
/// orientation of the widgets within the block
|
||||
Orientation blockOrientation;
|
||||
|
||||
CustomBlockDef (): title (""), defaultValue (""), blockOrientation (Orient_Horizontal)
|
||||
{}
|
||||
|
||||
CustomBlockDef (const QString &blockTitle)
|
||||
: title (blockTitle), defaultValue (""), blockOrientation (Orient_Horizontal)
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // VIEW_SUPPORT_HPP
|
Loading…
Reference in a new issue