From addc82cbb234a097d5ea1b89f0d77bf8e3d185d4 Mon Sep 17 00:00:00 2001
From: gfdgd_xi <3025613752@qq.com>
Date: Wed, 24 Apr 2024 20:33:04 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=B3=E4=BA=8E=E7=AA=97?=
 =?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 aboutwindow.cpp         | 20 ++++++++++++
 aboutwindow.h           | 25 +++++++++++++++
 aboutwindow.ui          | 70 +++++++++++++++++++++++++++++++++++++++++
 gxde-kernel-manager.pro |  3 ++
 kernelinformation.cpp   |  6 ++++
 kernelinstaller.ui      |  8 ++++-
 mainwindow.cpp          | 17 +++++++++-
 mainwindow.h            |  4 +++
 mainwindow.ui           | 32 ++++++++++++++++++-
 9 files changed, 182 insertions(+), 3 deletions(-)
 create mode 100644 aboutwindow.cpp
 create mode 100644 aboutwindow.h
 create mode 100644 aboutwindow.ui

diff --git a/aboutwindow.cpp b/aboutwindow.cpp
new file mode 100644
index 0000000..d5ea37a
--- /dev/null
+++ b/aboutwindow.cpp
@@ -0,0 +1,20 @@
+#include "aboutwindow.h"
+#include "ui_aboutwindow.h"
+
+AboutWindow::AboutWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::AboutWindow)
+{
+    ui->setupUi(this);
+}
+
+AboutWindow::~AboutWindow()
+{
+    delete ui;
+}
+
+void AboutWindow::on_m_closeButton_clicked()
+{
+    this->close();
+}
+
diff --git a/aboutwindow.h b/aboutwindow.h
new file mode 100644
index 0000000..0e0927a
--- /dev/null
+++ b/aboutwindow.h
@@ -0,0 +1,25 @@
+#ifndef ABOUTWINDOW_H
+#define ABOUTWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+class AboutWindow;
+}
+
+class AboutWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit AboutWindow(QWidget *parent = nullptr);
+    ~AboutWindow();
+
+private slots:
+    void on_m_closeButton_clicked();
+
+private:
+    Ui::AboutWindow *ui;
+};
+
+#endif // ABOUTWINDOW_H
diff --git a/aboutwindow.ui b/aboutwindow.ui
new file mode 100644
index 0000000..05508ad
--- /dev/null
+++ b/aboutwindow.ui
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutWindow</class>
+ <widget class="QMainWindow" name="AboutWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>About</string>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="Resource.qrc">
+    <normaloff>:/icon/icon.svg</normaloff>:/icon/icon.svg</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="QLabel" name="m_logoShower">
+      <property name="text">
+       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img width=128 src=&quot;:/icon/icon.svg&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QTextBrowser" name="textBrowser"/>
+      </item>
+      <item>
+       <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_closeButton">
+          <property name="text">
+           <string>OK</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources>
+  <include location="Resource.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/gxde-kernel-manager.pro b/gxde-kernel-manager.pro
index ab66745..bc7a18d 100644
--- a/gxde-kernel-manager.pro
+++ b/gxde-kernel-manager.pro
@@ -9,17 +9,20 @@ CONFIG += c++17
 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 
 SOURCES += \
+    aboutwindow.cpp \
     kernelinformation.cpp \
     kernelinstaller.cpp \
     main.cpp \
     mainwindow.cpp
 
 HEADERS += \
+    aboutwindow.h \
     kernelinformation.h \
     kernelinstaller.h \
     mainwindow.h
 
 FORMS += \
+    aboutwindow.ui \
     kernelinstaller.ui \
     mainwindow.ui
 
diff --git a/kernelinformation.cpp b/kernelinformation.cpp
index bb61d83..aa81212 100644
--- a/kernelinformation.cpp
+++ b/kernelinformation.cpp
@@ -79,6 +79,9 @@ QStringList KernelInformation::get_system(int value) const
     for(int i = 0; i < count; i++) {
         result << list.at(i).toString();
     }
+    if(!result.count()) {
+        result << "all";
+    }
     return result;
 }
 
@@ -90,6 +93,9 @@ QStringList KernelInformation::get_arch(int value) const
     for(int i = 0; i < count; i++) {
         result << list.at(i).toString();
     }
+    if(!result.count()) {
+        result << "all";
+    }
     return result;
 }
 
diff --git a/kernelinstaller.ui b/kernelinstaller.ui
index 2e1b00b..fb5963d 100644
--- a/kernelinstaller.ui
+++ b/kernelinstaller.ui
@@ -13,6 +13,10 @@
   <property name="windowTitle">
    <string>Kernel Installer</string>
   </property>
+  <property name="windowIcon">
+   <iconset resource="Resource.qrc">
+    <normaloff>:/icon/icon.svg</normaloff>:/icon/icon.svg</iconset>
+  </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QVBoxLayout" name="verticalLayout">
     <item>
@@ -31,6 +35,8 @@
    </layout>
   </widget>
  </widget>
- <resources/>
+ <resources>
+  <include location="Resource.qrc"/>
+ </resources>
  <connections/>
 </ui>
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 54545d0..66e36c3 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,5 +1,6 @@
 #include "mainwindow.h"
 #include "ui_mainwindow.h"
+#include "aboutwindow.h"
 
 #include "kernelinformation.h"
 
@@ -29,11 +30,12 @@ void MainWindow::RefreshKernelListView(KernelInformation *info)
     // 更新列表
     int count = info->get_count();
     QStandardItemModel *model = new QStandardItemModel();
-    model->setHorizontalHeaderLabels(QStringList() << tr("ID") << tr("Kernel Name") << tr("Author"));
+    model->setHorizontalHeaderLabels(QStringList() << tr("ID") << tr("Kernel Name") << tr("Author") << tr("Arch"));
     for(int i = 0; i < count; i++) {
         model->setItem(i, 0, new QStandardItem(QString::number(i)));
         model->setItem(i, 1, new QStandardItem(info->get_name(i)));
         model->setItem(i, 2, new QStandardItem(info->get_author(i)));
+        model->setItem(i, 3, new QStandardItem(info->get_arch(i).at(0)));
     }
     ui->m_kernelShow->setModel(model);
 }
@@ -56,3 +58,16 @@ void MainWindow::on_m_installButton_clicked()
     installer->show();
 }
 
+
+void MainWindow::on_actionExit_triggered()
+{
+    this->close();
+}
+
+
+void MainWindow::on_actionAbout_triggered()
+{
+    AboutWindow *aboutWindow = new AboutWindow();
+    aboutWindow->show();
+}
+
diff --git a/mainwindow.h b/mainwindow.h
index 251faaf..b3bdb58 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -22,6 +22,10 @@ private slots:
 
     void on_m_installButton_clicked();
 
+    void on_actionExit_triggered();
+
+    void on_actionAbout_triggered();
+
 private:
     Ui::MainWindow *ui;
     KernelInformation *kernelInformation;
diff --git a/mainwindow.ui b/mainwindow.ui
index 3f8c32c..34010d4 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -13,6 +13,10 @@
   <property name="windowTitle">
    <string>Kerne Manager</string>
   </property>
+  <property name="windowIcon">
+   <iconset resource="Resource.qrc">
+    <normaloff>:/icon/icon.svg</normaloff>:/icon/icon.svg</iconset>
+  </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QVBoxLayout" name="verticalLayout">
     <item>
@@ -80,9 +84,35 @@
      <height>23</height>
     </rect>
    </property>
+   <widget class="QMenu" name="menuProgram">
+    <property name="title">
+     <string>Program</string>
+    </property>
+    <addaction name="actionExit"/>
+   </widget>
+   <widget class="QMenu" name="menuHelp">
+    <property name="title">
+     <string>Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <addaction name="menuProgram"/>
+   <addaction name="menuHelp"/>
   </widget>
   <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionExit">
+   <property name="text">
+    <string>Exit</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>About</string>
+   </property>
+  </action>
  </widget>
- <resources/>
+ <resources>
+  <include location="Resource.qrc"/>
+ </resources>
  <connections/>
 </ui>