forked from Boria138/PortProtonQt
Compare commits
5 Commits
fdd5a0a3d5
...
596aed0077
| Author | SHA1 | Date | |
|---|---|---|---|
|
596aed0077
|
|||
|
6fc6cb1e02
|
|||
|
186e28a19b
|
|||
|
28e4d1e77c
|
|||
|
fff1f888c4
|
@@ -21,9 +21,9 @@ Current translation status:
|
||||
|
||||
| Locale | Progress | Translated |
|
||||
| :----- | -------: | ---------: |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 of 247 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 of 247 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 247 of 247 |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 of 249 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 of 249 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 249 of 249 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
| Локаль | Прогресс | Переведено |
|
||||
| :----- | -------: | ---------: |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 из 247 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 из 247 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 247 из 247 |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 из 249 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 из 249 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 249 из 249 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -427,3 +427,22 @@ def save_favorite_folders(folders):
|
||||
cp["FavoritesFolders"]["folders"] = f'"{fav_str}"'
|
||||
with open(CONFIG_FILE, "w", encoding="utf-8") as configfile:
|
||||
cp.write(configfile)
|
||||
|
||||
def read_minimize_to_tray():
|
||||
"""Reads the minimize-to-tray setting from the [Display] section.
|
||||
Returns True if the parameter is missing (default: minimize to tray).
|
||||
"""
|
||||
cp = read_config_safely(CONFIG_FILE)
|
||||
if cp is None or not cp.has_section("Display") or not cp.has_option("Display", "minimize_to_tray"):
|
||||
save_minimize_to_tray(True)
|
||||
return True
|
||||
return cp.getboolean("Display", "minimize_to_tray", fallback=True)
|
||||
|
||||
def save_minimize_to_tray(minimize_to_tray):
|
||||
"""Saves the minimize-to-tray setting to the [Display] section."""
|
||||
cp = read_config_safely(CONFIG_FILE) or configparser.ConfigParser()
|
||||
if "Display" not in cp:
|
||||
cp["Display"] = {}
|
||||
cp["Display"]["minimize_to_tray"] = str(minimize_to_tray)
|
||||
with open(CONFIG_FILE, "w", encoding="utf-8") as configfile:
|
||||
cp.write(configfile)
|
||||
|
||||
@@ -1436,6 +1436,7 @@ class InputManager(QObject):
|
||||
return super().eventFilter(obj, event)
|
||||
|
||||
def init_gamepad(self) -> None:
|
||||
self.monitor_observer = None # Добавляем атрибут для хранения observer
|
||||
self.check_gamepad()
|
||||
threading.Thread(target=self.run_udev_monitor, daemon=True).start()
|
||||
logger.info("Gamepad support initialized with hotplug (evdev + pyudev)")
|
||||
@@ -1446,9 +1447,9 @@ class InputManager(QObject):
|
||||
monitor = Monitor.from_netlink(context)
|
||||
monitor.filter_by(subsystem='input')
|
||||
observer = MonitorObserver(monitor, self.handle_udev_event)
|
||||
observer.start()
|
||||
while self.running:
|
||||
time.sleep(1)
|
||||
self.monitor_observer = observer # Сохраняем ссылку для остановки
|
||||
observer.start() # Это блокирует поток до вызова send_stop()
|
||||
logger.info("MonitorObserver stopped gracefully")
|
||||
except Exception as e:
|
||||
logger.error(f"Error in udev monitor: {e}", exc_info=True)
|
||||
|
||||
@@ -1569,11 +1570,21 @@ class InputManager(QObject):
|
||||
def cleanup(self) -> None:
|
||||
try:
|
||||
self.running = False
|
||||
|
||||
# Останавливаем udev monitor
|
||||
if self.monitor_observer:
|
||||
try:
|
||||
logger.info("Stopping udev monitor...")
|
||||
self.monitor_observer.send_stop()
|
||||
except Exception as e:
|
||||
logger.warning(f"Error stopping monitor observer: {e}")
|
||||
self.monitor_observer = None
|
||||
|
||||
self.dpad_timer.stop()
|
||||
self.nav_timer.stop()
|
||||
self.stop_rumble()
|
||||
if self.gamepad_thread:
|
||||
self.gamepad_thread.join()
|
||||
self.gamepad_thread.join(timeout=2.0) # Добавлен таймаут
|
||||
if self.gamepad:
|
||||
self.gamepad.close()
|
||||
self.gamepad = None
|
||||
|
||||
Binary file not shown.
@@ -9,7 +9,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-10-16 10:43+0500\n"
|
||||
"POT-Creation-Date: 2025-10-16 14:54+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: de_DE\n"
|
||||
@@ -624,6 +624,12 @@ msgstr ""
|
||||
msgid "Application Fullscreen Mode:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Minimize to tray on close"
|
||||
msgstr ""
|
||||
|
||||
msgid "Application Close Mode:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Auto Fullscreen on Gamepad connected"
|
||||
msgstr ""
|
||||
|
||||
|
||||
Binary file not shown.
@@ -9,7 +9,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-10-16 10:43+0500\n"
|
||||
"POT-Creation-Date: 2025-10-16 14:54+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: es_ES\n"
|
||||
@@ -624,6 +624,12 @@ msgstr ""
|
||||
msgid "Application Fullscreen Mode:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Minimize to tray on close"
|
||||
msgstr ""
|
||||
|
||||
msgid "Application Close Mode:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Auto Fullscreen on Gamepad connected"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -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-10-16 10:43+0500\n"
|
||||
"POT-Creation-Date: 2025-10-16 14:54+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"
|
||||
@@ -622,6 +622,12 @@ msgstr ""
|
||||
msgid "Application Fullscreen Mode:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Minimize to tray on close"
|
||||
msgstr ""
|
||||
|
||||
msgid "Application Close Mode:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Auto Fullscreen on Gamepad connected"
|
||||
msgstr ""
|
||||
|
||||
|
||||
Binary file not shown.
@@ -9,8 +9,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-10-16 10:43+0500\n"
|
||||
"PO-Revision-Date: 2025-10-16 10:43+0500\n"
|
||||
"POT-Creation-Date: 2025-10-16 14:54+0500\n"
|
||||
"PO-Revision-Date: 2025-10-16 14:54+0500\n"
|
||||
"Last-Translator: \n"
|
||||
"Language: ru_RU\n"
|
||||
"Language-Team: ru_RU <LL@li.org>\n"
|
||||
@@ -633,6 +633,12 @@ msgstr "Запуск приложения в полноэкранном режи
|
||||
msgid "Application Fullscreen Mode:"
|
||||
msgstr "Режим полноэкранного отображения приложения:"
|
||||
|
||||
msgid "Minimize to tray on close"
|
||||
msgstr "Сворачивать в трей при закрытии"
|
||||
|
||||
msgid "Application Close Mode:"
|
||||
msgstr "Режим закрытия приложения:"
|
||||
|
||||
msgid "Auto Fullscreen on Gamepad connected"
|
||||
msgstr "Режим полноэкранного отображения приложения при подключении геймпада"
|
||||
|
||||
|
||||
@@ -29,7 +29,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, read_rumble_config, save_rumble_config, read_gamepad_type, save_gamepad_type
|
||||
clear_cache, read_auto_fullscreen_gamepad, save_auto_fullscreen_gamepad, read_rumble_config, save_rumble_config, read_gamepad_type, save_gamepad_type, read_minimize_to_tray, save_minimize_to_tray
|
||||
)
|
||||
from portprotonqt.localization import _, get_egs_language, read_metadata_translations
|
||||
from portprotonqt.howlongtobeat_api import HowLongToBeat
|
||||
@@ -1860,7 +1860,19 @@ class MainWindow(QMainWindow):
|
||||
self.fullscreenCheckBox.setChecked(current_fullscreen)
|
||||
formLayout.addRow(self.fullscreenTitle, self.fullscreenCheckBox)
|
||||
|
||||
# 7. Automatic fullscreen on gamepad connection
|
||||
# 7. Minimize to tray setting
|
||||
self.minimizeToTrayCheckBox = QCheckBox(_("Minimize to tray on close"))
|
||||
self.minimizeToTrayCheckBox.setStyleSheet(self.theme.SETTINGS_CHECKBOX_STYLE)
|
||||
self.minimizeToTrayCheckBox.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
||||
self.minimizeToTrayTitle = QLabel(_("Application Close Mode:"))
|
||||
self.minimizeToTrayTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
|
||||
self.minimizeToTrayTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
||||
current_minimize_to_tray = read_minimize_to_tray()
|
||||
self.minimizeToTrayCheckBox.setChecked(current_minimize_to_tray)
|
||||
self.minimizeToTrayCheckBox.toggled.connect(lambda checked: save_minimize_to_tray(checked))
|
||||
formLayout.addRow(self.minimizeToTrayTitle, self.minimizeToTrayCheckBox)
|
||||
|
||||
# 8. Automatic fullscreen on gamepad connection
|
||||
self.autoFullscreenGamepadCheckBox = QCheckBox(_("Auto Fullscreen on Gamepad connected"))
|
||||
self.autoFullscreenGamepadCheckBox.setStyleSheet(self.theme.SETTINGS_CHECKBOX_STYLE)
|
||||
self.autoFullscreenGamepadCheckBox.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
||||
@@ -1872,7 +1884,7 @@ class MainWindow(QMainWindow):
|
||||
self.autoFullscreenGamepadCheckBox.setChecked(current_auto_fullscreen)
|
||||
formLayout.addRow(self.autoFullscreenGamepadTitle, self.autoFullscreenGamepadCheckBox)
|
||||
|
||||
# 8. Gamepad haptic feedback config
|
||||
# 9. Gamepad haptic feedback config
|
||||
self.gamepadRumbleCheckBox = QCheckBox(_("Gamepad haptic feedback"))
|
||||
self.gamepadRumbleCheckBox.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
||||
self.gamepadRumbleCheckBox.setStyleSheet(self.theme.SETTINGS_CHECKBOX_STYLE)
|
||||
@@ -3008,10 +3020,12 @@ class MainWindow(QMainWindow):
|
||||
logger.error(f"Failed to launch game {exe_name}: {e}")
|
||||
QMessageBox.warning(self, _("Error"), _("Failed to launch game: {0}").format(str(e)))
|
||||
|
||||
|
||||
def closeEvent(self, event):
|
||||
"""Обработчик закрытия окна: сворачивает приложение в трей, если не требуется принудительный выход."""
|
||||
if hasattr(self, 'is_exiting') and self.is_exiting:
|
||||
"""Обработчик закрытия окна: проверяет настройку minimize_to_tray.
|
||||
Если True — сворачиваем в трей (по умолчанию). Иначе — полностью закрываем.
|
||||
"""
|
||||
minimize_to_tray = read_minimize_to_tray() # Импорт read_minimize_to_tray из config_utils
|
||||
if hasattr(self, 'is_exiting') and self.is_exiting or not minimize_to_tray:
|
||||
# Принудительное закрытие: завершаем процессы и приложение
|
||||
for proc in self.game_processes:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user