1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00

Changed enum names to match OpenMW naming conventions

This commit is contained in:
graffy76 2013-05-12 14:28:36 -05:00
parent 88df3b980f
commit 144be59735
11 changed files with 66 additions and 67 deletions

View File

@ -10,7 +10,6 @@
#include "view/doc/viewmanager.hpp"
#include "view/doc/startup.hpp"
#include "view/doc/filedialog.hpp"
#include "model/settings/usersettings.hpp"
namespace CS
{

View File

@ -8,12 +8,12 @@ CSVSettings::AbstractBlock::AbstractBlock(bool isVisible, QWidget* parent)
: QObject (parent), mBox ( new GroupBox (isVisible, parent)), mWidgetParent (parent)
{}
QLayout *CSVSettings::AbstractBlock::createLayout (OcsWidgetOrientation direction,
QLayout *CSVSettings::AbstractBlock::createLayout (Orientation direction,
bool isZeroMargin, QWidget* parent)
{
QLayout *layout = 0;
if (direction == OCS_VERTICAL)
if (direction == Orient_Vertical)
layout = new QVBoxLayout (parent);
else
layout = new QHBoxLayout (parent);
@ -37,27 +37,27 @@ CSVSettings::AbstractWidget *CSVSettings::AbstractBlock::buildWidget (const QStr
switch (def.type)
{
case OCS_RADIO_WIDGET:
case Widget_RadioButton:
widg = createSettingWidget<QRadioButton> (def, layout);
break;
case OCS_SPIN_WIDGET:
case Widget_SpinBox:
widg = createSettingWidget<QSpinBox> (def, layout);
break;
case OCS_CHECK_WIDGET:
case Widget_CheckBox:
widg = createSettingWidget<QCheckBox> (def, layout);
break;
case OCS_TEXT_WIDGET:
case Widget_LineEdit:
widg = createSettingWidget<QLineEdit> (def, layout);
break;
case OCS_LIST_WIDGET:
case Widget_ListBox:
widg = createSettingWidget<QListWidget> (def, layout);
break;
case OCS_COMBO_WIDGET:
case Widget_ComboBox:
widg = createSettingWidget<QComboBox> (def, layout);
break;

View File

@ -37,7 +37,7 @@ namespace CSVSettings
protected:
QLayout *createLayout (OcsWidgetOrientation direction, bool isZeroMargin, QWidget* parent = 0);
QLayout *createLayout (Orientation direction, bool isZeroMargin, QWidget* parent = 0);
AbstractWidget *buildWidget (const QString &widgetName, WidgetDef &wDef,
QLayout *layout = 0, bool isConnected = true) const;

View File

@ -32,9 +32,9 @@ void CSVSettings::AbstractWidget::buildLabelAndWidget (QWidget *widget, WidgetDe
}
void CSVSettings::AbstractWidget::createLayout
(OcsWidgetOrientation direction, bool isZeroMargin)
(Orientation direction, bool isZeroMargin)
{
if (direction == OCS_VERTICAL)
if (direction == Orient_Vertical)
mLayout = new QVBoxLayout ();
else
mLayout = new QHBoxLayout ();
@ -43,7 +43,7 @@ void CSVSettings::AbstractWidget::createLayout
mLayout->setContentsMargins(0, 0, 0, 0);
}
QFlags<Qt::AlignmentFlag> CSVSettings::AbstractWidget::getAlignment (CSVSettings::OcsAlignment flag)
QFlags<Qt::AlignmentFlag> CSVSettings::AbstractWidget::getAlignment (CSVSettings::Alignment flag)
{
return QFlags<Qt::AlignmentFlag>(static_cast<int>(flag));
}

View File

@ -35,12 +35,12 @@ namespace CSVSettings
virtual void updateWidget (const QString &value) = 0;
//converts user-defined enum to Qt equivalents
QFlags<Qt::AlignmentFlag> getAlignment (OcsAlignment flag);
QFlags<Qt::AlignmentFlag> getAlignment (Alignment flag);
private:
//widget initialization utilities
void createLayout (OcsWidgetOrientation direction, bool isZeroMargin);
void createLayout (Orientation direction, bool isZeroMargin);
void buildLabelAndWidget (QWidget *widget, WidgetDef &def, bool noLabel);

View File

@ -37,7 +37,7 @@ int CSVSettings::CustomBlock::build(GroupBlockDefList &defList, GroupBlockDefLis
return retVal;
}
CSVSettings::GroupBox *CSVSettings::CustomBlock::buildGroupBox (OcsWidgetOrientation orientation)
CSVSettings::GroupBox *CSVSettings::CustomBlock::buildGroupBox (Orientation orientation)
{
GroupBox *box = new GroupBox (false, mBox);
QLayout *layout = createLayout (orientation, true, box);

View File

@ -25,7 +25,7 @@ namespace CSVSettings
protected:
GroupBox *buildGroupBox (OcsWidgetOrientation orientation);
GroupBox *buildGroupBox (Orientation orientation);
private:

View File

@ -48,7 +48,7 @@ void CSVSettings::EditorPage::setupUi()
undoStackItem->minMax.left = "0";
undoStackItem->minMax.right = "64";
WidgetDef stackWidget (OCS_SPIN_WIDGET);
WidgetDef stackWidget (Widget_SpinBox);
stackWidget.minMax = &(undoStackItem->minMax);
stackWidget.widgetWidth = 50;
@ -63,7 +63,7 @@ void CSVSettings::EditorPage::setupUi()
topLevelItem->minMax.left = "1";
topLevelItem->minMax.right = "256";
WidgetDef topLvlWinWidget (OCS_SPIN_WIDGET);
WidgetDef topLvlWinWidget (Widget_SpinBox);
topLvlWinWidget.minMax = &(topLevelItem->minMax);
topLvlWinWidget.widgetWidth = 50;
@ -76,9 +76,9 @@ void CSVSettings::EditorPage::setupUi()
SettingsItemDef *reuseSubItem = new SettingsItemDef (reuseSubwindow.title, "Reuse Subwindows");
*(reuseSubItem->valueList) << "None" << "Top-Level" << "Document-Level";
WidgetDef reuseSubWidget (OCS_RADIO_WIDGET);
WidgetDef reuseSubWidget (Widget_RadioButton);
reuseSubWidget.valueList = (reuseSubItem->valueList);
reuseSubWidget.widgetAlignment = OCS_LEFT;
reuseSubWidget.widgetAlignment = Align_Left;
reuseSubwindow.properties << reuseSubItem;
reuseSubItem->widget = reuseSubWidget;
@ -89,23 +89,23 @@ void CSVSettings::EditorPage::setupUi()
//custom width
SettingsItemDef *widthItem = new SettingsItemDef ("Window Width", "640");
widthItem->widget = WidgetDef (OCS_TEXT_WIDGET);
widthItem->widget = WidgetDef (Widget_LineEdit);
widthItem->widget.widgetWidth = 45;
//custom height
SettingsItemDef *heightItem = new SettingsItemDef ("Window Height", "480");
heightItem->widget = WidgetDef (OCS_TEXT_WIDGET);
heightItem->widget = WidgetDef (Widget_LineEdit);
heightItem->widget.widgetWidth = 45;
heightItem->widget.caption = "x";
customWindowSize.properties << widthItem << heightItem;
customWindowSize.widgetOrientation = OCS_HORIZONTAL;
customWindowSize.widgetOrientation = Orient_Horizontal;
customWindowSize.isVisible = false;
//pre-defined
SettingsItemDef *widthByHeightItem = new SettingsItemDef ("Window Size", "640x480");
WidgetDef widthByHeightWidget = WidgetDef (OCS_COMBO_WIDGET);
WidgetDef widthByHeightWidget = WidgetDef (Widget_ComboBox);
widthByHeightWidget.widgetWidth = 90;
*(widthByHeightItem->valueList) << "640x480" << "800x600" << "1024x768";
@ -125,12 +125,12 @@ void CSVSettings::EditorPage::setupUi()
// window size toggle
windowSizeToggle.captions << "Pre-Defined" << "Custom";
windowSizeToggle.widgetOrientation = OCS_VERTICAL;
windowSizeToggle.widgetOrientation = Orient_Vertical;
windowSizeToggle.isVisible = false;
//define a widget for each group in the toggle
for (int i = 0; i < 2; i++)
windowSizeToggle.widgets << new WidgetDef (OCS_RADIO_WIDGET);
windowSizeToggle.widgets << new WidgetDef (Widget_RadioButton);
windowSizeToggle.widgets.at(0)->isDefault = false;

View File

@ -24,8 +24,8 @@ void CSVSettings::ItemBlock::buildItemBlockWidgets (SettingsItemDef &iDef)
switch (wDef.type)
{
case OCS_CHECK_WIDGET:
case OCS_RADIO_WIDGET:
case Widget_CheckBox:
case Widget_RadioButton:
foreach (QString item, *(iDef.valueList))
{
@ -37,8 +37,8 @@ void CSVSettings::ItemBlock::buildItemBlockWidgets (SettingsItemDef &iDef)
break;
case OCS_COMBO_WIDGET:
case OCS_LIST_WIDGET:
case Widget_ComboBox:
case Widget_ListBox:
//assign the item's value list to the widget's value list.
//pass through to default to finish widget construction.

View File

@ -20,59 +20,59 @@ namespace CSVSettings
typedef QList<WidgetDef *> WidgetList;
typedef QMap<QString, ItemBlock *> ItemBlockMap;
enum OcsWidgetOrientation
enum Orientation
{
OCS_HORIZONTAL,
OCS_VERTICAL
Orient_Horizontal,
Orient_Vertical
};
enum OcsWidgetType
enum WidgetType
{
OCS_CHECK_WIDGET,
OCS_COMBO_WIDGET,
OCS_TEXT_WIDGET,
OCS_LIST_WIDGET,
OCS_RADIO_WIDGET,
OCS_SPIN_WIDGET,
OCS_UNDEFINED_WIDGET
Widget_CheckBox,
Widget_ComboBox,
Widget_LineEdit,
Widget_ListBox,
Widget_RadioButton,
Widget_SpinBox,
Widget_Undefined
};
enum OcsAlignment
enum Alignment
{
OCS_LEFT = Qt::AlignLeft,
OCS_CENTER = Qt::AlignHCenter,
OCS_RIGHT = Qt::AlignRight
Align_Left = Qt::AlignLeft,
Align_Center = Qt::AlignHCenter,
Align_Right = Qt::AlignRight
};
//template for defining the widget of a property.
struct WidgetDef
{
OcsWidgetType type; //type of widget providing input
WidgetType type; //type of widget providing input
int labelWidth; //width of caption label
int widgetWidth; //width of input widget
OcsWidgetOrientation orientation; //label / widget orientation (horizontal / vertical)
Orientation orientation; //label / widget orientation (horizontal / vertical)
QString inputMask; //input mask (line edit)
QString caption; //label caption. Leave empty for multiple items. See BlockDef::captionList
QString value; //widget value. Leave empty for multiple items. See BlockDef::valueList
CSMSettings::QStringPair *minMax; //Min/Max QString value pair. If empty, assigned to property item value pair.
QStringList *valueList; //value list for list widgets. If left empty, is assigned to property item value list during block build().
bool isDefault; //isDefault - determined at runtime.
OcsAlignment valueAlignment; //left / center / right-justify text in widget
OcsAlignment widgetAlignment; //left / center / right-justify widget in group box
Alignment valueAlignment; //left / center / right-justify text in widget
Alignment widgetAlignment; //left / center / right-justify widget in group box
WidgetDef() : labelWidth (-1), widgetWidth (-1),
orientation (OCS_HORIZONTAL),
isDefault (true), valueAlignment (OCS_CENTER),
widgetAlignment (OCS_RIGHT),
orientation (Orient_Horizontal),
isDefault (true), valueAlignment (Align_Center),
widgetAlignment (Align_Right),
inputMask (""), value (""),
caption (""), valueList (0)
{}
WidgetDef (OcsWidgetType widgType)
: type (widgType), orientation (OCS_HORIZONTAL),
caption (""), value (""), valueAlignment (OCS_CENTER),
widgetAlignment (OCS_RIGHT),
WidgetDef (WidgetType widgType)
: type (widgType), orientation (Orient_Horizontal),
caption (""), value (""), valueAlignment (Align_Center),
widgetAlignment (Align_Right),
labelWidth (-1), widgetWidth (-1),
valueList (0), isDefault (true)
{}
@ -91,13 +91,13 @@ namespace CSVSettings
bool hasMultipleValues;
CSMSettings::QStringPair minMax; //minimum / maximum value pair
WidgetDef widget; //definition of the input widget for this setting
OcsWidgetOrientation orientation; //general orientation of the widget / label for this property
Orientation orientation; //general orientation of the widget / label for this property
ProxyList *proxyList; //list of property and corresponding default values for proxy widget
SettingsItemDef() : name (""), defaultValue (""), orientation (OCS_VERTICAL), hasMultipleValues (false)
SettingsItemDef() : name (""), defaultValue (""), orientation (Orient_Vertical), hasMultipleValues (false)
{}
SettingsItemDef (QString propName, QString propDefault, OcsWidgetOrientation propOrient = OCS_VERTICAL)
SettingsItemDef (QString propName, QString propDefault, Orientation propOrient = Orient_Vertical)
: name (propName), defaultValue (propDefault), orientation (propOrient),
hasMultipleValues(false), valueList (new QStringList), proxyList ( new ProxyList)
{}
@ -112,16 +112,16 @@ namespace CSVSettings
QStringList captions; //list of captions for widgets at the block level (not associated with any particular property)
WidgetList widgets; //list of widgets at the block level (not associated with any particular property)
QList<SettingsItemDef *> properties; //list of the property(ies) which are subordinate to the property block.
OcsWidgetOrientation widgetOrientation; //general orientation of widgets in group block
Orientation widgetOrientation; //general orientation of widgets in group block
bool isVisible; //determines whether or not box border/title are visible
bool isProxy; //indicates whether or not this block defines a proxy block
QString defaultValue; //generic default value attribute
GroupBlockDef (): title(""), widgetOrientation (OCS_VERTICAL), isVisible (true), isProxy (false), defaultValue ("")
GroupBlockDef (): title(""), widgetOrientation (Orient_Vertical), isVisible (true), isProxy (false), defaultValue ("")
{}
GroupBlockDef (QString blockTitle)
: title (blockTitle), widgetOrientation (OCS_VERTICAL), isProxy (false), isVisible (true), defaultValue ("")
: title (blockTitle), widgetOrientation (Orient_Vertical), isProxy (false), isVisible (true), defaultValue ("")
{}
};
@ -130,13 +130,13 @@ namespace CSVSettings
QString title;
QString defaultValue; //default value for widgets unique to the custom block
GroupBlockDefList blockDefList; //list of settings groups that comprise the settings within the custom block
OcsWidgetOrientation blockOrientation;
Orientation blockOrientation;
CustomBlockDef (): title (""), defaultValue (""), blockOrientation (OCS_HORIZONTAL)
CustomBlockDef (): title (""), defaultValue (""), blockOrientation (Orient_Horizontal)
{}
CustomBlockDef (const QString &blockTitle)
: title (blockTitle), defaultValue (""), blockOrientation (OCS_HORIZONTAL)
: title (blockTitle), defaultValue (""), blockOrientation (Orient_Horizontal)
{}
};
}

View File

@ -61,7 +61,7 @@ CSVSettings::GroupBox *CSVSettings::ToggleBlock::buildToggleWidgets (GroupBlockD
WidgetDef *wDef = def.widgets.at(i);
wDef->caption = caption;
wDef->widgetAlignment = OCS_LEFT;
wDef->widgetAlignment = Align_Left;
AbstractWidget *widg = buildWidget (caption, *wDef, layout, false);