Manages a "system override" sequence involving visual and system-level changes.
More...
#include <system_override_manager.h>
|
| void | InitiateOverrideSequence (bool is_first_time) |
| | Initiates the full system override sequence. Installs input hooks (Windows), changes wallpaper, minimizes windows, sends a notification, and shows the floating animation widget.
|
| |
| void | RestoreSystemState () |
| | Restores the system state to normal. Uninstalls input hooks (Windows), restores the original wallpaper, removes the temporary wallpaper file, closes the floating widget, and emits overrideFinished(). On Windows, attempts to relaunch the application normally and quit the elevated instance.
|
| |
|
| void | overrideFinished () |
| | Emitted when the system override sequence has finished and the system state has been restored.
|
| |
|
| | SystemOverrideManager (QObject *parent=nullptr) |
| | Constructs a SystemOverrideManager. Initializes member variables, sets up the system tray icon for notifications, and initializes the media player. Performs COM initialization on Windows.
|
| |
| | ~SystemOverrideManager () override |
| | Destructor. Ensures the system state is restored if the override is active. Cleans up the floating widget, temporary wallpaper file, and uninstalls hooks on Windows. Performs COM uninitialization on Windows.
|
| |
|
| bool | SendSystemNotification (const QString &title, const QString &message) const |
| | Sends a system notification using QSystemTrayIcon. Ensures the tray icon is visible before sending.
|
| |
| void | ShowFloatingAnimationWidget (bool is_first_time) |
| | Creates, configures, positions, and shows the FloatingEnergySphereWidget. Connects the necessary signals for closing and sequence completion.
|
| |
|
| static bool | ChangeWallpaper () |
| | Saves the current wallpaper path and sets the desktop wallpaper to a temporary black image.
|
| |
| static bool | MinimizeAllWindows () |
| | Minimizes all open windows on the desktop (Windows only). Uses COM or a fallback method.
|
| |
| static bool | RelaunchNormally (const QStringList &arguments=QStringList()) |
| | Attempts to relaunch the application without administrative privileges (Windows only). Used after the override sequence to return to a normal instance.
|
| |
| static bool | RestoreWallpaper () |
| | Restores the original desktop wallpaper saved by ChangeWallpaper(). Also removes the temporary black wallpaper file.
|
| |
Manages a "system override" sequence involving visual and system-level changes.
This class orchestrates a sequence that:
- Changes the desktop wallpaper to black (saving the original).
- Minimizes all open windows.
- Displays a system notification.
- Shows a full-screen, interactive FloatingEnergySphereWidget.
- Optionally plays background audio.
- On Windows, installs low-level keyboard and mouse hooks to block most input, allowing only specific keys needed for an Easter egg within the floating widget.
It handles restoring the system state (wallpaper, unblocking input) when the sequence finishes or is interrupted. It also includes logic for checking admin privileges and relaunching the application with or without elevation on Windows.
◆ SystemOverrideManager()
| SystemOverrideManager::SystemOverrideManager |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Constructs a SystemOverrideManager. Initializes member variables, sets up the system tray icon for notifications, and initializes the media player. Performs COM initialization on Windows.
- Parameters
-
| parent | Optional parent QObject. |
◆ ~SystemOverrideManager()
| SystemOverrideManager::~SystemOverrideManager |
( |
| ) |
|
|
override |
Destructor. Ensures the system state is restored if the override is active. Cleans up the floating widget, temporary wallpaper file, and uninstalls hooks on Windows. Performs COM uninitialization on Windows.
◆ ChangeWallpaper()
| bool SystemOverrideManager::ChangeWallpaper |
( |
| ) |
|
|
staticprivate |
Saves the current wallpaper path and sets the desktop wallpaper to a temporary black image.
- Returns
- True on success, false otherwise.
◆ HandleFloatingWidgetClosed
| void SystemOverrideManager::HandleFloatingWidgetClosed |
( |
| ) |
|
|
privateslot |
Slot called when the FloatingEnergySphereWidget emits its widgetClosed signal. Cleans up the widget pointer and triggers system state restoration after a delay.
◆ InitiateOverrideSequence
| void SystemOverrideManager::InitiateOverrideSequence |
( |
bool | is_first_time | ) |
|
|
slot |
Initiates the full system override sequence. Installs input hooks (Windows), changes wallpaper, minimizes windows, sends a notification, and shows the floating animation widget.
- Parameters
-
| is_first_time | Flag indicating if this is the first time the sequence is run (affects floating widget's audio). |
◆ MinimizeAllWindows()
| bool SystemOverrideManager::MinimizeAllWindows |
( |
| ) |
|
|
staticprivate |
Minimizes all open windows on the desktop (Windows only). Uses COM or a fallback method.
- Returns
- True on success, false otherwise.
◆ overrideFinished
| void SystemOverrideManager::overrideFinished |
( |
| ) |
|
|
signal |
Emitted when the system override sequence has finished and the system state has been restored.
◆ RelaunchNormally()
| bool SystemOverrideManager::RelaunchNormally |
( |
const QStringList & | arguments = QStringList() | ) |
|
|
staticprivate |
Attempts to relaunch the application without administrative privileges (Windows only). Used after the override sequence to return to a normal instance.
- Parameters
-
| arguments | Optional command-line arguments to pass to the relaunched instance. |
- Returns
- True if the relaunch was successfully initiated, false otherwise.
◆ RestoreSystemState
| void SystemOverrideManager::RestoreSystemState |
( |
| ) |
|
|
slot |
Restores the system state to normal. Uninstalls input hooks (Windows), restores the original wallpaper, removes the temporary wallpaper file, closes the floating widget, and emits overrideFinished(). On Windows, attempts to relaunch the application normally and quit the elevated instance.
◆ RestoreWallpaper()
| bool SystemOverrideManager::RestoreWallpaper |
( |
| ) |
|
|
staticprivate |
Restores the original desktop wallpaper saved by ChangeWallpaper(). Also removes the temporary black wallpaper file.
- Returns
- True if the original wallpaper was successfully restored, false otherwise.
◆ SendSystemNotification()
| bool SystemOverrideManager::SendSystemNotification |
( |
const QString & | title, |
|
|
const QString & | message ) const |
|
nodiscardprivate |
Sends a system notification using QSystemTrayIcon. Ensures the tray icon is visible before sending.
- Parameters
-
| title | The title of the notification. |
| message | The main text content of the notification. |
- Returns
- True if the notification was sent successfully, false otherwise.
◆ ShowFloatingAnimationWidget()
| void SystemOverrideManager::ShowFloatingAnimationWidget |
( |
bool | is_first_time | ) |
|
|
private |
Creates, configures, positions, and shows the FloatingEnergySphereWidget. Connects the necessary signals for closing and sequence completion.
- Parameters
-
◆ floating_widget_
Pointer to the floating energy sphere widget instance.
◆ original_wallpaper_path_
| QString SystemOverrideManager::original_wallpaper_path_ |
|
private |
Stores the path to the user's original desktop wallpaper.
◆ override_active_
| bool SystemOverrideManager::override_active_ |
|
private |
Flag indicating if the system override sequence is currently active.
◆ temp_black_wallpaper_path_
| QString SystemOverrideManager::temp_black_wallpaper_path_ |
|
private |
Stores the path to the temporary black wallpaper image file.
◆ tray_icon_
| QSystemTrayIcon* SystemOverrideManager::tray_icon_ |
|
private |
System tray icon used for displaying notifications.
The documentation for this class was generated from the following files: