新增预览窗口

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

View File

@ -1,13 +1,25 @@
#include "kernelinformationdialog.h" #include "kernelinformationdialog.h"
#include "ui_kernelinformationdialog.h" #include "ui_kernelinformationdialog.h"
#include <QJsonArray>
KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) : KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::KernelInformationDialog) ui(new Ui::KernelInformationDialog)
{ {
ui->setupUi(this); 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() KernelInformationDialog::~KernelInformationDialog()

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>526</width>
<height>300</height> <height>330</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -39,13 +39,36 @@
<property name="text"> <property name="text">
<string>Kernel Name:</string> <string>Kernel Name:</string>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="m_kernelVersion">
<property name="text"> <property name="text">
<string>Kernel Version:</string> <string>Kernel Version:</string>
</property> </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> </widget>
</item> </item>
<item> <item>
@ -65,6 +88,19 @@
</item> </item>
</layout> </layout>
</item> </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> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">