优化内核详细信息窗口

This commit is contained in:
gfdgd xi 2024-05-18 11:04:21 +08:00
parent 86759a1bc5
commit ee34925def
5 changed files with 118 additions and 16 deletions

@ -4,6 +4,8 @@
<a href='https://gitee.com/GXDE-OS/gxde-kernel-manager/stargazers'><img src='https://gitee.com/GXDE-OS/gxde-kernel-manager/badge/star.svg?theme=dark' alt='star'></img></a> <a href='https://gitee.com/GXDE-OS/gxde-kernel-manager/stargazers'><img src='https://gitee.com/GXDE-OS/gxde-kernel-manager/badge/star.svg?theme=dark' alt='star'></img></a>
<a href='https://gitee.com/GXDE-OS/gxde-kernel-manager/members'><img src='https://gitee.com/GXDE-OS/gxde-kernel-manager/badge/fork.svg?theme=dark' alt='fork'></img></a> <a href='https://gitee.com/GXDE-OS/gxde-kernel-manager/members'><img src='https://gitee.com/GXDE-OS/gxde-kernel-manager/badge/fork.svg?theme=dark' alt='fork'></img></a>
## 国产的 arm CPU如飞腾、鲲鹏、麒麟 不要随意更换内核,否则会因为更换内核导致兼容性问题甚至无法启动
## 介绍 ## 介绍
GXDE 内核管理器是一个帮助用户更方便获取、安装、移除内核的工具。 GXDE 内核管理器是一个帮助用户更方便获取、安装、移除内核的工具。
目前支持 amd64、arm64、mips64 和 loong64 四个架构 目前支持 amd64、arm64、mips64 和 loong64 四个架构
@ -14,10 +16,12 @@ GXDE Kernel Manager is a kernel manager allows users to install or remove kernel
Support architectures: amd64, arm64, mips64, loong64 Support architectures: amd64, arm64, mips64, loong64
**Warning: You may damage your system unless you know what you will do!** **Warning: You may damage your system unless you know what you will do!**
![image.png](https://storage.deepin.org/thread/202405120819335429_image.png) ![image.png](https://storage.deepin.org/thread/202405120819335429_image.png)
![image.png](https://storage.deepin.org/thread/202405120820175356_image.png) ![image.png](https://storage.deepin.org/thread/202405120820175356_image.png)
## GXDE 系统如何安装 GXDE 内核管理器? ## GXDE 系统如何安装 GXDE 内核管理器?
只适用于 GXDEdeepin/UOS 等需要下载 deb 手动安装 只适用于 GXDEdeepin/UOS 等需要下载 deb 手动安装
```bash ```bash

@ -1,6 +1,8 @@
#include "kernelinformationdialog.h" #include "kernelinformationdialog.h"
#include "ui_kernelinformationdialog.h" #include "ui_kernelinformationdialog.h"
#include "kernelinstaller.h"
#include <QJsonArray> #include <QJsonArray>
KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) : KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) :
@ -16,6 +18,7 @@ KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *pare
QString kernelText = ""; QString kernelText = "";
for(QJsonValue i: array) { for(QJsonValue i: array) {
kernelText += i.toString() + " "; kernelText += i.toString() + " ";
pkgList.append(i.toString());
} }
ui->m_PkgName->setText(tr("Package Name:") + " " + kernelText); ui->m_PkgName->setText(tr("Package Name:") + " " + kernelText);
ui->m_kernelArch->setText(tr("Kernel Architecture:") + " " + data.value("Arch").toArray().at(0).toString()); ui->m_kernelArch->setText(tr("Kernel Architecture:") + " " + data.value("Arch").toArray().at(0).toString());
@ -26,3 +29,36 @@ KernelInformationDialog::~KernelInformationDialog()
{ {
delete ui; delete ui;
} }
void KernelInformationDialog::on_m_refreshButton_clicked()
{
}
void KernelInformationDialog::on_m_reconfigureButton_clicked()
{
KernelInstaller *installer = new KernelInstaller(KernelInstaller::Option::Reconfigure, pkgList);
installer->show();
}
void KernelInformationDialog::on_m_installButton_clicked()
{
KernelInstaller *installer = new KernelInstaller(KernelInstaller::Option::Install, pkgList);
connect(installer, &KernelInstaller::InstallFinished, this, [this](int status){
emit InstallFinished(status);
});
installer->show();
}
void KernelInformationDialog::on_m_removeButton_clicked()
{
KernelInstaller *installer = new KernelInstaller(KernelInstaller::Option::Remove, pkgList);
connect(installer, &KernelInstaller::InstallFinished, this, [this](int status){
emit RemoveFinished(status);
});
installer->show();
}

@ -16,8 +16,22 @@ public:
explicit KernelInformationDialog(QJsonObject data, QWidget *parent = nullptr); explicit KernelInformationDialog(QJsonObject data, QWidget *parent = nullptr);
~KernelInformationDialog(); ~KernelInformationDialog();
signals:
void InstallFinished(int status);
void RemoveFinished(int status);
private slots:
void on_m_refreshButton_clicked();
void on_m_reconfigureButton_clicked();
void on_m_installButton_clicked();
void on_m_removeButton_clicked();
private: private:
Ui::KernelInformationDialog *ui; Ui::KernelInformationDialog *ui;
QStringList pkgList;
}; };
#endif // KERNELINFORMATIONDIALOG_H #endif // KERNELINFORMATIONDIALOG_H

@ -6,12 +6,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>526</width> <width>650</width>
<height>330</height> <height>412</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Information</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
@ -98,21 +98,53 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="m_desTip">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QTextBrowser" name="m_des"/> <widget class="QTextBrowser" name="m_des"/>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="orientation"> <item>
<enum>Qt::Vertical</enum> <spacer name="horizontalSpacer">
</property> <property name="orientation">
<property name="sizeHint" stdset="0"> <enum>Qt::Horizontal</enum>
<size> </property>
<width>20</width> <property name="sizeHint" stdset="0">
<height>40</height> <size>
</size> <width>40</width>
</property> <height>20</height>
</spacer> </size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="m_reconfigureButton">
<property name="text">
<string>Reconfigure</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_installButton">
<property name="text">
<string>Install</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

@ -131,6 +131,13 @@ void MainWindow::on_actionGithub_triggered()
} }
void MainWindow::on_actionSourceforge_triggered()
{
QDesktopServices::openUrl(QUrl("https://sourceforge.net/projects/gxde-kernel-manager/"));
}
void MainWindow::on_m_removeButton_clicked() void MainWindow::on_m_removeButton_clicked()
{ {
QModelIndex list = ui->m_kernelShow->selectionModel()->currentIndex(); QModelIndex list = ui->m_kernelShow->selectionModel()->currentIndex();
@ -227,8 +234,17 @@ void MainWindow::on_m_kernelShow_doubleClicked(const QModelIndex &index)
QModelIndex chooseIndex = ui->m_kernelShow->model()->index(row, 0); QModelIndex chooseIndex = ui->m_kernelShow->model()->index(row, 0);
int id = ui->m_kernelShow->model()->data(chooseIndex).toUInt(); int id = ui->m_kernelShow->model()->data(chooseIndex).toUInt();
// 获取选中行 // 获取选中行
KernelInformationDialog dialog(kernelInformation->get_kernelData(id)); KernelInformationDialog *dialog = new KernelInformationDialog(kernelInformation->get_kernelData(id));
dialog.exec(); connect(dialog, &KernelInformationDialog::InstallFinished, this, [this](){
// 刷新列表
this->RefreshKernelListView(this->kernelInformation, ui->m_showLocalArchOnly->isChecked());
});
connect(dialog, &KernelInformationDialog::RemoveFinished, this, [this](){
// 刷新列表
this->RefreshKernelListView(this->kernelInformation, ui->m_showLocalArchOnly->isChecked());
});
dialog->show();
} }