Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom Qemu paths #3574

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gns3/modules/qemu/pages/qemu_vm_configuration_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ def loadSettings(self, settings, node=None, group=False):
index = self.uiProcessPriorityComboBox.findText(settings["process_priority"], QtCore.Qt.MatchFixedString)
if index != -1:
self.uiProcessPriorityComboBox.setCurrentIndex(index)
self.uiQemuPathLineEdit.setText(settings["qemu_path"])
self.uiQemuOptionsLineEdit.setText(settings["options"])
self.uiUsageTextEdit.setPlainText(settings["usage"])
self.uiTPMCheckBox.setChecked(settings["tpm"])
Expand Down Expand Up @@ -652,6 +653,7 @@ def saveSettings(self, settings, node=None, group=False):
else:
settings["cpu_throttling"] = 0
settings["process_priority"] = self.uiProcessPriorityComboBox.currentText().lower()
settings["qemu_path"] = self.QemuPathLineEdit.text().strip()
settings["options"] = self.uiQemuOptionsLineEdit.text()
settings["usage"] = self.uiUsageTextEdit.toPlainText()
settings["tpm"] = self.uiTPMCheckBox.isChecked()
Expand Down
2 changes: 2 additions & 0 deletions gns3/modules/qemu/pages/qemu_vm_preferences_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def _refreshInfo(self, qemu_vm):
except KeyError:
pass
QtWidgets.QTreeWidgetItem(section_item, ["QEMU platform:", os.path.basename(qemu_vm["platform"])])
if qemu_vm["qemu_path"]:
QtWidgets.QTreeWidgetItem(section_item, ["Custom QEMU path:", qemu_vm["qemu_path"]])
QtWidgets.QTreeWidgetItem(section_item, ["Console type:", qemu_vm["console_type"]])
QtWidgets.QTreeWidgetItem(section_item, ["Auto start console:", "{}".format(qemu_vm["console_auto_start"])])
QtWidgets.QTreeWidgetItem(section_item, ["Auxiliary console type:", qemu_vm["aux_type"]])
Expand Down
1 change: 1 addition & 0 deletions gns3/modules/qemu/qemu_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def __init__(self, module, server, project):
"uefi": QEMU_VM_SETTINGS["uefi"],
"create_config_disk": QEMU_VM_SETTINGS["create_config_disk"],
"platform": QEMU_VM_SETTINGS["platform"],
"qemu_path": "",
"on_close": QEMU_VM_SETTINGS["on_close"],
"cpu_throttling": QEMU_VM_SETTINGS["cpu_throttling"],
"process_priority": QEMU_VM_SETTINGS["process_priority"],
Expand Down
1 change: 1 addition & 0 deletions gns3/modules/qemu/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"create_config_disk": False,
"on_close": "power_off",
"platform": "x86_64",
"qemu_path": "",
"cpu_throttling": 0,
"process_priority": "normal",
"options": "",
Expand Down
54 changes: 33 additions & 21 deletions gns3/modules/qemu/ui/qemu_vm_configuration_page.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>478</width>
<height>579</height>
<width>518</width>
<height>618</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -896,21 +896,7 @@
<string>Additional settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="uiTPMCheckBox">
<property name="text">
<string>Enable Trusted Platform Module (TPM)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="uiQemuOptionsLabel">
<property name="text">
<string>Options:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="uiQemuOptionsLineEdit">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Variable replacements:&lt;/p&gt;
Expand All @@ -926,7 +912,14 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="uiUEFICheckBox">
<property name="text">
<string>Enable UEFI boot mode</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="uiBaseVMCheckBox">
<property name="enabled">
<bool>true</bool>
Expand All @@ -936,19 +929,38 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="uiUEFICheckBox">
<item row="0" column="0">
<widget class="QLabel" name="uiQemuPathLabel">
<property name="text">
<string>Enable UEFI boot mode</string>
<string>Qemu binary path:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiQemuOptionsLabel">
<property name="text">
<string>Command line options:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="uiTPMCheckBox">
<property name="text">
<string>Enable Trusted Platform Module (TPM)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="uiQemuPathLineEdit"/>
</item>
</layout>
<zorder>uiQemuOptionsLineEdit</zorder>
<zorder>uiQemuOptionsLabel</zorder>
<zorder>uiBaseVMCheckBox</zorder>
<zorder>uiTPMCheckBox</zorder>
<zorder>uiUEFICheckBox</zorder>
<zorder>uiQemuPathLabel</zorder>
<zorder>uiQemuPathLineEdit</zorder>
</widget>
</item>
<item>
Expand Down
41 changes: 25 additions & 16 deletions gns3/modules/qemu/ui/qemu_vm_configuration_page_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/qemu/ui/qemu_vm_configuration_page.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
Expand All @@ -14,7 +14,7 @@
class Ui_QemuVMConfigPageWidget(object):
def setupUi(self, QemuVMConfigPageWidget):
QemuVMConfigPageWidget.setObjectName("QemuVMConfigPageWidget")
QemuVMConfigPageWidget.resize(478, 579)
QemuVMConfigPageWidget.resize(518, 618)
self.verticalLayout = QtWidgets.QVBoxLayout(QemuVMConfigPageWidget)
self.verticalLayout.setObjectName("verticalLayout")
self.uiQemutabWidget = QtWidgets.QTabWidget(QemuVMConfigPageWidget)
Expand Down Expand Up @@ -436,27 +436,35 @@ def setupUi(self, QemuVMConfigPageWidget):
self.groupBox.setObjectName("groupBox")
self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox)
self.gridLayout_3.setObjectName("gridLayout_3")
self.uiTPMCheckBox = QtWidgets.QCheckBox(self.groupBox)
self.uiTPMCheckBox.setObjectName("uiTPMCheckBox")
self.gridLayout_3.addWidget(self.uiTPMCheckBox, 1, 0, 1, 2)
self.uiQemuOptionsLabel = QtWidgets.QLabel(self.groupBox)
self.uiQemuOptionsLabel.setObjectName("uiQemuOptionsLabel")
self.gridLayout_3.addWidget(self.uiQemuOptionsLabel, 0, 0, 1, 1)
self.uiQemuOptionsLineEdit = QtWidgets.QLineEdit(self.groupBox)
self.uiQemuOptionsLineEdit.setObjectName("uiQemuOptionsLineEdit")
self.gridLayout_3.addWidget(self.uiQemuOptionsLineEdit, 0, 1, 1, 1)
self.gridLayout_3.addWidget(self.uiQemuOptionsLineEdit, 1, 1, 1, 1)
self.uiUEFICheckBox = QtWidgets.QCheckBox(self.groupBox)
self.uiUEFICheckBox.setObjectName("uiUEFICheckBox")
self.gridLayout_3.addWidget(self.uiUEFICheckBox, 4, 0, 1, 2)
self.uiBaseVMCheckBox = QtWidgets.QCheckBox(self.groupBox)
self.uiBaseVMCheckBox.setEnabled(True)
self.uiBaseVMCheckBox.setObjectName("uiBaseVMCheckBox")
self.gridLayout_3.addWidget(self.uiBaseVMCheckBox, 3, 0, 1, 2)
self.uiUEFICheckBox = QtWidgets.QCheckBox(self.groupBox)
self.uiUEFICheckBox.setObjectName("uiUEFICheckBox")
self.gridLayout_3.addWidget(self.uiUEFICheckBox, 2, 0, 1, 2)
self.gridLayout_3.addWidget(self.uiBaseVMCheckBox, 5, 0, 1, 2)
self.uiQemuPathLabel = QtWidgets.QLabel(self.groupBox)
self.uiQemuPathLabel.setObjectName("uiQemuPathLabel")
self.gridLayout_3.addWidget(self.uiQemuPathLabel, 0, 0, 1, 1)
self.uiQemuOptionsLabel = QtWidgets.QLabel(self.groupBox)
self.uiQemuOptionsLabel.setObjectName("uiQemuOptionsLabel")
self.gridLayout_3.addWidget(self.uiQemuOptionsLabel, 1, 0, 1, 1)
self.uiTPMCheckBox = QtWidgets.QCheckBox(self.groupBox)
self.uiTPMCheckBox.setObjectName("uiTPMCheckBox")
self.gridLayout_3.addWidget(self.uiTPMCheckBox, 3, 0, 1, 2)
self.uiQemuPathLineEdit = QtWidgets.QLineEdit(self.groupBox)
self.uiQemuPathLineEdit.setObjectName("uiQemuPathLineEdit")
self.gridLayout_3.addWidget(self.uiQemuPathLineEdit, 0, 1, 1, 1)
self.uiQemuOptionsLineEdit.raise_()
self.uiQemuOptionsLabel.raise_()
self.uiBaseVMCheckBox.raise_()
self.uiTPMCheckBox.raise_()
self.uiUEFICheckBox.raise_()
self.uiQemuPathLabel.raise_()
self.uiQemuPathLineEdit.raise_()
self.verticalLayout_2.addWidget(self.groupBox)
spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem4)
Expand Down Expand Up @@ -566,8 +574,6 @@ def retranslateUi(self, QemuVMConfigPageWidget):
self.uiProcessPriorityComboBox.setItemText(4, _translate("QemuVMConfigPageWidget", "Low"))
self.uiProcessPriorityComboBox.setItemText(5, _translate("QemuVMConfigPageWidget", "Very low"))
self.groupBox.setTitle(_translate("QemuVMConfigPageWidget", "Additional settings"))
self.uiTPMCheckBox.setText(_translate("QemuVMConfigPageWidget", "Enable Trusted Platform Module (TPM)"))
self.uiQemuOptionsLabel.setText(_translate("QemuVMConfigPageWidget", "Options:"))
self.uiQemuOptionsLineEdit.setToolTip(_translate("QemuVMConfigPageWidget", "<html><head/><body><p>Variable replacements:</p>\n"
"<ul>\n"
"<li>%vm-name% =VM name</li>\n"
Expand All @@ -578,7 +584,10 @@ def retranslateUi(self, QemuVMConfigPageWidget):
"<li>%guest-cid% = unique ID from 3 to 65535</li>\n"
"</ul>\n"
"</body></html>"))
self.uiBaseVMCheckBox.setText(_translate("QemuVMConfigPageWidget", "Use as a linked base VM"))
self.uiUEFICheckBox.setText(_translate("QemuVMConfigPageWidget", "Enable UEFI boot mode"))
self.uiBaseVMCheckBox.setText(_translate("QemuVMConfigPageWidget", "Use as a linked base VM"))
self.uiQemuPathLabel.setText(_translate("QemuVMConfigPageWidget", "Qemu binary path:"))
self.uiQemuOptionsLabel.setText(_translate("QemuVMConfigPageWidget", "Command line options:"))
self.uiTPMCheckBox.setText(_translate("QemuVMConfigPageWidget", "Enable Trusted Platform Module (TPM)"))
self.uiQemutabWidget.setTabText(self.uiQemutabWidget.indexOf(self.uiAdvancedSettingsTab), _translate("QemuVMConfigPageWidget", "Advanced"))
self.uiQemutabWidget.setTabText(self.uiQemutabWidget.indexOf(self.uiUsageTab), _translate("QemuVMConfigPageWidget", "Usage"))