mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Configurable back-end port
This commit is contained in:
@@ -12,6 +12,7 @@ from PySide6.QtWidgets import (
|
||||
QPushButton,
|
||||
QVBoxLayout,
|
||||
QCheckBox,
|
||||
QSpinBox,
|
||||
)
|
||||
|
||||
from qt_ui import liberation_install, liberation_theme
|
||||
@@ -46,6 +47,9 @@ class QLiberationPreferences(QFrame):
|
||||
self.payloads_cb = QCheckBox()
|
||||
self.payloads_cb.setChecked(self.prefer_liberation_payloads)
|
||||
|
||||
self.port = liberation_install.server_port()
|
||||
self.port_input = QSpinBox()
|
||||
|
||||
self.initUi()
|
||||
|
||||
def initUi(self):
|
||||
@@ -87,6 +91,17 @@ class QLiberationPreferences(QFrame):
|
||||
)
|
||||
layout.addWidget(self.payloads_cb, 5, 1, alignment=Qt.AlignmentFlag.AlignRight)
|
||||
|
||||
layout.addWidget(
|
||||
QLabel("<strong>Server port (restart required):</strong>"),
|
||||
6,
|
||||
0,
|
||||
alignment=Qt.AlignmentFlag.AlignLeft,
|
||||
)
|
||||
layout.addWidget(self.port_input, 6, 1, alignment=Qt.AlignmentFlag.AlignRight)
|
||||
self.port_input.setRange(1, 2**16 - 1)
|
||||
self.port_input.setValue(self.port)
|
||||
self.port_input.setStyleSheet("QSpinBox{ width: 50 }")
|
||||
|
||||
main_layout.addLayout(layout)
|
||||
main_layout.addStretch()
|
||||
|
||||
@@ -113,6 +128,7 @@ class QLiberationPreferences(QFrame):
|
||||
self.saved_game_dir = self.edit_saved_game_dir.text()
|
||||
self.dcs_install_dir = self.edit_dcs_install_dir.text()
|
||||
self.prefer_liberation_payloads = self.payloads_cb.isChecked()
|
||||
self.port = self.port_input.value()
|
||||
set_theme_index(self.themeSelect.currentIndex())
|
||||
|
||||
if not os.path.isdir(self.saved_game_dir):
|
||||
@@ -169,7 +185,10 @@ class QLiberationPreferences(QFrame):
|
||||
return False
|
||||
|
||||
liberation_install.setup(
|
||||
self.saved_game_dir, self.dcs_install_dir, self.prefer_liberation_payloads
|
||||
self.saved_game_dir,
|
||||
self.dcs_install_dir,
|
||||
self.prefer_liberation_payloads,
|
||||
self.port,
|
||||
)
|
||||
liberation_install.save_config()
|
||||
liberation_theme.save_theme_config()
|
||||
|
||||
Reference in New Issue
Block a user