Commit 835988af authored by Simonas Leleiva's avatar Simonas Leleiva

Merge pull request #20 from SfietKonstantin/script-bugfix

[Bugfix] Bugfixed the generator
parents 75604577 13bb333f
This diff is collapsed.
...@@ -70,6 +70,14 @@ void NemoThemeButtonPressedGradient::setWidth(int width) ...@@ -70,6 +70,14 @@ void NemoThemeButtonPressedGradient::setWidth(int width)
} }
} }
void NemoThemeButtonPressedGradient::setWidthDefault()
{
if (m_width != 240) {
m_width = 240;
emit widthChanged();
}
}
int NemoThemeButtonPressedGradient::height() const int NemoThemeButtonPressedGradient::height() const
{ {
return m_height; return m_height;
...@@ -83,6 +91,14 @@ void NemoThemeButtonPressedGradient::setHeight(int height) ...@@ -83,6 +91,14 @@ void NemoThemeButtonPressedGradient::setHeight(int height)
} }
} }
void NemoThemeButtonPressedGradient::setHeightDefault()
{
if (m_height != 240) {
m_height = 240;
emit heightChanged();
}
}
double NemoThemeButtonPressedGradient::center() const double NemoThemeButtonPressedGradient::center() const
{ {
return m_center; return m_center;
...@@ -96,6 +112,14 @@ void NemoThemeButtonPressedGradient::setCenter(double center) ...@@ -96,6 +112,14 @@ void NemoThemeButtonPressedGradient::setCenter(double center)
} }
} }
void NemoThemeButtonPressedGradient::setCenterDefault()
{
if (m_center != 0.29) {
m_center = 0.29;
emit centerChanged();
}
}
double NemoThemeButtonPressedGradient::edge() const double NemoThemeButtonPressedGradient::edge() const
{ {
return m_edge; return m_edge;
...@@ -108,3 +132,11 @@ void NemoThemeButtonPressedGradient::setEdge(double edge) ...@@ -108,3 +132,11 @@ void NemoThemeButtonPressedGradient::setEdge(double edge)
emit edgeChanged(); emit edgeChanged();
} }
} }
void NemoThemeButtonPressedGradient::setEdgeDefault()
{
if (m_edge != 0.5) {
m_edge = 0.5;
emit edgeChanged();
}
}
...@@ -43,12 +43,16 @@ public: ...@@ -43,12 +43,16 @@ public:
void setEdgeColor(const QColor &edgeColor); void setEdgeColor(const QColor &edgeColor);
int width() const; int width() const;
void setWidth(int width); void setWidth(int width);
void setWidthDefault();
int height() const; int height() const;
void setHeight(int height); void setHeight(int height);
void setHeightDefault();
double center() const; double center() const;
void setCenter(double center); void setCenter(double center);
void setCenterDefault();
double edge() const; double edge() const;
void setEdge(double edge); void setEdge(double edge);
void setEdgeDefault();
Q_SIGNALS: Q_SIGNALS:
void centerColorChanged(); void centerColorChanged();
void edgeColorChanged(); void edgeColorChanged();
......
...@@ -42,6 +42,14 @@ void NemoThemeFont::setPointSize(int pointSize) ...@@ -42,6 +42,14 @@ void NemoThemeFont::setPointSize(int pointSize)
} }
} }
void NemoThemeFont::setPointSizeDefault()
{
if (m_pointSize != 24) {
m_pointSize = 24;
emit pointSizeChanged();
}
}
int NemoThemeFont::weight() const int NemoThemeFont::weight() const
{ {
return m_weight; return m_weight;
...@@ -54,3 +62,11 @@ void NemoThemeFont::setWeight(int weight) ...@@ -54,3 +62,11 @@ void NemoThemeFont::setWeight(int weight)
emit weightChanged(); emit weightChanged();
} }
} }
void NemoThemeFont::setWeightDefault()
{
if (m_weight != 25) {
m_weight = 25;
emit weightChanged();
}
}
...@@ -34,8 +34,10 @@ public: ...@@ -34,8 +34,10 @@ public:
explicit NemoThemeFont(QObject *parent = 0); explicit NemoThemeFont(QObject *parent = 0);
int pointSize() const; int pointSize() const;
void setPointSize(int pointSize); void setPointSize(int pointSize);
void setPointSizeDefault();
int weight() const; int weight() const;
void setWeight(int weight); void setWeight(int weight);
void setWeightDefault();
Q_SIGNALS: Q_SIGNALS:
void pointSizeChanged(); void pointSizeChanged();
void weightChanged(); void weightChanged();
......
...@@ -53,3 +53,11 @@ void NemoThemeLabel::setPointSize(int pointSize) ...@@ -53,3 +53,11 @@ void NemoThemeLabel::setPointSize(int pointSize)
emit pointSizeChanged(); emit pointSizeChanged();
} }
} }
void NemoThemeLabel::setPointSizeDefault()
{
if (m_pointSize != 24) {
m_pointSize = 24;
emit pointSizeChanged();
}
}
...@@ -37,6 +37,7 @@ public: ...@@ -37,6 +37,7 @@ public:
void setColor(const QColor &color); void setColor(const QColor &color);
int pointSize() const; int pointSize() const;
void setPointSize(int pointSize); void setPointSize(int pointSize);
void setPointSizeDefault();
Q_SIGNALS: Q_SIGNALS:
void colorChanged(); void colorChanged();
void pointSizeChanged(); void pointSizeChanged();
......
...@@ -69,6 +69,14 @@ void NemoThemePageDimmer::setHeight(int height) ...@@ -69,6 +69,14 @@ void NemoThemePageDimmer::setHeight(int height)
} }
} }
void NemoThemePageDimmer::setHeightDefault()
{
if (m_height != 15) {
m_height = 15;
emit heightChanged();
}
}
double NemoThemePageDimmer::startPosition() const double NemoThemePageDimmer::startPosition() const
{ {
return m_startPosition; return m_startPosition;
...@@ -82,6 +90,14 @@ void NemoThemePageDimmer::setStartPosition(double startPosition) ...@@ -82,6 +90,14 @@ void NemoThemePageDimmer::setStartPosition(double startPosition)
} }
} }
void NemoThemePageDimmer::setStartPositionDefault()
{
if (m_startPosition != 0) {
m_startPosition = 0;
emit startPositionChanged();
}
}
double NemoThemePageDimmer::endPosition() const double NemoThemePageDimmer::endPosition() const
{ {
return m_endPosition; return m_endPosition;
...@@ -94,3 +110,11 @@ void NemoThemePageDimmer::setEndPosition(double endPosition) ...@@ -94,3 +110,11 @@ void NemoThemePageDimmer::setEndPosition(double endPosition)
emit endPositionChanged(); emit endPositionChanged();
} }
} }
void NemoThemePageDimmer::setEndPositionDefault()
{
if (m_endPosition != 1.0) {
m_endPosition = 1.0;
emit endPositionChanged();
}
}
...@@ -42,10 +42,13 @@ public: ...@@ -42,10 +42,13 @@ public:
void setEndColor(const QColor &endColor); void setEndColor(const QColor &endColor);
int height() const; int height() const;
void setHeight(int height); void setHeight(int height);
void setHeightDefault();
double startPosition() const; double startPosition() const;
void setStartPosition(double startPosition); void setStartPosition(double startPosition);
void setStartPositionDefault();
double endPosition() const; double endPosition() const;
void setEndPosition(double endPosition); void setEndPosition(double endPosition);
void setEndPositionDefault();
Q_SIGNALS: Q_SIGNALS:
void startColorChanged(); void startColorChanged();
void endColorChanged(); void endColorChanged();
......
...@@ -45,6 +45,14 @@ void NemoThemeSpinner::setRadius(int radius) ...@@ -45,6 +45,14 @@ void NemoThemeSpinner::setRadius(int radius)
} }
} }
void NemoThemeSpinner::setRadiusDefault()
{
if (m_radius != 32) {
m_radius = 32;
emit radiusChanged();
}
}
QColor NemoThemeSpinner::primaryColor() const QColor NemoThemeSpinner::primaryColor() const
{ {
return m_primaryColor; return m_primaryColor;
...@@ -84,6 +92,14 @@ void NemoThemeSpinner::setHorizontalSpacing(int horizontalSpacing) ...@@ -84,6 +92,14 @@ void NemoThemeSpinner::setHorizontalSpacing(int horizontalSpacing)
} }
} }
void NemoThemeSpinner::setHorizontalSpacingDefault()
{
if (m_horizontalSpacing != 15) {
m_horizontalSpacing = 15;
emit horizontalSpacingChanged();
}
}
int NemoThemeSpinner::verticalSpacing() const int NemoThemeSpinner::verticalSpacing() const
{ {
return m_verticalSpacing; return m_verticalSpacing;
...@@ -97,6 +113,14 @@ void NemoThemeSpinner::setVerticalSpacing(int verticalSpacing) ...@@ -97,6 +113,14 @@ void NemoThemeSpinner::setVerticalSpacing(int verticalSpacing)
} }
} }
void NemoThemeSpinner::setVerticalSpacingDefault()
{
if (m_verticalSpacing != 15) {
m_verticalSpacing = 15;
emit verticalSpacingChanged();
}
}
int NemoThemeSpinner::initialStateDuration() const int NemoThemeSpinner::initialStateDuration() const
{ {
return m_initialStateDuration; return m_initialStateDuration;
...@@ -110,6 +134,14 @@ void NemoThemeSpinner::setInitialStateDuration(int initialStateDuration) ...@@ -110,6 +134,14 @@ void NemoThemeSpinner::setInitialStateDuration(int initialStateDuration)
} }
} }
void NemoThemeSpinner::setInitialStateDurationDefault()
{
if (m_initialStateDuration != 1500) {
m_initialStateDuration = 1500;
emit initialStateDurationChanged();
}
}
int NemoThemeSpinner::transitionDuration() const int NemoThemeSpinner::transitionDuration() const
{ {
return m_transitionDuration; return m_transitionDuration;
...@@ -122,3 +154,11 @@ void NemoThemeSpinner::setTransitionDuration(int transitionDuration) ...@@ -122,3 +154,11 @@ void NemoThemeSpinner::setTransitionDuration(int transitionDuration)
emit transitionDurationChanged(); emit transitionDurationChanged();
} }
} }
void NemoThemeSpinner::setTransitionDurationDefault()
{
if (m_transitionDuration != 500) {
m_transitionDuration = 500;
emit transitionDurationChanged();
}
}
...@@ -40,18 +40,23 @@ public: ...@@ -40,18 +40,23 @@ public:
explicit NemoThemeSpinner(QObject *parent = 0); explicit NemoThemeSpinner(QObject *parent = 0);
int radius() const; int radius() const;
void setRadius(int radius); void setRadius(int radius);
void setRadiusDefault();
QColor primaryColor() const; QColor primaryColor() const;
void setPrimaryColor(const QColor &primaryColor); void setPrimaryColor(const QColor &primaryColor);
QColor secondaryColor() const; QColor secondaryColor() const;
void setSecondaryColor(const QColor &secondaryColor); void setSecondaryColor(const QColor &secondaryColor);
int horizontalSpacing() const; int horizontalSpacing() const;
void setHorizontalSpacing(int horizontalSpacing); void setHorizontalSpacing(int horizontalSpacing);
void setHorizontalSpacingDefault();
int verticalSpacing() const; int verticalSpacing() const;
void setVerticalSpacing(int verticalSpacing); void setVerticalSpacing(int verticalSpacing);
void setVerticalSpacingDefault();
int initialStateDuration() const; int initialStateDuration() const;
void setInitialStateDuration(int initialStateDuration); void setInitialStateDuration(int initialStateDuration);
void setInitialStateDurationDefault();
int transitionDuration() const; int transitionDuration() const;
void setTransitionDuration(int transitionDuration); void setTransitionDuration(int transitionDuration);
void setTransitionDurationDefault();
Q_SIGNALS: Q_SIGNALS:
void radiusChanged(); void radiusChanged();
void primaryColorChanged(); void primaryColorChanged();
......
...@@ -66,3 +66,11 @@ void NemoThemeTextField::setPointSize(int pointSize) ...@@ -66,3 +66,11 @@ void NemoThemeTextField::setPointSize(int pointSize)
emit pointSizeChanged(); emit pointSizeChanged();
} }
} }
void NemoThemeTextField::setPointSizeDefault()
{
if (m_pointSize != 24) {
m_pointSize = 24;
emit pointSizeChanged();
}
}
...@@ -40,6 +40,7 @@ public: ...@@ -40,6 +40,7 @@ public:
void setSelectionColor(const QColor &selectionColor); void setSelectionColor(const QColor &selectionColor);
int pointSize() const; int pointSize() const;
void setPointSize(int pointSize); void setPointSize(int pointSize);
void setPointSizeDefault();
Q_SIGNALS: Q_SIGNALS:
void selectedTextColorChanged(); void selectedTextColorChanged();
void selectionColorChanged(); void selectionColorChanged();
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
"selectedTextColor": "#ffffff", "selectedTextColor": "#ffffff",
"selectionColor": "#0091e5" "selectionColor": "#0091e5"
}, },
"toolBar": {
"background": "#000000"
},
"window": { "window": {
"background": "#000000" "background": "#000000"
}, },
...@@ -47,6 +50,17 @@ ...@@ -47,6 +50,17 @@
"startColor": "black", "startColor": "black",
"endColor": "transparent" "endColor": "transparent"
} }
},
"spinner": {
"primaryColor": "accentColor",
"secondaryColor": "transparent"
},
"label": {
"color": "#ffffff"
},
"checkbox": {
"back1": "#0091e5",
"back2": "#313131"
} }
} }
} }
...@@ -106,6 +106,10 @@ def _getGetterSetter(property): ...@@ -106,6 +106,10 @@ def _getGetterSetter(property):
if "type" in property: if "type" in property:
header += " void set" + _getUpper(propertyName) header += " void set" + _getUpper(propertyName)
header += "(" + _getArgumentType(property) + propertyName + ");\n" header += "(" + _getArgumentType(property) + propertyName + ");\n"
if "default" in property:
header += " void set" + _getUpper(propertyName) + "Default"
header += "();\n"
return header return header
def _getGetterSetterImpl(name, property): def _getGetterSetterImpl(name, property):
...@@ -126,6 +130,21 @@ def _getGetterSetterImpl(name, property): ...@@ -126,6 +130,21 @@ def _getGetterSetterImpl(name, property):
source += " }\n" source += " }\n"
source += "}\n" source += "}\n"
source += "\n" source += "\n"
if "default" in property:
default = str(property["default"])
if isinstance(property["default"], str) or isinstance(property["default"], unicode):
default = "\"" + default + "\""
source += "void " + name + "::set" + _getUpper(propertyName) + "Default"
source += "()\n"
source += "{\n"
source += " if (m_" + propertyName + " != " + default + ") {\n"
source += " m_" + propertyName + " = " + default + ";\n"
source += " emit " + propertyName + "Changed();\n"
source += " }\n"
source += "}\n"
source += "\n"
return source return source
def _getSignal(property): def _getSignal(property):
...@@ -189,7 +208,7 @@ static inline int jsonToInt(const QJsonValue &value, ...@@ -189,7 +208,7 @@ static inline int jsonToInt(const QJsonValue &value,
trueValue = defines.value(valueString); trueValue = defines.value(valueString);
} }
} }
double doubleValue = trueValue.toDouble(); double doubleValue = trueValue.toDouble();
return (int) doubleValue; return (int) doubleValue;
} }
...@@ -292,7 +311,7 @@ def _getCasted(property, jsonObject, name, cppObject): ...@@ -292,7 +311,7 @@ def _getCasted(property, jsonObject, name, cppObject):
value = "jsonValue(" + jsonObject + _getUpper(name) + ", \"" value = "jsonValue(" + jsonObject + _getUpper(name) + ", \""
value += property["name"] + "\", \"" + name + "\")" value += property["name"] + "\", \"" + name + "\")"
if "default" in property: if "default" in property:
value = jsonObject + ".value(\"" + name + "\")" value = jsonObject + _getUpper(name) + ".value(\"" + property["name"] + "\")"
if type == "QString": if type == "QString":
castedValue = "jsonToString(" + value + ", defines)" castedValue = "jsonToString(" + value + ", defines)"
...@@ -313,6 +332,8 @@ def _getCasted(property, jsonObject, name, cppObject): ...@@ -313,6 +332,8 @@ def _getCasted(property, jsonObject, name, cppObject):
data += property["name"] + "\")) {\n" data += property["name"] + "\")) {\n"
data += " " + cppObject + "->set" + _getUpper(property["name"]) data += " " + cppObject + "->set" + _getUpper(property["name"])
data += "(" + castedValue + ");\n" data += "(" + castedValue + ");\n"
data += " } else {\n"
data += " " + cppObject + "->set" + _getUpper(property["name"]) + "Default();\n"
data += " }\n" data += " }\n"
return data return data
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment