Skip to content

Commit 4b7e0aa

Browse files
committed
Update opendspx using stdc::JsonValue
1 parent 6407f1f commit 4b7e0aa

23 files changed

Lines changed: 99 additions & 83 deletions

File tree

‎scripts/vcpkg-manifest/vcpkg.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"platform": "linux"
2929
},
3030
"wolf-midi",
31-
"nlohmann-json",
3231
"zstd",
3332
"opendspx",
3433
{

‎src/plugins/CMakeLists.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ qm_find_qt(LinguistTools)
88
set(CURRENT_PLUGIN_DESC "${APPLICATION_NAME} Application Plugin")
99

1010
find_package(ExtensionSystem CONFIG REQUIRED)
11-
find_package(nlohmann_json CONFIG REQUIRED)
1211
find_package(opendspx CONFIG REQUIRED)
1312

1413
function(diffscope_add_builtin_plugin _target)

‎src/plugins/audio/internal/waveformsinger/WaveformSingerModel.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#include <opendspx/anchornode.h>
1515
#include <opendspx/vibrato.h>
16-
#include <opendspxinterpolator/parameterinterpolator.h>
17-
#include <opendspxinterpolator/vibratocurve.h>
16+
#include <opendspx/interpolator/parameterinterpolator.h>
17+
#include <opendspx/interpolator/vibratocurve.h>
1818

1919
namespace Audio::Internal {
2020

‎src/plugins/coreplugin/core/CoreInterface.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
#include <extensionsystem/pluginmanager.h>
4040

41+
#include <stdcorelib/support/json.h>
42+
4143
#include <opendspx/model.h>
4244

4345
#include <SVSCraftCore/SVSCraftNamespace.h>
@@ -348,14 +350,14 @@ namespace Core {
348350
}
349351
},
350352
.workspace = {
351-
{"diffscope", nlohmann::json::object({
352-
{"keySignatures", nlohmann::json::array({
353-
nlohmann::json::object({
353+
{"diffscope", stdc::JsonObject({
354+
{"keySignatures", stdc::JsonArray({
355+
stdc::JsonValue(stdc::JsonObject({
354356
{"pos", 0},
355357
{"mode", 2741},
356358
{"tonality", 0},
357359
{"accidentalType", 1}
358-
})
360+
}))
359361
})}
360362
})}
361363
}

‎src/plugins/coreplugin/internal/jsonutils.h‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <algorithm>
88

9-
#include <nlohmann/json.hpp>
9+
#include <stdcorelib/support/json.h>
1010

1111
#include <QJsonArray>
1212
#include <QJsonObject>
@@ -16,7 +16,7 @@ namespace Core::Internal {
1616

1717
class JsonUtils {
1818
public:
19-
static nlohmann::json fromQJsonValue(const QJsonValue &value) {
19+
static stdc::JsonValue fromQJsonValue(const QJsonValue &value) {
2020
if (value.isString())
2121
return value.toString().toStdString();
2222

@@ -27,13 +27,13 @@ namespace Core::Internal {
2727
return value.toDouble();
2828

2929
if (value.isArray()) {
30-
nlohmann::json ret = nlohmann::json::array();
30+
stdc::JsonArray ret;
3131
std::ranges::transform(value.toArray(), std::back_inserter(ret), &JsonUtils::fromQJsonValue);
3232
return ret;
3333
}
3434

3535
if (value.isObject()) {
36-
nlohmann::json ret = nlohmann::json::object();
36+
stdc::JsonObject ret;
3737
for (auto [key, item] : value.toObject().asKeyValueRange()) {
3838
ret[key.toString().toStdString()] = fromQJsonValue(item);
3939
}
@@ -43,26 +43,26 @@ namespace Core::Internal {
4343
return {};
4444
}
4545

46-
static QJsonValue toQJsonValue(const nlohmann::json &value) {
47-
if (value.is_string())
48-
return QString::fromStdString(value.get<std::string>());
46+
static QJsonValue toQJsonValue(const stdc::JsonValue &value) {
47+
if (value.isString())
48+
return QString::fromStdString(value.toString());
4949

50-
if (value.is_boolean())
51-
return value.get<bool>();
50+
if (value.isBool())
51+
return value.toBool();
5252

53-
if (value.is_number())
54-
return value.get<double>();
53+
if (value.isNumber())
54+
return value.toDouble();
5555

56-
if (value.is_array()) {
56+
if (value.isArray()) {
5757
QJsonArray ret;
58-
std::ranges::transform(value, std::back_inserter(ret), &JsonUtils::toQJsonValue);
58+
std::ranges::transform(value.toArray(), std::back_inserter(ret), &JsonUtils::toQJsonValue);
5959
return ret;
6060
}
6161

62-
if (value.is_object()) {
62+
if (value.isObject()) {
6363
QJsonObject ret;
64-
for (auto it = value.begin(); it != value.end(); ++it) {
65-
ret[it.key().c_str()] = toQJsonValue(it.value());
64+
for (const auto &[key, item] : value.toObject()) {
65+
ret[QString::fromStdString(key)] = toQJsonValue(item);
6666
}
6767
return ret;
6868
}

‎src/plugins/coreplugin/project/clipboard/DspxClipboardData.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include <QJsonObject>
88
#include <QJsonArray>
99

10-
#include <opendspxserializer/serializer.h>
11-
#include <opendspxserializer/jsonconverterv1.h>
10+
#include <opendspx/serializer/serializer.h>
11+
#include <opendspx/serializer/jsonconverterv1.h>
1212

1313
#include <coreplugin/internal/jsonutils.h>
1414

‎src/plugins/coreplugin/project/clipboard/DspxClipboardData.h‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <QList>
1010

11+
#include <stdcorelib/support/json.h>
12+
1113
#include <opendspx/model.h>
1214

1315
#include <coreplugin/coreglobal.h>
@@ -47,11 +49,11 @@ namespace Core {
4749
return std::get<Label>(m_data);
4850
}
4951

50-
void setKeySignatures(const QList<nlohmann::json> &keySignatures) {
52+
void setKeySignatures(const QList<stdc::JsonValue> &keySignatures) {
5153
m_data = keySignatures;
5254
}
5355

54-
QList<nlohmann::json> keySignatures() const {
56+
QList<stdc::JsonValue> keySignatures() const {
5557
return std::get<KeySignature>(m_data);
5658
}
5759

@@ -120,7 +122,7 @@ namespace Core {
120122
std::variant<
121123
QList<opendspx::Tempo>,
122124
QList<opendspx::Label>,
123-
QList<nlohmann::json>,
125+
QList<stdc::JsonValue>,
124126
QList<opendspx::Track>,
125127
QList<std::vector<opendspx::ClipRef>>,
126128
QList<opendspx::Note>,

0 commit comments

Comments
 (0)