From 86f7263b91010fb604a062e98c92001c59355c24 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Fri, 17 May 2024 19:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A2=84=E8=A7=88=E7=AA=97?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernelinformationdialog.cpp | 14 ++++++++++++- kernelinformationdialog.ui | 42 ++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/kernelinformationdialog.cpp b/kernelinformationdialog.cpp index 2c5cf9a..41cf134 100644 --- a/kernelinformationdialog.cpp +++ b/kernelinformationdialog.cpp @@ -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() diff --git a/kernelinformationdialog.ui b/kernelinformationdialog.ui index 7484d0c..da9d843 100644 --- a/kernelinformationdialog.ui +++ b/kernelinformationdialog.ui @@ -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">