3 Commits

Author SHA1 Message Date
84708ed260 chore(changelog): update
All checks were successful
Check Translations / check-translations (push) Successful in 35s
Code and build check / Check code (push) Successful in 1m19s
Code and build check / Build with uv (push) Successful in 46s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-11 23:19:31 +05:00
9fe5a8315a chore(localization): update
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-11 23:17:35 +05:00
c1b8eac127 feat: add gamepad haptic feedback setting
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-11 23:11:38 +05:00
13 changed files with 90 additions and 17 deletions

View File

@@ -27,7 +27,7 @@
- Оверлей на кнопку Insert или кнопку Xbox/PS на геймпаде для закрытия приложения, выключения, перезагрузки и перехода в спящий режим или между сессиями
- [Gamescope сессия](https://git.linux-gaming.ru/Boria138/gamescope-session-portprotonqt)
- Мапинги управления для Dualshock 4 и DualSense
- Виброотдача на геймпаде при запуске игры
- Настройка тактильной обратной связи на геймпаде при запуске игры (по умолчанию отключена)
### Changed
- Обновлены все иконки

View File

@@ -20,9 +20,9 @@ Current translation status:
| Locale | Progress | Translated |
| :----- | -------: | ---------: |
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 of 160 |
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 of 160 |
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 160 of 160 |
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 of 162 |
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 of 162 |
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 162 of 162 |
---

View File

@@ -20,9 +20,9 @@
| Локаль | Прогресс | Переведено |
| :----- | -------: | ---------: |
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 из 160 |
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 из 160 |
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 160 из 160 |
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 из 162 |
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 из 162 |
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 162 из 162 |
---

View File

@@ -322,6 +322,41 @@ def save_favorites(favorites):
with open(CONFIG_FILE, "w", encoding="utf-8") as configfile:
cp.write(configfile)
def read_rumble_config():
"""
Читает настройку виброотдачи геймпада из секции [Gamepad].
Если параметр отсутствует, сохраняет и возвращает False по умолчанию.
"""
cp = configparser.ConfigParser()
if os.path.exists(CONFIG_FILE):
try:
cp.read(CONFIG_FILE, encoding="utf-8")
except Exception as e:
logger.error("Ошибка чтения конфигурационного файла: %s", e)
save_rumble_config(False)
return False
if not cp.has_section("Gamepad") or not cp.has_option("Gamepad", "rumble_enabled"):
save_rumble_config(False)
return False
return cp.getboolean("Gamepad", "rumble_enabled", fallback=False)
return False
def save_rumble_config(rumble_enabled):
"""
Сохраняет настройку виброотдачи геймпада в секцию [Gamepad].
"""
cp = configparser.ConfigParser()
if os.path.exists(CONFIG_FILE):
try:
cp.read(CONFIG_FILE, encoding="utf-8")
except (configparser.DuplicateSectionError, configparser.DuplicateOptionError) as e:
logger.error("Ошибка чтения конфигурационного файла: %s", e)
if "Gamepad" not in cp:
cp["Gamepad"] = {}
cp["Gamepad"]["rumble_enabled"] = str(rumble_enabled)
with open(CONFIG_FILE, "w", encoding="utf-8") as configfile:
cp.write(configfile)
def ensure_default_proxy_config():
"""
Проверяет наличие секции [Proxy] в конфигурационном файле.
@@ -342,7 +377,6 @@ def ensure_default_proxy_config():
with open(CONFIG_FILE, "w", encoding="utf-8") as configfile:
cp.write(configfile)
def read_proxy_config():
"""
Читает настройки прокси из секции [Proxy] конфигурационного файла.
@@ -421,8 +455,6 @@ def save_fullscreen_config(fullscreen):
with open(CONFIG_FILE, "w", encoding="utf-8") as configfile:
cp.write(configfile)
def read_window_geometry() -> tuple[int, int]:
"""
Читает ширину и высоту окна из секции [MainWindow] конфигурационного файла.

View File

@@ -10,7 +10,7 @@ from portprotonqt.logger import get_logger
from portprotonqt.image_utils import FullscreenDialog
from portprotonqt.custom_widgets import NavLabel
from portprotonqt.game_card import GameCard
from portprotonqt.config_utils import read_fullscreen_config, read_window_geometry, save_window_geometry, read_auto_fullscreen_gamepad
from portprotonqt.config_utils import read_fullscreen_config, read_window_geometry, save_window_geometry, read_auto_fullscreen_gamepad, read_rumble_config
logger = get_logger(__name__)
@@ -128,6 +128,8 @@ class InputManager(QObject):
def trigger_rumble(self, duration_ms: int = 200, strong_magnitude: int = 0x8000, weak_magnitude: int = 0x8000) -> None:
"""Trigger a rumble effect on the gamepad if supported."""
if not read_rumble_config():
return
if not self.gamepad:
return
try:

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-10 10:25+0500\n"
"POT-Creation-Date: 2025-06-11 23:15+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de_DE\n"
@@ -376,6 +376,12 @@ msgstr ""
msgid "Auto Fullscreen on Gamepad connected:"
msgstr ""
msgid "Gamepad haptic feedback"
msgstr ""
msgid "Gamepad haptic feedback:"
msgstr ""
msgid "Save Settings"
msgstr ""

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-10 10:25+0500\n"
"POT-Creation-Date: 2025-06-11 23:15+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: es_ES\n"
@@ -376,6 +376,12 @@ msgstr ""
msgid "Auto Fullscreen on Gamepad connected:"
msgstr ""
msgid "Gamepad haptic feedback"
msgstr ""
msgid "Gamepad haptic feedback:"
msgstr ""
msgid "Save Settings"
msgstr ""

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PortProtonQt 0.1.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-10 10:25+0500\n"
"POT-Creation-Date: 2025-06-11 23:15+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -374,6 +374,12 @@ msgstr ""
msgid "Auto Fullscreen on Gamepad connected:"
msgstr ""
msgid "Gamepad haptic feedback"
msgstr ""
msgid "Gamepad haptic feedback:"
msgstr ""
msgid "Save Settings"
msgstr ""

View File

@@ -9,8 +9,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-10 10:25+0500\n"
"PO-Revision-Date: 2025-06-10 10:24+0500\n"
"POT-Creation-Date: 2025-06-11 23:15+0500\n"
"PO-Revision-Date: 2025-06-11 23:15+0500\n"
"Last-Translator: \n"
"Language: ru_RU\n"
"Language-Team: ru_RU <LL@li.org>\n"
@@ -383,6 +383,12 @@ msgstr "Режим полноэкранного отображения прил
msgid "Auto Fullscreen on Gamepad connected:"
msgstr "Режим полноэкранного отображения приложения при подключении геймпада:"
msgid "Gamepad haptic feedback"
msgstr "Тактильная обратная связь на геймпаде"
msgid "Gamepad haptic feedback:"
msgstr "Тактильная обратная связь на геймпаде:"
msgid "Save Settings"
msgstr "Сохранить настройки"

View File

@@ -26,7 +26,7 @@ from portprotonqt.config_utils import (
read_display_filter, read_favorites, save_favorites, save_time_config, save_sort_method,
save_display_filter, save_proxy_config, read_proxy_config, read_fullscreen_config,
save_fullscreen_config, read_window_geometry, save_window_geometry, reset_config,
clear_cache, read_auto_fullscreen_gamepad, save_auto_fullscreen_gamepad
clear_cache, read_auto_fullscreen_gamepad, save_auto_fullscreen_gamepad, read_rumble_config, save_rumble_config
)
from portprotonqt.localization import _
from portprotonqt.logger import get_logger
@@ -997,6 +997,17 @@ class MainWindow(QMainWindow):
self.autoFullscreenGamepadCheckBox.setChecked(current_auto_fullscreen)
formLayout.addRow(self.autoFullscreenGamepadTitle, self.autoFullscreenGamepadCheckBox)
# 7. Gamepad haptic feedback config
self.gamepadRumbleCheckBox = QCheckBox(_("Gamepad haptic feedback"))
self.gamepadRumbleCheckBox.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
self.gamepadRumbleCheckBox.setStyleSheet(self.theme.SETTINGS_CHECKBOX_STYLE)
self.gamepadRumbleTitle = QLabel(_("Gamepad haptic feedback:"))
self.gamepadRumbleTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
self.gamepadRumbleTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
current_rumble_state = read_rumble_config()
self.gamepadRumbleCheckBox.setChecked(current_rumble_state)
formLayout.addRow(self.gamepadRumbleTitle, self.gamepadRumbleCheckBox)
layout.addLayout(formLayout)
# Кнопки
@@ -1117,6 +1128,10 @@ class MainWindow(QMainWindow):
auto_fullscreen_gamepad = self.autoFullscreenGamepadCheckBox.isChecked()
save_auto_fullscreen_gamepad(auto_fullscreen_gamepad)
# Сохранение настройки виброотдачи геймпада
rumble_enabled = self.gamepadRumbleCheckBox.isChecked()
save_rumble_config(rumble_enabled)
for card in self.game_card_cache.values():
card.update_badge_visibility(filter_key)