mirror of
https://github.com/logos-storage/logos-storage-app-skeleton.git
synced 2026-06-14 04:19:25 +00:00
Add debug dialog
This commit is contained in:
parent
242e3fc135
commit
1f54d2a569
49
app/DebugDialog.cpp
Normal file
49
app/DebugDialog.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include "DebugDialog.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QStandardPaths>
|
||||
#include <QStringList>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DebugDialog::DebugDialog(QWidget* parent, const QString& json) : QDialog(parent) {
|
||||
setWindowTitle("Debug Logos Storage UI");
|
||||
setFixedSize(300, 220);
|
||||
|
||||
QJsonParseError err;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), &err);
|
||||
|
||||
if (err.error != QJsonParseError::NoError) {
|
||||
qWarning() << "JSON parse error:" << err.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!doc.isObject()) {
|
||||
qWarning() << "Expected JSON object";
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject obj = doc.object();
|
||||
QString id = obj.value("id").toString();
|
||||
|
||||
qDebug() << "DebugDialog: Plugin name from JSON:" << id;
|
||||
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
|
||||
// auto* logo = new QLabel(this);
|
||||
// logo->setPixmap(
|
||||
// QPixmap(":/images/assets/logos.png").scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
// logo->setAlignment(Qt::AlignCenter);
|
||||
|
||||
// auto* text = new QLabel(this);
|
||||
// text->setAlignment(Qt::AlignCenter);
|
||||
// text->setText("Logos Storage UI\nUI version: 1.0.0\nStorage version " + version);
|
||||
// text->setTextFormat(Qt::PlainText);
|
||||
|
||||
// layout->addWidget(logo);
|
||||
// layout->addWidget(text);
|
||||
}
|
||||
8
app/DebugDialog.h
Normal file
8
app/DebugDialog.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <QDialog>
|
||||
|
||||
class DebugDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DebugDialog(QWidget* parent = nullptr, const QString& debug = "");
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user