3 Commits

Author SHA1 Message Date
61115411e7 chore(changelog): update
All checks were successful
Check Translations / check-translations (push) Successful in 44s
Code and build check / Check code (push) Successful in 1m54s
Code and build check / Build with uv (push) Successful in 54s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-08 22:57:43 +05:00
55c32457d6 chore(localization): update
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-08 22:56:19 +05:00
b965b23a50 feat: add toggle favorite actions to context menu
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-08 22:53:16 +05:00
11 changed files with 101 additions and 14 deletions

View File

@@ -18,8 +18,8 @@
- Сохранение и восстановление размера окна при перезапуске - Сохранение и восстановление размера окна при перезапуске
- Переключатель полноэкранного режима приложения - Переключатель полноэкранного режима приложения
- Пункт в контекстном меню «Открыть папку игры» - Пункт в контекстном меню «Открыть папку игры»
- Пункт в контекстном меню «Добавить в Steam» - Пункты в контекстном меню «Добавить в Steam» и «Удалить из Steam»
- Пункт в контекстном меню «Удалить из Steam» - Пункты в контекстном меню «Добавить в Избранное» и «Удалить из Избранного» для переключения статуса избранного через геймпад
- Метод сортировки «Сначала избранное» - Метод сортировки «Сначала избранное»
- Настройка автоматического перехода в полноэкранный режим при подключении геймпада (по умолчанию отключена) - Настройка автоматического перехода в полноэкранный режим при подключении геймпада (по умолчанию отключена)
- Обработчики для QMenu и QComboBox при управлении геймпадом - Обработчики для QMenu и QComboBox при управлении геймпадом

View File

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

View File

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

View File

@@ -6,7 +6,7 @@ import subprocess
from PySide6.QtWidgets import QMessageBox, QDialog, QMenu from PySide6.QtWidgets import QMessageBox, QDialog, QMenu
from PySide6.QtCore import QUrl, QPoint from PySide6.QtCore import QUrl, QPoint
from PySide6.QtGui import QDesktopServices from PySide6.QtGui import QDesktopServices
from portprotonqt.config_utils import parse_desktop_entry from portprotonqt.config_utils import parse_desktop_entry, read_favorites, save_favorites
from portprotonqt.localization import _ from portprotonqt.localization import _
from portprotonqt.steam_api import is_game_in_steam, add_to_steam, remove_from_steam from portprotonqt.steam_api import is_game_in_steam, add_to_steam, remove_from_steam
from portprotonqt.dialogs import AddGameDialog from portprotonqt.dialogs import AddGameDialog
@@ -41,6 +41,17 @@ class ContextMenuManager:
""" """
menu = QMenu(self.parent) menu = QMenu(self.parent)
favorites = read_favorites()
is_favorite = game_card.name in favorites
if is_favorite:
favorite_action = menu.addAction(_("Remove from Favorites"))
favorite_action.triggered.connect(lambda: self.toggle_favorite(game_card, False))
else:
favorite_action = menu.addAction(_("Add to Favorites"))
favorite_action.triggered.connect(lambda: self.toggle_favorite(game_card, True))
if game_card.game_source not in ("steam", "epic"): if game_card.game_source not in ("steam", "epic"):
desktop_dir = subprocess.check_output(['xdg-user-dir', 'DESKTOP']).decode('utf-8').strip() desktop_dir = subprocess.check_output(['xdg-user-dir', 'DESKTOP']).decode('utf-8').strip()
desktop_path = os.path.join(desktop_dir, f"{game_card.name}.desktop") desktop_path = os.path.join(desktop_dir, f"{game_card.name}.desktop")
@@ -80,6 +91,26 @@ class ContextMenuManager:
menu.exec(game_card.mapToGlobal(pos)) menu.exec(game_card.mapToGlobal(pos))
def toggle_favorite(self, game_card, add: bool):
"""
Toggle the favorite status of a game and update its icon.
Args:
game_card: The GameCard instance to toggle.
add: True to add to favorites, False to remove.
"""
favorites = read_favorites()
if add and game_card.name not in favorites:
favorites.append(game_card.name)
game_card.is_favorite = True
self.parent.statusBar().showMessage(_("Added '{0}' to favorites").format(game_card.name), 3000)
elif not add and game_card.name in favorites:
favorites.remove(game_card.name)
game_card.is_favorite = False
self.parent.statusBar().showMessage(_("Removed '{0}' from favorites").format(game_card.name), 3000)
save_favorites(favorites)
game_card.update_favorite_icon()
def _check_portproton(self): def _check_portproton(self):
"""Check if PortProton is available.""" """Check if PortProton is available."""
if self.portproton_location is None: if self.portproton_location is None:

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-08 09:31+0500\n" "POT-Creation-Date: 2025-06-08 22:55+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de_DE\n" "Language: de_DE\n"
@@ -20,6 +20,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n" "Generated-By: Babel 2.17.0\n"
msgid "Remove from Favorites"
msgstr ""
msgid "Add to Favorites"
msgstr ""
msgid "Remove from Desktop" msgid "Remove from Desktop"
msgstr "" msgstr ""
@@ -47,6 +53,14 @@ msgstr ""
msgid "Add to Steam" msgid "Add to Steam"
msgstr "" msgstr ""
#, python-brace-format
msgid "Added '{0}' to favorites"
msgstr ""
#, python-brace-format
msgid "Removed '{0}' from favorites"
msgstr ""
msgid "Error" msgid "Error"
msgstr "" msgstr ""

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-08 09:31+0500\n" "POT-Creation-Date: 2025-06-08 22:55+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: es_ES\n" "Language: es_ES\n"
@@ -20,6 +20,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n" "Generated-By: Babel 2.17.0\n"
msgid "Remove from Favorites"
msgstr ""
msgid "Add to Favorites"
msgstr ""
msgid "Remove from Desktop" msgid "Remove from Desktop"
msgstr "" msgstr ""
@@ -47,6 +53,14 @@ msgstr ""
msgid "Add to Steam" msgid "Add to Steam"
msgstr "" msgstr ""
#, python-brace-format
msgid "Added '{0}' to favorites"
msgstr ""
#, python-brace-format
msgid "Removed '{0}' from favorites"
msgstr ""
msgid "Error" msgid "Error"
msgstr "" msgstr ""

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PortProtonQT 0.1.1\n" "Project-Id-Version: PortProtonQT 0.1.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-08 09:31+0500\n" "POT-Creation-Date: 2025-06-08 22:55+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,6 +18,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n" "Generated-By: Babel 2.17.0\n"
msgid "Remove from Favorites"
msgstr ""
msgid "Add to Favorites"
msgstr ""
msgid "Remove from Desktop" msgid "Remove from Desktop"
msgstr "" msgstr ""
@@ -45,6 +51,14 @@ msgstr ""
msgid "Add to Steam" msgid "Add to Steam"
msgstr "" msgstr ""
#, python-brace-format
msgid "Added '{0}' to favorites"
msgstr ""
#, python-brace-format
msgid "Removed '{0}' from favorites"
msgstr ""
msgid "Error" msgid "Error"
msgstr "" msgstr ""

View File

@@ -9,8 +9,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-06-08 09:31+0500\n" "POT-Creation-Date: 2025-06-08 22:55+0500\n"
"PO-Revision-Date: 2025-06-08 09:31+0500\n" "PO-Revision-Date: 2025-06-08 22:55+0500\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language: ru_RU\n" "Language: ru_RU\n"
"Language-Team: ru_RU <LL@li.org>\n" "Language-Team: ru_RU <LL@li.org>\n"
@@ -21,6 +21,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n" "Generated-By: Babel 2.17.0\n"
msgid "Remove from Favorites"
msgstr "Удалить из Избранного"
msgid "Add to Favorites"
msgstr "Добавить в Избранное"
msgid "Remove from Desktop" msgid "Remove from Desktop"
msgstr "Удалить с рабочего стола" msgstr "Удалить с рабочего стола"
@@ -48,6 +54,14 @@ msgstr "Удалить из Steam"
msgid "Add to Steam" msgid "Add to Steam"
msgstr "Добавить в Steam" msgstr "Добавить в Steam"
#, python-brace-format
msgid "Added '{0}' to favorites"
msgstr "Добавление '{0}' в избранное"
#, python-brace-format
msgid "Removed '{0}' from favorites"
msgstr "Удаление '{0}' из избранного"
msgid "Error" msgid "Error"
msgstr "Ошибка" msgstr "Ошибка"