game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
recommendations_widget.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// recommendations_widget.h
4// ==============================================================================
5// Unified game recommendations panel combining all data sources
6// (ProtonDB, Steam Deck, Lutris, Native Linux detection)
7// ==============================================================================
8
9#pragma once
10
12
13#include <QFrame>
14#include <QFuture>
15#include <QFutureWatcher>
16#include <QLabel>
17#include <QPushButton>
18#include <QTextEdit>
19#include <QWidget>
20
21class QVBoxLayout;
22class QGroupBox;
23class ThemeManager;
24
25/**
26 * @class RecommendationsWidget
27 * @brief Unified widget for displaying game compatibility and recommendations
28 *
29 * Combines data from multiple sources:
30 * - ProtonDB (tier, tweaks, notes)
31 * - Steam Deck compatibility (Valve verification)
32 * - Lutris installers
33 * - Native Linux detection
34 *
35 * Displays a confidence score and provides a single "Apply" button.
36 */
37class RecommendationsWidget : public QFrame
38{
39 Q_OBJECT
40
41 public:
42 explicit RecommendationsWidget(QWidget* parent = nullptr, ThemeManager* themeManager = nullptr);
43 ~RecommendationsWidget() override;
44
45 /// Load recommendations for a game by Steam App ID
46 void loadRecommendations(int steamAppId, const QString& gameName);
47
48 /// Set recommendations directly (for when already fetched)
49 void setRecommendations(const GameSuggestions& suggestions);
50
51 /// Clear all displayed data
52 void clear();
53
54 /// Get the current recommendations (for applying)
56 {
57 return currentSuggestions_;
58 }
59
60 /// Check if recommendations are available
61 bool hasRecommendations() const
62 {
63 return currentSuggestions_.hasRecommendations();
64 }
65
66 signals:
67 /// Emitted when user clicks "Apply Recommendations"
68 void applyRequested(const GameSuggestions& suggestions);
69
70 /// Emitted when loading completes (async)
71 void loadingComplete(bool success);
72
73 private slots:
74 void onApplyClicked();
75 void onViewProtonDBClicked();
76 void applyTheme();
77
78 private:
79 void setupUI();
80 void updateDisplay();
81 void updateConfidenceBadge();
82 void updateDataSources();
83 void updateSuggestionsList();
84
85 // UI components
86 QLabel* confidenceBadge_ = nullptr;
87 QLabel* confidenceSummary_ = nullptr;
88
89 // Data sources grid
90 QLabel* protondbLabel_ = nullptr;
91 QLabel* steamDeckLabel_ = nullptr;
92 QLabel* lutrisLabel_ = nullptr;
93 QLabel* nativeLabel_ = nullptr;
94
95 // Suggestions list
96 QTextEdit* suggestionsText_ = nullptr;
97
98 // Action buttons
99 QPushButton* applyBtn_ = nullptr;
100 QPushButton* viewProtonDBBtn_ = nullptr;
101
102 // Current data
103 GameSuggestions currentSuggestions_;
104 int currentSteamAppId_ = 0;
105
106 // Async loading support - tracks pending fetch operations
107 QFutureWatcher<GameSuggestions>* fetchWatcher_ = nullptr;
108
109 ThemeManager* themeManager_;
110};
bool hasRecommendations() const
Check if recommendations are available.
RecommendationsWidget(QWidget *parent=nullptr, ThemeManager *themeManager=nullptr)
void setRecommendations(const GameSuggestions &suggestions)
Set recommendations directly (for when already fetched).
void loadRecommendations(int steamAppId, const QString &gameName)
Load recommendations for a game by Steam App ID.
void applyRequested(const GameSuggestions &suggestions)
Emitted when user clicks "Apply Recommendations".
void clear()
Clear all displayed data.
void loadingComplete(bool success)
Emitted when loading completes (async).
const GameSuggestions & getCurrentSuggestions() const
Get the current recommendations (for applying).
Collection of suggestions for a game.