.h初步完善

This commit is contained in:
gfdgd xi 2023-02-19 14:09:18 +08:00
parent 107c886f3f
commit 558dc437a0
2 changed files with 107 additions and 2 deletions

View File

@ -7,3 +7,82 @@ vbox::vbox(QString name, QString managerPath) {
Command command = Command();
this->vboxVersion = Command().GetCommand("'" + managerPath + "' -v");
}
int vbox::Create(QString type){
return system(("\"" + managerPath + "\" createvm --name \""
+ name + "\" --ostype \"" + type +
"\" --register").toUtf8());
}
int vbox::CreateDisk(QString path, int size){
return system(("\"" + managerPath + "\" createvdi --filename \"" + path + "\" --size \"" + size + "\"").toUtf8());
}
int vbox::CreateDiskControl(QString controlName){
return system(("\"" + managerPath + "\" storagectl \"" + name + "\" --name \"" + controlName + "\" --add ide").toUtf8());
}
int vbox::MountDisk(QString diskPath, QString controlName, int port, int device){
return system(("\"" + managerPath + "\" storageattach \"" + name +
"\" --storagectl \"" + controlName + "\" --type hdd --port "
+ port + " --device " + device + " --medium \"" + diskPath + "\"").toUtf8());
}
int vbox::MountISO(QString isoPath, QString controlName, int port, int device){
return system(("\"" + managerPath + "\" storageattach \"" + name + "\" --storagectl \"" +
controlName + "\" --type dvddrive --port " + port + " --device " + device
+ " --medium \"{isoPath}\"").toUtf8());
}
int vbox::BootFirst(QString bootDrive){
//return os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --boot1 {bootDrive}")
}
int vbox::SetNetBridge(QString netDriver){
}
int vbox::SetCPU(int number){
}
int vbox::SetMemory(int memory){
}
int vbox::SetRemote(bool setting){
}
int vbox::SetRemoteConnectSetting(int port){
}
void vbox::Start(bool unShown){
}
int vbox::Stop(){
}
int vbox::Delete(){
}
int vbox::SetDisplayMemory(int memory){
}
int vbox::InstallGuessAdditions(QString controlName, int port, int device){
}
int vbox::EnabledAudio(){
}
int vbox::EnabledClipboardMode(){
}
int vbox::EnabledDraganddrop(){
}
int vbox::ShareFile(QString name, QString path){
}
int vbox::SetVBoxSVGA(){
}
int vbox::SetMousePS2(){
}
int vbox::SetKeyboardPS2(){
}
int vbox::OpenUSB(){
}

View File

@ -5,12 +5,38 @@
class vbox
{
public:
vbox(QString name, QString managerPath="VBoxManage");
private:
// 虚拟机信息
QString name;
QString managerPath;
QString vboxVersion;
vbox(QString name, QString managerPath="VBoxManage");
int Create(QString type="Windows7");
int CreateDisk(QString path, int size);
int CreateDiskControl(QString controlName="storage_controller_1");
int MountDisk(QString diskPath, QString controlName="storage_controller_1", int port=0, int device=0);
int MountISO(QString isoPath, QString controlName="storage_controller_1", int port=1, int device=0);
int BootFirst(QString bootDrive);
int SetNetBridge(QString netDriver);
int SetCPU(int number);
int SetMemory(int memory);
int SetRemote(bool setting);
int SetRemoteConnectSetting(int port=5540);
void Start(bool unShown=false);
int Stop();
int Delete();
int SetDisplayMemory(int memory);
int InstallGuessAdditions(QString controlName="storage_controller_1", int port=1, int device=0);
int EnabledAudio();
int EnabledClipboardMode();
int EnabledDraganddrop();
int ShareFile(QString name, QString path);
int SetVBoxSVGA();
int SetMousePS2();
int SetKeyboardPS2();
int OpenUSB();
private:
};
#endif // VBOX_H