diff --git a/Android X86/AXVM/AXVM.pro b/Android X86/AXVM/AXVM.pro index cc99588..9e018cf 100644 --- a/Android X86/AXVM/AXVM.pro +++ b/Android X86/AXVM/AXVM.pro @@ -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 diff --git a/Android X86/AXVM/build/Makefile b/Android X86/AXVM/build/Makefile index 7e307f6..d27328b 100644 --- a/Android X86/AXVM/build/Makefile +++ b/Android X86/AXVM/build/Makefile @@ -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 diff --git a/Android X86/AXVM/build/mainwindow.o b/Android X86/AXVM/build/mainwindow.o deleted file mode 100644 index 10ff719..0000000 Binary files a/Android X86/AXVM/build/mainwindow.o and /dev/null differ diff --git a/Android X86/AXVM/downloadthread.cpp b/Android X86/AXVM/downloadthread.cpp index 57942b5..c11d9dc 100644 --- a/Android X86/AXVM/downloadthread.cpp +++ b/Android X86/AXVM/downloadthread.cpp @@ -1,3 +1,4 @@ +#define SETTINGSTEP 6 #include "downloadthread.h" #include #include @@ -7,47 +8,77 @@ #include #include #include +#include +// 文件操作 +#include +// 命令执行 +#include +// 获取内存总量 +#if defined(Q_OS_LINUX) // 区分系统平台 +#include "sys/statfs.h" // Linux 上 +#else // Windows 上 +#pragma comment(lib, "Kernel32.lib") +#pragma comment(lib, "Psapi.lib") +#include +#include +#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; } diff --git a/Android X86/AXVM/downloadthread.h b/Android X86/AXVM/downloadthread.h index 5ab95cb..fbf60e1 100644 --- a/Android X86/AXVM/downloadthread.h +++ b/Android X86/AXVM/downloadthread.h @@ -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 diff --git a/Android X86/AXVM/getipserver.cpp b/Android X86/AXVM/getipserver.cpp new file mode 100644 index 0000000..f50f785 --- /dev/null +++ b/Android X86/AXVM/getipserver.cpp @@ -0,0 +1,44 @@ +#include "getipserver.h" +#include +#include +#include +#include +#include + +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("

IP Address: " + ipAddress + "

Get Port: " + QString::number(tcpSocket->peerPort()) + "

").toLocal8Bit()); + tcpSocket->close(); + if(lock){ + return; + } + lock = true; + QMessageBox::question(NULL, "提示", "IP地址为“" + ipAddress + "”想要连接,是否连接?"); + lock = false; + }); + qDebug() << "a"; +} diff --git a/Android X86/AXVM/getipserver.h b/Android X86/AXVM/getipserver.h new file mode 100644 index 0000000..e186df1 --- /dev/null +++ b/Android X86/AXVM/getipserver.h @@ -0,0 +1,20 @@ +#ifndef GETIPSERVER_H +#define GETIPSERVER_H + +#include +#include +#include + +class GetIPServer : public QMainWindow +{ +public: + GetIPServer(QLabel *localIp); + void ConnectClient(); + +private: + bool lock; + QTcpServer *tcp; + QTcpSocket *tcpSocket; +}; + +#endif // GETIPSERVER_H diff --git a/Android X86/AXVM/mainwindow.cpp b/Android X86/AXVM/mainwindow.cpp index 79e3765..5de91ae 100644 --- a/Android X86/AXVM/mainwindow.cpp +++ b/Android X86/AXVM/mainwindow.cpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include // 用于镜像信息获取 #include #include @@ -16,16 +18,21 @@ #include #include "downloadthread.h" #include +// 用于执行命令 +#include +// 用于 Mini HTTP 服务器搭建 +#include 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() +{ + } diff --git a/Android X86/AXVM/mainwindow.h b/Android X86/AXVM/mainwindow.h index 802e7b1..f7daebc 100644 --- a/Android X86/AXVM/mainwindow.h +++ b/Android X86/AXVM/mainwindow.h @@ -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; diff --git a/Android X86/AXVM/mainwindow.ui b/Android X86/AXVM/mainwindow.ui index dcff21d..a16904d 100644 --- a/Android X86/AXVM/mainwindow.ui +++ b/Android X86/AXVM/mainwindow.ui @@ -21,7 +21,7 @@ QTabWidget::West - 1 + 0 Qt::ElideNone @@ -31,12 +31,34 @@ 操作 - - + + - + + + + 0 + 0 + + - TextLabel + 选择虚拟机: + + + + + + + + + + + 0 + 0 + + + + PushButton @@ -47,7 +69,7 @@ - TextLabel + IP地址: @@ -57,13 +79,111 @@ - PushButton + 连接 + + + + + + + + + + + 重置虚拟机 + + + + + + + 开启虚拟机 + + + + + + + 设置虚拟机 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 关闭虚拟机 + + + + + + + 重置虚拟机配置 + + + + + 安装/卸载应用: + + + + + + + + + + 安装 + + + + + + + 浏览 + + + + + + + 卸载 + + + + + + + + + + + 访问:http://127.0.0.1:30201 连接 + + + + + + Qt::Vertical @@ -142,6 +262,13 @@ + + + + ©2022~Now,gfdgd xi、为什么您不喜欢熊出没和阿布呢 + + + diff --git a/Android X86/build-AXVM-unknown-Debug/AXVM b/Android X86/build-AXVM-unknown-Debug/AXVM index a4c2626..d7e8723 100755 Binary files a/Android X86/build-AXVM-unknown-Debug/AXVM and b/Android X86/build-AXVM-unknown-Debug/AXVM differ diff --git a/Android X86/build-AXVM-unknown-Debug/Makefile b/Android X86/build-AXVM-unknown-Debug/Makefile index e7dd525..69fc158 100644 --- a/Android X86/build-AXVM-unknown-Debug/Makefile +++ b/Android X86/build-AXVM-unknown-Debug/Makefile @@ -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 diff --git a/Android X86/build-AXVM-unknown-Debug/downloadthread.o b/Android X86/build-AXVM-unknown-Debug/downloadthread.o index 7dc8da8..a3b5613 100644 Binary files a/Android X86/build-AXVM-unknown-Debug/downloadthread.o and b/Android X86/build-AXVM-unknown-Debug/downloadthread.o differ diff --git a/Android X86/build-AXVM-unknown-Debug/getipserver.o b/Android X86/build-AXVM-unknown-Debug/getipserver.o new file mode 100644 index 0000000..f569b88 Binary files /dev/null and b/Android X86/build-AXVM-unknown-Debug/getipserver.o differ diff --git a/Android X86/build-AXVM-unknown-Debug/mainwindow.o b/Android X86/build-AXVM-unknown-Debug/mainwindow.o index d4f992f..38a2934 100644 Binary files a/Android X86/build-AXVM-unknown-Debug/mainwindow.o and b/Android X86/build-AXVM-unknown-Debug/mainwindow.o differ diff --git a/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.cpp b/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.cpp index 2d75e2a..ed450ee 100644 --- a/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.cpp +++ b/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.cpp @@ -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: ; } } diff --git a/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.o b/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.o index 119ffbd..c1ee54f 100644 Binary files a/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.o and b/Android X86/build-AXVM-unknown-Debug/moc_mainwindow.o differ diff --git a/Android X86/build-AXVM-unknown-Debug/ui_mainwindow.h b/Android X86/build-AXVM-unknown-Debug/ui_mainwindow.h index 450c179..63d3697 100644 --- a/Android X86/build-AXVM-unknown-Debug/ui_mainwindow.h +++ b/Android X86/build-AXVM-unknown-Debug/ui_mainwindow.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -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 }; diff --git a/mainwindow.py b/mainwindow.py index 4574f8d..b12bdca 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -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()