新增窗口
This commit is contained in:
		
							parent
							
								
									30372e2c32
								
							
						
					
					
						commit
						19e4ec2930
					
				@ -23,5 +23,6 @@
 | 
			
		||||
        <file>Donate/Alipay.jpg</file>
 | 
			
		||||
        <file>Donate/QQ.png</file>
 | 
			
		||||
        <file>Donate/Wechat.png</file>
 | 
			
		||||
        <file>icon/tux.png</file>
 | 
			
		||||
    </qresource>
 | 
			
		||||
</RCC>
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,7 @@ SOURCES += \
 | 
			
		||||
    aboutwindow.cpp \
 | 
			
		||||
    aptpkginfo.cpp \
 | 
			
		||||
    kernelinformation.cpp \
 | 
			
		||||
    kernelinformationdialog.cpp \
 | 
			
		||||
    kernelinstaller.cpp \
 | 
			
		||||
    main.cpp \
 | 
			
		||||
    mainwindow.cpp \
 | 
			
		||||
@ -21,12 +22,14 @@ HEADERS += \
 | 
			
		||||
    aboutwindow.h \
 | 
			
		||||
    aptpkginfo.h \
 | 
			
		||||
    kernelinformation.h \
 | 
			
		||||
    kernelinformationdialog.h \
 | 
			
		||||
    kernelinstaller.h \
 | 
			
		||||
    mainwindow.h \
 | 
			
		||||
    programinfo.h
 | 
			
		||||
 | 
			
		||||
FORMS += \
 | 
			
		||||
    aboutwindow.ui \
 | 
			
		||||
    kernelinformationdialog.ui \
 | 
			
		||||
    kernelinstaller.ui \
 | 
			
		||||
    mainwindow.ui
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								icon/tux.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								icon/tux.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 7.5 KiB  | 
							
								
								
									
										16
									
								
								kernelinformationdialog.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								kernelinformationdialog.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
#include "kernelinformationdialog.h"
 | 
			
		||||
#include "ui_kernelinformationdialog.h"
 | 
			
		||||
 | 
			
		||||
KernelInformationDialog::KernelInformationDialog(QJsonObject data, QWidget *parent) :
 | 
			
		||||
    QDialog(parent),
 | 
			
		||||
    ui(new Ui::KernelInformationDialog)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    // 解析数据
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
KernelInformationDialog::~KernelInformationDialog()
 | 
			
		||||
{
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								kernelinformationdialog.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								kernelinformationdialog.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
#ifndef KERNELINFORMATIONDIALOG_H
 | 
			
		||||
#define KERNELINFORMATIONDIALOG_H
 | 
			
		||||
 | 
			
		||||
#include <QDialog>
 | 
			
		||||
#include <QJsonObject>
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class KernelInformationDialog;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class KernelInformationDialog : public QDialog
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit KernelInformationDialog(QJsonObject data, QWidget *parent = nullptr);
 | 
			
		||||
    ~KernelInformationDialog();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::KernelInformationDialog *ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // KERNELINFORMATIONDIALOG_H
 | 
			
		||||
							
								
								
									
										85
									
								
								kernelinformationdialog.ui
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								kernelinformationdialog.ui
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,85 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>KernelInformationDialog</class>
 | 
			
		||||
 <widget class="QDialog" name="KernelInformationDialog">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>400</width>
 | 
			
		||||
    <height>300</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Dialog</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout_2">
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="linuxIconShower">
 | 
			
		||||
       <property name="sizePolicy">
 | 
			
		||||
        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
 | 
			
		||||
         <horstretch>0</horstretch>
 | 
			
		||||
         <verstretch>0</verstretch>
 | 
			
		||||
        </sizepolicy>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string><html><head/><body><p><img src=":/icon/tux.png"/></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="QLabel" name="m_kernelName">
 | 
			
		||||
         <property name="text">
 | 
			
		||||
          <string>Kernel Name:</string>
 | 
			
		||||
         </property>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <widget class="QLabel" name="label">
 | 
			
		||||
         <property name="text">
 | 
			
		||||
          <string>Kernel Version:</string>
 | 
			
		||||
         </property>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item>
 | 
			
		||||
        <spacer name="verticalSpacer_2">
 | 
			
		||||
         <property name="orientation">
 | 
			
		||||
          <enum>Qt::Vertical</enum>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="sizeHint" stdset="0">
 | 
			
		||||
          <size>
 | 
			
		||||
           <width>20</width>
 | 
			
		||||
           <height>40</height>
 | 
			
		||||
          </size>
 | 
			
		||||
         </property>
 | 
			
		||||
        </spacer>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </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>
 | 
			
		||||
   </item>
 | 
			
		||||
  </layout>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
@ -8,6 +8,8 @@
 | 
			
		||||
#include <QStandardItemModel>
 | 
			
		||||
#include <qdesktopservices.h>
 | 
			
		||||
 | 
			
		||||
#include "kernelinformationdialog.h"
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow(QWidget *parent)
 | 
			
		||||
    : QMainWindow(parent)
 | 
			
		||||
    , ui(new Ui::MainWindow)
 | 
			
		||||
@ -210,3 +212,23 @@ void MainWindow::on_actionDonate_triggered()
 | 
			
		||||
    QDesktopServices::openUrl(QUrl("https://gitee.com/GXDE-OS#%E8%AF%B7%E4%BD%9C%E8%80%85%E5%96%9D%E6%9D%AF%E8%8C%B6"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_m_kernelShow_doubleClicked(const QModelIndex &index)
 | 
			
		||||
{
 | 
			
		||||
    // 显示具体信息
 | 
			
		||||
    QModelIndex list = index;
 | 
			
		||||
    int row = list.row();
 | 
			
		||||
    if(row < 0) {
 | 
			
		||||
        // 未选中任何内容
 | 
			
		||||
        QMessageBox::critical(this, tr("Error"), tr("Nothing to choose"));
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    // 获取 ID
 | 
			
		||||
    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();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -45,6 +45,8 @@ private slots:
 | 
			
		||||
 | 
			
		||||
    void on_actionDonate_triggered();
 | 
			
		||||
 | 
			
		||||
    void on_m_kernelShow_doubleClicked(const QModelIndex &index);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::MainWindow *ui;
 | 
			
		||||
    KernelInformation *kernelInformation;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user