mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 17:48:27 +08:00
新增架构检测
This commit is contained in:
parent
4632417414
commit
6b5c514760
Binary file not shown.
@ -37,6 +37,13 @@ QString buildvbox::GetNet(){
|
||||
}
|
||||
|
||||
buildvbox::buildvbox(QString isoPath, int id){
|
||||
/*QDir vboxPath(QDir::homePath() + "/VirtualBox VMs/Windows");
|
||||
if(vboxPath.exists()){
|
||||
qDebug("虚拟机存在,直接启动!");
|
||||
vbox vm("Windows");
|
||||
vm.Start();
|
||||
return;
|
||||
}*/
|
||||
QString programPath = QCoreApplication::applicationDirPath();
|
||||
QString net = GetNet();
|
||||
qDebug() << "使用网卡:" << net << endl;
|
||||
|
@ -2,6 +2,18 @@
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
|
||||
QString GetRunCommand(QString command){
|
||||
QProcess process;
|
||||
process.start(command);
|
||||
process.waitForStarted();
|
||||
process.waitForFinished();
|
||||
QString re = process.readAllStandardOutput();
|
||||
process.close();
|
||||
return re;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -11,6 +23,11 @@ int main(int argc, char *argv[])
|
||||
trans->load("virtualmachine-en_US.qm");
|
||||
|
||||
a.installTranslator(trans);
|
||||
// 判断是否为 !amd64
|
||||
if(GetRunCommand("arch").replace(" ", "").replace("\n", "") == QString("x86_64")){
|
||||
QMessageBox::critical(NULL, "错误", "此程序不支持非 X86 架构,立即退出");
|
||||
return 0;
|
||||
}
|
||||
MainWindow w;
|
||||
|
||||
w.show();
|
||||
|
BIN
VM-source/main.o
BIN
VM-source/main.o
Binary file not shown.
@ -21,8 +21,25 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->tabWidget->setTabPosition(QTabWidget::West); // 标签靠左
|
||||
// 允许输出 qDebug 信息
|
||||
QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
|
||||
// 判断是否安装 vbox
|
||||
if(system("which VBoxManage")){
|
||||
if(QMessageBox::question(NULL, "提示", "检测到您似乎没有安装 VirtualBox,立即安装?") == QMessageBox::Yes){
|
||||
system("xdg-open https://www.virtualbox.org/wiki/Linux_Downloads");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString MainWindow::GetRunCommand(QString command){
|
||||
QProcess process;
|
||||
process.start(command);
|
||||
process.waitForStarted();
|
||||
process.waitForFinished();
|
||||
QString re = process.readAllStandardOutput();
|
||||
process.close();
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void on_browser_clicked();
|
||||
|
||||
QString GetRunCommand(QString command);
|
||||
void on_install_clicked();
|
||||
|
||||
private:
|
||||
|
Binary file not shown.
@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
struct qt_meta_stringdata_MainWindow_t {
|
||||
QByteArrayData data[4];
|
||||
char stringdata0[50];
|
||||
QByteArrayData data[6];
|
||||
char stringdata0[72];
|
||||
};
|
||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||
@ -35,11 +35,13 @@ static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
|
||||
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
|
||||
QT_MOC_LITERAL(1, 11, 18), // "on_browser_clicked"
|
||||
QT_MOC_LITERAL(2, 30, 0), // ""
|
||||
QT_MOC_LITERAL(3, 31, 18) // "on_install_clicked"
|
||||
QT_MOC_LITERAL(3, 31, 13), // "GetRunCommand"
|
||||
QT_MOC_LITERAL(4, 45, 7), // "command"
|
||||
QT_MOC_LITERAL(5, 53, 18) // "on_install_clicked"
|
||||
|
||||
},
|
||||
"MainWindow\0on_browser_clicked\0\0"
|
||||
"on_install_clicked"
|
||||
"GetRunCommand\0command\0on_install_clicked"
|
||||
};
|
||||
#undef QT_MOC_LITERAL
|
||||
|
||||
@ -49,7 +51,7 @@ static const uint qt_meta_data_MainWindow[] = {
|
||||
8, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
2, 14, // methods
|
||||
3, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
@ -57,11 +59,13 @@ static const uint qt_meta_data_MainWindow[] = {
|
||||
0, // signalCount
|
||||
|
||||
// slots: name, argc, parameters, tag, flags
|
||||
1, 0, 24, 2, 0x08 /* Private */,
|
||||
3, 0, 25, 2, 0x08 /* Private */,
|
||||
1, 0, 29, 2, 0x08 /* Private */,
|
||||
3, 1, 30, 2, 0x08 /* Private */,
|
||||
5, 0, 33, 2, 0x08 /* Private */,
|
||||
|
||||
// slots: parameters
|
||||
QMetaType::Void,
|
||||
QMetaType::QString, QMetaType::QString, 4,
|
||||
QMetaType::Void,
|
||||
|
||||
0 // eod
|
||||
@ -74,11 +78,12 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
|
||||
(void)_t;
|
||||
switch (_id) {
|
||||
case 0: _t->on_browser_clicked(); break;
|
||||
case 1: _t->on_install_clicked(); break;
|
||||
case 1: { QString _r = _t->GetRunCommand((*reinterpret_cast< QString(*)>(_a[1])));
|
||||
if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = std::move(_r); } break;
|
||||
case 2: _t->on_install_clicked(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
(void)_a;
|
||||
}
|
||||
|
||||
QT_INIT_METAOBJECT const QMetaObject MainWindow::staticMetaObject = { {
|
||||
@ -110,13 +115,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 2)
|
||||
if (_id < 3)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 2;
|
||||
_id -= 3;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
if (_id < 2)
|
||||
if (_id < 3)
|
||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||
_id -= 2;
|
||||
_id -= 3;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
Binary file not shown.
@ -41,7 +41,6 @@ int vbox::SetCPU(int number){
|
||||
return system(("\"" + managerPath + "\" modifyvm \"" + name + "\" --cpus " + QString::number(number)).toLatin1());
|
||||
}
|
||||
int vbox::SetMemory(int memory){
|
||||
QMessageBox::information(NULL, "", ("\"" + managerPath + "\" modifyvm \"" + name + "\" --memory " + QString::number(memory)).toLatin1());
|
||||
return system(("\"" + managerPath + "\" modifyvm \"" + name + "\" --memory " + QString::number(memory)).toLatin1());
|
||||
}
|
||||
int vbox::SetRemote(bool setting){
|
||||
|
BIN
VM-source/vbox.o
BIN
VM-source/vbox.o
Binary file not shown.
Loading…
Reference in New Issue
Block a user