kemu: make it easy to control ACPI

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-09-13 18:19:57 +00:00
parent 0d66697afd
commit 1509daa12b
2 changed files with 28 additions and 15 deletions

View file

@ -83,20 +83,20 @@
<string/> <string/>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>CD-ROM image</string> <string>Hard Disk image</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="KUrlRequester" name="CDROMInput"/> <widget class="KUrlRequester" name="CDROMInput"/>
</item> </item>
<item row="1" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Hard Drive image</string> <string>CD-ROM image</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -173,9 +173,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1">
<widget class="KLineEdit" name="argumentsLineEdit"/>
</item>
<item row="6" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="KVMCheckBox"> <widget class="QCheckBox" name="KVMCheckBox">
<property name="text"> <property name="text">
@ -186,7 +183,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2"> <item row="9" column="1">
<widget class="KLineEdit" name="argumentsLineEdit"/>
</item>
<item row="8" column="0" colspan="2">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -199,7 +199,14 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="8" column="0"> <item row="5" column="1">
<widget class="KIntNumInput" name="CPUInput">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Extra arguments</string> <string>Extra arguments</string>
@ -213,10 +220,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="7" column="0" colspan="2">
<widget class="KIntNumInput" name="CPUInput"> <widget class="QCheckBox" name="ACPICheckBox">
<property name="minimum"> <property name="text">
<number>1</number> <string>Advanced Configuration and Power Interface</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -130,6 +130,7 @@ KEmuMainWindow::KEmuMainWindow(QWidget *parent, Qt::WindowFlags flags)
connect(m_kemuui->RAMInput, SIGNAL(valueChanged(int)), this, SLOT(machineSave(int))); 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->CPUInput, SIGNAL(valueChanged(int)), this, SLOT(machineSave(int)));
connect(m_kemuui->KVMCheckBox, SIGNAL(stateChanged(int)), this, SLOT(machineSave(int))); connect(m_kemuui->KVMCheckBox, SIGNAL(stateChanged(int)), this, SLOT(machineSave(int)));
connect(m_kemuui->ACPICheckBox, SIGNAL(stateChanged(int)), this, SLOT(machineSave(int)));
connect(m_kemuui->argumentsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(machineSave(QString))); connect(m_kemuui->argumentsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(machineSave(QString)));
} }
@ -197,6 +198,7 @@ void KEmuMainWindow::machineSave(const QString ignored)
m_settings->setValue(machine + "/ram", m_kemuui->RAMInput->value()); m_settings->setValue(machine + "/ram", m_kemuui->RAMInput->value());
m_settings->setValue(machine + "/cpu", m_kemuui->CPUInput->value()); m_settings->setValue(machine + "/cpu", m_kemuui->CPUInput->value());
m_settings->setValue(machine + "/kvm", m_kemuui->KVMCheckBox->isChecked()); m_settings->setValue(machine + "/kvm", m_kemuui->KVMCheckBox->isChecked());
m_settings->setValue(machine + "/acpi", m_kemuui->ACPICheckBox->isChecked());
m_settings->setValue(machine + "/args", m_kemuui->argumentsLineEdit->text()); m_settings->setValue(machine + "/args", m_kemuui->argumentsLineEdit->text());
m_settings->sync(); m_settings->sync();
} }
@ -222,6 +224,7 @@ void KEmuMainWindow::machineLoad(const QString machine)
m_kemuui->RAMInput->setValue(m_settings->value(machine + "/ram", 32).toInt()); m_kemuui->RAMInput->setValue(m_settings->value(machine + "/ram", 32).toInt());
m_kemuui->CPUInput->setValue(m_settings->value(machine + "/cpu", 1).toInt()); m_kemuui->CPUInput->setValue(m_settings->value(machine + "/cpu", 1).toInt());
m_kemuui->KVMCheckBox->setChecked(m_settings->value(machine + "/kvm", false).toBool()); m_kemuui->KVMCheckBox->setChecked(m_settings->value(machine + "/kvm", false).toBool());
m_kemuui->ACPICheckBox->setChecked(m_settings->value(machine + "/acpi", false).toBool());
m_kemuui->argumentsLineEdit->setText(m_settings->value(machine + "/args").toString()); m_kemuui->argumentsLineEdit->setText(m_settings->value(machine + "/args").toString());
} }
@ -309,6 +312,9 @@ void KEmuMainWindow::startStopMachine()
if (m_kemuui->KVMCheckBox->isChecked()) { if (m_kemuui->KVMCheckBox->isChecked()) {
machineArgs << "-enable-kvm"; machineArgs << "-enable-kvm";
} }
if (!m_kemuui->ACPICheckBox->isChecked()) {
machineArgs << "-no-acpi";
}
const QString extraArgs = m_kemuui->argumentsLineEdit->text(); const QString extraArgs = m_kemuui->argumentsLineEdit->text();
if (!extraArgs.isEmpty()) { if (!extraArgs.isEmpty()) {
foreach (const QString argument, extraArgs.split(" ")) { foreach (const QString argument, extraArgs.split(" ")) {