game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
app_controller.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// ==============================================================================
3// app_controller.h
4// ==============================================================================
5// Main application controller - orchestrates all sub-controllers
6// This is the primary interface between UI and business logic
7// ==============================================================================
8
9#pragma once
10
11#include <memory>
12#include <string>
13
14namespace core
15{
16
17// Forward declarations
21class SteamController;
23
24// ==============================================================================
25// AppController
26// ==============================================================================
27// Central orchestrator for the application.
28// UI layers create one instance and access sub-controllers through it.
29// Handles initialization, shutdown, and cross-controller coordination.
30// ==============================================================================
31
33{
34 public:
37
38 // Non-copyable, non-movable (singleton-ish, but not enforced)
39 AppController(const AppController&) = delete;
41
42 // =========================================================================
43 // Initialization
44 // =========================================================================
45
46 /// Initialize the application
47 /// Must be called before using any controllers
48 /// @param notificationService UI's notification implementation
49 /// @return true if initialization successful
50 bool initialize(std::shared_ptr<INotificationService> notificationService);
51
52 /// Shutdown the application
53 /// Saves state, stops processes, cleans up resources
54 void shutdown();
55
56 /// Check if application is initialized
57 bool isInitialized() const;
58
59 // =========================================================================
60 // Sub-Controller Access
61 // =========================================================================
62
63 /// Get the game library controller
66
67 /// Get the launch controller
69 const LaunchController& launcher() const;
70
71 /// Get the settings controller
74
75 /// Get the Steam integration controller
77 const SteamController& steam() const;
78
79 // =========================================================================
80 // Application-Level Operations
81 // =========================================================================
82
83 /// Process background tasks and update state
84 /// UI should call this periodically (e.g., each frame or on a timer)
85 void update();
86
87 /// Request application exit
88 /// Returns true if safe to exit, false if user should confirm (running games)
90
91 /// Force exit without confirmation
92 void forceExit();
93
94 /// Check if there are running games that would block exit
96
97 // =========================================================================
98 // Paths & Configuration
99 // =========================================================================
100
101 /// Get application data directory
102 std::string getDataDirectory() const;
103
104 /// Get application config directory
105 std::string getConfigDirectory() const;
106
107 /// Get application cache directory
108 std::string getCacheDirectory() const;
109
110 /// Get log file path
111 std::string getLogFilePath() const;
112
113 // =========================================================================
114 // Version & Info
115 // =========================================================================
116
117 /// Get application version string
118 static std::string getVersion();
119
120 /// Get application name
121 static std::string getAppName();
122
123 private:
124 class Impl;
125 std::unique_ptr<Impl> impl_;
126};
127
128} // namespace core
SettingsController & settings()
Get the settings controller.
std::string getLogFilePath() const
Get log file path.
std::string getDataDirectory() const
Get application data directory.
static std::string getVersion()
Get application version string.
SteamController & steam()
Get the Steam integration controller.
LaunchController & launcher()
Get the launch controller.
static std::string getAppName()
Get application name.
bool hasBlockingProcesses() const
Check if there are running games that would block exit.
void forceExit()
Force exit without confirmation.
void update()
Process background tasks and update state UI should call this periodically (e.g., each frame or on a ...
bool initialize(std::shared_ptr< INotificationService > notificationService)
Initialize the application Must be called before using any controllers.
AppController(const AppController &)=delete
const SteamController & steam() const
const LaunchController & launcher() const
bool isInitialized() const
Check if application is initialized.
void shutdown()
Shutdown the application Saves state, stops processes, cleans up resources.
const SettingsController & settings() const
bool requestExit()
Request application exit Returns true if safe to exit, false if user should confirm (running games).
std::string getConfigDirectory() const
Get application config directory.
std::string getCacheDirectory() const
Get application cache directory.
GameLibraryController & library()
Get the game library controller.
AppController & operator=(const AppController &)=delete
const GameLibraryController & library() const