2023-08-18 19:09:55 +08:00
|
|
|
|
//
|
2023-08-08 15:15:19 +08:00
|
|
|
|
// Created by HW on 2023/07/26.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved
|
|
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_MainWindow.h"
|
2023-08-13 12:16:22 +08:00
|
|
|
|
#include "netio.h"
|
2023-08-08 15:15:19 +08:00
|
|
|
|
#include "config.h"
|
|
|
|
|
ExitManager exit_manager;
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
|
QMainWindow(parent), ui(new Ui::MainWindow) {
|
|
|
|
|
ui->setupUi(this);
|
2023-08-13 12:16:22 +08:00
|
|
|
|
agree = false;
|
2023-08-08 15:15:19 +08:00
|
|
|
|
QDesktopWidget* desktopWidget = QApplication::desktop();
|
|
|
|
|
QRect deskRect = desktopWidget->availableGeometry();
|
|
|
|
|
resize(deskRect.width()*0.8, deskRect.height()*0.8);
|
|
|
|
|
setWindowState(Qt::WindowMaximized);
|
|
|
|
|
mainWindowLayout=new MainWindowLayout(this);
|
|
|
|
|
setCentralWidget(mainWindowLayout);
|
2023-08-13 12:16:22 +08:00
|
|
|
|
setWindowTitle(QString::fromLocal8Bit(TITLE));
|
2023-08-08 15:15:19 +08:00
|
|
|
|
QString path = QApplication::applicationDirPath();
|
|
|
|
|
path += LOGO_TITLEBAR;
|
|
|
|
|
icon = new QIcon(path);
|
|
|
|
|
setWindowIcon(*icon);
|
2023-08-13 12:16:22 +08:00
|
|
|
|
setStyleSheet("*{font-family:SimHei;}");
|
2023-08-18 19:09:55 +08:00
|
|
|
|
|
2023-08-08 15:15:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow() {
|
2023-08-13 12:16:22 +08:00
|
|
|
|
SQLiteHelper sqlite_helper;
|
|
|
|
|
sqlite_helper.db.close();
|
|
|
|
|
QSqlDatabase::removeDatabase("mydb");
|
2023-08-08 15:15:19 +08:00
|
|
|
|
delete icon;
|
|
|
|
|
this->setCentralWidget(nullptr);
|
|
|
|
|
delete mainWindowLayout;
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|