Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode/
bin/
bin/
build/
qt_gui/build/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

欢迎访问[原理介绍博客](https://blog.csdn.net/weixin_42112038/article/details/125346545),欢迎关注!

## Qt 图形界面

仓库新增了基于 Qt 的简洁界面(位于 `qt_gui/` 目录),提供更现代的窗口布局,并包含结束相关进程等基础功能。希望在保持功能的同时,带来更美观优雅的使用体验。

## 功能

注:以下*斜体标注*的内容表示即将到来的功能
Expand Down
14 changes: 14 additions & 0 deletions qt_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)
project(MythwareToolkitQt)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)

find_package(Qt5 REQUIRED COMPONENTS Widgets)

add_executable(MythwareToolkitQt
main.cpp
mainwindow.cpp
mainwindow.h)

target_link_libraries(MythwareToolkitQt Qt5::Widgets)
10 changes: 10 additions & 0 deletions qt_gui/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow w;
w.show();
return app.exec();
}
46 changes: 46 additions & 0 deletions qt_gui/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "mainwindow.h"
#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QProcess>
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setWindowTitle(tr("Mythware Toolkit"));
QWidget *central = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(central);

QLabel *title = new QLabel(tr("Mythware Toolkit"), this);
title->setAlignment(Qt::AlignCenter);
layout->addWidget(title);

QPushButton *killMythware = new QPushButton(tr("Kill Mythware"), this);
layout->addWidget(killMythware);

QPushButton *killAssistant = new QPushButton(tr("Kill Assistant"), this);
layout->addWidget(killAssistant);

connect(killMythware, &QPushButton::clicked, this, [this]() {
#ifdef Q_OS_WIN
QProcess::execute("taskkill", {"/f", "/im", "StudentMain.exe"});
QMessageBox::information(this, tr("Done"), tr("StudentMain.exe terminated."));
#else
QMessageBox::warning(this, tr("Unsupported"), tr("Available only on Windows."));
#endif
});

connect(killAssistant, &QPushButton::clicked, this, [this]() {
#ifdef Q_OS_WIN
QProcess::execute("taskkill", {"/f", "/im", "Helper.exe"});
QMessageBox::information(this, tr("Done"), tr("Helper.exe terminated."));
#else
QMessageBox::warning(this, tr("Unsupported"), tr("Available only on Windows."));
#endif
});

setCentralWidget(central);
resize(360, 200);
}
12 changes: 12 additions & 0 deletions qt_gui/mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef MYTHWARE_MAINWINDOW_H
#define MYTHWARE_MAINWINDOW_H

#include <QMainWindow>

class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
};

#endif // MYTHWARE_MAINWINDOW_H