La fila és el botó: clic descarrega/actualitza o juga, amb text d'acció

This commit is contained in:
2026-05-29 22:03:41 +02:00
parent 694d67f11e
commit 0334e79480
2 changed files with 74 additions and 60 deletions
+9 -2
View File
@@ -53,8 +53,7 @@ class MainWindow(QMainWindow):
list_layout.setSpacing(6)
for game in config.games:
row = GameRow(game, root)
row.download_requested.connect(self._on_download)
row.run_requested.connect(self._on_run)
row.activated.connect(self._on_activate)
row.delete_requested.connect(self._on_delete)
self.rows[game.id] = row
list_layout.addWidget(row)
@@ -151,6 +150,14 @@ class MainWindow(QMainWindow):
# --------------------------------------------------------------- accions
def _on_activate(self, game: Game) -> None:
"""Clic sobre la fila: descarrega/actualitza si cal, si no juga."""
row = self.rows[game.id]
if row.primary_action_is_download():
self._on_download(game)
else:
self._on_run(game)
def _on_download(self, game: Game) -> None:
row = self.rows[game.id]
row.set_busy(True, "Descarregant…")