mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-13 10:08:28 +08:00
41 lines
998 B
C++
41 lines
998 B
C++
|
#include "buildvbox.h"
|
||
|
#include <QFile>
|
||
|
#include <QNetworkInterface>
|
||
|
#include <QMessageBox>
|
||
|
using namespace std;
|
||
|
|
||
|
// 清屏
|
||
|
void buildvbox::CleanScreen(){
|
||
|
if(QFile::exists("/etc/os-version")){
|
||
|
// Unix
|
||
|
system("clear");
|
||
|
return;
|
||
|
}
|
||
|
// Windows
|
||
|
system("cls");
|
||
|
}
|
||
|
|
||
|
QString buildvbox::GetNet(){
|
||
|
QList<QNetworkInterface> netList = QNetworkInterface::allInterfaces();
|
||
|
foreach(QNetworkInterface net, netList){
|
||
|
qDebug() << "Device:" << net.name();
|
||
|
QList<QNetworkAddressEntry> entryList = net.addressEntries();
|
||
|
foreach(QNetworkAddressEntry entry, entryList){
|
||
|
QString ip = entry.ip().toString();
|
||
|
qDebug() << "IP Address: " << ip;
|
||
|
if(ip != "127.0.0.1" && ip != "192.168.250.1"){
|
||
|
// 返回网卡名称
|
||
|
return net.name();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return "";
|
||
|
}
|
||
|
|
||
|
buildvbox::buildvbox()
|
||
|
{
|
||
|
QString net = GetNet();
|
||
|
qDebug() << "使用网卡:" << net << endl;
|
||
|
|
||
|
}
|