bool Advanced_Settings_Window::Save_Emulators_Info() { // FIXME save only if emulators changed // Check defaults emulators bool installed_kvm, installed_qemu, default_kvm, default_qemu; installed_kvm = installed_qemu = default_kvm = default_qemu = false; for( int ix = 0; ix < Emulators.count(); ++ix ) { if( Emulators[ix].Get_Type() == VM::QEMU ) { installed_qemu = true; if( Emulators[ix].Get_Default() ) default_qemu = true; } else if( Emulators[ix].Get_Type() == VM::KVM ) { installed_kvm = true; if( Emulators[ix].Get_Default() ) default_kvm = true; } } if( installed_qemu && default_qemu == false ) { AQGraphic_Warning( tr("Error!"), tr("Default QEMU Emulator isn't selected!") ); return false; } if( installed_kvm && default_kvm == false ) { AQGraphic_Warning( tr("Error!"), tr("Default KVM Emulator isn't selected!") ); return false; } // Remove old emulators files if( ! Remove_All_Emulators_Files() ) { AQWarning( "bool Advanced_Settings_Window::Save_Emulators_Info()", "Not all old emulators files removed!" ); } // Save new files for( int ix = 0; ix < Emulators.count(); ++ix ) { if( ! Emulators[ ix ].Save() ) { AQGraphic_Warning( tr("Error!"), tr("Cannot save emulator \"%1\"!").arg(Emulators[ix].Get_Name()) ); } } return true; }
void Emulator_Options_Window::done(int r) { if ( r == QDialog::Accepted ) { // Find all Emulators Names if( ui.Edit_Name->text().isEmpty() ) { AQGraphic_Warning( tr("Error!"), tr("Enulator Name is Empty!") ); return; } if( ! Name_Valid(ui.Edit_Name->text()) ) { AQGraphic_Warning( tr("Error!"), tr("This emulator name is already used!") ); return; } // Name Current_Emulator.Set_Name( ui.Edit_Name->text() ); // Path Current_Emulator.Set_Path( ui.Edit_Path_to_Dir->text() ); // Save Binary List QMap<QString, QString> bin_files; for( int ix = 0; ix < ui.Table_Systems->rowCount(); ix++ ) { bin_files[ ui.Table_Systems->item(ix, 0)->text() ] = ui.Table_Systems->item(ix, 1)->text(); } Current_Emulator.Set_Binary_Files( bin_files ); // Check version if( ui.RB_Check_Version->isChecked() ) Current_Emulator.Set_Check_Version( true ); else Current_Emulator.Set_Check_Version( false ); // Check available options if( ui.RB_Check_Options->isChecked() ) Current_Emulator.Set_Check_Available_Options( true ); else Current_Emulator.Set_Check_Available_Options( false ); // Force version if( ui.RB_Force_Version->isChecked() ) Current_Emulator.Set_Force_Version( true ); else Current_Emulator.Set_Force_Version( false ); // Version Current_Emulator.Set_Version( String_To_Emulator_Version(ui.CB_Version->currentText()) ); // Update emulator? Update_Emulator(); } QDialog::done(r); }
void Convert_HDD_Image_Window::on_Button_Convert_clicked() { if( ui.Edit_Output_File_Name->text().isEmpty() ) { AQGraphic_Warning( tr("File Name is Empty!"), tr("Please Enter Correct HDD Image filename!") ); return; } if( ! Valid_Info ) { AQGraphic_Warning( tr("Error!"), tr("Cannot get a valid format for current HDD image!") ); return; } QStringList args; args << "convert"; // compressed if( ui.CH_Compressed->isEnabled() && ui.CH_Compressed->isChecked() ) args << "-c"; // encrypted if( ui.CH_Encrypted->isEnabled() && ui.CH_Encrypted->isChecked() ) args << "-e"; args << "-f" << HDD_Info->Get_Disk_Info().Disk_Format; // Input format args << ui.Edit_Base_File_Name->text(); // In file name args << "-O" << ui.CB_Output_Format->currentText(); // Output format args << ui.Edit_Output_File_Name->text(); // Output File name connect( &Conv_Thread, SIGNAL(Conversion_Complete(bool)), this, SLOT(Conversion_Done(bool)) ); Conv_Thread.Set_Args( args ); Conv_Thread.start(); ProgDial = new QProgressDialog( tr("Please Wait. Converting HDD Image..."), tr("Cancel"), 0, 0, this ); connect( ProgDial, SIGNAL(canceled()), this, SLOT(Cancel_Convertion()) ); ProgDial->setWindowModality( Qt::WindowModal ); ProgDial->setValue( 0 ); ProgDial->exec(); }
void Advanced_Settings_Window::Load_Templates() { QList<QString> all_templates = Get_Templates_List(); ui.CB_Default_VM_Template->clear(); for( int ix = 0; ix < all_templates.count(); ++ix ) { QFileInfo tmp_info = QFileInfo( all_templates[ix] ); ui.CB_Default_VM_Template->addItem( tmp_info.completeBaseName() ); } // no items found if( ui.CB_Default_VM_Template->count() < 1 ) { AQGraphic_Warning( tr("Warning"), tr("AQEMU VM Templates Not Found!") ); } else { // Find default template for( int ix = 0; ix < ui.CB_Default_VM_Template->count(); ++ix ) { if( ui.CB_Default_VM_Template->itemText(ix) == Settings.value("Default_VM_Template", "Linux 2.6").toString() ) { ui.CB_Default_VM_Template->setCurrentIndex( ix ); } } } }
void Emulator_Options_Window::Update_Emulator() { if( Update_Info ) { if( ui.RB_Save_Options->isChecked() || // Update emulator bin files info? ui.RB_Check_Options->isChecked() ) { QMap<QString, Available_Devices> devList; for( int ix = 0; ix < ui.Table_Systems->rowCount(); ix++ ) { if( ! QFile::exists(ui.Table_Systems->item(ix, 1)->text()) ) continue; bool ok = false; Available_Devices tmpDev = System_Info::Get_Emulator_Info( ui.Table_Systems->item(ix, 1)->text(), &ok, Current_Emulator.Get_Version(), ui.Table_Systems->item(ix, 0)->text() ); if( ok ) devList[ ui.Table_Systems->item(ix, 0)->text() ] = tmpDev; else AQGraphic_Warning( tr("Error!"), tr("Cannot get emulator info! For file: %1").arg(ui.Table_Systems->item(ix, 1)->text()) ); } Current_Emulator.Set_Devices( devList ); } else if( ui.RB_Check_Version->isChecked() ) // Update version { VM::Emulator_Version emul_version = VM::Obsolete; for( int ix = 0; ix < ui.Table_Systems->rowCount(); ix++ ) { if( QFile::exists(ui.Table_Systems->item(ix, 1)->text()) ) emul_version = System_Info::Get_Emulator_Version( ui.Table_Systems->item(ix, 1)->text() ); else continue; if( emul_version != VM::Obsolete ) break; } if( emul_version == VM::Obsolete ) AQGraphic_Warning( tr("Error!"), tr("Cannot get version for emulator!") ); else Current_Emulator.Set_Version( emul_version ); } } }
void Emulator_Options_Window::on_Button_Find_clicked() { if( ui.Edit_Path_to_Dir->text().isEmpty() ) { AQGraphic_Warning( tr("Error!"), tr("Path is Empty!") ); return; } QDir dir = QDir( ui.Edit_Path_to_Dir->text() ); if( ! dir.exists() ) { AQGraphic_Warning( tr("Warning"), tr("Path doesn't exist!") ); return; } // Set Type and Bin files QMap<QString, QString> list; list = System_Info::Find_QEMU_Binary_Files( ui.Edit_Path_to_Dir->text() ); // Clear old bin files ui.Table_Systems->clearContents(); while( ui.Table_Systems->rowCount() > 0 ) ui.Table_Systems->removeRow( 0 ); // Add bin files to Table_Systems QMap<QString, QString>::const_iterator iter = list.constBegin(); while( iter != list.constEnd() ) { ui.Table_Systems->insertRow( ui.Table_Systems->rowCount() ); QTableWidgetItem *newItem = new QTableWidgetItem( iter.key() ); ui.Table_Systems->setItem( ui.Table_Systems->rowCount()-1, 0, newItem ); newItem = new QTableWidgetItem( QDir::toNativeSeparators(iter.value()) ); ui.Table_Systems->setItem( ui.Table_Systems->rowCount()-1, 1, newItem ); ++iter; // next value } // Update emulator info Update_Info = true; Update_Emulator(); Update_Info = false; }
void VM_Wizard_Window::on_CB_RAM_Size_editTextChanged( const QString &text ) { if( text.isEmpty() ) return; QRegExp rx( "\\s*([\\d]+)\\s*(MB|GB|M|G|)\\s*" ); // like: 512MB or 512 if( ! rx.exactMatch(text.toUpper()) ) { AQGraphic_Warning( tr("Error"), tr("Cannot convert \"%1\" to memory size!").arg(text) ); return; } QStringList ramStrings = rx.capturedTexts(); if( ramStrings.count() != 3 ) { AQGraphic_Warning( tr("Error"), tr("Cannot convert \"%1\" to memory size!").arg(text) ); return; } bool ok = false; int value = ramStrings[1].toInt( &ok, 10 ); if( ! ok ) { AQGraphic_Warning( tr("Error"), tr("Cannot convert \"%1\" to integer!").arg(ramStrings[1]) ); return; } if( ramStrings[2] == "MB" || ramStrings[2] == "M" ); // Size in megabytes else if( ramStrings[2] == "GB" || ramStrings[2] == "G" ) value *= 1024; else { AQGraphic_Warning( tr("Error"), tr("Cannot convert \"%1\" to size suffix! Valid suffixes: MB, GB").arg(ramStrings[2]) ); return; } if( value <= 0 ) { AQGraphic_Warning( tr("Error"), tr("Memory size < 0! Valid size is 1 or more") ); return; } on_TB_Update_Available_RAM_Size_clicked(); if( (value > ui.Memory_Size->maximum()) && (ui.CH_Remove_RAM_Size_Limitation->isChecked() == false) ) { AQGraphic_Warning( tr("Error"), tr("Your memory size %1 MB > %2 MB - all free RAM on this system!\n" "To setup this value, check \"Remove limitation on maximum amount of memory\".") .arg(value).arg(ui.Memory_Size->maximum()) ); on_Memory_Size_valueChanged( ui.Memory_Size->value() ); // Set valid size return; } // All OK. Set memory size ui.Memory_Size->setValue( value ); }
void Properties_Window::on_Button_OK_clicked() { if( ui.GB_Floppy->isEnabled() ) { if( ! QFile::exists(ui.CB_FD_Devices->lineEdit()->text()) ) { AQGraphic_Warning( tr("Warning"), tr("Image file doesn't exist!") ); } else { Add_To_Recent_FDD_Files( ui.CB_FD_Devices->lineEdit()->text() ); accept(); } } else if( ui.GB_CDROM->isEnabled() ) { if( ! QFile::exists(ui.CB_CDROM_Devices->lineEdit()->text()) ) { AQGraphic_Warning( tr("Warning"), tr("Image file doesn't exist!") ); } else { Add_To_Recent_CD_Files( ui.CB_CDROM_Devices->lineEdit()->text() ); accept(); } } else if( ui.GB_HDD->isEnabled() ) { if( ! QFile::exists(ui.Edit_HDD_Image_Path->text()) ) AQGraphic_Warning( tr("Warning"), tr("Image file doesn't exist!") ); else accept(); } else { AQError( "void Properties_Window::on_Button_OK_clicked()", "Default Section!" ); } }
void Emulator_Control_Window::on_actionUSB_Update_Device_List_triggered() { // Get New USB Host List QList<VM_USB> tmp_list = System_Info::Get_All_Host_USB(); if( tmp_list.isEmpty() ) { AQGraphic_Warning( tr("Error!"), tr("Cannot Get USB Information From System!") ); return; } QList<VM_USB> used_list = System_Info::Get_Used_USB_List(); // Delete all used USB devices for( int ax = 0; ax < tmp_list.count(); ax++ ) { for( int bx = 0; bx < used_list.count(); bx++ ) { if( tmp_list[ax] == used_list[bx] ) { tmp_list.removeAt( ax ); ax--; break; } } } QList<QAction*> ac_list = ui.menuUSB_Connect->actions(); // Delete Previous Menu (is avirable) if( ac_list.count() > 1 ) { ui.menuUSB_Connect->clear(); ui.menuUSB_Connect->addAction( ui.actionUSB_Update_Device_List ); ui.menuUSB_Connect->addSeparator(); } // Add items for( int ix = 0; ix < tmp_list.count(); ++ix ) { QAction *new_act = new QAction( tmp_list[ix].Get_Product_Name(), ui.menuUSB_Connect ); new_act->setData( tmp_list[ix].Get_ID_Line() ); connect( new_act, SIGNAL(triggered()), this, SLOT(Add_USB_To_VM()) ); ui.menuUSB_Connect->addAction( new_act ); } }
void Copy_VM_Window::on_Button_OK_clicked() { for( int ix = 0; ix < All_Machine_Names.count(); ++ix ) { if( All_Machine_Names[ix] == ui.Edit_New_VM_Name->text() ) { AQGraphic_Warning( tr("Error!"), tr("This VM Name is Already Used!") ); return; } } // OK, New Name Unuque accept(); }
void Convert_HDD_Image_Window::Conversion_Done( bool ok ) { if( ok ) { ProgDial->accept(); Conv_Thread.terminate(); QMessageBox::information( this, tr("Information:"), tr("Conversion completed sucessfuly!") ); accept(); } else { ProgDial->accept(); Conv_Thread.terminate(); AQGraphic_Warning( tr("Error!"), tr("Cannot convert image!\nDetails:\n%1").arg(Conv_Thread.Get_Error_Message()) ); } }
void VM_Wizard_Window::Update_RAM_Size_ComboBox( int freeRAM ) { static int oldRamSize = 0; if( freeRAM == oldRamSize ) return; else oldRamSize = freeRAM; QStringList ramSizes; ramSizes << "32 MB" << "64 MB" << "128 MB" << "256 MB" << "512 MB" << "1 GB" << "2 GB" << "3 GB" << "4 GB" << "8 GB" << "16 GB" << "32 GB"; int maxRamIndex = 0; if( freeRAM >= 32768 ) maxRamIndex = 12; else if( freeRAM >= 16384 ) maxRamIndex = 11; else if( freeRAM >= 8192 ) maxRamIndex = 10; else if( freeRAM >= 4096 ) maxRamIndex = 9; else if( freeRAM >= 3072 ) maxRamIndex = 8; else if( freeRAM >= 2048 ) maxRamIndex = 7; else if( freeRAM >= 1024 ) maxRamIndex = 6; else if( freeRAM >= 512 ) maxRamIndex = 5; else if( freeRAM >= 256 ) maxRamIndex = 4; else if( freeRAM >= 128 ) maxRamIndex = 3; else if( freeRAM >= 64 ) maxRamIndex = 2; else if( freeRAM >= 32 ) maxRamIndex = 1; else { AQGraphic_Warning( tr("Error"), tr("Free memory on this system is lower than 32 MB!") ); return; } if( maxRamIndex > ramSizes.count() ) { AQError( "void VM_Wizard_Window::Update_RAM_Size_ComboBox( int freeRAM )", "maxRamIndex > ramSizes.count()" ); return; } QString oldText = ui.CB_RAM_Size->currentText(); ui.CB_RAM_Size->clear(); for( int ix = 0; ix < maxRamIndex; ix++ ) ui.CB_RAM_Size->addItem( ramSizes[ix] ); ui.CB_RAM_Size->setEditText( oldText ); }
void Convert_HDD_Image_Window::on_Button_Browse_Base_clicked() { QString fileName = QFileDialog::getOpenFileName( this, tr("Select Base HDD Image File"), Get_Last_Dir_Path(ui.Edit_Base_File_Name->text()), tr("All Files (*);;Images Files (*.img *.qcow *.qcow2 *.wmdk)") ); if( fileName.isEmpty() ) return; fileName = QDir::toNativeSeparators( fileName ); ui.Edit_Base_File_Name->setText( fileName ); if( ! QFile::exists(fileName) ) { AQGraphic_Warning( tr("Error!"), tr("Cannot Locate Input File!") ); return; } // Get info about image HDD_Info->Update_Disk_Info( fileName ); }
void VM_Wizard_Window::on_CH_Remove_RAM_Size_Limitation_stateChanged( int state ) { if( state == Qt::Checked ) { ui.Memory_Size->setMaximum( 32768 ); ui.Label_Available_Free_Memory->setText( "32 GB" ); Update_RAM_Size_ComboBox( 32768 ); } else { int allRAM = 0, freeRAM = 0; System_Info::Get_Free_Memory_Size( allRAM, freeRAM ); if( allRAM < ui.Memory_Size->value() ) AQGraphic_Warning( tr("Error"), tr("Current memory size bigger than all existing host memory!\nUsing maximum available size.") ); ui.Memory_Size->setMaximum( allRAM ); ui.Label_Available_Free_Memory->setText( QString("%1 MB").arg(allRAM) ); Update_RAM_Size_ComboBox( allRAM ); } }
void Select_Icon_Window::on_Button_OK_clicked() { // Check values if( ui.RB_Icon_Other->isChecked() ) { New_Icon_Path = ":/images/other.png"; accept(); } else if( ui.RB_Icon_Windows->isChecked() ) { New_Icon_Path = ":/images/default_windows.png"; accept(); } else if( ui.RB_Icon_Linux->isChecked() ) { New_Icon_Path = ":/images/default_linux.png"; accept(); } else if( ui.RB_All_System_Icons->isChecked() ) { if( ui.All_Icons_List->currentItem() != NULL ) { New_Icon_Path = ui.All_Icons_List->currentItem()->data( 128 ).toString(); accept(); } } else if( ui.RB_User_Icons->isChecked() ) { if( QFile::exists(ui.Edit_Other_Icon_Path->text()) ) { New_Icon_Path = ui.Edit_Other_Icon_Path->text(); accept(); } else { AQGraphic_Warning( tr("Error!"), tr("Icon file doesn't exist!") ); } } }
void Emulator_Control_Window::on_actionSave_Screenshot_triggered() { if( Settings.value("Use_Screenshots_Folder", "no").toString() == "yes" ) { if( ! Settings.value("Screenshot_Folder_Path", "").toString().isEmpty() ) { // create unique file name QString unic_name = QUuid::createUuid(); unic_name = unic_name.mid( 25, 12 ); // save screenshot Cur_VM->Take_Screenshot( Settings.value("Screenshot_Folder_Path", "").toString() + unic_name + "." + Settings.value( "Screenshot_Save_Format", "PNG" ).toString() ); } } else { AQGraphic_Warning( "Warning!", "Shared Screenshots Folder Not Enabled!\nPlease Enter Name for New Screenshot." ); on_actionSave_Screenshot_As_triggered(); } }
void Advanced_Settings_Window::on_Button_OK_clicked() { // Execute Before Start QEMU Settings.setValue( "Run_Before_QEMU", ui.Edit_Before_Start_Command->text() ); // Execute After Stop QEMU Settings.setValue( "Run_After_QEMU", ui.Edit_After_Stop_Command->text() ); // Use Shared Folder For All Screenshots if( ui.CH_Screenshot_Folder->isChecked() ) { Settings.setValue( "Use_Screenshots_Folder", "yes" ); QDir dir; // For Check on valid // Screenshots Shared Folder Path if( dir.exists(ui.Edit_Screenshot_Folder->text()) ) { Settings.setValue( "Screenshot_Folder_Path", ui.Edit_Screenshot_Folder->text() ); } else { AQGraphic_Warning( tr("Invalid Value!"), tr("Shared screenshot folder doesn't exist!") ); return; } } else { Settings.setValue( "Use_Screenshots_Folder", "no" ); // Screenshots Shared Folder Path Settings.setValue( "Screenshot_Folder_Path", ui.Edit_Screenshot_Folder->text() ); } // Screenshot save format if( ui.RB_Format_PNG->isChecked() ) Settings.setValue( "Screenshot_Save_Format", "PNG" ); else if( ui.RB_Format_Jpeg->isChecked() ) Settings.setValue( "Screenshot_Save_Format", "JPEG" ); else Settings.setValue( "Screenshot_Save_Format", "PPM" ); // Jpeg Quality Settings.setValue( "Jpeg_Quality", QString::number(ui.HS_Jpeg_Quality->value()) ); // Additional CDROM int old_count = Settings.value( "Additional_CDROM_Devices/Count", "0" ).toString().toInt(); if( old_count > ui.CDROM_List->count() ) { // Delete Old Items for( int dx = ui.CDROM_List->count()-1; dx < old_count; dx++ ) { Settings.remove( "Additional_CDROM_Devices/Device" + QString::number(dx) ); } } Settings.setValue( "Additional_CDROM_Devices/Count", QString::number(ui.CDROM_List->count()) ); for( int ix = 0; ix < ui.CDROM_List->count(); ix++ ) { Settings.setValue( "Additional_CDROM_Devices/Device" + QString::number(ix), ui.CDROM_List->item(ix)->text() ); } Settings.setValue( "Info/Show_Tab_Info", ui.CH_Show_Tab_Info->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_QEMU_Args", ui.CH_Show_QEMU_Args->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_Screenshot_in_Save_Mode", ui.CH_Show_Screenshot_in_Save_Mode->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Details", ui.CH_Machine_Details->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Name", ui.CH_Machine_Name->isChecked() ? "no" : "no" ); Settings.setValue( "Info/Emulator_Type", ui.CH_Emulator_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Emulator_Version", ui.CH_Emulator_Version->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Computer_Type", ui.CH_Computer_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Type", ui.CH_Machine_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Boot_Priority", ui.CH_Boot_Priority->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/CPU_Type", ui.CH_CPU_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Number_of_CPU", ui.CH_Number_of_CPU->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Video_Card", ui.CH_Video_Card->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Keyboard_Layout", ui.CH_Keyboard_Layout->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Memory_Size", ui.CH_Memory_Size->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Use_Sound", ui.CH_Use_Sound->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Fullscreen", ui.CH_Fullscreen->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Snapshot", ui.CH_Snapshot->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Localtime", ui.CH_Localtime->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_FDD", ui.CH_Show_FDD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_CD", ui.CH_Show_CD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_HDD", ui.CH_Show_HDD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Network_Cards", ui.CH_Network_Cards->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Redirections", ui.CH_Redirections->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Serial_Port", ui.CH_Serial_Port->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Parallel_Port", ui.CH_Parallel_Port->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/USB_Port", ui.CH_USB_Port->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Win2K_Hack", ui.CH_Win2K_Hack->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/RTC_TD_Hack", ui.CH_RTC_TD_Hack->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/No_Shutdown", ui.CH_No_Shutdown->isChecked()? "yes" : "no" ); Settings.setValue( "Info/No_Reboot", ui.CH_No_Reboot->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Start_CPU", ui.CH_Start_CPU->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Check_Boot_on_FDD", ui.CH_Check_Boot_on_FDD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/ACPI", ui.CH_ACPI->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Start_Date", ui.CH_Start_Date->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/No_Frame", ui.CH_No_Frame->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Alt_Grab", ui.CH_Alt_Grab->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/No_Quit", ui.CH_No_Quit->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Portrait", ui.CH_Portrait->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Curses", ui.CH_Curses->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_Cursor", ui.CH_Show_Cursor->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Init_Graphical_Mode", ui.CH_Init_Graphical_Mode->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/ROM_File", ui.CH_ROM_File->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/MTDBlock", ui.CH_MTDBlock->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/SD_Image", ui.CH_SD_Image->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/PFlash", ui.CH_PFlash->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Linux_Boot", ui.CH_Linux_Boot->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Acceleration", ui.CH_Acceleration->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/VNC", ui.CH_VNC->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/SPICE", ui.CH_SPICE->isChecked() ? "yes" : "no" ); // MAC Address Generation Mode if( ui.RB_MAC_Random->isChecked() ) Settings.setValue( "MAC_Generation_Mode", "Random" ); else if( ui.RB_MAC_QEMU->isChecked() ) Settings.setValue( "MAC_Generation_Mode", "QEMU_Segment" ); else if( ui.RB_MAC_Valid->isChecked() ) Settings.setValue( "MAC_Generation_Mode", "Model" ); // Save to Log File if( ui.CH_Log_Save_in_File->isChecked() ) Settings.setValue( "Log/Save_In_File", "yes" ); else Settings.setValue( "Log/Save_In_File", "no" ); // Print In StdOut if( ui.CH_Log_Print_in_STDIO->isChecked() ) Settings.setValue( "Log/Print_In_STDOUT", "yes" ); else Settings.setValue( "Log/Print_In_STDOUT", "no" ); // Log File Path Settings.setValue( "Log/Log_Path", ui.Edit_Log_Path->text() ); // Save to AQEMU Log if( ui.CH_Log_Debug->isChecked() ) Settings.setValue( "Log/Save_Debug", "yes" ); else Settings.setValue( "Log/Save_Debug", "no" ); if( ui.CH_Log_Warning->isChecked() ) Settings.setValue( "Log/Save_Warning", "yes" ); else Settings.setValue( "Log/Save_Warning", "no" ); if( ui.CH_Log_Error->isChecked() ) Settings.setValue( "Log/Save_Error", "yes" ); else Settings.setValue( "Log/Save_Error", "no" ); // QEMU-IMG Path Settings.setValue( "QEMU-IMG_Path", ui.Edit_QEMU_IMG_Path->text() ); // QEMU_AUDIO if( ui.CH_Audio_Default->isChecked() ) Settings.setValue( "QEMU_AUDIO/Use_Default_Driver", "no" ); else Settings.setValue( "QEMU_AUDIO/Use_Default_Driver", "yes" ); // QEMU_AUDIO_DRV Settings.setValue( "QEMU_AUDIO/QEMU_AUDIO_DRV", ui.CB_Host_Sound_System->currentText() ); // Recent CD Count Settings.setValue( "CD_ROM_Exits_Images/Max", QString::number(ui.SB_Recent_CD_Count->value()) ); // Recent FDD Count Settings.setValue( "Floppy_Exits_Images/Max", QString::number(ui.SB_Recent_FDD_Count->value()) ); // First VNC Port for Embedded Display Settings.setValue( "First_VNC_Port", QString::number(ui.SB_First_VNC_Port->value()) ); // QEMU/KVM Monitor Type #ifdef Q_OS_WIN32 Settings.setValue( "Emulator_Monitor_Type", "tcp" ); #else Settings.setValue( "Emulator_Monitor_Type", ui.RB_Monitor_TCP->isChecked() ? "tcp" : "stdio" ); #endif Settings.setValue( "Emulator_Monitor_Hostname", ui.CB_Monitor_Hostname->currentText() ); Settings.setValue( "Emulator_Monitor_Port", ui.SB_Monitor_Port->value() ); // All OK? if( Settings.status() != QSettings::NoError ) AQError( "void Advanced_Settings_Window::on_Button_OK_clicked()", "QSettings Error!" ); if( Save_Emulators_Info() ) accept(); }
void Add_New_Device_Window::on_Button_OK_clicked() { // Interface switch( ui.CB_Interface->currentIndex() ) { case 0: Device.Set_Interface( VM::DI_IDE ); break; case 1: Device.Set_Interface( VM::DI_SCSI ); break; case 2: Device.Set_Interface( VM::DI_SD ); break; case 3: Device.Set_Interface( VM::DI_MTD ); break; case 4: Device.Set_Interface( VM::DI_Floppy ); break; case 5: Device.Set_Interface( VM::DI_PFlash ); break; case 6: Device.Set_Interface( VM::DI_Virtio ); break; default: AQError( "void Add_New_Device_Window::on_Button_OK_clicked()", "Invalid Interface Index! Use IDE" ); Device.Set_Interface( VM::DI_IDE ); break; } Device.Use_Interface( ui.CH_Interface->isChecked() ); // Media switch( ui.CB_Media->currentIndex() ) { case 0: Device.Set_Media( VM::DM_Disk ); break; case 1: Device.Set_Media( VM::DM_CD_ROM ); break; default: AQError( "void Add_New_Device_Window::on_Button_OK_clicked()", "Invalid Media Index! Use Disk" ); Device.Set_Media( VM::DM_Disk ); break; } Device.Use_Media( ui.CH_Media->isChecked() ); // File Path if( ui.CH_File->isChecked() ) { if( ! QFile::exists(ui.Edit_File_Path->text()) ) { AQGraphic_Warning( tr("Error!"), tr("File does not exist!") ); return; } } Device.Use_File_Path( ui.CH_File->isChecked() ); Device.Set_File_Path( ui.Edit_File_Path->text() ); // Index Device.Use_Index( ui.CH_Index->isChecked() ); Device.Set_Index( ui.SB_Index->value() ); // Bus, Unit Device.Use_Bus_Unit( ui.CH_Bus_Unit->isChecked() ); Device.Set_Bus( ui.SB_Bus->value() ); Device.Set_Unit( ui.SB_Unit->value() ); // Snapshot Device.Use_Snapshot( ui.CH_Snapshot->isChecked() ); Device.Set_Snapshot( (ui.CB_Snapshot->currentIndex() == 0) ? true : false ); // Cache Device.Use_Cache( ui.CH_Cache->isChecked() ); Device.Set_Cache( ui.CB_Cache->currentText() ); // AIO Device.Use_AIO( ui.CH_AIO->isChecked() ); Device.Set_AIO( ui.CB_AIO->currentText() ); // Boot Device.Use_Boot( ui.CH_Boot->isChecked() ); Device.Set_Boot( (ui.CB_Boot->currentIndex() == 0) ? true : false ); // hdachs if( ui.GB_hdachs_Settings->isChecked() ) { bool ok; qulonglong cyls = ui.Edit_Cyls->text().toULongLong( &ok, 10 ); if( ! ok ) { AQGraphic_Warning( tr("Warning!"), tr("\"Cyls\" value is incorrect!") ); return; } qulonglong heads = ui.Edit_Heads->text().toULongLong( &ok, 10 ); if( ! ok ) { AQGraphic_Warning( tr("Warning!"), tr("\"Heads\" value is incorrect!") ); return; } qulonglong secs = ui.Edit_Secs->text().toULongLong( &ok, 10) ; if( ! ok ) { AQGraphic_Warning( tr("Warning!"), tr("\"Secs\" value is incorrect!") ); return; } qulonglong trans = ui.Edit_Trans->text().toULongLong( &ok, 10 ); if( ! ok ) { AQGraphic_Warning( tr("Warning!"), tr("\"Trans\" value is incorrect!") ); return; } Device.Use_hdachs( ui.GB_hdachs_Settings->isChecked() ); Device.Set_Cyls( cyls ); Device.Set_Heads( heads ); Device.Set_Secs( secs ); Device.Set_Trans( trans ); } accept(); }
void Advanced_Settings_Window::done(int r) { if ( r == QDialog::Accepted ) { // Execute Before Start QEMU Settings.setValue( "Run_Before_QEMU", ui.Edit_Before_Start_Command->text() ); // Execute After Stop QEMU Settings.setValue( "Run_After_QEMU", ui.Edit_After_Stop_Command->text() ); // Use Shared Folder For All Screenshots if( ui.CH_Screenshot_Folder->isChecked() ) { Settings.setValue( "Use_Screenshots_Folder", "yes" ); QDir dir; // For Check on valid // Screenshots Shared Folder Path if( dir.exists(ui.Edit_Screenshot_Folder->text()) ) { Settings.setValue( "Screenshot_Folder_Path", ui.Edit_Screenshot_Folder->text() ); } else { AQGraphic_Warning( tr("Invalid Value!"), tr("Shared screenshot folder doesn't exist!") ); return; } } else { Settings.setValue( "Use_Screenshots_Folder", "no" ); // Screenshots Shared Folder Path Settings.setValue( "Screenshot_Folder_Path", ui.Edit_Screenshot_Folder->text() ); } // Screenshot save format if( ui.RB_Format_PNG->isChecked() ) Settings.setValue( "Screenshot_Save_Format", "PNG" ); else if( ui.RB_Format_Jpeg->isChecked() ) Settings.setValue( "Screenshot_Save_Format", "JPEG" ); else Settings.setValue( "Screenshot_Save_Format", "PPM" ); // Jpeg Quality Settings.setValue( "Jpeg_Quality", QString::number(ui.HS_Jpeg_Quality->value()) ); // Additional CDROM int old_count = Settings.value( "Additional_CDROM_Devices/Count", "0" ).toString().toInt(); if( old_count > ui.CDROM_List->count() ) { // Delete Old Items for( int dx = ui.CDROM_List->count()-1; dx < old_count; dx++ ) { Settings.remove( "Additional_CDROM_Devices/Device" + QString::number(dx) ); } } Settings.setValue( "Additional_CDROM_Devices/Count", QString::number(ui.CDROM_List->count()) ); for( int ix = 0; ix < ui.CDROM_List->count(); ix++ ) { Settings.setValue( "Additional_CDROM_Devices/Device" + QString::number(ix), ui.CDROM_List->item(ix)->text() ); } // Settings.setValue( "Info/Show_Tab_Info", ui.CH_Show_Tab_Info->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_QEMU_Args", ui.CH_Show_QEMU_Args->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_Screenshot_in_Save_Mode", ui.CH_Show_Screenshot_in_Save_Mode->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Details", ui.CH_Machine_Details->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Name", ui.CH_Machine_Name->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Accelerator", ui.CH_Machine_Accelerator->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Computer_Type", ui.CH_Computer_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Machine_Type", ui.CH_Machine_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Boot_Priority", ui.CH_Boot_Priority->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/CPU_Type", ui.CH_CPU_Type->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Number_of_CPU", ui.CH_Number_of_CPU->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Video_Card", ui.CH_Video_Card->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Keyboard_Layout", ui.CH_Keyboard_Layout->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Memory_Size", ui.CH_Memory_Size->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Use_Sound", ui.CH_Use_Sound->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Fullscreen", ui.CH_Fullscreen->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Snapshot", ui.CH_Snapshot->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Localtime", ui.CH_Localtime->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_FDD", ui.CH_Show_FDD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_CD", ui.CH_Show_CD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_HDD", ui.CH_Show_HDD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Network_Cards", ui.CH_Network_Cards->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Redirections", ui.CH_Redirections->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Serial_Port", ui.CH_Serial_Port->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Parallel_Port", ui.CH_Parallel_Port->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/USB_Port", ui.CH_USB_Port->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Win2K_Hack", ui.CH_Win2K_Hack->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/RTC_TD_Hack", ui.CH_RTC_TD_Hack->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/No_Shutdown", ui.CH_No_Shutdown->isChecked()? "yes" : "no" ); Settings.setValue( "Info/No_Reboot", ui.CH_No_Reboot->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Start_CPU", ui.CH_Start_CPU->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Check_Boot_on_FDD", ui.CH_Check_Boot_on_FDD->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/ACPI", ui.CH_ACPI->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Start_Date", ui.CH_Start_Date->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/No_Frame", ui.CH_No_Frame->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Alt_Grab", ui.CH_Alt_Grab->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/No_Quit", ui.CH_No_Quit->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Portrait", ui.CH_Portrait->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Curses", ui.CH_Curses->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Show_Cursor", ui.CH_Show_Cursor->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Init_Graphical_Mode", ui.CH_Init_Graphical_Mode->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/ROM_File", ui.CH_ROM_File->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/MTDBlock", ui.CH_MTDBlock->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/SD_Image", ui.CH_SD_Image->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/PFlash", ui.CH_PFlash->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/Linux_Boot", ui.CH_Linux_Boot->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/VNC", ui.CH_VNC->isChecked() ? "yes" : "no" ); Settings.setValue( "Info/SPICE", ui.CH_SPICE->isChecked() ? "yes" : "no" ); // MAC Address Generation Mode if( ui.RB_MAC_Random->isChecked() ) Settings.setValue( "MAC_Generation_Mode", "Random" ); else if( ui.RB_MAC_QEMU->isChecked() ) Settings.setValue( "MAC_Generation_Mode", "QEMU_Segment" ); else if( ui.RB_MAC_Valid->isChecked() ) Settings.setValue( "MAC_Generation_Mode", "Model" ); // Save to Log File if( ui.CH_Log_Save_in_File->isChecked() ) Settings.setValue( "Log/Save_In_File", "yes" ); else Settings.setValue( "Log/Save_In_File", "no" ); // Print In StdOut if( ui.CH_Log_Print_in_STDIO->isChecked() ) Settings.setValue( "Log/Print_In_STDOUT", "yes" ); else Settings.setValue( "Log/Print_In_STDOUT", "no" ); // Log File Path Settings.setValue( "Log/Log_Path", ui.Edit_Log_Path->text() ); // Save to AQEMU Log if( ui.CH_Log_Debug->isChecked() ) Settings.setValue( "Log/Save_Debug", "yes" ); else Settings.setValue( "Log/Save_Debug", "no" ); if( ui.CH_Log_Warning->isChecked() ) Settings.setValue( "Log/Save_Warning", "yes" ); else Settings.setValue( "Log/Save_Warning", "no" ); if( ui.CH_Log_Error->isChecked() ) Settings.setValue( "Log/Save_Error", "yes" ); else Settings.setValue( "Log/Save_Error", "no" ); // QEMU-IMG Path Settings.setValue( "QEMU-IMG_Path", ui.Edit_QEMU_IMG_Path->text() ); // QEMU_AUDIO if( ui.CH_Audio_Default->isChecked() ) Settings.setValue( "QEMU_AUDIO/Use_Default_Driver", "no" ); else Settings.setValue( "QEMU_AUDIO/Use_Default_Driver", "yes" ); // QEMU_AUDIO_DRV Settings.setValue( "QEMU_AUDIO/QEMU_AUDIO_DRV", ui.CB_Host_Sound_System->currentText() ); // First VNC Port for Embedded Display Settings.setValue( "First_VNC_Port", QString::number(ui.SB_First_VNC_Port->value()) ); // QEMU Monitor Type #ifdef Q_OS_WIN32 Settings.setValue( "Emulator_Monitor_Type", "tcp" ); #else Settings.setValue( "Emulator_Monitor_Type", ui.RB_Monitor_TCP->isChecked() ? "tcp" : "stdio" ); #endif Settings.setValue( "Emulator_Monitor_Hostname", ui.CB_Monitor_Hostname->currentText() ); Settings.setValue( "Emulator_Monitor_Port", ui.SB_Monitor_Port->value() ); // USB if( ui.RB_USB_Style_device->isChecked() ) Settings.setValue( "USB_Style", "device" ); else Settings.setValue( "USB_Style", "usbdevice" ); if( ui.RB_USB_ID_BusAddr->isChecked() ) Settings.setValue( "USB_ID_Style", "BusAddr" ); else if( ui.RB_USB_ID_BusPath->isChecked() ) Settings.setValue( "USB_ID_Style", "BusPath" ); else if( ui.RB_USB_ID_VendorProduct->isChecked() ) Settings.setValue( "USB_ID_Style", "VendorProduct" ); // All OK? if( Settings.status() != QSettings::NoError ) AQError( "void Advanced_Settings_Window::done(int)", "QSettings Error!" ); QDir dir; // For Check on valid Settings.setValue( "Default_VM_Template", ui.CB_Default_VM_Template->currentText() ); ui.Edit_VM_Folder->setText( QDir::toNativeSeparators(ui.Edit_VM_Folder->text()) ); // VM Folder if( ! (ui.Edit_VM_Folder->text().endsWith("/") || ui.Edit_VM_Folder->text().endsWith("\\")) ) ui.Edit_VM_Folder->setText( ui.Edit_VM_Folder->text() + QDir::toNativeSeparators("/") ); if( dir.exists(ui.Edit_VM_Folder->text()) ) { if( ! dir.exists(ui.Edit_VM_Folder->text() + QDir::toNativeSeparators("/os_templates/")) ) dir.mkdir( ui.Edit_VM_Folder->text() + QDir::toNativeSeparators("/os_templates/") ); Settings.setValue( "VM_Directory", ui.Edit_VM_Folder->text() ); } else { int mes_res = QMessageBox::question( this, tr("Invalid Value!"), tr("AQEMU VM folder doesn't exist! Do you want to create it?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes ); if( mes_res == QMessageBox::Yes ) { if( ! (dir.mkdir(ui.Edit_VM_Folder->text()) && dir.mkdir(ui.Edit_VM_Folder->text() + QDir::toNativeSeparators("/os_templates/"))) ) { AQGraphic_Warning( tr("Error!"), tr("Cannot Create New Folder!") ); return; } else Settings.setValue( "VM_Directory", ui.Edit_VM_Folder->text() ); } else return; } // Use New Emulator Control Removable Device Menu if( ui.CH_Use_New_Device_Changer->isChecked() ) Settings.setValue( "Use_New_Device_Changer", "yes" ); else Settings.setValue( "Use_New_Device_Changer", "no" ); // Interface Language if( ui.CB_Language->currentIndex() == 0 ) Settings.setValue( "Language", "en" ); else Settings.setValue( "Language", ui.CB_Language->itemText(ui.CB_Language->currentIndex()) ); // VM Icons Size switch( ui.CB_VM_Icons_Size->currentIndex() ) { case 0: Settings.setValue( "VM_Icons_Size", 16 ); break; case 1: Settings.setValue( "VM_Icons_Size", 24 ); break; case 2: Settings.setValue( "VM_Icons_Size", 32 ); break; case 3: Settings.setValue( "VM_Icons_Size", 48 ); break; case 4: Settings.setValue( "VM_Icons_Size", 64 ); break; default: Settings.setValue( "VM_Icons_Size", 48 ); break; } /* // USB Support if( ui.CH_Use_USB->isChecked() ) Settings.setValue( "Use_USB", "yes" ); else Settings.setValue( "Use_USB", "no" ); */ // Screenshot for OS Logo if( ui.CH_Screenshot_for_OS_Logo->isChecked() ) Settings.setValue( "Use_Screenshot_for_OS_Logo", "yes" ); else Settings.setValue( "Use_Screenshot_for_OS_Logo", "no" ); /* // 64x64 Icons if( ui.CH_64_Icons->isChecked() ) Settings.setValue( "64x64_Icons", "yes" ); else Settings.setValue( "64x64_Icons", "no" );*/ Settings.sync(); if( Settings.status() != QSettings::NoError ) { AQError( "void Settings_Window::on_Button_Box_clicked( QAbstractButton* button )", "QSettings Error!" ); } // Emulator Control if( ui.RB_Emul_Show_Window->isChecked() ) { Settings.setValue( "Show_Emulator_Control_Window", "yes" ); Settings.setValue( "Use_VNC_Display", "no" ); Settings.setValue( "Include_Emulator_Control", "no" ); } else if( ui.RB_Emul_Show_VNC->isChecked() ) { Settings.setValue( "Show_Emulator_Control_Window", "yes" ); Settings.setValue( "Use_VNC_Display", "yes" ); Settings.setValue( "Include_Emulator_Control", "no" ); } else if( ui.RB_Emul_Show_In_Main_Window->isChecked() ) { Settings.setValue( "Show_Emulator_Control_Window", "yes" ); Settings.setValue( "Use_VNC_Display", "no" ); Settings.setValue( "Include_Emulator_Control", "yes" ); } else if( ui.RB_Emul_Show_VNC_In_Main_Window->isChecked() ) { Settings.setValue( "Show_Emulator_Control_Window", "yes" ); Settings.setValue( "Use_VNC_Display", "yes" ); Settings.setValue( "Include_Emulator_Control", "yes" ); } else if( ui.RB_Emul_No_Show->isChecked() ) { Settings.setValue( "Show_Emulator_Control_Window", "no" ); Settings.setValue( "Use_VNC_Display", "no" ); Settings.setValue( "Include_Emulator_Control", "no" ); } } QDialog::done(r); }
void VM_Wizard_Window::on_Button_Next_clicked() { if( ui.Welcome_Page == ui.Wizard_Pages->currentWidget() ) { ui.Wizard_Pages->setCurrentWidget( ui.Wizard_Mode_Page ); ui.Button_Back->setEnabled( true ); ui.Label_Page->setText( tr("Wizard Mode") ); } else if( ui.Wizard_Mode_Page == ui.Wizard_Pages->currentWidget() ) { bool q = ! Get_Default_Emulator( VM::QEMU ).Get_Name().isEmpty(); // FIXME what it? bool k = ! Get_Default_Emulator( VM::KVM ).Get_Name().isEmpty(); if( q && k ) { Use_Emulator_Type_Page = true; ui.Wizard_Pages->setCurrentWidget( ui.Emulator_Type_Page ); ui.RB_Emulator_KVM->setChecked( true ); ui.Label_Page->setText( tr("Emulator Type") ); } else { if( q ) { ui.RB_Emulator_QEMU->setChecked( true ); Current_Emulator = Get_Default_Emulator( VM::QEMU ); } else if( k ) { ui.RB_Emulator_KVM->setChecked( true ); Current_Emulator = Get_Default_Emulator( VM::KVM ); } else { AQGraphic_Warning( tr("Error!"), tr("Please Add One Or More Emulators in Advanced Settings!") ); return; } // All Find Systems All_Systems = Current_Emulator.Get_Devices(); if( All_Systems.isEmpty() ) { AQError( "void VM_Wizard_Window::on_Button_Next_clicked()", "Cannot get devices!" ); return; } // Comp types ui.CB_Computer_Type->clear(); ui.CB_Computer_Type->addItem( tr("No Selected") ); for( QMap<QString, Available_Devices>::const_iterator it = All_Systems.constBegin(); it != All_Systems.constEnd(); it++ ) ui.CB_Computer_Type->addItem( it.value().System.Caption ); Use_Emulator_Type_Page = false; ui.Wizard_Pages->setCurrentWidget( ui.Template_Page ); on_RB_VM_Template_toggled( ui.RB_VM_Template->isChecked() ); ui.Label_Page->setText( tr("Template For VM") ); } } else if( ui.Emulator_Type_Page == ui.Wizard_Pages->currentWidget() ) { if( ui.RB_Emulator_QEMU->isChecked() ) Current_Emulator = Get_Default_Emulator( VM::QEMU ); else if( ui.RB_Emulator_KVM->isChecked() ) Current_Emulator = Get_Default_Emulator( VM::KVM ); else { AQError( "void VM_Wizard_Window::on_Button_Next_clicked()", "Emulator Type Not Set!" ); return; } // All Find Systems FIXME ^^^ All_Systems = Current_Emulator.Get_Devices(); if( All_Systems.isEmpty() ) { AQError( "void VM_Wizard_Window::on_Button_Next_clicked()", "Cannot get devices!" ); return; } // Comp types ui.CB_Computer_Type->clear(); ui.CB_Computer_Type->addItem( tr("No Selected") ); for( QMap<QString, Available_Devices>::const_iterator it = All_Systems.constBegin(); it != All_Systems.constEnd(); it++ ) ui.CB_Computer_Type->addItem( it.value().System.Caption ); ui.Wizard_Pages->setCurrentWidget( ui.Template_Page ); on_RB_VM_Template_toggled( ui.RB_VM_Template->isChecked() ); ui.Label_Page->setText( tr("Template For VM") ); } else if( ui.Template_Page == ui.Wizard_Pages->currentWidget() ) { // Use Selected Template if( ui.RB_VM_Template->isChecked() ) { if( ! New_VM->Load_VM(OS_Templates_List[ui.CB_OS_Type->currentIndex()-1].filePath()) ) { AQGraphic_Error( "void VM_Wizard_Window::Create_New_VM()", tr("Error!"), tr("Cannot Create New VM from Template!") ); return; } } // Emulator New_VM->Set_Emulator( Current_Emulator ); // Find CPU List For This Template bool devices_finded = false; if( ui.RB_Emulator_KVM->isChecked() ) { New_VM->Set_Computer_Type( "qemu-kvm" ); if( New_VM->Get_Audio_Cards().Audio_es1370 ) { VM::Sound_Cards tmp_audio = New_VM->Get_Audio_Cards(); tmp_audio.Audio_es1370 = false; tmp_audio.Audio_AC97 = true; New_VM->Set_Audio_Cards( tmp_audio ); } Current_Devices = &All_Systems[ "qemu-kvm" ]; devices_finded = true; } else { Current_Devices = &All_Systems[ New_VM->Get_Computer_Type() ]; if( ! Current_Devices->System.QEMU_Name.isEmpty() ) devices_finded = true; } // Use Selected Template if( ui.RB_VM_Template->isChecked() ) { // Name ui.Edit_VM_Name->setText( New_VM->Get_Machine_Name() ); // Memory ui.Memory_Size->setValue( New_VM->Get_Memory_Size() ); // HDA double hda_size = New_VM->Get_HDA().Get_Virtual_Size_in_GB(); if( hda_size != 0.0 ) { ui.SB_HDD_Size->setValue( hda_size ); } else { ui.SB_HDD_Size->setValue( 10.0 ); } // Network ui.RB_User_Mode_Network->setChecked( New_VM->Get_Use_Network() ); // Find CPU List For This Template Current_Devices = &All_Systems[ New_VM->Get_Computer_Type() ]; if( ! Current_Devices->System.QEMU_Name.isEmpty() ) devices_finded = true; } else // Create New VM in Date Mode { // Select Memory Size, and HDD Size switch( ui.CB_Relese_Date->currentIndex() ) { case 0: AQError( "void VM_Wizard_Window::Create_New_VM()", "Relese Date Not Selected!" ); ui.Memory_Size->setValue( 512 ); break; case 1: // 1985-1990 ui.Memory_Size->setValue( 16 ); ui.SB_HDD_Size->setValue( 1.0 ); break; case 2: // 1990-1995 ui.Memory_Size->setValue( 64 ); ui.SB_HDD_Size->setValue( 2.0 ); break; case 3: // 1995-2000 ui.Memory_Size->setValue( 256 ); ui.SB_HDD_Size->setValue( 10.0 ); break; case 4: // 2000-2005 ui.Memory_Size->setValue( 512 ); ui.SB_HDD_Size->setValue( 20.0 ); break; case 5: // 2005-2010 ui.Memory_Size->setValue( 1024 ); ui.SB_HDD_Size->setValue( 40.0 ); break; default: AQError( "void VM_Wizard_Window::Create_New_VM()", "Relese Date Default Section!" ); ui.Memory_Size->setValue( 512 ); break; } // Find CPU List For This Template QString compCaption = ui.CB_Computer_Type->currentText(); for( QMap<QString, Available_Devices>::const_iterator it = All_Systems.constBegin(); it != All_Systems.constEnd(); it++ ) { if( it.value().System.Caption == compCaption ) { Current_Devices = &it.value(); if( ! Current_Devices->System.QEMU_Name.isEmpty() ) devices_finded = true; } } } if( ! devices_finded ) { AQGraphic_Error( "void VM_Wizard_Window::on_Button_Next_clicked()", tr("Error!"), tr("Cannot Find Emulator System ID!") ); } else { // Add CPU's ui.CB_CPU_Type->clear(); for( int cx = 0; cx < Current_Devices->CPU_List.count(); ++cx ) ui.CB_CPU_Type->addItem( Current_Devices->CPU_List[cx].Caption ); } // Typical or custom mode if( ui.RB_Typical->isChecked() ) { ui.Label_Page->setText( tr("Virtual Machine Name") ); on_Edit_VM_Name_textEdited( ui.Edit_VM_Name->text() ); ui.Label_Caption_CPU_Type->setVisible( false ); ui.Line_CPU_Type->setVisible( false ); ui.Label_CPU_Type->setVisible( false ); ui.CB_CPU_Type->setVisible( false ); } else { ui.Label_Page->setText( tr("VM Name and CPU Type") ); on_Edit_VM_Name_textEdited( ui.Edit_VM_Name->text() ); ui.Label_Caption_CPU_Type->setVisible( true ); ui.Line_CPU_Type->setVisible( true ); ui.Label_CPU_Type->setVisible( true ); ui.CB_CPU_Type->setVisible( true ); } // Next tab ui.Wizard_Pages->setCurrentWidget( ui.General_Settings_Page ); } else if( ui.General_Settings_Page == ui.Wizard_Pages->currentWidget() ) { for( int vx = 0; vx < VM_List->count(); ++vx ) { if( VM_List->at(vx)->Get_Machine_Name() == ui.Edit_VM_Name->text() ) { AQGraphic_Warning( tr("Warning"), tr("This VM Name is Already Exists!") ); return; } } if( ui.RB_Typical->isChecked() ) { ui.Wizard_Pages->setCurrentWidget( ui.Typical_HDD_Page ); ui.Label_Page->setText( tr("Hard Disk Size") ); } else { ui.Wizard_Pages->setCurrentWidget( ui.Memory_Page ); ui.Label_Page->setText( tr("Memory") ); } } else if( ui.Memory_Page == ui.Wizard_Pages->currentWidget() ) { on_CH_Remove_RAM_Size_Limitation_stateChanged( Qt::Unchecked ); // It for update max avairable RAM size ui.Wizard_Pages->setCurrentWidget( ui.Custom_HDD_Page ); ui.Label_Page->setText( tr("Virtual Hard Disk") ); } else if( ui.Typical_HDD_Page == ui.Wizard_Pages->currentWidget() ) { ui.Wizard_Pages->setCurrentWidget( ui.Network_Page ); ui.Label_Page->setText( tr("Network") ); } else if( ui.Custom_HDD_Page == ui.Wizard_Pages->currentWidget() ) { ui.Wizard_Pages->setCurrentWidget( ui.Network_Page ); ui.Label_Page->setText( tr("Network") ); } else if( ui.Network_Page == ui.Wizard_Pages->currentWidget() ) { ui.Wizard_Pages->setCurrentWidget( ui.Finish_Page ); ui.Button_Next->setText( tr("&Finish") ); ui.Label_Page->setText( tr("Finish!") ); } else if( ui.Finish_Page == ui.Wizard_Pages->currentWidget() ) { if( Create_New_VM() ) accept(); } else { AQError( "void VM_Wizard_Window::on_Button_Next_clicked()", "Default Section!" ); } }
const VM_SPICE &SPICE_Settings_Widget::Get_Settings( bool &settingsValidated ) const { static VM_SPICE spiceSettings; spiceSettings.Use_SPICE( ui.CH_Use_SPICE->isChecked() ); spiceSettings.Set_GXL_Devices_Count( ui.SB_QXL_Num->value() ); bool ok = false; unsigned int val = ui.CB_RAM_Size->currentText().toUInt( &ok ); if( ok ) spiceSettings.Set_RAM_Size( val ); else { AQGraphic_Warning( tr("Error"), tr("SPICE RAM size incorrect!") ); settingsValidated = false; return spiceSettings; } val = ui.Edit_SPICE_Port->text().toUInt( &ok ); if( ok ) spiceSettings.Set_Port( val ); else { AQGraphic_Warning( tr("Error"), tr("SPICE port number incorrect!") ); settingsValidated = false; return spiceSettings; } spiceSettings.Use_SPort( ui.CH_SPICE_SPort->isChecked() ); val = ui.Edit_SPICE_SPort->text().toUInt( &ok ); if( ok ) spiceSettings.Set_SPort( val ); else { AQGraphic_Warning( tr("Error"), tr("SPICE SPort number incorrect!") ); settingsValidated = false; return spiceSettings; } spiceSettings.Use_Hostname( ui.CH_SPICE_Host->isChecked() ); spiceSettings.Set_Hostname( ui.Edit_SPICE_Host->text() ); spiceSettings.Use_Image_Compression( ui.CH_Use_Image_Compression->isChecked() ); if( ui.CB_Image_Compression->currentIndex() == 0 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_on ); else if( ui.CB_Image_Compression->currentIndex() == 1 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_auto_glz ); else if( ui.CB_Image_Compression->currentIndex() == 2 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_auto_lz ); else if( ui.CB_Image_Compression->currentIndex() == 3 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_quic ); else if( ui.CB_Image_Compression->currentIndex() == 4 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_glz ); else if( ui.CB_Image_Compression->currentIndex() == 5 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_lz ); else if( ui.CB_Image_Compression->currentIndex() == 6 ) spiceSettings.Set_Image_Compression( VM::SPICE_IC_Type_off ); else { AQGraphic_Warning( tr("Error"), tr("SPICE image compression type invalid!") ); settingsValidated = false; return spiceSettings; } spiceSettings.Use_Renderer( ui.CH_Set_Renderer->isChecked() ); QList<VM::SPICE_Renderer> tmpRendersList; for( int ix = 0; ix < ui.Renderer_Order_List->count(); ++ix ) { tmpRendersList << (VM::SPICE_Renderer)ui.Renderer_Order_List->item( ix )->data( Qt::UserRole ).toInt(); } spiceSettings.Set_Renderer_List( tmpRendersList ); spiceSettings.Use_Video_Stream_Compression( ui.CH_Use_Video_Compression->isChecked() ); spiceSettings.Use_Playback_Compression( ui.CH_Use_Playback_Compression->isChecked() ); spiceSettings.Use_Password( ! ui.RB_No_Password->isChecked() ); spiceSettings.Set_Password( ui.Edit_Password->text() ); settingsValidated = true; return spiceSettings; }