优化内核详细信息窗口

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/members'><img src='https://gitee.com/GXDE-OS/gxde-kernel-manager/badge/fork.svg?theme=dark' alt='fork'></img></a>
## 国产的 arm CPU如飞腾、鲲鹏、麒麟 不要随意更换内核,否则会因为更换内核导致兼容性问题甚至无法启动
## 介绍
GXDE 内核管理器是一个帮助用户更方便获取、安装、移除内核的工具。
目前支持 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
**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/202405120820175356_image.png)
## GXDE 系统如何安装 GXDE 内核管理器?
只适用于 GXDEdeepin/UOS 等需要下载 deb 手动安装
```bash

@ -1,6 +1,8 @@
#include "kernelinformationdialog.h"
#include "ui_kernelinformationdialog.h"
#include "kernelinstaller.h"
#include <QJsonArray>
KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) :
@ -16,6 +18,7 @@ KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *pare
QString kernelText = "";
for(QJsonValue i: array) {
kernelText += i.toString() + " ";
pkgList.append(i.toString());
}
ui->m_PkgName->setText(tr("Package Name:") + " " + kernelText);
ui->m_kernelArch->setText(tr("Kernel Architecture:") + " " + data.value("Arch").toArray().at(0).toString());
@ -26,3 +29,36 @@ KernelInformationDialog::~KernelInformationDialog()
{
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);
~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:
Ui::KernelInformationDialog *ui;
QStringList pkgList;
};
#endif // KERNELINFORMATIONDIALOG_H

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>526</width>
<height>330</height>
<width>650</width>
<height>412</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Information</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -98,21 +98,53 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_desTip">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="m_des"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</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>
</layout>
</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()
{
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);
int id = ui->m_kernelShow->model()->data(chooseIndex).toUInt();
// 获取选中行
KernelInformationDialog dialog(kernelInformation->get_kernelData(id));
dialog.exec();
KernelInformationDialog *dialog = new KernelInformationDialog(kernelInformation->get_kernelData(id));
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();
}