新增关于窗口
This commit is contained in:
parent
060fbf810b
commit
addc82cbb2
20
aboutwindow.cpp
Normal file
20
aboutwindow.cpp
Normal file
@ -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();
|
||||
}
|
||||
|
25
aboutwindow.h
Normal file
25
aboutwindow.h
Normal file
@ -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
|
70
aboutwindow.ui
Normal file
70
aboutwindow.ui
Normal file
@ -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><html><head/><body><p><img width=128 src=":/icon/icon.svg"/></p></body></html></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>
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user