コード例 #1
0
void Convert_HDD_Thread::run()
{
	QProcess *proc = new QProcess();
	
	QSettings settings;
	proc->start( settings.value("QEMU-IMG_Path", "qemu-img").toString(), Arguments );
	
	if( ! proc->waitForStarted(2000) )
		AQError( "void Convert_HDD_Thread::run()", "Cannot Start qemu-img!" );
	
	if( ! proc->waitForFinished(-1) )
		AQError( "void Convert_HDD_Thread::run()", "Cannot Finish qemu-img!" );
	
	QString err_str = proc->readAllStandardError();
	delete proc;
	
	if( err_str.count() > 0 )
	{
		AQError( "void Convert_HDD_Thread::run()", "qemu-img Send Error String!\nDetalis: " + err_str );
		Error_Message = err_str;
		emit Conversion_Complete( false );
	}
	else
	{
		AQDebug( "void Convert_HDD_Thread::run()", "Conversion complete!" );
		emit Conversion_Complete( true );
	}
}
コード例 #2
0
void Emulator_Control_Window::Set_Device( const QString &dev_name, const QString &path )
{
	if( Cur_VM->Get_Emulator().Get_Version() != VM::QEMU_0_9_0 )
	{
		QString new_dev_name;
		
		if( dev_name == "fda" ) new_dev_name = "floppy0";
		else if( dev_name == "fdb" ) new_dev_name = "floppy1";
		else if( dev_name == "cdrom" ) new_dev_name = "ide1-cd0";
		else
		{
			AQError( "void Emulator_Control_Window::Set_Device( const QString &dev_name, const QString &path )",
					 "Cannot Found Device: " + dev_name );
		}
		
		emit Ready_Read_Command( "change " + new_dev_name + " \"" + path + "\"" );
	}
	else
	{
		// For Version 0.9.0 and Old
		emit Ready_Read_Command( "change " + dev_name + " \"" + path + "\"" );
	}
	
	if( dev_name == "fda" ) Cur_VM->Set_FD0( VM_Storage_Device(true, path) );
	else if( dev_name == "fdb" ) Cur_VM->Set_FD1( VM_Storage_Device(true, path) );
	else if( dev_name == "cdrom" ) Cur_VM->Set_CD_ROM( VM_Storage_Device(true, path) );
	else
	{
		AQError( "void Emulator_Control_Window::Set_Device( const QString &dev_name, const QString &path )",
				 "Cannot Found Device: " + dev_name );
	}
}
コード例 #3
0
void Delete_VM_Files_Window::on_Button_Delete_clicked()
{
	int mes_ret = QMessageBox::question( this, tr("Confirm Delete"),
										 tr("Delete \"") + VM_Name + tr("\" VM and Selected Files?"),
										 QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
	
	QString no_Delete_Files_List;
	
	if( mes_ret == QMessageBox::Yes )
	{
		// Delete VM XML File
		if( ! QFile::remove(VM_Path) )
		{
			AQError( "void Delete_VM_Files_Window::on_Button_Delete_clicked()",
					 "Cannot Delete VM File: \"" + VM_Path + "\"" );
			no_Delete_Files_List += VM_Path + "\n";
		}
		
		// Delete Files
		for( int ix = 0; ix < ui.Files_List->rowCount(); ix++ )
		{
			QTableWidgetItem *item_CheckBox = ui.Files_List->item( ix, 0 );
			QTableWidgetItem *item_Text = ui.Files_List->item( ix, 2 );
			
			if( item_CheckBox == NULL || item_Text == NULL )
			{
				AQError( "void Delete_VM_Files_Window::on_Button_Delete_clicked()",
						 "item_CheckBox == NULL || item_Text == NULL" );
				continue;
			}
			
			// Cheked?
			if( item_CheckBox->checkState() == Qt::Checked )
			{
				if( ! QFile::remove(item_Text->text()) )
				{
					AQError( "void Delete_VM_Files_Window::on_Button_Delete_clicked()",
							 "Cannot Delete File: \"" + item_Text->text() + "\"" );
					no_Delete_Files_List += item_Text->text() + "\n";
					continue;
				}
			}
		}
		
		// Show Errors
		if( ! no_Delete_Files_List.isEmpty() )
		{
			QMessageBox::information( this, tr("An error occurred while deleting files"),
									tr("This Files Not Deleted:\n") + no_Delete_Files_List + tr("Please Check Permissions!"),
									QMessageBox::Ok );
		}
		
		// Send accept
		accept();
	}
}
コード例 #4
0
ファイル: SPICE_Settings_Widget.cpp プロジェクト: loadx/aqemu
void SPICE_Settings_Widget::Show_Renderer_List( const QList<VM::SPICE_Renderer> &list )
{
	ui.Renderer_Order_List->clear();
	
	for( int ix = 0; ix < list.count(); ++ix )
	{
		QString renderStr;
		switch( list[ix] )
		{
			case VM::SPICE_Renderer_cairo:
				renderStr = tr( "cairo" );
				break;
				
			case VM::SPICE_Renderer_oglpbuf:
				renderStr = tr( "oglpbuf" );
				break;
				
			case VM::SPICE_Renderer_oglpixmap:
				renderStr = tr( "oglpixmap" );
				break;
				
			default:
				renderStr = tr( "Error!" );
				AQError( "void SPICE_Settings_Widget::Show_Renderer_List( const QList<VM::SPICE_Renderer> &list )",
						 "Invalid SPICE render type!" );
				break;
		}
		
		QListWidgetItem *tmpItem = new QListWidgetItem( renderStr, ui.Renderer_Order_List, QListWidgetItem::Type );
		tmpItem->setData( Qt::UserRole, list[ix] );
		ui.Renderer_Order_List->addItem( tmpItem );
	}
}
コード例 #5
0
void Folder_Sharing_Widget::on_actionRemove_triggered()
{
	int mes_ret = QMessageBox::question( this, tr("Remove?"),
			tr("Remove Folder?"),
			QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
	
	if( mes_ret == QMessageBox::No ) return;
	
    bool found = false;
	for( int fx = 0; fx < 32; ++fx )
	{
		if( ui.Folders_List->currentItem()->data(512).toString() == "folder" + QString::number(fx) )
		{
			found = true;
			
			Shared_Folders.removeAt( fx );
		}
	}
	
	if( ! found )
	{
		AQError( "void Folder_Sharing_Widget::on_actionRemove_triggered()",
				 "Incorrect folder!" );
		return;
	}
	
	emit Folder_Changed();
}
コード例 #6
0
ファイル: Properties_Window.cpp プロジェクト: loadx/aqemu
void Properties_Window::on_TB_HDD_Advanced_Settings_clicked()
{
	// Set device
	Add_New_Device_Window *win = new Add_New_Device_Window();
	win->Set_Device( PW_HDD.Get_Nativ_Device() );
	
	// Set emulator
	if( ! Current_Machine_Devices )
	{
		AQError( "void Properties_Window::on_TB_HDD_Advanced_Settings_clicked()",
				 "Current_Machine_Devices == NULL" );
		return;
	}
	
	win->Set_Emulator_Devices( *Current_Machine_Devices );
	
	// Show dialog
	if( win->exec() == QDialog::Accepted )
	{
		// Set new values
		PW_HDD.Set_Nativ_Device( win->Get_Device() );
		
		if( PW_HDD.Get_Nativ_Device().Get_File_Path() != ui.Edit_HDD_Image_Path->text() )
			ui.Edit_HDD_Image_Path->setText( PW_HDD.Get_Nativ_Device().Get_File_Path() );
		
		// Nativ Mode - on, File - not used
		if( PW_HDD.Get_Nativ_Device().Get_Nativ_Mode() &&
			PW_HDD.Get_Nativ_Device().Use_File_Path() == false )
			ui.Edit_HDD_Image_Path->setText( "" );
	}
	
	delete win;
}
コード例 #7
0
ファイル: VM_Wizard_Window.cpp プロジェクト: loadx/aqemu
QString VM_Wizard_Window::Find_OS_Icon( const QString os_name )
{
	if( os_name.isEmpty() )
	{
		AQError( "QString VM_Wizard_Window::Find_OS_Icon( const QString os_name )",
				 "os_name is Empty!" );
		return "";
	}
	else
	{
		// Find all os icons
		QDir icons_dir( QDir::toNativeSeparators(Settings.value("AQEMU_Data_Folder","").toString() + "/os_icons/") );
		QFileInfoList all_os_icons = icons_dir.entryInfoList( QStringList("*.png"), QDir::Files, QDir::Unsorted );
		
		QRegExp rex;
		rex.setPatternSyntax( QRegExp::Wildcard );
		rex.setCaseSensitivity( Qt::CaseInsensitive );
		
		for( int i = 0; i < all_os_icons.count(); i++ )
		{
			rex.setPattern( "*" + all_os_icons[i].baseName() + "*" );
			
			if( rex.exactMatch(os_name) )
			{
				return all_os_icons[ i ].absoluteFilePath();
			}
		}
		
		// select os family...
		
		// Linux
		rex.setPattern( "*linux*" );
		if( rex.exactMatch(os_name) )
		{
			return ":/images/default_linux.png";
		}
		
		// Windows
		rex.setPattern( "*windows*" );
		if( rex.exactMatch(os_name) )
		{
			return ":/images/default_windows.png";
		}
		
		return ":/images/other.png";
	}
}
コード例 #8
0
ファイル: Select_Icon_Window.cpp プロジェクト: loadx/aqemu
void Select_Icon_Window::on_Button_Browse_clicked()
{
	QString iconPath = QFileDialog::getOpenFileName( this, tr("Select Icon File:"),
													 Get_Last_Dir_Path(ui.Edit_Other_Icon_Path->text()),
													 tr("PNG Images (*.png)") );
	
	if( iconPath.isEmpty() ) return;
	iconPath = QDir::toNativeSeparators( iconPath );

	if( ! QFile::exists(iconPath) )
	{
		AQError( "void Select_Icon_Window::on_Button_Browse_clicked()",
				 "File No Exists!" );
	}
	else
	{
		ui.Edit_Other_Icon_Path->setText( iconPath );
	}
}
コード例 #9
0
ファイル: VM_Wizard_Window.cpp プロジェクト: loadx/aqemu
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 );
}
コード例 #10
0
ファイル: Properties_Window.cpp プロジェクト: loadx/aqemu
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!" );
	}
}
コード例 #11
0
void Emulator_Control_Window::Add_USB_To_VM()
{
	QAction *usb_item = qobject_cast<QAction*>( sender() );
	
	if( usb_item )
	{
		QList<QAction*> ac_list = ui.menuDisconnect->actions();
		
		for( int ix = 0; ix < ac_list.count(); ++ix )
		{
			// Unique value
			if( usb_item->data().toString() == ac_list[ix]->data().toString() )
			{
				AQWarning( "void Emulator_Control_Window::Add_USB_To_VM()",
						   "This is not unique value: " + usb_item->data().toString() );
				return;
			}
		}
		
		// Create Item for Disconnect Menu
		QAction *dis_act = new QAction( usb_item->text(), ui.menuDisconnect );
		dis_act->setData( usb_item->data() );
		
		connect( dis_act, SIGNAL(triggered()), this, SLOT(Delete_USB_From_VM()) );
		
		ui.menuDisconnect->addAction( dis_act );
		
		// Add To Running VM
		emit Ready_Read_Command( "usb_add host:" + usb_item->data().toString() );
	}
	else
	{
		AQError( "void Emulator_Control_Window::Add_USB_To_VM()",
				 "Cannot convert to QAction!" );
	}
}
コード例 #12
0
void Emulator_Control_Window::Delete_USB_From_VM()
{
	QAction *usb_item = qobject_cast<QAction*>( sender() );
	
	if( usb_item )
	{
		QList<QAction*> ac_list = ui.menuDisconnect->actions();
		
		for( int ix = 0; ix < ac_list.count(); ++ix )
		{
			if( usb_item->data().toString() == ac_list[ix]->data().toString() )
			{
				// Delete from Running VM
				QString bus_addr; // FIXME = Cur_VM->Get_USB_Bus_Address( usb_item->data().toString() );
				
				if( bus_addr.isEmpty() ) return;
				
				emit Ready_Read_Command( "usb_del " + bus_addr );
				
				// Delete item
				ui.menuDisconnect->removeAction( usb_item );
				
				return;
			}
		}
		
		// Cannot Find
		AQGraphic_Error( "void Emulator_Control_Window::Delete_USB_From_VM()",
						 tr("Error!"), tr("Cannot Find USB Device!"), false );
	}
	else
	{
		AQError( "void Emulator_Control_Window::Delete_USB_From_VM()",
				 "Cannot convert to QAction!" );
	}
}
コード例 #13
0
ファイル: Properties_Window.cpp プロジェクト: loadx/aqemu
void Properties_Window::on_Button_Update_Info_clicked()
{
	if( ui.GB_Floppy->isEnabled() )
	{
		VM_Storage_Device *fd = new VM_Storage_Device( true, ui.CB_FD_Devices->lineEdit()->text() );
		
		if( ui.CB_FD_Devices->lineEdit()->text().isEmpty() )
		{
			ui.Label_Info->setText( tr("Image Size: ") + QString::number(0) + tr("Kb") );
			return;
		}
		
		if( ! QFile::exists(ui.CB_FD_Devices->lineEdit()->text()) )
		{
			ui.Label_Info->setText( tr("Image Size: ") + QString::number(0) + tr("Kb") );
			return;
		}
		
		QFileInfo fd_img = QFileInfo( fd->Get_File_Name() );
		qint64 size_in_bytes = fd_img.size();
		
		if( size_in_bytes <= 0 )
			ui.Label_Info->setText( tr("Image Size: ") + QString::number(0) + tr("Kb") );
		else
			ui.Label_Info->setText( tr("Image Size: ") +
									QString::number((int)size_in_bytes / 1024.0) + tr("Kb") );
		
		delete fd;
	}
	else if( ui.GB_CDROM->isEnabled() )
	{
		VM_Storage_Device *cd = new VM_Storage_Device( true, ui.CB_CDROM_Devices->lineEdit()->text() );
		
		if( ui.CB_CDROM_Devices->lineEdit()->text().isEmpty() )
		{
			ui.Label_Info->setText( tr("Image Size: ") + QString::number(0)  + tr("Mb") );
			return;
		}
		
		if( ! QFile::exists(ui.CB_CDROM_Devices->lineEdit()->text()) )
		{
			ui.Label_Info->setText( tr("Image Size: ") + QString::number(0) + tr("Mb") );
			return;
		}
		
		QFileInfo cd_img = QFileInfo( cd->Get_File_Name() );
		qint64 size_in_bytes = cd_img.size();
		
		if( size_in_bytes <= 0 )
			ui.Label_Info->setText( tr("Image Size: ") + QString::number(0) + tr("Mb") );
		else
			ui.Label_Info->setText( tr("Image Size: ") +
									QString::number((float)size_in_bytes / 1024.0 / 1024.0, 'f', 2) + tr("Mb") );
		
		delete cd;
	}
	else if( ui.GB_HDD->isEnabled() )
	{
		HDD_Info->Update_Disk_Info( ui.Edit_HDD_Image_Path->text() );
	}
	else
	{
		AQError( "void Properties_Window::on_Button_Update_Info_clicked()",
				 "No Enabled GB!" );
	}
}
コード例 #14
0
ファイル: Add_New_Device_Window.cpp プロジェクト: loadx/aqemu
void Add_New_Device_Window::Set_Device( const VM_Nativ_Storage_Device &dev )
{
	Device = dev;
	
	// Update View...
	ui.CH_Interface->setChecked( Device.Use_Interface() );
	
	// Interface
	switch( Device.Get_Interface() )
	{
		case VM::DI_IDE:
			ui.CB_Interface->setCurrentIndex( 0 );
			break;
			
		case VM::DI_SCSI:
			ui.CB_Interface->setCurrentIndex( 1 );
			break;
			
		case VM::DI_SD:
			ui.CB_Interface->setCurrentIndex( 2 );
			break;
			
		case VM::DI_MTD:
			ui.CB_Interface->setCurrentIndex( 3 );
			break;
			
		case VM::DI_Floppy:
			ui.CB_Interface->setCurrentIndex( 4 );
			break;
			
		case VM::DI_PFlash:
			ui.CB_Interface->setCurrentIndex( 5 );
			break;
			
		case VM::DI_Virtio:
			ui.CB_Interface->setCurrentIndex( 6 );
			break;
			
		default:
			AQError( "void Add_New_Device_Window::Set_Device( const VM_Nativ_Storage_Device &dev )",
					 "Interface Default Section! Use IDE!" );
			break;
	}
	
	// Media
	ui.CH_Media->setChecked( Device.Use_Media() );
	
	switch( Device.Get_Media() )
	{
		case VM::DM_Disk:
			ui.CB_Media->setCurrentIndex( 0 );
			break;
			
		case VM::DM_CD_ROM:
			ui.CB_Media->setCurrentIndex( 1 );
			break;
			
		default:
			AQError( "void Add_New_Device_Window::Set_Device( const VM_Nativ_Storage_Device &dev )",
					 "Media Default Section! Use Disk!" );
			break;
	}
	
	// File Path
	ui.CH_File->setChecked( Device.Use_File_Path() );
	ui.Edit_File_Path->setText( Device.Get_File_Path() );
	
	// Index
	ui.CH_Index->setChecked( Device.Use_Index() );
	ui.SB_Index->setValue( Device.Get_Index() );
	
	// Bus, Unit
	ui.CH_Bus_Unit->setChecked( Device.Use_Bus_Unit() );
	ui.SB_Bus->setValue( Device.Get_Bus() );
	ui.SB_Unit->setValue( Device.Get_Unit() );
	
	// Snapshot
	ui.CH_Snapshot->setChecked( Device.Use_Snapshot() );
	ui.CB_Snapshot->setCurrentIndex( Device.Get_Snapshot() ? 0 : 1 );
	
	// Cache
	ui.CH_Cache->setChecked( Device.Use_Cache() );
	int index = ui.CB_Cache->findText( Device.Get_Cache() );
	if( index != -1 )
		ui.CB_Cache->setCurrentIndex( index );
	else
		AQError( "void Add_New_Device_Window::Set_Device( const VM_Nativ_Storage_Device &dev )",
				 "Cache: " + Device.Get_Cache() );
	
	// AIO
	ui.CH_AIO->setChecked( Device.Use_AIO() );
	index = ui.CB_AIO->findText( Device.Get_AIO() );
	if( index != -1 ) ui.CB_AIO->setCurrentIndex( index );
	else
		AQError( "void Add_New_Device_Window::Set_Device( const VM_Nativ_Storage_Device &dev )",
				 "AIO: " + Device.Get_AIO() );
	
	// Boot
	ui.CH_Boot->setChecked( Device.Use_Boot() );
	ui.CB_Boot->setCurrentIndex( Device.Get_Boot() ? 0 : 1 );
	
	// cyls, heads, secs, trans
	ui.GB_hdachs_Settings->setChecked( Device.Use_hdachs() );
	ui.Edit_Cyls->setText( QString::number(Device.Get_Cyls()) );
	ui.Edit_Heads->setText( QString::number(Device.Get_Heads()) );
	ui.Edit_Secs->setText( QString::number(Device.Get_Secs()) );
	ui.Edit_Trans->setText( QString::number(Device.Get_Trans()) );
}
コード例 #15
0
ファイル: Add_New_Device_Window.cpp プロジェクト: loadx/aqemu
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();
}
コード例 #16
0
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);
}
コード例 #17
0
void Delete_VM_Files_Window::Set_VM( Virtual_Machine *vm )
{
	if( vm == NULL )
	{
		AQError( "void Delete_VM_Files_Window::Set_VM( Virtual_Machine *vm )",
				 "vm == NULL" );
		return;
	}
	
	// Clear List
	Clear_List();
	
	VM_Name = vm->Get_Machine_Name();
	
	File_List_Item tmp;
	
	// VM File
	VM_Path = vm->Get_VM_XML_File_Path();
	
	// Screenshot
	if( Path_Valid(vm->Get_Screenshot_Path()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "Screenshot" );
		tmp.Path = vm->Get_Screenshot_Path();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// FD0
	if( Path_Valid(vm->Get_FD0().Get_File_Name()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "Floppy A" );
		tmp.Path = vm->Get_FD0().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// FD1
	if( Path_Valid(vm->Get_FD1().Get_File_Name()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "Floppy B" );
		tmp.Path = vm->Get_FD1().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// CD-ROM
	if( Path_Valid(vm->Get_CD_ROM().Get_File_Name()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "CD-ROM" );
		tmp.Path = vm->Get_CD_ROM().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// HDA
	if( Path_Valid(vm->Get_HDA().Get_File_Name()) )
	{
		tmp.Hard_Drive = true;
		tmp.Name = tr( "HDA (Primary Master)" );
		tmp.Path = vm->Get_HDA().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// HDB
	if( Path_Valid(vm->Get_HDB().Get_File_Name()) )
	{
		tmp.Hard_Drive = true;
		tmp.Name = tr( "HDB (Primary Slave)" );
		tmp.Path = vm->Get_HDB().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// HDC
	if( Path_Valid(vm->Get_HDC().Get_File_Name()) )
	{
		tmp.Hard_Drive = true;
		tmp.Name = tr( "HDC (Secondary Master)" );
		tmp.Path = vm->Get_HDC().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// HDD
	if( Path_Valid(vm->Get_HDD().Get_File_Name()) )
	{
		tmp.Hard_Drive = true;
		tmp.Name = tr( "HDD (Secondary Slave)" );
		tmp.Path = vm->Get_HDD().Get_File_Name();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// ROM File
	if( Path_Valid(vm->Get_ROM_File()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "ROM File" );
		tmp.Path = vm->Get_ROM_File();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// MTDBlock File
	if( Path_Valid(vm->Get_MTDBlock_File()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "MTDBlock File" );
		tmp.Path = vm->Get_MTDBlock_File();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// SD Card File
	if( Path_Valid(vm->Get_SecureDigital_File()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "SD Card File" );
		tmp.Path = vm->Get_SecureDigital_File();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// PFlash File
	if( Path_Valid(vm->Get_PFlash_File()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "PFlash File" );
		tmp.Path = vm->Get_PFlash_File();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// bzImage
	if( Path_Valid(vm->Get_bzImage_Path()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "Kernel bzImage" );
		tmp.Path = vm->Get_bzImage_Path();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// Initrd
	if( Path_Valid(vm->Get_Initrd_Path()) )
	{
		tmp.Hard_Drive = false;
		tmp.Name = tr( "Kernel Initrd" );
		tmp.Path = vm->Get_Initrd_Path();
		
		File_List_Items << tmp;
		Add_To_Files_List( tmp );
	}
	
	// Serial Ports
	if( vm->Get_Serial_Ports().count() > 0 )
	{
		QList<VM_Port> tmp_port = vm->Get_Serial_Ports();
		
		for( int ix = 0; ix < tmp_port.count(); ix++ )
		{
			if( tmp_port[ix].Get_Port_Redirection() == VM::PR_file )
			{
				if( Path_Valid(tmp_port[ix].Get_Parametrs_Line()) )
				{
					tmp.Hard_Drive = false;
					tmp.Name = tr( "Serial Port Redirection" );
					tmp.Path = tmp_port[ix].Get_Parametrs_Line();
					
					File_List_Items << tmp;
					Add_To_Files_List( tmp );
				}
			}
		}
	}
	
	// Parallel Ports
	if( vm->Get_Parallel_Ports().count() > 0 )
	{
		QList<VM_Port> tmp_port = vm->Get_Parallel_Ports();
		
		for( int ix = 0; ix < tmp_port.count(); ix++ )
		{
			if( tmp_port[ix].Get_Port_Redirection() == VM::PR_file )
			{
				if( Path_Valid(tmp_port[ix].Get_Parametrs_Line()) )
				{
					tmp.Hard_Drive = false;
					tmp.Name = tr( "Parallel Port Redirection" );
					tmp.Path = tmp_port[ix].Get_Parametrs_Line();
					
					File_List_Items << tmp;
					Add_To_Files_List( tmp );
				}
			}
		}
	}
	
	// Storage Devices
	if( vm->Get_Storage_Devices_List().count() > 0 )
	{
		QList<VM_Nativ_Storage_Device> tmp_dev = vm->Get_Storage_Devices_List();
		
		for( int ix = 0; ix < tmp_dev.count(); ix++ )
		{
			if( Path_Valid(tmp_dev[ix].Get_File_Path()) )
			{
				if( tmp_dev[ix].Get_Media() == VM::DM_Disk ) tmp.Hard_Drive = true;
				else tmp.Hard_Drive = false;
				
				tmp.Name = tr( "Storage Device" );
				tmp.Path = tmp_dev[ix].Get_File_Path();
				
				File_List_Items << tmp;
				Add_To_Files_List( tmp );
			}
		}
	}
}
コード例 #18
0
ファイル: VM_Wizard_Window.cpp プロジェクト: loadx/aqemu
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!" );
	}
}
コード例 #19
0
bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()
{
	// Start process
	QSettings settings;
	QProcess *qemuImgProc = new QProcess( this );
	qemuImgProc->start( settings.value("QEMU-IMG_Path", "qemu-img").toString(), QStringList("-h") );
	
	if( ! qemuImgProc->waitForStarted(2000) )
		AQError( "bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()",
				 "Cannot start qemu-img!" );
	
	if( ! qemuImgProc->waitForFinished(3000) )
		AQError( "bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()",
				 "Cannot finish qemu-img!" );
	
	// Read all output text
	QString allText = qemuImgProc->readAllStandardError();
	allText += qemuImgProc->readAllStandardOutput();
	
	delete qemuImgProc;
	
	if( allText.isEmpty() )
	{
		AQError( "bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()",
				 "qemu-img not send text!" );
		return false;
	}
	else // Parse text
	{
		// Encryption
		QRegExp possibleEncrypte = QRegExp( "-e\\s+" );
		if( possibleEncrypte.exactMatch(allText) ) Possible_Encrypte = true;
		else Possible_Encrypte = false;
		
		// Formats
		QRegExp formats = QRegExp( ".*Supported formats:\\s+(.*)\n" );
		if( ! formats.exactMatch(allText) )
		{
			AQError( "bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()",
					 "Cannot match RegExp!" );
			return false;
		}
		
		QStringList tmpList = formats.capturedTexts();
		if( tmpList.count() < 2 )
		{
			AQError( "bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()",
					 "Captured text lines < 2" );
			return false;
		}
		
		QStringList formatsList = tmpList[ 1 ].split( ' ', QString::SkipEmptyParts );
		if( formatsList.isEmpty() )
		{
			AQError( "bool Convert_HDD_Image_Window::Get_QEMU_IMG_Info()",
					 "Formats list is empty!" );
			return false;
		}
		
		// Add formats
		formatsList.sort();
		ui.CB_Output_Format->addItems( formatsList );
		
		// qcow2 - is default format
		int qcow2 = ui.CB_Output_Format->findText( "qcow2" );
		if( qcow2 != -1 ) ui.CB_Output_Format->setCurrentIndex( qcow2 );
		else
		{
			// qcow2 not available use qcow
			int qcow = ui.CB_Output_Format->findText( "qcow" );
			if( qcow != -1 ) ui.CB_Output_Format->setCurrentIndex( qcow );
		}
		
		return true;
	}
}
コード例 #20
0
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();
}
コード例 #21
0
ファイル: VM_Wizard_Window.cpp プロジェクト: loadx/aqemu
void VM_Wizard_Window::on_Button_Back_clicked()
{
	ui.Button_Next->setEnabled( true );
	
	if( ui.Welcome_Page == ui.Wizard_Pages->currentWidget() )
	{
	}
	else if( ui.Wizard_Mode_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.Welcome_Page );
		ui.Label_Page->setText( tr("New Virtual Machine Wizard") );
		ui.Button_Back->setEnabled( false );
	}
	else if( ui.Template_Page == ui.Wizard_Pages->currentWidget() )
	{
		if( Use_Emulator_Type_Page )
		{
			ui.Wizard_Pages->setCurrentWidget( ui.Emulator_Type_Page );
			ui.Label_Page->setText( tr("Emulator Type") );
		}
		else
		{
			ui.Wizard_Pages->setCurrentWidget( ui.Wizard_Mode_Page );
			ui.Label_Page->setText( tr("Wizard Mode") );
		}
	}
	else if( ui.Emulator_Type_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.Wizard_Mode_Page );
		ui.Label_Page->setText( tr("Wizard Mode") );
	}
	else if( ui.General_Settings_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.Template_Page );
		ui.Label_Page->setText( tr("VM Hardware Template") );
	}
	else if( ui.Memory_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.General_Settings_Page );
		ui.Label_Page->setText( tr("VM Name and CPU Type") );
		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 );
	}
	else if( ui.Typical_HDD_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.General_Settings_Page );
		ui.Label_Page->setText( tr("Virtual Machine Name") );
		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 if( ui.Custom_HDD_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.Memory_Page );
		ui.Label_Page->setText( tr("Memory") );
	}
	else if( ui.Network_Page == ui.Wizard_Pages->currentWidget() )
	{
		if( ui.RB_Typical->isChecked() ) // typcal or custom mode
		{
			ui.Wizard_Pages->setCurrentWidget( ui.Typical_HDD_Page );
			ui.Label_Page->setText( tr("Hard Disk Size") );
		}
		else
		{
			ui.Wizard_Pages->setCurrentWidget( ui.Custom_HDD_Page );
			ui.Label_Page->setText( tr("Virtual Hard Disk") );
		}
	}
	else if( ui.Finish_Page == ui.Wizard_Pages->currentWidget() )
	{
		ui.Wizard_Pages->setCurrentWidget( ui.Network_Page );
		ui.Label_Page->setText( tr("Network") );
		ui.Button_Next->setText( tr("&Next") );
	}
	else
	{
		// Default
		AQError( "void VM_Wizard_Window::on_Button_Back_clicked()",
				 "Default Section!" );
	}
}