Skip to content

Commit

Permalink
GameSettings: group wine and proton groups under compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
loathingKernel committed Jan 14, 2025
1 parent 4b95609 commit 4b54e58
Showing 8 changed files with 57 additions and 31 deletions.
2 changes: 1 addition & 1 deletion rare/components/tabs/settings/widgets/env_vars.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
class EnvVars(QGroupBox):
def __init__(self, parent):
super(EnvVars, self).__init__(parent=parent)
self.setTitle(self.tr("Environment variables"))
self.setTitle(self.tr("Environment"))

self.core = LegendaryCoreSingleton()
self.app_name: str = "default"
45 changes: 35 additions & 10 deletions rare/components/tabs/settings/widgets/game.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,12 @@
from PySide6.QtGui import QHideEvent
from PySide6.QtWidgets import (
QWidget,
QVBoxLayout
QVBoxLayout,
# QStackedWidget,
QGroupBox,
# QComboBox,
# QFormLayout,
# QLabel,
)

from rare.shared import LegendaryCoreSingleton
@@ -45,14 +50,36 @@ def __init__(
self.env_vars = envvar_widget(self)

if pf.system() != "Windows":
self.compat = QGroupBox(self.tr("Compatibility"), parent=self)
# self.compat_label = QLabel(self.tr("Runner"))
# self.compat_combo = QComboBox(self)
# self.compat_stack = QStackedWidget(self)

self.compat_layout = QVBoxLayout(self.compat)
# self.compat_layout = QFormLayout(self.compat)
# self.compat_layout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.compat_label)
# self.compat_layout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.compat_combo)
# self.compat_layout.setWidget(1, QFormLayout.ItemRole.SpanningRole, self.compat_stack)
# self.compat_layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.FieldsStayAtSizeHint)
#
self.wine = wine_widget(self)
self.wine.environ_changed.connect(self.env_vars.reset_model)

if pf.system() in {"Linux", "FreeBSD"}:
self.proton_tool = proton_widget(self)
self.proton_tool.environ_changed.connect(self.env_vars.reset_model)
self.proton_tool.tool_enabled.connect(self.wine.tool_enabled)
self.proton_tool.tool_enabled.connect(self.launch.tool_enabled)
self.compat_layout.addWidget(self.wine)
# wine_index = self.compat_stack.addWidget(self.wine)
# self.compat_combo.addItem("Wine", wine_index)

if pf.system() in {"Linux", "FreeBSD"}:
self.proton_tool = proton_widget(self)
self.proton_tool.environ_changed.connect(self.env_vars.reset_model)
self.proton_tool.tool_enabled.connect(self.wine.tool_enabled)
self.proton_tool.tool_enabled.connect(self.launch.tool_enabled)
self.compat_layout.addWidget(self.proton_tool)
# proton_index = self.compat_stack.addWidget(self.proton_tool)
# self.compat_combo.addItem("Proton", proton_index)

# self.compat_combo.currentIndexChanged.connect(
# lambda: self.compat_stack.setCurrentIndex(self.compat_combo.currentData(Qt.ItemDataRole.UserRole))
# )

self.dxvk = dxvk_widget(self)
self.dxvk.environ_changed.connect(self.env_vars.reset_model)
@@ -64,9 +91,7 @@ def __init__(
self.main_layout = QVBoxLayout(self)
self.main_layout.addWidget(self.launch)
if pf.system() != "Windows":
self.main_layout.addWidget(self.wine)
if pf.system() in {"Linux", "FreeBSD"}:
self.main_layout.addWidget(self.proton_tool)
self.main_layout.addWidget(self.compat)
self.main_layout.addWidget(self.dxvk)
if pf.system() in {"Linux", "FreeBSD"}:
self.main_layout.addWidget(self.mangohud)
2 changes: 1 addition & 1 deletion rare/components/tabs/settings/widgets/launch.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ def __init__(
parent=None
):
super(LaunchSettingsBase, self).__init__(parent=parent)
self.setTitle(self.tr("Launch settings"))
self.setTitle(self.tr("Launch"))

self.core = LegendaryCoreSingleton()
self.app_name: str = "default"
4 changes: 2 additions & 2 deletions rare/components/tabs/settings/widgets/overlay.py
Original file line number Diff line number Diff line change
@@ -233,7 +233,7 @@ def showEvent(self, a0: QShowEvent):
class DxvkSettings(OverlaySettings):
def __init__(self, parent=None):
super(DxvkSettings, self).__init__(parent=parent)
self.setTitle(self.tr("DXVK settings"))
self.setTitle(self.tr("DXVK HUD"))
grid = [
OverlayCheckBox("fps", self.tr("FPS")),
OverlayCheckBox("frametime", self.tr("Frametime")),
@@ -285,7 +285,7 @@ def update_settings_override(self, state: ActivationStates):
class MangoHudSettings(OverlaySettings):
def __init__(self, parent=None):
super(MangoHudSettings, self).__init__(parent=parent)
self.setTitle(self.tr("MangoHud settings"))
self.setTitle(self.tr("MangoHud"))
grid = [
OverlayCheckBox("read_cfg", self.tr("Read config")),
OverlayCheckBox("fps", self.tr("FPS"), default_enabled=True),
2 changes: 1 addition & 1 deletion rare/components/tabs/settings/widgets/proton.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class ProtonSettings(QGroupBox):

def __init__(self, parent=None):
super(ProtonSettings, self).__init__(parent=parent)
self.setTitle(self.tr("Proton settings"))
self.setTitle(self.tr("Proton"))

self.tool_combo = QComboBox(self)
self.tool_combo.currentIndexChanged.connect(self.__on_proton_changed)
5 changes: 3 additions & 2 deletions rare/components/tabs/settings/widgets/wine.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
from logging import getLogger
from typing import Optional

from PySide6.QtCore import Signal, Qt, QSignalBlocker
from PySide6.QtCore import Signal, Qt, QSignalBlocker, Slot
from PySide6.QtGui import QShowEvent
from PySide6.QtWidgets import QFileDialog, QFormLayout, QGroupBox

@@ -19,7 +19,7 @@ class WineSettings(QGroupBox):

def __init__(self, parent=None):
super(WineSettings, self).__init__(parent=parent)
self.setTitle(self.tr("Wine settings"))
self.setTitle(self.tr("Wine"))

self.core = LegendaryCoreSingleton()
self.signals = GlobalSignalsSingleton()
@@ -62,6 +62,7 @@ def showEvent(self, a0: QShowEvent):

return super().showEvent(a0)

@Slot(bool)
def tool_enabled(self, enabled: bool):
if enabled:
config.set_boolean(self.app_name, "no_wine", True)
12 changes: 6 additions & 6 deletions rare/ui/components/tabs/settings/legendary.py
Original file line number Diff line number Diff line change
@@ -32,18 +32,18 @@ def setupUi(self, LegendarySettings):
self.left_layout.setObjectName(u"left_layout")
self.install_dir_group = QGroupBox(LegendarySettings)
self.install_dir_group.setObjectName(u"install_dir_group")
self.install_dir_group.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.install_dir_group.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignTop)
self.install_dir_layout = QVBoxLayout(self.install_dir_group)
self.install_dir_layout.setObjectName(u"install_dir_layout")

self.left_layout.addWidget(self.install_dir_group)

self.download_group = QGroupBox(LegendarySettings)
self.download_group.setObjectName(u"download_group")
self.download_group.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.download_group.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignTop)
self.download_layout = QFormLayout(self.download_group)
self.download_layout.setObjectName(u"download_layout")
self.download_layout.setLabelAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
self.download_layout.setLabelAlignment(Qt.AlignmentFlag.AlignRight|Qt.AlignmentFlag.AlignTrailing|Qt.AlignmentFlag.AlignVCenter)
self.max_workers_label = QLabel(self.download_group)
self.max_workers_label.setObjectName(u"max_workers_label")
sizePolicy = QSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Preferred)
@@ -146,15 +146,15 @@ def setupUi(self, LegendarySettings):
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.locale_group.sizePolicy().hasHeightForWidth())
self.locale_group.setSizePolicy(sizePolicy2)
self.locale_group.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.locale_group.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignTop)
self.locale_layout = QVBoxLayout(self.locale_group)
self.locale_layout.setObjectName(u"locale_layout")

self.right_layout.addWidget(self.locale_group)

self.cleanup_group = QGroupBox(LegendarySettings)
self.cleanup_group.setObjectName(u"cleanup_group")
self.cleanup_group.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
self.cleanup_group.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignTop)
self.cleanup_layout = QVBoxLayout(self.cleanup_group)
self.cleanup_layout.setObjectName(u"cleanup_layout")
self.clean_keep_manifests_button = QPushButton(self.cleanup_group)
@@ -225,7 +225,7 @@ def setupUi(self, LegendarySettings):
# setupUi

def retranslateUi(self, LegendarySettings):
self.install_dir_group.setTitle(QCoreApplication.translate("LegendarySettings", u"Default installation folder", None))
self.install_dir_group.setTitle(QCoreApplication.translate("LegendarySettings", u"Installation folder", None))
self.download_group.setTitle(QCoreApplication.translate("LegendarySettings", u"Download settings", None))
self.max_workers_label.setText(QCoreApplication.translate("LegendarySettings", u"Max workers", None))
self.max_workers_info_label.setText(QCoreApplication.translate("LegendarySettings", u"Less is slower (0: Default)", None))
16 changes: 8 additions & 8 deletions rare/ui/components/tabs/settings/legendary.ui
Original file line number Diff line number Diff line change
@@ -19,10 +19,10 @@
<item>
<widget class="QGroupBox" name="install_dir_group">
<property name="title">
<string>Default installation folder</string>
<string>Installation folder</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="install_dir_layout"/>
</widget>
@@ -33,11 +33,11 @@
<string>Download settings</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QFormLayout" name="download_layout">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="max_workers_label">
@@ -169,7 +169,7 @@
<item>
<spacer name="left_vspacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -195,7 +195,7 @@
<string>Locale</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="locale_layout"/>
</widget>
@@ -206,7 +206,7 @@
<string>Cleanup</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="cleanup_layout">
<item>
@@ -302,7 +302,7 @@ Disabling this greatly improves start-up time, but some library filters may not
<item>
<spacer name="right_vspacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>

0 comments on commit 4b54e58

Please sign in to comment.