架构显示

This commit is contained in:
gfdgd xi 2024-04-25 20:59:24 +08:00
parent 19cc5cf347
commit 11b1f70ecc
3 changed files with 14 additions and 1 deletions

View File

@ -115,3 +115,15 @@ bool KernelInformation::get_installedAlready(int value) const
QString pkgName = this->get_pkgName(value).at(0);
return QFile::exists("/var/lib/dpkg/info/" + pkgName + ".list");
}
QString KernelInformation::arch() const
{
QProcess process;
process.start("dpkg", QStringList() << "--print-architecture");
process.waitForStarted();
process.waitForFinished();
QString data = process.readAllStandardOutput();
data = data.replace("\n", "").replace(" ", "");
process.close();
return data;
}

View File

@ -36,6 +36,7 @@ public:
bool get_installedAlready(int value) const;
QString localKernelName() const;
QString arch() const;
signals:
void loadFinished(QNetworkReply *reply);

View File

@ -18,7 +18,7 @@ MainWindow::MainWindow(QWidget *parent)
void MainWindow::RefreshKernelList()
{
ui->m_nowKernel->setText(tr("Kernel: ") + kernelInformation->localKernelName());
ui->m_nowKernel->setText(tr("Kernel: ") + kernelInformation->localKernelName() + " " + tr("Arch: ") + kernelInformation->arch());
connect(kernelInformation, &KernelInformation::loadFinished, this, [this](){
qDebug() << this->kernelInformation->get_listData();
RefreshKernelListView(kernelInformation);