Skip to content

Commit

Permalink
Lua plugin: Fixed group layers being exported with "imagelayer" type
Browse files Browse the repository at this point in the history
Also avoided some implicit type conversions.

Closes #1595
  • Loading branch information
bjorn committed Jun 5, 2017
1 parent 925b7ca commit fa73525
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugins/lua/luaplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void LuaPlugin::writeGroupLayer(LuaTableWriter &writer,
{
writer.writeStartTable();

writer.writeKeyAndValue("type", "imagelayer");
writer.writeKeyAndValue("type", "group");
writer.writeKeyAndValue("name", groupLayer->name());
writer.writeKeyAndValue("visible", groupLayer->isVisible());
writer.writeKeyAndValue("opacity", groupLayer->opacity());
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/lua/luatablewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void LuaTableWriter::writeNewline()
}
}

void LuaTableWriter::write(const char *bytes, unsigned length)
void LuaTableWriter::write(const char *bytes, qint64 length)
{
if (m_device->write(bytes, length) != length)
m_error = true;
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/lua/luatablewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class LuaTableWriter

void writeKeyAndValue(const QByteArray &key, int value);
void writeKeyAndValue(const QByteArray &key, unsigned value);
void writeKeyAndValue(const QByteArray &key, float value);
void writeKeyAndValue(const QByteArray &key, double value);
void writeKeyAndValue(const QByteArray &key, bool value);
void writeKeyAndValue(const QByteArray &key, const char *value);
Expand All @@ -77,7 +78,7 @@ class LuaTableWriter
void writeIndent();

void writeNewline();
void write(const char *bytes, unsigned length);
void write(const char *bytes, qint64 length);
void write(const char *bytes);
void write(const QByteArray &bytes);
void write(char c);
Expand Down Expand Up @@ -106,6 +107,9 @@ inline void LuaTableWriter::writeKeyAndValue(const QByteArray &key, int value)
inline void LuaTableWriter::writeKeyAndValue(const QByteArray &key, unsigned value)
{ writeKeyAndUnquotedValue(key, QByteArray::number(value)); }

inline void LuaTableWriter::writeKeyAndValue(const QByteArray &key, float value)
{ writeKeyAndValue(key, static_cast<double>(value)); }

inline void LuaTableWriter::writeKeyAndValue(const QByteArray &key, double value)
{ writeKeyAndUnquotedValue(key, QByteArray::number(value)); }

Expand Down

0 comments on commit fa73525

Please sign in to comment.