| 1 |
/** |
| 2 |
* This file is generated by dconfig2cpp. |
| 3 |
* Command line arguments: ./dconfig2cpp -p ./dtkcore/toolGenerate/dconfig2cpp ./dtkcore/tests/data/dconf-example.meta.json |
| 4 |
* Generation time: 2025-01-14T10:54:59 |
| 5 |
* JSON file version: 1.0 |
| 6 |
* |
| 7 |
* WARNING: DO NOT MODIFY THIS FILE MANUALLY. |
| 8 |
* If you need to change the content, please modify the dconfig2cpp tool. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef DCONF-EXAMPLE_META_H |
| 12 |
#define DCONF-EXAMPLE_META_H |
| 13 |
|
| 14 |
#include <QThread> |
| 15 |
#include <QVariant> |
| 16 |
#include <QDebug> |
| 17 |
#include <QAtomicPointer> |
| 18 |
#include <QAtomicInteger> |
| 19 |
#include <DConfig> |
| 20 |
|
| 21 |
class dconf-example_meta : public QObject { |
| 22 |
Q_OBJECT |
| 23 |
|
| 24 |
Q_PROPERTY(QList<QVariant> array READ array WRITE setArray NOTIFY arrayChanged) |
| 25 |
Q_PROPERTY(QList<QVariant> array_map READ array_map WRITE setArray_map NOTIFY array_mapChanged) |
| 26 |
Q_PROPERTY(QList<QVariant> array_map_struct READ array_map_struct WRITE setArray_map_struct NOTIFY array_map_structChanged) |
| 27 |
Q_PROPERTY(bool canExit READ canExit WRITE setCanExit NOTIFY canExitChanged) |
| 28 |
Q_PROPERTY(QString key2 READ key2 WRITE setKey2 NOTIFY key2Changed) |
| 29 |
Q_PROPERTY(QString key3 READ key3 WRITE setKey3 NOTIFY key3Changed) |
| 30 |
Q_PROPERTY(QVariantMap map READ map WRITE setMap NOTIFY mapChanged) |
| 31 |
Q_PROPERTY(QVariantMap map_array READ map_array WRITE setMap_array NOTIFY map_arrayChanged) |
| 32 |
Q_PROPERTY(double number READ number WRITE setNumber NOTIFY numberChanged) |
| 33 |
Q_PROPERTY(double numberDouble READ numberDouble WRITE setNumberDouble NOTIFY numberDoubleChanged) |
| 34 |
Q_PROPERTY(bool publicConfig READ publicConfig WRITE setPublicConfig NOTIFY publicConfigChanged) |
| 35 |
Q_PROPERTY(QVariantMap struct READ struct WRITE setStruct NOTIFY structChanged) |
| 36 |
public: |
| 37 |
explicit dconf-example_meta(QThread *thread, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) |
| 38 |
: QObject(parent) { |
| 39 |
|
| 40 |
if (!thread->isRunning()) { |
| 41 |
qWarning() << QStringLiteral("Warning: The provided thread is not running."); |
| 42 |
} |
| 43 |
Q_ASSERT(QThread::currentThread() != thread); |
| 44 |
auto worker = new QObject(); |
| 45 |
worker->moveToThread(thread); |
| 46 |
QMetaObject::invokeMethod(worker, [=]() { |
| 47 |
auto config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr); |
| 48 |
if (!config) { |
| 49 |
qWarning() << QStringLiteral("Failed to create DConfig instance."); |
| 50 |
worker->deleteLater(); |
| 51 |
return; |
| 52 |
} |
| 53 |
config->moveToThread(QThread::currentThread()); |
| 54 |
initialize(config); |
| 55 |
worker->deleteLater(); |
| 56 |
}); |
| 57 |
} |
| 58 |
explicit dconf-example_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) |
| 59 |
: QObject(parent) { |
| 60 |
|
| 61 |
if (!thread->isRunning()) { |
| 62 |
qWarning() << QStringLiteral("Warning: The provided thread is not running."); |
| 63 |
} |
| 64 |
Q_ASSERT(QThread::currentThread() != thread); |
| 65 |
auto worker = new QObject(); |
| 66 |
worker->moveToThread(thread); |
| 67 |
QMetaObject::invokeMethod(worker, [=]() { |
| 68 |
auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr); |
| 69 |
if (!config) { |
| 70 |
qWarning() << QStringLiteral("Failed to create DConfig instance."); |
| 71 |
worker->deleteLater(); |
| 72 |
return; |
| 73 |
} |
| 74 |
config->moveToThread(QThread::currentThread()); |
| 75 |
initialize(config); |
| 76 |
worker->deleteLater(); |
| 77 |
}); |
| 78 |
} |
| 79 |
explicit dconf-example_meta(QThread *thread, const QString &name, const QString &subpath, QObject *parent = nullptr) |
| 80 |
: QObject(parent) { |
| 81 |
|
| 82 |
if (!thread->isRunning()) { |
| 83 |
qWarning() << QStringLiteral("Warning: The provided thread is not running."); |
| 84 |
} |
| 85 |
Q_ASSERT(QThread::currentThread() != thread); |
| 86 |
auto worker = new QObject(); |
| 87 |
worker->moveToThread(thread); |
| 88 |
QMetaObject::invokeMethod(worker, [=]() { |
| 89 |
auto config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr); |
| 90 |
if (!config) { |
| 91 |
qWarning() << QStringLiteral("Failed to create DConfig instance."); |
| 92 |
worker->deleteLater(); |
| 93 |
return; |
| 94 |
} |
| 95 |
config->moveToThread(QThread::currentThread()); |
| 96 |
initialize(config); |
| 97 |
worker->deleteLater(); |
| 98 |
}); |
| 99 |
} |
| 100 |
explicit dconf-example_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent = nullptr) |
| 101 |
: QObject(parent) { |
| 102 |
|
| 103 |
if (!thread->isRunning()) { |
| 104 |
qWarning() << QStringLiteral("Warning: The provided thread is not running."); |
| 105 |
} |
| 106 |
Q_ASSERT(QThread::currentThread() != thread); |
| 107 |
auto worker = new QObject(); |
| 108 |
worker->moveToThread(thread); |
| 109 |
QMetaObject::invokeMethod(worker, [=]() { |
| 110 |
auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr); |
| 111 |
if (!config) { |
| 112 |
qWarning() << QStringLiteral("Failed to create DConfig instance."); |
| 113 |
worker->deleteLater(); |
| 114 |
return; |
| 115 |
} |
| 116 |
config->moveToThread(QThread::currentThread()); |
| 117 |
initialize(config); |
| 118 |
worker->deleteLater(); |
| 119 |
}); |
| 120 |
} |
| 121 |
~dconf-example_meta() { |
| 122 |
if (m_config.loadRelaxed()) { |
| 123 |
m_config.loadRelaxed()->deleteLater(); |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
QList<QVariant> array() const { |
| 128 |
return p_array; |
| 129 |
} |
| 130 |
void setArray(const QList<QVariant> &value) { |
| 131 |
auto oldValue = p_array; |
| 132 |
p_array = value; |
| 133 |
markPropertySet(0); |
| 134 |
if (auto config = m_config.loadRelaxed()) { |
| 135 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 136 |
m_config.loadRelaxed()->setValue(QStringLiteral("array"), value); |
| 137 |
}); |
| 138 |
} |
| 139 |
if (p_array != oldValue) { |
| 140 |
Q_EMIT arrayChanged(); |
| 141 |
} |
| 142 |
} |
| 143 |
QList<QVariant> array_map() const { |
| 144 |
return p_array_map; |
| 145 |
} |
| 146 |
void setArray_map(const QList<QVariant> &value) { |
| 147 |
auto oldValue = p_array_map; |
| 148 |
p_array_map = value; |
| 149 |
markPropertySet(1); |
| 150 |
if (auto config = m_config.loadRelaxed()) { |
| 151 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 152 |
m_config.loadRelaxed()->setValue(QStringLiteral("array_map"), value); |
| 153 |
}); |
| 154 |
} |
| 155 |
if (p_array_map != oldValue) { |
| 156 |
Q_EMIT array_mapChanged(); |
| 157 |
} |
| 158 |
} |
| 159 |
QList<QVariant> array_map_struct() const { |
| 160 |
return p_array_map_struct; |
| 161 |
} |
| 162 |
void setArray_map_struct(const QList<QVariant> &value) { |
| 163 |
auto oldValue = p_array_map_struct; |
| 164 |
p_array_map_struct = value; |
| 165 |
markPropertySet(2); |
| 166 |
if (auto config = m_config.loadRelaxed()) { |
| 167 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 168 |
m_config.loadRelaxed()->setValue(QStringLiteral("array_map_struct"), value); |
| 169 |
}); |
| 170 |
} |
| 171 |
if (p_array_map_struct != oldValue) { |
| 172 |
Q_EMIT array_map_structChanged(); |
| 173 |
} |
| 174 |
} |
| 175 |
bool canExit() const { |
| 176 |
return p_canExit; |
| 177 |
} |
| 178 |
void setCanExit(const bool &value) { |
| 179 |
auto oldValue = p_canExit; |
| 180 |
p_canExit = value; |
| 181 |
markPropertySet(3); |
| 182 |
if (auto config = m_config.loadRelaxed()) { |
| 183 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 184 |
m_config.loadRelaxed()->setValue(QStringLiteral("canExit"), value); |
| 185 |
}); |
| 186 |
} |
| 187 |
if (p_canExit != oldValue) { |
| 188 |
Q_EMIT canExitChanged(); |
| 189 |
} |
| 190 |
} |
| 191 |
QString key2() const { |
| 192 |
return p_key2; |
| 193 |
} |
| 194 |
void setKey2(const QString &value) { |
| 195 |
auto oldValue = p_key2; |
| 196 |
p_key2 = value; |
| 197 |
markPropertySet(4); |
| 198 |
if (auto config = m_config.loadRelaxed()) { |
| 199 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 200 |
m_config.loadRelaxed()->setValue(QStringLiteral("key2"), value); |
| 201 |
}); |
| 202 |
} |
| 203 |
if (p_key2 != oldValue) { |
| 204 |
Q_EMIT key2Changed(); |
| 205 |
} |
| 206 |
} |
| 207 |
QString key3() const { |
| 208 |
return p_key3; |
| 209 |
} |
| 210 |
void setKey3(const QString &value) { |
| 211 |
auto oldValue = p_key3; |
| 212 |
p_key3 = value; |
| 213 |
markPropertySet(5); |
| 214 |
if (auto config = m_config.loadRelaxed()) { |
| 215 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 216 |
m_config.loadRelaxed()->setValue(QStringLiteral("key3"), value); |
| 217 |
}); |
| 218 |
} |
| 219 |
if (p_key3 != oldValue) { |
| 220 |
Q_EMIT key3Changed(); |
| 221 |
} |
| 222 |
} |
| 223 |
QVariantMap map() const { |
| 224 |
return p_map; |
| 225 |
} |
| 226 |
void setMap(const QVariantMap &value) { |
| 227 |
auto oldValue = p_map; |
| 228 |
p_map = value; |
| 229 |
markPropertySet(6); |
| 230 |
if (auto config = m_config.loadRelaxed()) { |
| 231 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 232 |
m_config.loadRelaxed()->setValue(QStringLiteral("map"), value); |
| 233 |
}); |
| 234 |
} |
| 235 |
if (p_map != oldValue) { |
| 236 |
Q_EMIT mapChanged(); |
| 237 |
} |
| 238 |
} |
| 239 |
QVariantMap map_array() const { |
| 240 |
return p_map_array; |
| 241 |
} |
| 242 |
void setMap_array(const QVariantMap &value) { |
| 243 |
auto oldValue = p_map_array; |
| 244 |
p_map_array = value; |
| 245 |
markPropertySet(7); |
| 246 |
if (auto config = m_config.loadRelaxed()) { |
| 247 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 248 |
m_config.loadRelaxed()->setValue(QStringLiteral("map_array"), value); |
| 249 |
}); |
| 250 |
} |
| 251 |
if (p_map_array != oldValue) { |
| 252 |
Q_EMIT map_arrayChanged(); |
| 253 |
} |
| 254 |
} |
| 255 |
double number() const { |
| 256 |
return p_number; |
| 257 |
} |
| 258 |
void setNumber(const double &value) { |
| 259 |
auto oldValue = p_number; |
| 260 |
p_number = value; |
| 261 |
markPropertySet(8); |
| 262 |
if (auto config = m_config.loadRelaxed()) { |
| 263 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 264 |
m_config.loadRelaxed()->setValue(QStringLiteral("number"), value); |
| 265 |
}); |
| 266 |
} |
| 267 |
if (p_number != oldValue) { |
| 268 |
Q_EMIT numberChanged(); |
| 269 |
} |
| 270 |
} |
| 271 |
double numberDouble() const { |
| 272 |
return p_numberDouble; |
| 273 |
} |
| 274 |
void setNumberDouble(const double &value) { |
| 275 |
auto oldValue = p_numberDouble; |
| 276 |
p_numberDouble = value; |
| 277 |
markPropertySet(9); |
| 278 |
if (auto config = m_config.loadRelaxed()) { |
| 279 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 280 |
m_config.loadRelaxed()->setValue(QStringLiteral("numberDouble"), value); |
| 281 |
}); |
| 282 |
} |
| 283 |
if (p_numberDouble != oldValue) { |
| 284 |
Q_EMIT numberDoubleChanged(); |
| 285 |
} |
| 286 |
} |
| 287 |
bool publicConfig() const { |
| 288 |
return p_publicConfig; |
| 289 |
} |
| 290 |
void setPublicConfig(const bool &value) { |
| 291 |
auto oldValue = p_publicConfig; |
| 292 |
p_publicConfig = value; |
| 293 |
markPropertySet(10); |
| 294 |
if (auto config = m_config.loadRelaxed()) { |
| 295 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 296 |
m_config.loadRelaxed()->setValue(QStringLiteral("publicConfig"), value); |
| 297 |
}); |
| 298 |
} |
| 299 |
if (p_publicConfig != oldValue) { |
| 300 |
Q_EMIT publicConfigChanged(); |
| 301 |
} |
| 302 |
} |
| 303 |
QVariantMap struct() const { |
| 304 |
return p_struct; |
| 305 |
} |
| 306 |
void setStruct(const QVariantMap &value) { |
| 307 |
auto oldValue = p_struct; |
| 308 |
p_struct = value; |
| 309 |
markPropertySet(11); |
| 310 |
if (auto config = m_config.loadRelaxed()) { |
| 311 |
QMetaObject::invokeMethod(config, [this, value]() { |
| 312 |
m_config.loadRelaxed()->setValue(QStringLiteral("struct"), value); |
| 313 |
}); |
| 314 |
} |
| 315 |
if (p_struct != oldValue) { |
| 316 |
Q_EMIT structChanged(); |
| 317 |
} |
| 318 |
} |
| 319 |
Q_SIGNALS: |
| 320 |
void arrayChanged(); |
| 321 |
void array_mapChanged(); |
| 322 |
void array_map_structChanged(); |
| 323 |
void canExitChanged(); |
| 324 |
void key2Changed(); |
| 325 |
void key3Changed(); |
| 326 |
void mapChanged(); |
| 327 |
void map_arrayChanged(); |
| 328 |
void numberChanged(); |
| 329 |
void numberDoubleChanged(); |
| 330 |
void publicConfigChanged(); |
| 331 |
void structChanged(); |
| 332 |
private: |
| 333 |
void initialize(DTK_CORE_NAMESPACE::DConfig *config) { |
| 334 |
Q_ASSERT(!m_config.loadRelaxed()); |
| 335 |
m_config.storeRelaxed(config); |
| 336 |
if (testPropertySet(0)) { |
| 337 |
config->setValue(QStringLiteral("array"), QVariant::fromValue(p_array)); |
| 338 |
} else { |
| 339 |
updateValue(QStringLiteral("array"), QVariant::fromValue(p_array)); |
| 340 |
} |
| 341 |
if (testPropertySet(1)) { |
| 342 |
config->setValue(QStringLiteral("array_map"), QVariant::fromValue(p_array_map)); |
| 343 |
} else { |
| 344 |
updateValue(QStringLiteral("array_map"), QVariant::fromValue(p_array_map)); |
| 345 |
} |
| 346 |
if (testPropertySet(2)) { |
| 347 |
config->setValue(QStringLiteral("array_map_struct"), QVariant::fromValue(p_array_map_struct)); |
| 348 |
} else { |
| 349 |
updateValue(QStringLiteral("array_map_struct"), QVariant::fromValue(p_array_map_struct)); |
| 350 |
} |
| 351 |
if (testPropertySet(3)) { |
| 352 |
config->setValue(QStringLiteral("canExit"), QVariant::fromValue(p_canExit)); |
| 353 |
} else { |
| 354 |
updateValue(QStringLiteral("canExit"), QVariant::fromValue(p_canExit)); |
| 355 |
} |
| 356 |
if (testPropertySet(4)) { |
| 357 |
config->setValue(QStringLiteral("key2"), QVariant::fromValue(p_key2)); |
| 358 |
} else { |
| 359 |
updateValue(QStringLiteral("key2"), QVariant::fromValue(p_key2)); |
| 360 |
} |
| 361 |
if (testPropertySet(5)) { |
| 362 |
config->setValue(QStringLiteral("key3"), QVariant::fromValue(p_key3)); |
| 363 |
} else { |
| 364 |
updateValue(QStringLiteral("key3"), QVariant::fromValue(p_key3)); |
| 365 |
} |
| 366 |
if (testPropertySet(6)) { |
| 367 |
config->setValue(QStringLiteral("map"), QVariant::fromValue(p_map)); |
| 368 |
} else { |
| 369 |
updateValue(QStringLiteral("map"), QVariant::fromValue(p_map)); |
| 370 |
} |
| 371 |
if (testPropertySet(7)) { |
| 372 |
config->setValue(QStringLiteral("map_array"), QVariant::fromValue(p_map_array)); |
| 373 |
} else { |
| 374 |
updateValue(QStringLiteral("map_array"), QVariant::fromValue(p_map_array)); |
| 375 |
} |
| 376 |
if (testPropertySet(8)) { |
| 377 |
config->setValue(QStringLiteral("number"), QVariant::fromValue(p_number)); |
| 378 |
} else { |
| 379 |
updateValue(QStringLiteral("number"), QVariant::fromValue(p_number)); |
| 380 |
} |
| 381 |
if (testPropertySet(9)) { |
| 382 |
config->setValue(QStringLiteral("numberDouble"), QVariant::fromValue(p_numberDouble)); |
| 383 |
} else { |
| 384 |
updateValue(QStringLiteral("numberDouble"), QVariant::fromValue(p_numberDouble)); |
| 385 |
} |
| 386 |
if (testPropertySet(10)) { |
| 387 |
config->setValue(QStringLiteral("publicConfig"), QVariant::fromValue(p_publicConfig)); |
| 388 |
} else { |
| 389 |
updateValue(QStringLiteral("publicConfig"), QVariant::fromValue(p_publicConfig)); |
| 390 |
} |
| 391 |
if (testPropertySet(11)) { |
| 392 |
config->setValue(QStringLiteral("struct"), QVariant::fromValue(p_struct)); |
| 393 |
} else { |
| 394 |
updateValue(QStringLiteral("struct"), QVariant::fromValue(p_struct)); |
| 395 |
} |
| 396 |
|
| 397 |
connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) { |
| 398 |
updateValue(key); |
| 399 |
}, Qt::DirectConnection); |
| 400 |
} |
| 401 |
void updateValue(const QString &key, const QVariant &fallback = QVariant()) { |
| 402 |
Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread()); |
| 403 |
const QVariant &value = m_config.loadRelaxed()->value(key, fallback); |
| 404 |
if (key == QStringLiteral("array")) { |
| 405 |
auto newValue = qvariant_cast<QList<QVariant>>(value); |
| 406 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 407 |
if (p_array != newValue) { |
| 408 |
p_array = newValue; |
| 409 |
Q_EMIT arrayChanged(); |
| 410 |
} |
| 411 |
}); |
| 412 |
return; |
| 413 |
} |
| 414 |
if (key == QStringLiteral("array_map")) { |
| 415 |
auto newValue = qvariant_cast<QList<QVariant>>(value); |
| 416 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 417 |
if (p_array_map != newValue) { |
| 418 |
p_array_map = newValue; |
| 419 |
Q_EMIT array_mapChanged(); |
| 420 |
} |
| 421 |
}); |
| 422 |
return; |
| 423 |
} |
| 424 |
if (key == QStringLiteral("array_map_struct")) { |
| 425 |
auto newValue = qvariant_cast<QList<QVariant>>(value); |
| 426 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 427 |
if (p_array_map_struct != newValue) { |
| 428 |
p_array_map_struct = newValue; |
| 429 |
Q_EMIT array_map_structChanged(); |
| 430 |
} |
| 431 |
}); |
| 432 |
return; |
| 433 |
} |
| 434 |
if (key == QStringLiteral("canExit")) { |
| 435 |
auto newValue = qvariant_cast<bool>(value); |
| 436 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 437 |
if (p_canExit != newValue) { |
| 438 |
p_canExit = newValue; |
| 439 |
Q_EMIT canExitChanged(); |
| 440 |
} |
| 441 |
}); |
| 442 |
return; |
| 443 |
} |
| 444 |
if (key == QStringLiteral("key2")) { |
| 445 |
auto newValue = qvariant_cast<QString>(value); |
| 446 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 447 |
if (p_key2 != newValue) { |
| 448 |
p_key2 = newValue; |
| 449 |
Q_EMIT key2Changed(); |
| 450 |
} |
| 451 |
}); |
| 452 |
return; |
| 453 |
} |
| 454 |
if (key == QStringLiteral("key3")) { |
| 455 |
auto newValue = qvariant_cast<QString>(value); |
| 456 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 457 |
if (p_key3 != newValue) { |
| 458 |
p_key3 = newValue; |
| 459 |
Q_EMIT key3Changed(); |
| 460 |
} |
| 461 |
}); |
| 462 |
return; |
| 463 |
} |
| 464 |
if (key == QStringLiteral("map")) { |
| 465 |
auto newValue = qvariant_cast<QVariantMap>(value); |
| 466 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 467 |
if (p_map != newValue) { |
| 468 |
p_map = newValue; |
| 469 |
Q_EMIT mapChanged(); |
| 470 |
} |
| 471 |
}); |
| 472 |
return; |
| 473 |
} |
| 474 |
if (key == QStringLiteral("map_array")) { |
| 475 |
auto newValue = qvariant_cast<QVariantMap>(value); |
| 476 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 477 |
if (p_map_array != newValue) { |
| 478 |
p_map_array = newValue; |
| 479 |
Q_EMIT map_arrayChanged(); |
| 480 |
} |
| 481 |
}); |
| 482 |
return; |
| 483 |
} |
| 484 |
if (key == QStringLiteral("number")) { |
| 485 |
auto newValue = qvariant_cast<double>(value); |
| 486 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 487 |
if (p_number != newValue) { |
| 488 |
p_number = newValue; |
| 489 |
Q_EMIT numberChanged(); |
| 490 |
} |
| 491 |
}); |
| 492 |
return; |
| 493 |
} |
| 494 |
if (key == QStringLiteral("numberDouble")) { |
| 495 |
auto newValue = qvariant_cast<double>(value); |
| 496 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 497 |
if (p_numberDouble != newValue) { |
| 498 |
p_numberDouble = newValue; |
| 499 |
Q_EMIT numberDoubleChanged(); |
| 500 |
} |
| 501 |
}); |
| 502 |
return; |
| 503 |
} |
| 504 |
if (key == QStringLiteral("publicConfig")) { |
| 505 |
auto newValue = qvariant_cast<bool>(value); |
| 506 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 507 |
if (p_publicConfig != newValue) { |
| 508 |
p_publicConfig = newValue; |
| 509 |
Q_EMIT publicConfigChanged(); |
| 510 |
} |
| 511 |
}); |
| 512 |
return; |
| 513 |
} |
| 514 |
if (key == QStringLiteral("struct")) { |
| 515 |
auto newValue = qvariant_cast<QVariantMap>(value); |
| 516 |
QMetaObject::invokeMethod(this, [this, newValue]() { |
| 517 |
if (p_struct != newValue) { |
| 518 |
p_struct = newValue; |
| 519 |
Q_EMIT structChanged(); |
| 520 |
} |
| 521 |
}); |
| 522 |
return; |
| 523 |
} |
| 524 |
} |
| 525 |
inline void markPropertySet(const int index) { |
| 526 |
if (index < 32) { |
| 527 |
m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0)); |
| 528 |
return; |
| 529 |
} |
| 530 |
Q_UNREACHABLE(); |
| 531 |
} |
| 532 |
inline bool testPropertySet(const int index) const { |
| 533 |
if (index < 32) { |
| 534 |
return (m_propertySetStatus0.loadRelaxed() & (1 << (index - 0))); |
| 535 |
} |
| 536 |
Q_UNREACHABLE(); |
| 537 |
} |
| 538 |
QAtomicPointer<DTK_CORE_NAMESPACE::DConfig> m_config = nullptr; |
| 539 |
QList<QVariant> p_array { QList<QVariant>{QVariant(QStringLiteral("value1")), QVariant(QStringLiteral("value2"))} }; |
| 540 |
QList<QVariant> p_array_map { QList<QVariant>{QVariant(QVariantMap{{QStringLiteral("key1"), QVariant(QStringLiteral("value1"))}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}})} }; |
| 541 |
QList<QVariant> p_array_map_struct { QList<QVariant>{QVariant(QVariantMap{{QStringLiteral("key1"), QVariant(QVariantMap{{QStringLiteral("field1"), QVariant(QStringLiteral("value1"))}})}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}})} }; |
| 542 |
bool p_canExit { true }; |
| 543 |
QString p_key2 { QStringLiteral("125") }; |
| 544 |
QString p_key3 { QStringLiteral("application") }; |
| 545 |
QVariantMap p_map { QVariantMap{{QStringLiteral("key1"), QVariant(QStringLiteral("value1"))}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}} }; |
| 546 |
QVariantMap p_map_array { QVariantMap{{QStringLiteral("key1"), QVariant(QList<QVariant>{QVariant(QStringLiteral("value1"))})}, {QStringLiteral("key2"), QVariant(QList<QVariant>{QVariant(QStringLiteral("value2"))})}} }; |
| 547 |
double p_number { 1 }; |
| 548 |
double p_numberDouble { 1 }; |
| 549 |
bool p_publicConfig { true }; |
| 550 |
QVariantMap p_struct { QVariantMap{{QStringLiteral("key1"), QVariant(QStringLiteral("value1"))}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}} }; |
| 551 |
QAtomicInteger<quint32> m_propertySetStatus0 = 0; |
| 552 |
}; |
| 553 |
|
| 554 |
#endif // DCONF-EXAMPLE_META_H |