| 374 | } |
| 375 | |
| 376 | void PerformanceCounterSelection::Save() |
| 377 | { |
| 378 | QString filename = RDDialog::getSaveFileName(this, tr("Save File"), QDir::homePath(), |
| 379 | tr("Performance Counter Settings (*.json)")); |
| 380 | |
| 381 | if(filename.isEmpty()) |
| 382 | return; |
| 383 | |
| 384 | QVariantList counterIds; |
| 385 | for(const GPUCounter v : m_SelectedCounters.keys()) |
| 386 | { |
| 387 | const Uuid uuid = m_CounterToUuid[v]; |
| 388 | QVariantList e; |
| 389 | |
| 390 | for(const uint32_t b : uuid.words) |
| 391 | { |
| 392 | e.append(b); |
| 393 | } |
| 394 | |
| 395 | counterIds.append(QVariant(e)); |
| 396 | } |
| 397 | |
| 398 | QVariantMap doc; |
| 399 | doc[lit("counters")] = counterIds; |
| 400 | |
| 401 | QFile f(filename); |
| 402 | if(f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) |
| 403 | { |
| 404 | SaveToJSON(doc, f, JSON_ID, JSON_VER); |
| 405 | } |
| 406 | else |
| 407 | { |
| 408 | RDDialog::critical(this, tr("Error saving config"), |
| 409 | tr("Couldn't open path %1 for write.").arg(filename)); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | void PerformanceCounterSelection::Load() |
| 414 | { |