Compare commits
No commits in common. "ce7f2ae8fa775cbf1a0ef2e53e7dac017a19bbef" and "f109ed7d62e04d1008653ef08ac08978d8590841" have entirely different histories.
ce7f2ae8fa
...
f109ed7d62
|
@ -197,7 +197,6 @@
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerCreateWidget.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\LayerStyleDialog.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\ColorPicker.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\ColorPicker.h" />
|
||||||
<ClInclude Include="src\Editor\util\EncodeUtil.hpp" />
|
|
||||||
<ClInclude Include="src\Editor\util\JsonUtil.hpp" />
|
<ClInclude Include="src\Editor\util\JsonUtil.hpp" />
|
||||||
<ClInclude Include="src\Editor\ElementManager.h" />
|
<ClInclude Include="src\Editor\ElementManager.h" />
|
||||||
<QtMoc Include="src\Editor\ElementPoolWidget.h" />
|
<QtMoc Include="src\Editor\ElementPoolWidget.h" />
|
||||||
|
|
|
@ -480,9 +480,6 @@
|
||||||
<ClInclude Include="src\Editor\util\JsonUtil.hpp">
|
<ClInclude Include="src\Editor\util\JsonUtil.hpp">
|
||||||
<Filter>Header Files\Editor\util</Filter>
|
<Filter>Header Files\Editor\util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\Editor\util\EncodeUtil.hpp">
|
|
||||||
<Filter>Header Files\Editor\util</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="res\MainWindow.qrc">
|
<QtRcc Include="res\MainWindow.qrc">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "LayerStyle.h"
|
#include "LayerStyle.h"
|
||||||
#include "./EditorWidgetComponent/StrokeStyleWidget.h"
|
#include "./EditorWidgetComponent/StrokeStyleWidget.h"
|
||||||
#include "./util/EncodeUtil.hpp"
|
#include "./util/JsonUtil.hpp"
|
||||||
#include <qtmaterialcheckbox.h>
|
#include <qtmaterialcheckbox.h>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
@ -124,8 +124,8 @@ QJsonObject StrokeElementLayerStyle::toJson() const
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("type", "stroke");
|
json.insert("type", "stroke");
|
||||||
json.insert("enableEachSideIndependent", enableEachSideIndependent);
|
json.insert("enableEachSideIndependent", enableEachSideIndependent);
|
||||||
json.insert("left", EncodeUtil::toBase64<GLfloat>(strokePair.first->encoded()));
|
json.insert("left", JsonUtil::toQJsonArray<GLfloat>(strokePair.first->encoded()));
|
||||||
json.insert("right", EncodeUtil::toBase64<GLfloat>(strokePair.second->encoded()));
|
json.insert("right", JsonUtil::toQJsonArray<GLfloat>(strokePair.second->encoded()));
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <QByteArray>
|
|
||||||
|
|
||||||
namespace EncodeUtil
|
|
||||||
{
|
|
||||||
#include <vector>
|
|
||||||
template<typename S>
|
|
||||||
QString toBase64(const std::vector<S>& vec)
|
|
||||||
{
|
|
||||||
QByteArray ba;
|
|
||||||
ba.resize(vec.size() * sizeof(S));
|
|
||||||
memcpy_s(ba.data(), ba.size(), vec.data(), vec.size());
|
|
||||||
return ba.toBase64();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
std::vector<T> fromBase64(const QString& str)
|
|
||||||
{
|
|
||||||
QByteArray ba = QByteArray::fromBase64(str.toUtf8());
|
|
||||||
std::vector<T> vec;
|
|
||||||
vec.resize(ba.size() / sizeof(T));
|
|
||||||
memcpy_s(vec.data(), vec.size() * sizeof(T), ba.data(), ba.size());
|
|
||||||
return vec;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue