feat: added egs badge

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
Boris Yumankulov 2025-06-04 09:50:24 +05:00
parent 768d437dda
commit a31c9dc186
Signed by: Boria138
GPG Key ID: 14B4A5673FD39C76
2 changed files with 52 additions and 13 deletions

View File

@ -156,6 +156,20 @@ class GameCard(QFrame):
steam_visible = (str(steam_game).lower() == "true")
self.steamLabel.setVisible(steam_visible)
# Epic Games Store бейдж
egs_icon = self.theme_manager.get_icon("steam")
self.egsLabel = ClickableLabel(
"Epic Games",
icon=egs_icon,
parent=coverWidget,
icon_size=16,
icon_space=5,
)
self.egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
self.egsLabel.setFixedWidth(int(card_width * 2/3)) # Устанавливаем ширину в 2/3 ширины карточки
egs_visible = (str(steam_game).lower() == "epic")
self.egsLabel.setVisible(egs_visible)
# WeAntiCheatYet бейдж
anticheat_text = self.getAntiCheatText(anticheat_status)
if anticheat_text:
@ -187,6 +201,11 @@ class GameCard(QFrame):
steam_x = card_width - badge_width - right_margin
self.steamLabel.move(steam_x, top_y)
badge_y_positions.append(top_y + self.steamLabel.height())
if egs_visible:
egs_x = card_width - badge_width - right_margin
egs_y = badge_y_positions[-1] + badge_spacing if badge_y_positions else top_y
self.egsLabel.move(egs_x, egs_y)
badge_y_positions.append(egs_y + self.egsLabel.height())
if protondb_visible:
protondb_x = card_width - badge_width - right_margin
protondb_y = badge_y_positions[-1] + badge_spacing if badge_y_positions else top_y
@ -199,6 +218,7 @@ class GameCard(QFrame):
self.anticheatLabel.raise_()
self.protondbLabel.raise_()
self.egsLabel.raise_()
self.steamLabel.raise_()
self.protondbLabel.clicked.connect(self.open_protondb_report)
self.steamLabel.clicked.connect(self.open_steam_page)
@ -219,16 +239,16 @@ class GameCard(QFrame):
@staticmethod
def getAntiCheatText(status: str) -> str:
if not status:
return ""
translations = {
"supported": _("Supported"),
"running": _("Running"),
"planned": _("Planned"),
"broken": _("Broken"),
"denied": _("Denied")
}
return translations.get(status.lower(), "")
if not status:
return ""
translations = {
"supported": _("Supported"),
"running": _("Running"),
"planned": _("Planned"),
"broken": _("Broken"),
"denied": _("Denied")
}
return translations.get(status.lower(), "")
@staticmethod
def getAntiCheatIconFilename(status: str) -> str:
@ -273,9 +293,9 @@ class GameCard(QFrame):
QDesktopServices.openUrl(url)
def open_weanticheatyet_page(self):
formatted_name = self.name.lower().replace(" ", "-")
url = QUrl(f"https://areweanticheatyet.com/game/{formatted_name}")
QDesktopServices.openUrl(url)
formatted_name = self.name.lower().replace(" ", "-")
url = QUrl(f"https://areweanticheatyet.com/game/{formatted_name}")
QDesktopServices.openUrl(url)
def update_favorite_icon(self):
if self.is_favorite:

View File

@ -1432,6 +1432,20 @@ class MainWindow(QMainWindow):
steamLabel.setVisible(steam_visible)
steamLabel.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(f"https://steamcommunity.com/app/{appid}")))
# Epic Games Store бейдж
egs_icon = self.theme_manager.get_icon("steam")
egsLabel = ClickableLabel(
"Epic Games",
icon=egs_icon,
parent=coverFrame,
icon_size=16,
icon_space=5,
)
egsLabel.setStyleSheet(self.theme.STEAM_BADGE_STYLE)
egsLabel.setFixedWidth(badge_width)
egs_visible = (str(steam_game).lower() == "epic")
egsLabel.setVisible(egs_visible)
# WeAntiCheatYet бейдж
anticheat_text = GameCard.getAntiCheatText(anticheat_status)
if anticheat_text:
@ -1459,6 +1473,11 @@ class MainWindow(QMainWindow):
steam_x = 300 - badge_width - right_margin
steamLabel.move(steam_x, top_y)
badge_y_positions.append(top_y + steamLabel.height())
if egs_visible:
egs_x = 300 - badge_width - right_margin
egs_y = badge_y_positions[-1] + badge_spacing if badge_y_positions else top_y
egsLabel.move(egs_x, egs_y)
badge_y_positions.append(egs_y + egsLabel.height())
if protondb_visible:
protondb_x = 300 - badge_width - right_margin
protondb_y = badge_y_positions[-1] + badge_spacing if badge_y_positions else top_y