kemu: make it easy to control audio output

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-09-19 02:30:55 +00:00
parent 4928a08c7e
commit a3cd840696
2 changed files with 89 additions and 27 deletions

View file

@ -83,20 +83,20 @@
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Hard Disk image</string>
<string>CD-ROM image</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KUrlRequester" name="CDROMInput"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>CD-ROM image</string>
<string>Hard Disk image</string>
</property>
</widget>
</item>
@ -159,34 +159,21 @@
</item>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Random Access Memory</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="KIntNumInput" name="RAMInput">
<property name="minimum">
<number>32</number>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="KVMCheckBox">
<property name="text">
<string>Kernel-based Virtual Machine </string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="KLineEdit" name="argumentsLineEdit"/>
</item>
<item row="8" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -199,34 +186,103 @@
</property>
</spacer>
</item>
<item row="5" column="1">
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="KVMCheckBox">
<property name="text">
<string>Kernel-based Virtual Machine </string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="KLineEdit" name="argumentsLineEdit"/>
</item>
<item row="6" column="1">
<widget class="KIntNumInput" name="CPUInput">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="10" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Extra arguments</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>CPU cores</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="ACPICheckBox">
<property name="text">
<string>Advanced Configuration and Power Interface</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="audioComboBox">
<item>
<property name="text">
<string>sb16</string>
</property>
</item>
<item>
<property name="text">
<string>es1370</string>
</property>
</item>
<item>
<property name="text">
<string>ac97</string>
</property>
</item>
<item>
<property name="text">
<string>adlib</string>
</property>
</item>
<item>
<property name="text">
<string>gus</string>
</property>
</item>
<item>
<property name="text">
<string>cs4231a</string>
</property>
</item>
<item>
<property name="text">
<string>hda</string>
</property>
</item>
<item>
<property name="text">
<string>pcspk</string>
</property>
</item>
<item>
<property name="text">
<string>all</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Audio output</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -238,7 +294,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>20</height>
<height>21</height>
</rect>
</property>
</widget>

View file

@ -127,6 +127,7 @@ KEmuMainWindow::KEmuMainWindow(QWidget *parent, Qt::WindowFlags flags)
connect(m_kemuui->HardDiskInput, SIGNAL(textChanged(QString)), this, SLOT(machineSave(QString)));
connect(m_kemuui->systemComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(machineSave(QString)));
connect(m_kemuui->videoComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(machineSave(QString)));
connect(m_kemuui->audioComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(machineSave(QString)));
connect(m_kemuui->RAMInput, SIGNAL(valueChanged(int)), this, SLOT(machineSave(int)));
connect(m_kemuui->CPUInput, SIGNAL(valueChanged(int)), this, SLOT(machineSave(int)));
connect(m_kemuui->KVMCheckBox, SIGNAL(stateChanged(int)), this, SLOT(machineSave(int)));
@ -215,6 +216,7 @@ void KEmuMainWindow::machineSave(const QString ignored)
m_settings->setValue(machine + "/harddisk", m_kemuui->HardDiskInput->url().prettyUrl());
m_settings->setValue(machine + "/system", m_kemuui->systemComboBox->currentText());
m_settings->setValue(machine + "/video", m_kemuui->videoComboBox->currentText());
m_settings->setValue(machine + "/audio", m_kemuui->audioComboBox->currentText());
m_settings->setValue(machine + "/ram", m_kemuui->RAMInput->value());
m_settings->setValue(machine + "/cpu", m_kemuui->CPUInput->value());
m_settings->setValue(machine + "/kvm", m_kemuui->KVMCheckBox->isChecked());
@ -241,6 +243,9 @@ void KEmuMainWindow::machineLoad(const QString machine)
const QString video = m_settings->value(machine + "/video", "virtio").toString();
const int videoIndex = m_kemuui->videoComboBox->findText(video);
m_kemuui->videoComboBox->setCurrentIndex(videoIndex);
const QString audio = m_settings->value(machine + "/audio", "ac97").toString();
const int audioIndex = m_kemuui->audioComboBox->findText(audio);
m_kemuui->audioComboBox->setCurrentIndex(audioIndex);
m_kemuui->RAMInput->setValue(m_settings->value(machine + "/ram", 32).toInt());
m_kemuui->CPUInput->setValue(m_settings->value(machine + "/cpu", 1).toInt());
m_kemuui->KVMCheckBox->setChecked(m_settings->value(machine + "/kvm", false).toBool());
@ -329,6 +334,7 @@ void KEmuMainWindow::startStopMachine()
return;
}
machineArgs << "-vga" << m_kemuui->videoComboBox->currentText();
machineArgs << "-soundhw" << m_kemuui->audioComboBox->currentText();
machineArgs << "-m" << QByteArray::number(m_kemuui->RAMInput->value());
machineArgs << "-smp" << QByteArray::number(m_kemuui->CPUInput->value());
if (m_kemuui->KVMCheckBox->isChecked()) {