新增预览窗口

This commit is contained in:
gfdgd xi 2024-05-17 19:45:01 +08:00
parent 19e4ec2930
commit 86f7263b91
2 changed files with 52 additions and 4 deletions

@ -1,13 +1,25 @@
#include "kernelinformationdialog.h"
#include "ui_kernelinformationdialog.h"
#include <QJsonArray>
KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) :
QDialog(parent),
ui(new Ui::KernelInformationDialog)
{
ui->setupUi(this);
// 解析数据
ui->m_kernelName->setText(tr("Kernel Name:") + " " + data.value("Name").toString());
ui->m_kernelVersion->setText(tr("Kernel Version:") + " " + data.value("Ver").toString());
ui->m_kernelAuthor->setText(tr("Author:") + " " + data.value("Author").toString());
QJsonArray array = data.value("PkgName").toArray();
QString kernelText = "";
for(QJsonValue i: array) {
kernelText += i.toString() + " ";
}
ui->m_PkgName->setText(tr("Package Name:") + " " + kernelText);
ui->m_kernelArch->setText(tr("Kernel Architecture:") + " " + data.value("Arch").toArray().at(0).toString());
ui->m_des->setText(data.value("Des").toString());
}
KernelInformationDialog::~KernelInformationDialog()

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>526</width>
<height>330</height>
</rect>
</property>
<property name="windowTitle">
@ -39,13 +39,36 @@
<property name="text">
<string>Kernel Name:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="m_kernelVersion">
<property name="text">
<string>Kernel Version:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_kernelAuthor">
<property name="text">
<string>Author:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_kernelArch">
<property name="text">
<string>Kernel Architecture:</string>
</property>
</widget>
</item>
<item>
@ -65,6 +88,19 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="m_PkgName">
<property name="text">
<string>Package Name:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="m_des"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">