This commit is contained in:
gfdgd_xi 2022-08-11 12:27:25 +08:00
parent 00176f9919
commit 8f6bee1346
19 changed files with 636 additions and 75 deletions

View File

@ -28,11 +28,13 @@ CONFIG += console
SOURCES += \
main.cpp \
mainwindow.cpp \
downloadthread.cpp
downloadthread.cpp \
getipserver.cpp
HEADERS += \
mainwindow.h \
downloadthread.h
downloadthread.h \
getipserver.h
FORMS += \
mainwindow.ui

View File

@ -54,10 +54,12 @@ OBJECTS_DIR = ./
SOURCES = ../main.cpp \
../mainwindow.cpp \
../downloadthread.cpp moc_mainwindow.cpp
../downloadthread.cpp \
../getipserver.cpp moc_mainwindow.cpp
OBJECTS = main.o \
mainwindow.o \
downloadthread.o \
getipserver.o \
moc_mainwindow.o
DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
@ -165,9 +167,11 @@ DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
../../AXVM.pro ../mainwindow.h \
../downloadthread.h ../main.cpp \
../downloadthread.h \
../getipserver.h ../main.cpp \
../mainwindow.cpp \
../downloadthread.cpp
../downloadthread.cpp \
../getipserver.cpp
QMAKE_TARGET = AXVM
DESTDIR =
TARGET = AXVM
@ -407,8 +411,8 @@ distdir: FORCE
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/
$(COPY_FILE) --parents ../mainwindow.h ../downloadthread.h $(DISTDIR)/
$(COPY_FILE) --parents ../main.cpp ../mainwindow.cpp ../downloadthread.cpp $(DISTDIR)/
$(COPY_FILE) --parents ../mainwindow.h ../downloadthread.h ../getipserver.h $(DISTDIR)/
$(COPY_FILE) --parents ../main.cpp ../mainwindow.cpp ../downloadthread.cpp ../getipserver.cpp $(DISTDIR)/
$(COPY_FILE) --parents ../mainwindow.ui $(DISTDIR)/
@ -477,12 +481,18 @@ main.o: ../main.cpp ../mainwindow.h \
mainwindow.o: ../mainwindow.cpp ../mainwindow.h \
../downloadthread.h \
ui_mainwindow.h
ui_mainwindow.h \
../getipserver.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o ../mainwindow.cpp
downloadthread.o: ../downloadthread.cpp ../downloadthread.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o downloadthread.o ../downloadthread.cpp
getipserver.o: ../getipserver.cpp ../getipserver.h \
../mainwindow.h \
../downloadthread.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o getipserver.o ../getipserver.cpp
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp

Binary file not shown.

View File

@ -1,3 +1,4 @@
#define SETTINGSTEP 6
#include "downloadthread.h"
#include <QProgressDialog>
#include <QFile>
@ -7,47 +8,77 @@
#include <QTimer>
#include <QNetworkReply>
#include <QMessageBox>
#include <QCoreApplication>
// 文件操作
#include <QDir>
// 命令执行
#include <QProcess>
// 获取内存总量
#if defined(Q_OS_LINUX) // 区分系统平台
#include "sys/statfs.h" // Linux 上
#else // Windows 上
#pragma comment(lib, "Kernel32.lib")
#pragma comment(lib, "Psapi.lib")
#include <windows.h>
#include <tlhelp32.h>
#endif
DownloadThread::DownloadThread(QProgressDialog *progressDialog, QString url, QString save){
DownloadThread::DownloadThread(QProgressDialog *progressDialog, QString url, QString name, QString mouse, bool NotDownload){
dialog = progressDialog;
fileUrl = url;
savePath = save;
vmName = name;
setMouse = mouse;
notDownload = NotDownload;
}
// 文件下载
void DownloadThread::run(){
// 创建文件夹
QDir dir;
QString configDir = QCoreApplication::applicationDirPath() + "/VM";
if(!dir.exists(configDir)){
// 文件不存在
dir.mkpath(configDir);
}
configDir = QCoreApplication::applicationDirPath() + "/VM/" + vmName;
if(!dir.exists(configDir)){
// 文件不存在
dir.mkpath(configDir);
}
QString savePath = configDir + "/vm.ova";
// 文件下载
int timeout = 0;
QFile f(savePath);
if(!f.open(QIODevice::WriteOnly)){
emit MessageBoxError("文件无法写入");
f.close();
delete dialog;
dialog->close();
return;
}
if(notDownload){
qDebug() << "b";
SettingVirtualMachine(savePath);
return;
}
QNetworkAccessManager m;
QNetworkRequest req;
// 响应 https
// 响应 https(就是不行)
QSslConfiguration conf = req.sslConfiguration();
/*conf.setPeerVerifyMode(QSslSocket::VerifyNone);
conf.setProtocol(QSsl::TlsV1SslV3);
req.setSslConfiguration(conf);
req.setUrl(QUrl(fileUrl));*/
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
conf.setProtocol(QSsl::TlsV1SslV3);
conf.setProtocol(QSsl::TlsV1_0);
req.setSslConfiguration(conf);
req.setUrl(QUrl(fileUrl));
//QNetworkRequest request ;
//request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
//QNetworkReply* reply = QNetworkAccessManager::createRequest(op, request, outgoingData);
//QNetworkRequest request(req);
// 下载文件
QNetworkReply *reply = m.get(req);
QEventLoop loop;
QTimer t;
//QMessageBox::information(this, "", QString::number(reply->rawHeader(QString("Content-Length").toUtf8())));
qDebug() << reply->rawHeader(QString("Content-Length").toUtf8());
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
connect(reply, &QNetworkReply::downloadProgress, [=, &f, &t](qint64 bytesRead, qint64 totalBytes){
f.write(reply->readAll());
dialog->setValue(bytesRead / totalBytes * 100);
dialog->setValue((float)bytesRead / totalBytes * 100);
dialog->setLabelText(QString::number(bytesRead / 1024 / 1024) + "MB/" + QString::number(totalBytes / 1024 / 1024) + "MB");
if(t.isActive()){
t.start(timeout);
}
@ -58,9 +89,108 @@ void DownloadThread::run(){
}
loop.exec();
if(reply->error() != QNetworkReply::NoError){
emit MessageBoxError("下载失败");
f.close();
delete reply;
delete dialog;
dialog->close();
return;
}
f.close();
delete reply;
dialog->close();
SettingVirtualMachine(savePath);
}
void DownloadThread::SettingVirtualMachine(QString savePath){
// 设置虚拟机
dialog->setLabelText("设置虚拟机");
dialog->setWindowTitle("正在设置“" + vmName + "");
dialog->setValue(100 / SETTINGSTEP * 0);
dialog->show();
// 拷贝 OVA 文件
if(notDownload){
if(QFile::exists(savePath)){
QFile::remove(savePath);
}
if(!QFile::copy(fileUrl, savePath)){
emit MessageBoxError("文件复制错误,无法继续");
}
}
// 导入 OVA 镜像
QProcess progress;
QStringList command;
dialog->setValue(100 / SETTINGSTEP * 1);
command << "import" << savePath;
progress.start("VBoxManage", command);
progress.waitForFinished();
qDebug() << "正常信息:\n";
qDebug() << progress.readAllStandardOutput();
qDebug() << "错误信息:\n";
qDebug() << progress.readAllStandardError();
// 获取内存
dialog->setValue(100 / SETTINGSTEP * 2);
int memtotal = 0;
#if defined (Q_OS_LINUX) // 在 Linux 下读取总内存
progress.start("free -m");
progress.waitForFinished();
progress.readLine(); // 忽略第一行
QString memoryInfo = progress.readLine(); // 只读取第 2 行
qDebug() << memoryInfo;
memoryInfo.replace("\n", ""); // 忽略换行符
memoryInfo.replace(QRegExp("( ){1,}"), " "); // 将连续的空格换为单个空格
auto memoryList = memoryInfo.split(" "); // 根据空格切割内容
qDebug() << memoryList;
if(memoryList.size() >= 2){ // 保证至少有两个
// 理论上列表应该出现的是如下的内容
// ["Mem:", "13998", "9622", "197", "803", "4179", "3331"]
// 因此要读[1]
memtotal = memoryList[1].toDouble();
}
else{
emit MessageBoxError("内存读取错误,请自行打开 VirtualBox 设置内存");
return;
}
#endif
// 设置内存
// 示例命令VBoxManage modifyvm [name] --memory 4096
command.clear(); // 清空参数列表
command << "modifyvm" << vmName << "--memory" << QString::number(memtotal / 2);
progress.start("VBoxManage", command);
progress.waitForFinished();
// 设置显卡,默认的 VMSVGA 在 Android X86 上运行有很多问题,应设为 VBoxVGA
// 示例命令VBoxManage modifyvm [name] --graphicscontroller vboxvga
dialog->setValue(100 / SETTINGSTEP * 3);
command.clear(); // 清空参数列表
command << "modifyvm" << vmName << "--graphicscontroller" << "vboxvga";
qDebug() << command;
progress.start("VBoxManage", command);
progress.waitForFinished();
// 设置声卡
// VBoxManage modifyvm [name] --audio pulse --audiocontroller hda --audioin on --audioout on
dialog->setValue(100 / SETTINGSTEP * 4);
command.clear(); // 清空参数列表
command << "modifyvm" << vmName << "--audio" << "pulse" << "--audiocontroller" << "hda" << "--audioin" << "on" << "--audioout" << "on";
progress.start("VBoxManage", command);
progress.waitForFinished();
// 设置显存
// VBoxManage modifyvm [name] --vram 128
dialog->setValue(100 / SETTINGSTEP * 5);
command.clear(); // 清空参数列表
command << "modifyvm" << vmName << "--vram" << "128";
progress.start("VBoxManage", command);
progress.waitForFinished();
// 设置鼠标
// VBoxManage modifyvm [name] --mouse ps2
dialog->setValue(100 / SETTINGSTEP * 6);
if(setMouse == "ps2"){
command.clear(); // 清空参数列表
command << "modifyvm" << vmName << "--mouse" << "ps2";
progress.start("VBoxManage", command);
progress.waitForFinished();
}
// 结束
dialog->setValue(100);
emit MessageBoxOpenVM(vmName);
dialog->close();
delete dialog;
}

View File

@ -11,16 +11,23 @@
class DownloadThread : public QThread // 继承 QThread
{
public:
DownloadThread(QProgressDialog *dialog, QString url, QString save);
DownloadThread(QProgressDialog *dialog, QString url, QString save, QString mouse, bool NotDownload);
void SettingVirtualMachine(QString savePath);
QProgressDialog *dialog;
QString fileUrl;
QString savePath;
QString vmName;
QString setMouse;
bool notDownload;
QString notDownloadPath;
protected:
void run(); // 核心
signals:
void ChangeValue();
// 防止非主线程刷新控件导致程序退出
void MessageBoxInfo(QString info);
void MessageBoxError(QString info);
void MessageBoxOpenVM(QString vmName);
};
#endif // DOWNLOADTHREAD_H

View File

@ -0,0 +1,44 @@
#include "getipserver.h"
#include <QTcpServer>
#include <mainwindow.h>
#include <QtNetwork>
#include <QHostAddress>
#include <QMessageBox>
GetIPServer::GetIPServer(QLabel *localIp)
{
lock = false;
tcp = new QTcpServer();
QHostAddress ip("0.0.0.0");
tcp->listen(QHostAddress::Any, 30201);
// 获取 IP 地址
QString IpAddress;
foreach (QHostAddress address, QNetworkInterface::allAddresses())
{
if(address.protocol() == QAbstractSocket::IPv4Protocol && address.toString() != "127.0.0.1" && address.toString() != "192.168.250.1"){
IpAddress = address.toString();
}
}
qDebug() << "服务器IP" << IpAddress;
qDebug() << "服务器端口:" << tcp->serverPort();
localIp->setText("访问http://" + IpAddress + ":" + QString::number(tcp->serverPort()) + " 连接");
connect(tcp, &QTcpServer::newConnection, this, [this](){
tcpSocket = tcp->nextPendingConnection();
QString ipAddress = QHostAddress(tcpSocket->peerAddress().toIPv4Address()).toString();
qDebug() << ipAddress;
qDebug() << tcpSocket->peerPort();
tcpSocket->write("HTTP/1.1 200 OK"\
"Content-Type: text/html;charset=utf-8"\
"\n\n");
tcpSocket->write(QString("<html><body><p>IP Address: " + ipAddress + "</p><p>Get Port: " + QString::number(tcpSocket->peerPort()) + "</p></body></html>").toLocal8Bit());
tcpSocket->close();
if(lock){
return;
}
lock = true;
QMessageBox::question(NULL, "提示", "IP地址为“" + ipAddress + "”想要连接,是否连接?");
lock = false;
});
qDebug() << "a";
}

View File

@ -0,0 +1,20 @@
#ifndef GETIPSERVER_H
#define GETIPSERVER_H
#include <mainwindow.h>
#include <QTcpServer>
#include <QLabel>
class GetIPServer : public QMainWindow
{
public:
GetIPServer(QLabel *localIp);
void ConnectClient();
private:
bool lock;
QTcpServer *tcp;
QTcpSocket *tcpSocket;
};
#endif // GETIPSERVER_H

View File

@ -4,6 +4,8 @@
#include <QStringListModel>
#include <QStandardItem>
#include <QThread>
#include <QInputDialog>
#include <QFileDialog>
// 用于镜像信息获取
#include <QNetworkReply>
#include <QNetworkAccessManager>
@ -16,16 +18,21 @@
#include <QProgressDialog>
#include "downloadthread.h"
#include <QLoggingCategory>
// 用于执行命令
#include <QProcess>
// 用于 Mini HTTP 服务器搭建
#include <getipserver.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
// 获取网络镜像列表
QEventLoop loop;
QNetworkAccessManager manager;
QNetworkReply *reply = manager.get(QNetworkRequest(QUrl("http://127.0.0.1/list.json")));
QNetworkReply *reply = manager.get(QNetworkRequest(QUrl("http://120.25.153.144/AXVM/list.json")));
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
// 解析获取数据并显示
@ -35,6 +42,7 @@ MainWindow::MainWindow(QWidget *parent) :
QStringList nameList;
QStandardItemModel *nameListModel = new QStandardItemModel(this);
int size = name.size();
qDebug() << size;
for (int i = 0; i < size; ++i) {
QJsonValue value = name.at(i);
QJsonArray obj = value.toArray();
@ -44,6 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->urlImageList->setModel(nameListModel);
// 允许 qDebug() 输出
QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
GetIPServer *ip = new GetIPServer(ui->localIP);
}
MainWindow::~MainWindow()
@ -53,19 +62,88 @@ MainWindow::~MainWindow()
// 安装事件
void MainWindow::on_pushButton_2_clicked()
{
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
qDebug() << QSslSocket::supportsSsl();
qDebug() << QSslSocket::sslLibraryBuildVersionString();
qDebug() << QSslSocket::sslLibraryVersionString();
qDebug() << manager->supportedSchemes();
qDebug() << name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(1).toString();
downloadDialog = new QProgressDialog("文件下载", "文件下载", 0, 100, this);
downloadDialog->setWindowTitle("下载文件ing……");
if(ui->urlImageList->selectionModel()->currentIndex().row() == -1){ // 未选择任何选项
QMessageBox::information(this, "提示", "您未选择任何项");
return;
}
downloadDialog = new QProgressDialog("", "无用的按钮", 0, 100, this);
downloadDialog->setWindowTitle("正在下载“" + name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(0).toString() + "");
downloadDialog->show();
thread = new DownloadThread(downloadDialog, name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(1).toString(), "/tmp/1.exe");
if(name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(3).isArray()){
if(QMessageBox::question(this, "提示", "推荐您手动下载格式包,是否手动获取链接并下载?") == QMessageBox::Yes){
QJsonArray urlList = name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(3).toArray();
QString urlThings = "";
for(int i = 0; i < urlList.size(); i=i+2){
urlThings += urlList.at(i).toString() + "" + urlList.at(i + 1).toString();
}
QString choose = QInputDialog::getMultiLineText(this,
"" + name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(0).toString() + "”下载链接",
"请在下面任选一个链接复制到浏览器地址栏进行下载下载完成后按下“OK”按钮选择下载的 OVA 文件如果想要取消操作请按“Cancal”",
urlThings);
if(choose == ""){ // 忽略取消
downloadDialog->close();
delete downloadDialog;
return;
}
QString path = QFileDialog::getOpenFileName(this, "浏览 OVA 文件", "~", "OVA文件(*.ova);;全部文件(*.*)");
if(path == ""){ // 忽略取消
downloadDialog->close();
delete downloadDialog;
return;
}
thread = new DownloadThread(downloadDialog,
path,
name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(0).toString(),
name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(2).toString(),
true);
//connect(thread, &DownloadThread::MessageBoxInfo, this, [this](QString info){QMessageBox::information(this, "提示", info);});
//connect(thread, &DownloadThread::MessageBoxError, this, [this](QString info){QMessageBox::critical(this, "错误", info);});
/*connect(thread, &DownloadThread::MessageBoxOpenVM, this, [this](QString vmName){
if(QMessageBox::question(this, "提示", "安装成功!是否现在马上启动虚拟机?") == QMessageBox::Yes){
QProcess process;
QStringList command;
command << "startvm" << vmName;
process.start("VBoxManage", command);
process.waitForFinished();
qDebug() << process.readAllStandardError();
qDebug() << process.readAllStandardOutput();
}});*/
thread->start();
return;
}
}
thread = new DownloadThread(downloadDialog,
name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(1).toString(),
name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(0).toString(),
name.at(ui->urlImageList->selectionModel()->currentIndex().row()).toArray().at(2).toString(),
false);
//connect(thread, &DownloadThread::MessageBoxInfo, this, &MainWindow::MessageBoxInfo);
//connect(thread, &DownloadThread::MessageBoxError, this, &MainWindow::MessageBoxError);
//connect(thread, &DownloadThread::MessageBoxOpenVM, this, &MainWindow::OpenVM);
thread->start();
}
void MainWindow::ChangeValue(){
//downloadDialog->setValue(thread->value);
void DownloadThread::MessageBoxInfo(QString info){
QMessageBox::information(NULL, "提示", info);
}
void DownloadThread::MessageBoxError(QString info){
QMessageBox::critical(NULL, "错误", info);
}
void DownloadThread::MessageBoxOpenVM(QString vmName)
{
if(QMessageBox::question(NULL, "提示", "安装成功!是否现在马上启动虚拟机?") == QMessageBox::Yes){
QProcess process;
QStringList command;
command << "startvm" << vmName;
process.start("VBoxManage", command);
process.waitForFinished();
qDebug() << process.readAllStandardError();
qDebug() << process.readAllStandardOutput();
}
}
void MainWindow::on_centralWidget_destroyed()
{
}

View File

@ -22,7 +22,11 @@ public:
private slots:
void on_pushButton_2_clicked();
void ChangeValue();
//void OpenVM(QString vmName);
//void MessageBoxInfo(QString info);
//void MessageBoxError(QString info);
void on_centralWidget_destroyed();
private:
Ui::MainWindow *ui;

View File

@ -21,7 +21,7 @@
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
@ -31,12 +31,34 @@
<string>操作</string>
</attribute>
<layout class="QGridLayout" name="gridLayout" columnstretch="0">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
<string>选择虚拟机:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
@ -47,7 +69,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>TextLabel</string>
<string>IP地址</string>
</property>
</widget>
</item>
@ -57,13 +79,111 @@
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>PushButton</string>
<string>连接</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_11">
<property name="text">
<string>重置虚拟机</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string>开启虚拟机</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_10">
<property name="text">
<string>设置虚拟机</string>
</property>
</widget>
</item>
<item row="0" column="5">
<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 row="0" column="1">
<widget class="QPushButton" name="pushButton_9">
<property name="text">
<string>关闭虚拟机</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_12">
<property name="text">
<string>重置虚拟机配置</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>安装/卸载应用:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_6">
<property name="text">
<string>安装</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>浏览</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>卸载</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="localIP">
<property name="text">
<string>访问http://127.0.0.1:30201 连接</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -142,6 +262,13 @@
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>©2022~Nowgfdgd xi、为什么您不喜欢熊出没和阿布呢</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>

View File

@ -54,10 +54,12 @@ OBJECTS_DIR = ./
SOURCES = ../AXVM/main.cpp \
../AXVM/mainwindow.cpp \
../AXVM/downloadthread.cpp moc_mainwindow.cpp
../AXVM/downloadthread.cpp \
../AXVM/getipserver.cpp moc_mainwindow.cpp
OBJECTS = main.o \
mainwindow.o \
downloadthread.o \
getipserver.o \
moc_mainwindow.o
DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
@ -166,9 +168,11 @@ DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
../AXVM/AXVM.pro ../AXVM/mainwindow.h \
../AXVM/downloadthread.h ../AXVM/main.cpp \
../AXVM/downloadthread.h \
../AXVM/getipserver.h ../AXVM/main.cpp \
../AXVM/mainwindow.cpp \
../AXVM/downloadthread.cpp
../AXVM/downloadthread.cpp \
../AXVM/getipserver.cpp
QMAKE_TARGET = AXVM
DESTDIR =
TARGET = AXVM
@ -410,8 +414,8 @@ distdir: FORCE
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/
$(COPY_FILE) --parents ../AXVM/mainwindow.h ../AXVM/downloadthread.h $(DISTDIR)/
$(COPY_FILE) --parents ../AXVM/main.cpp ../AXVM/mainwindow.cpp ../AXVM/downloadthread.cpp $(DISTDIR)/
$(COPY_FILE) --parents ../AXVM/mainwindow.h ../AXVM/downloadthread.h ../AXVM/getipserver.h $(DISTDIR)/
$(COPY_FILE) --parents ../AXVM/main.cpp ../AXVM/mainwindow.cpp ../AXVM/downloadthread.cpp ../AXVM/getipserver.cpp $(DISTDIR)/
$(COPY_FILE) --parents ../AXVM/mainwindow.ui $(DISTDIR)/
@ -486,6 +490,11 @@ mainwindow.o: ../AXVM/mainwindow.cpp ../AXVM/mainwindow.h \
downloadthread.o: ../AXVM/downloadthread.cpp ../AXVM/downloadthread.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o downloadthread.o ../AXVM/downloadthread.cpp
getipserver.o: ../AXVM/getipserver.cpp ../AXVM/getipserver.h \
../AXVM/mainwindow.h \
../AXVM/downloadthread.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o getipserver.o ../AXVM/getipserver.cpp
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp

Binary file not shown.

View File

@ -23,7 +23,7 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_MainWindow_t {
QByteArrayData data[4];
char stringdata0[48];
char stringdata0[63];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
@ -35,11 +35,11 @@ static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
QT_MOC_LITERAL(1, 11, 23), // "on_pushButton_2_clicked"
QT_MOC_LITERAL(2, 35, 0), // ""
QT_MOC_LITERAL(3, 36, 11) // "ChangeValue"
QT_MOC_LITERAL(3, 36, 26) // "on_centralWidget_destroyed"
},
"MainWindow\0on_pushButton_2_clicked\0\0"
"ChangeValue"
"on_centralWidget_destroyed"
};
#undef QT_MOC_LITERAL
@ -74,7 +74,7 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
(void)_t;
switch (_id) {
case 0: _t->on_pushButton_2_clicked(); break;
case 1: _t->ChangeValue(); break;
case 1: _t->on_centralWidget_destroyed(); break;
default: ;
}
}

View File

@ -11,6 +11,7 @@
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
@ -34,12 +35,29 @@ public:
QTabWidget *tabWidget;
QWidget *tab;
QGridLayout *gridLayout;
QHBoxLayout *horizontalLayout_2;
QLabel *label_2;
QHBoxLayout *horizontalLayout_5;
QLabel *label_3;
QComboBox *comboBox;
QPushButton *pushButton_7;
QHBoxLayout *horizontalLayout_3;
QLabel *label;
QLineEdit *lineEdit;
QPushButton *pushButton_3;
QGridLayout *gridLayout_2;
QPushButton *pushButton_11;
QPushButton *pushButton_8;
QPushButton *pushButton_10;
QSpacerItem *horizontalSpacer;
QPushButton *pushButton_9;
QPushButton *pushButton_12;
QHBoxLayout *horizontalLayout_4;
QLabel *label_2;
QLineEdit *lineEdit_2;
QPushButton *pushButton_6;
QPushButton *pushButton_5;
QPushButton *pushButton_4;
QHBoxLayout *horizontalLayout_2;
QLabel *localIP;
QSpacerItem *verticalSpacer;
QWidget *tab_2;
QHBoxLayout *horizontalLayout;
@ -51,6 +69,7 @@ public:
QSpacerItem *verticalSpacer_2;
QListView *urlImageList;
QWidget *tab_3;
QLabel *label_4;
QStatusBar *statusBar;
void setupUi(QMainWindow *MainWindow)
@ -74,16 +93,33 @@ public:
gridLayout->setSpacing(6);
gridLayout->setContentsMargins(11, 11, 11, 11);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->setSpacing(6);
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
label_2 = new QLabel(tab);
label_2->setObjectName(QString::fromUtf8("label_2"));
horizontalLayout_5 = new QHBoxLayout();
horizontalLayout_5->setSpacing(6);
horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5"));
label_3 = new QLabel(tab);
label_3->setObjectName(QString::fromUtf8("label_3"));
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(label_3->sizePolicy().hasHeightForWidth());
label_3->setSizePolicy(sizePolicy);
horizontalLayout_2->addWidget(label_2);
horizontalLayout_5->addWidget(label_3);
comboBox = new QComboBox(tab);
comboBox->setObjectName(QString::fromUtf8("comboBox"));
horizontalLayout_5->addWidget(comboBox);
pushButton_7 = new QPushButton(tab);
pushButton_7->setObjectName(QString::fromUtf8("pushButton_7"));
sizePolicy.setHeightForWidth(pushButton_7->sizePolicy().hasHeightForWidth());
pushButton_7->setSizePolicy(sizePolicy);
horizontalLayout_5->addWidget(pushButton_7);
gridLayout->addLayout(horizontalLayout_2, 1, 0, 1, 1);
gridLayout->addLayout(horizontalLayout_5, 3, 0, 1, 1);
horizontalLayout_3 = new QHBoxLayout();
horizontalLayout_3->setSpacing(6);
@ -106,9 +142,86 @@ public:
gridLayout->addLayout(horizontalLayout_3, 0, 0, 1, 1);
gridLayout_2 = new QGridLayout();
gridLayout_2->setSpacing(6);
gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
pushButton_11 = new QPushButton(tab);
pushButton_11->setObjectName(QString::fromUtf8("pushButton_11"));
gridLayout_2->addWidget(pushButton_11, 0, 4, 1, 1);
pushButton_8 = new QPushButton(tab);
pushButton_8->setObjectName(QString::fromUtf8("pushButton_8"));
gridLayout_2->addWidget(pushButton_8, 0, 0, 1, 1);
pushButton_10 = new QPushButton(tab);
pushButton_10->setObjectName(QString::fromUtf8("pushButton_10"));
gridLayout_2->addWidget(pushButton_10, 0, 2, 1, 1);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout_2->addItem(horizontalSpacer, 0, 5, 1, 1);
pushButton_9 = new QPushButton(tab);
pushButton_9->setObjectName(QString::fromUtf8("pushButton_9"));
gridLayout_2->addWidget(pushButton_9, 0, 1, 1, 1);
pushButton_12 = new QPushButton(tab);
pushButton_12->setObjectName(QString::fromUtf8("pushButton_12"));
gridLayout_2->addWidget(pushButton_12, 0, 3, 1, 1);
gridLayout->addLayout(gridLayout_2, 4, 0, 1, 1);
horizontalLayout_4 = new QHBoxLayout();
horizontalLayout_4->setSpacing(6);
horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
label_2 = new QLabel(tab);
label_2->setObjectName(QString::fromUtf8("label_2"));
horizontalLayout_4->addWidget(label_2);
lineEdit_2 = new QLineEdit(tab);
lineEdit_2->setObjectName(QString::fromUtf8("lineEdit_2"));
horizontalLayout_4->addWidget(lineEdit_2);
pushButton_6 = new QPushButton(tab);
pushButton_6->setObjectName(QString::fromUtf8("pushButton_6"));
horizontalLayout_4->addWidget(pushButton_6);
pushButton_5 = new QPushButton(tab);
pushButton_5->setObjectName(QString::fromUtf8("pushButton_5"));
horizontalLayout_4->addWidget(pushButton_5);
pushButton_4 = new QPushButton(tab);
pushButton_4->setObjectName(QString::fromUtf8("pushButton_4"));
horizontalLayout_4->addWidget(pushButton_4);
gridLayout->addLayout(horizontalLayout_4, 2, 0, 1, 1);
horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->setSpacing(6);
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
localIP = new QLabel(tab);
localIP->setObjectName(QString::fromUtf8("localIP"));
horizontalLayout_2->addWidget(localIP);
gridLayout->addLayout(horizontalLayout_2, 1, 0, 1, 1);
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
gridLayout->addItem(verticalSpacer, 2, 0, 1, 1);
gridLayout->addItem(verticalSpacer, 5, 0, 1, 1);
tabWidget->addTab(tab, QString());
tab_2 = new QWidget();
@ -158,6 +271,11 @@ public:
verticalLayout_2->addWidget(tabWidget);
label_4 = new QLabel(centralWidget);
label_4->setObjectName(QString::fromUtf8("label_4"));
verticalLayout_2->addWidget(label_4);
MainWindow->setCentralWidget(centralWidget);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
@ -165,7 +283,7 @@ public:
retranslateUi(MainWindow);
tabWidget->setCurrentIndex(1);
tabWidget->setCurrentIndex(0);
QMetaObject::connectSlotsByName(MainWindow);
@ -174,14 +292,26 @@ public:
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr));
label_2->setText(QCoreApplication::translate("MainWindow", "TextLabel", nullptr));
label->setText(QCoreApplication::translate("MainWindow", "TextLabel", nullptr));
pushButton_3->setText(QCoreApplication::translate("MainWindow", "PushButton", nullptr));
label_3->setText(QCoreApplication::translate("MainWindow", "\351\200\211\346\213\251\350\231\232\346\213\237\346\234\272\357\274\232", nullptr));
pushButton_7->setText(QCoreApplication::translate("MainWindow", "PushButton", nullptr));
label->setText(QCoreApplication::translate("MainWindow", "IP\345\234\260\345\235\200\357\274\232", nullptr));
pushButton_3->setText(QCoreApplication::translate("MainWindow", "\350\277\236\346\216\245", nullptr));
pushButton_11->setText(QCoreApplication::translate("MainWindow", "\351\207\215\347\275\256\350\231\232\346\213\237\346\234\272", nullptr));
pushButton_8->setText(QCoreApplication::translate("MainWindow", "\345\274\200\345\220\257\350\231\232\346\213\237\346\234\272", nullptr));
pushButton_10->setText(QCoreApplication::translate("MainWindow", "\350\256\276\347\275\256\350\231\232\346\213\237\346\234\272", nullptr));
pushButton_9->setText(QCoreApplication::translate("MainWindow", "\345\205\263\351\227\255\350\231\232\346\213\237\346\234\272", nullptr));
pushButton_12->setText(QCoreApplication::translate("MainWindow", "\351\207\215\347\275\256\350\231\232\346\213\237\346\234\272\351\205\215\347\275\256", nullptr));
label_2->setText(QCoreApplication::translate("MainWindow", "\345\256\211\350\243\205/\345\215\270\350\275\275\345\272\224\347\224\250\357\274\232", nullptr));
pushButton_6->setText(QCoreApplication::translate("MainWindow", "\345\256\211\350\243\205", nullptr));
pushButton_5->setText(QCoreApplication::translate("MainWindow", "\346\265\217\350\247\210", nullptr));
pushButton_4->setText(QCoreApplication::translate("MainWindow", "\345\215\270\350\275\275", nullptr));
localIP->setText(QCoreApplication::translate("MainWindow", "\350\256\277\351\227\256\357\274\232http://127.0.0.1:30201 \350\277\236\346\216\245", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab), QCoreApplication::translate("MainWindow", "\346\223\215\344\275\234", nullptr));
pushButton_2->setText(QCoreApplication::translate("MainWindow", "<<", nullptr));
pushButton->setText(QCoreApplication::translate("MainWindow", ">>", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab_2), QCoreApplication::translate("MainWindow", "\346\226\260\345\273\272\346\250\241\346\213\237\345\231\250", nullptr));
tabWidget->setTabText(tabWidget->indexOf(tab_3), QCoreApplication::translate("MainWindow", "\345\205\263\344\272\216", nullptr));
label_4->setText(QCoreApplication::translate("MainWindow", "\302\2512022~Now\357\274\214gfdgd xi\343\200\201\344\270\272\344\273\200\344\271\210\346\202\250\344\270\215\345\226\234\346\254\242\347\206\212\345\207\272\346\262\241\345\222\214\351\230\277\345\270\203\345\221\242", nullptr));
} // retranslateUi
};

View File

@ -1657,7 +1657,7 @@ def showhelp():
helpWidget.setLayout(helpLayout)
helpWindow.setCentralWidget(helpWidget)
helpWindow.setFixedSize(helpWindow.frameSize().width() * 0.9, helpWindow.frameSize().height() * 1.5)
helpWindow.setFixedSize(int(helpWindow.frameSize().width() * 0.9), int(helpWindow.frameSize().height() * 1.5))
helpWindow.setWindowTitle("帮助")
helpWindow.setWindowIcon(QtGui.QIcon(iconPath))
helpWindow.show()