Tome
A generic data editor for games supporting arbitrary input and output formats.
localizedstringfacet.h
1 #ifndef LOCALIZEDSTRINGFACET_H
2 #define LOCALIZEDSTRINGFACET_H
3 
4 #include <QObject>
5 
6 #include "facet.h"
7 
8 namespace Tome
9 {
10  class FacetContext;
11 
15  class LocalizedStringFacet : public QObject, public Facet
16  {
17  Q_OBJECT
18 
19  public:
21 
22  QWidget* createWidget(const FacetContext& context) const Q_DECL_OVERRIDE;
23  const QVariant getDefaultValue() const Q_DECL_OVERRIDE;
24  const QString getDescriptionForValue(const QVariant facetValue) const Q_DECL_OVERRIDE;
25  const QString getDisplayName() const Q_DECL_OVERRIDE;
26  const QString getKey() const Q_DECL_OVERRIDE;
27  const QString getTargetType() const Q_DECL_OVERRIDE;
28  const QVariant getWidgetValue(QWidget* widget) const Q_DECL_OVERRIDE;
29  void setWidgetValue(QWidget* widget, const QVariant value) const Q_DECL_OVERRIDE;
30  QString validateValue(const FacetContext& context, const QVariant value, const QVariant facetValue) const Q_DECL_OVERRIDE;
31 
35  static const QString FacetKey;
36  };
37 }
38 
39 #endif // LOCALIZEDSTRINGFACET_H
Definition: commandlineoptions.h:6
const QString getDescriptionForValue(const QVariant facetValue) const Q_DECL_OVERRIDE
Gets the text to add to the description of a field, explaining the restriction of the domain of the c...
Definition: localizedstringfacet.cpp:30
const QVariant getWidgetValue(QWidget *widget) const Q_DECL_OVERRIDE
Gets the current value of the widget for specifying the restriction of the domain of the custom type ...
Definition: localizedstringfacet.cpp:51
const QVariant getDefaultValue() const Q_DECL_OVERRIDE
Gets the default restriction of the domain of the custom type (e.g. default minimum value)...
Definition: localizedstringfacet.cpp:25
static const QString FacetKey
Key of the restriction of the domain of the custom type used for serialization.
Definition: localizedstringfacet.h:35
const QString getKey() const Q_DECL_OVERRIDE
Gets the key of the restriction of the domain of the custom type used for serialization.
Definition: localizedstringfacet.cpp:41
Marks a custom String type for localization.
Definition: localizedstringfacet.h:15
const QString getDisplayName() const Q_DECL_OVERRIDE
Gets the name of the restriction of the domain of the custom type (e.g. "Minimum Value").
Definition: localizedstringfacet.cpp:36
QString validateValue(const FacetContext &context, const QVariant value, const QVariant facetValue) const Q_DECL_OVERRIDE
Validates the specified field value against the domain restrictions imposed by this facet...
Definition: localizedstringfacet.cpp:63
Context to apply facets in.
Definition: facetcontext.h:11
Restricts the domain of a custom type.
Definition: facet.h:14
QWidget * createWidget(const FacetContext &context) const Q_DECL_OVERRIDE
Creates a widget for specifying the restriction of the domain of the custom type (e.g. QSpinBox).
Definition: localizedstringfacet.cpp:19
const QString getTargetType() const Q_DECL_OVERRIDE
Gets the custom type whose domain can be restricted by this facet.
Definition: localizedstringfacet.cpp:46
void setWidgetValue(QWidget *widget, const QVariant value) const Q_DECL_OVERRIDE
Sets the current value of the widget for specifying the restriction of the domain of the custom type ...
Definition: localizedstringfacet.cpp:57