Operating System Simulator Plugin
3.5.1
Unreal Engine plugin that simulates an Operating System Environment
|
Represents an operating system in the simulation. More...
#include "OperatingSystem.h"
Public Member Functions | |
template<class T > | |
T * | GetAs () const |
Get a pointer to the object casted as type T. | |
template<class T > | |
FORCEINLINE const T * | GetAsConst () const |
Get a pointer to the object casted as type T. | |
OPERATINGSYSTEMSIMULATOR_API bool | AddNotification (const FOperatingSystemNotification &NewNotification) |
Adds a notification to the operating system. | |
OPERATINGSYSTEMSIMULATOR_API bool | AddNotification (const FGenericError &GenericError, const EOperatingSystemNotificationCategory &Category, const EOperatingSystemNotificationType Verbosity=EOperatingSystemNotificationType::Error) |
Adds a notification to the operating system. This method allows adding a notification to the operating system with the specified error, category, and verbosity. | |
void | StartOperatingSystem (const TWeakObjectPtr< const UOperatingSystemSaveGame > LoadGameInstance, FGenericError &OutError) |
Start the operating system. This method starts the operating system. It performs the necessary initialization and loads the settings and programs. | |
void | PostLoadOperatingSystem () |
Calls the PostLoadOperatingSystemImpl method and handles any error that occurs. | |
void | FinishInstallation () |
Finish the installation of the operating system. | |
void | InstallStartupPrograms () |
Install the startup programs for the operating system. | |
void | ShutdownOS () |
Shuts down the operating system. | |
void | RestartOS () |
Restarts the operating system. | |
void | DestroyOS () |
Destroys the operating system instance. | |
int32 | AddRunningProgram (UOperatingSystemBaseProgram *NewProgram, FGenericError &OutError) |
Adds a running program to the operating system. | |
void | ProgramStarted (UOperatingSystemBaseProgram *StartedProgram, const bool bIsRestored) |
Notifies the operating system that a program has started. | |
bool | IsProgramRunning (const TWeakObjectPtr< const UOperatingSystemBaseProgram > TestProgram) const |
Check if a program is running. | |
bool | IsProgramRunning (const TSubclassOf< UOperatingSystemBaseProgram > TestProgramClass) const |
Checks if a program of the specified class is currently running. | |
UDraggableWindow * | CreateNewWindow (TWeakObjectPtr< UOperatingSystemBaseProgram > TargetProgram) const |
Creates a new window for the target program. | |
void | BringWindowToFront (UDraggableWindow *TargetWindow) |
Bring the specified window to the front. | |
virtual UOperatingSystemDirectory * | CreateDirectoryInPath (const FString &TargetPath, const FString &DirectoryName, TSoftClassPtr< UOperatingSystemDirectory > DirectoryClass, UOperatingSystemPartition *TargetPartition, const bool bIsFromSaveGame, FGenericError &OutError) |
Creates a directory in the given target path. | |
bool | CreateProgramsFromRepository (const TSoftObjectPtr< UOperatingSystemProgramsCollection > &TargetRepository, const bool bIsInstalledWithOS) |
Create programs from a given repository. | |
void | SetToInstallStartupPrograms (const bool bInstall) |
bool | ShouldInstallStartupPrograms () const |
void | SetDeviceName (const FText &NewName) |
FText | GetDeviceName () const |
void | SetAutoLogin (const bool bEnableAutoLogin) |
bool | CanAutoLogin () const |
float | GetInstallationTime () const |
float | GetLoadingTime () const |
float | GetInitialLoadingTime () const |
const TArray< FOperatingSystemNotification > & | GetNotifications () const |
void | ClearAllNotifications () |
OPERATINGSYSTEMSIMULATOR_API void | ConsumeSpaceInMB (const float &NewSizeInMB, UOperatingSystemPartition *Partition, FGenericError &OutError) |
OPERATINGSYSTEMSIMULATOR_API void | ConsumeSpaceInGB (const float &NewSizeInGB, UOperatingSystemPartition *Partition, FGenericError &OutError) |
OPERATINGSYSTEMSIMULATOR_API FText | GetSizeAsText (const EOperatingSystemSizeMethod SizeMethod, const UOperatingSystemPartition *Partition, FGenericError &OutError) const |
OPERATINGSYSTEMSIMULATOR_API float | GetStoragePercentage (const UOperatingSystemPartition *Partition, FGenericError &OutError) const |
OPERATINGSYSTEMSIMULATOR_API double | GetHardDiskSize (FGenericError &OutError, const EOperatingSystemSizeMethod SizeMethod=EOperatingSystemSizeMethod::GB) const |
void | UninstallProgram (const FName &ProgramIdentifier, FGenericError &OutErrorIfAny) |
void | UninstallProgramByClass (const TSoftClassPtr< UOperatingSystemBaseProgram > ProgramClass, FGenericError &OutErrorIfAny) |
UOperatingSystemBaseProgram * | InstallProgramFromPackage (const FName &ProgramIdentifier, FGenericError &OutErrorIfAny) |
UOperatingSystemBaseProgram * | InstallProgramFromClass (FGenericError &OutErrorIfAny, const TSoftClassPtr< UOperatingSystemBaseProgram > ProgramClass, UOperatingSystemPartition *TargetPartition=nullptr) |
void | BeginInstallation (UOperatingSystemPartition *TargetPartition, FGenericError &OutError) |
UOperatingSystemPartition * | AllocatePartition (const double SizeInBytes, FGenericError &OutError) |
void | RemovePartition (UOperatingSystemPartition *PartitionToDelete, FGenericError &OutError) |
void | RefreshPartitions () |
void | InstallationCompleted (const bool bSwitchToDesktop=true) |
bool | CreateNewUser (const FOperatingSystemUser &NewUser, const bool bSetAsActive=false) |
bool | LoginUser (const FText &Username, const FText &Password) |
bool | UpdateCurrentUserDetails (const FOperatingSystemUser &UpdatedDetails) |
bool | HasEnoughSpace (const double &TestSizeInBytes, const UOperatingSystemPartition *InPartition) const |
TArray< UOperatingSystemPartition * > | GetDiskPartitions () const |
UOperatingSystemPartition * | GetOperatingSystemPartition () const |
void | CloseProgram (UOperatingSystemBaseProgram *TargetProgram, FGenericError &OutError) |
bool | BringBackgroundProgramToFront (UOperatingSystemBaseProgram *TargetProgram) |
bool | IsProgramInBackground (UOperatingSystemBaseProgram *TestProgram) const |
void | MinimizeProgram (UOperatingSystemBaseProgram *TargetProgram) |
void | CloseAllRunningPrograms () |
void | RestoreMinimizedProgram (const UOperatingSystemBaseProgram *TargetProgram) |
Restores a minimized program to the foreground on the operating system's taskbar. | |
UObject * | GetDirectoryIconObject (const FGameplayTag &TestTag) const |
bool | IsUnix () const |
float | GetBsodOnScreenTime () const |
float | GetToastNotificationDisplayTime () const |
TArray< UOperatingSystemBaseProgram * > | GetInstalledPrograms () const |
void | GetInstalledProgramsMap (TMap< FName, UOperatingSystemBaseProgram * > &OutInstalledPrograms) |
UOperatingSystemBaseProgram * | GetInstalledProgram (const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const |
bool | IsProgramInstalled (const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const |
UOperatingSystemBaseProgram * | GetRunningProgram (const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const |
bool | IsPreInstalledOperatingSystem () const |
UOperatingSystemSettingsData * | GetSettings () const |
bool | IsRunningOnPortableDevice () const |
virtual UOperatingSystemPartition * | FindPartitionFromLetter (const FName &TargetDiskLetter) const |
Find a partition in the operating system from a given disk letter. | |
virtual TOptional< FText > | GetRootCommand () const |
Retrieves the root command associated with the operating system. | |
virtual TOptional< FOperatingSystemUser > | GetRootUser () const |
Returns the root user of the operating system. This method retrieves the root user of the operating system and returns it as an optional object. If the root user cannot be determined or is not available, an empty optional object is returned. | |
bool | HasValidRootCommandAndUser () const |
Determines whether the root command and user are valid. | |
bool | IsShuttingDown () const |
Check if the operating system is in the process of shutting down. | |
bool | IsRestarting () const |
Checks if the operating system is currently restarting. | |
TArray< FOperatingSystemUser > | GetAllUsers () const |
Returns an array of all users registered in the operating system. This function retrieves information about all users registered in the operating system. | |
Static Public Member Functions | |
static FName | GetOperatingSystemProgramRestoredEventName () |
static UE_NODISCARD UOperatingSystem * | CreateOperatingSystem (UOperatingSystemBaseDevice *OwningDevice, FGenericError &OutError) |
Creates a new instance of the operating system associated with the specified device. | |
static UE_NODISCARD FString | GetOperatingSystemUniqueID (const UOperatingSystem *TestOperatingSystem) |
Gets the unique ID of the operating system. This method retrieves the unique ID of the operating system represented by the given TestOperatingSystem object. | |
Public Attributes | |
FOperatingSystemProgramDelegate | OnProgramStarted |
Delegate representing the event when a program starts in the operating system. | |
FOperatingSystemProgramDelegate | OnProgramClosed |
Delegate for handling the program closed event. | |
FOperatingSystemProgramDelegate | OnProgramInstalled |
Delegate representing the event when a program is installed in the operating system. | |
FOperatingSystemProgramDelegate | OnProgramUninstalled |
Protected Member Functions | |
virtual OPERATINGSYSTEMSIMULATOR_API void | OnShowNotification (const FOperatingSystemNotification &NewNotification) |
This method is called when a new notification should be shown on the operating system. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | OnAllOnNotificationsCleared () |
Callback triggered when all notifications are cleared. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | OnValidate (FGenericError &OutError) const |
This method is called to validate the object's state. This method should be overridden by derived classes to provide specific validation logic for the object. The validation result should be stored in the OutError parameter. If there are any validation errors, they should be added to the OutError object using its MAKE_ERROR macro. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | FinalizePreInstallation (FGenericError &OutError) |
Finalizes the pre-installation process. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | PrepareOperatingSystemInstallImpl (FGenericError &OutError) |
Prepares the operating system for installation. | |
virtual OPERATINGSYSTEMSIMULATOR_API bool | StartOperatingSystemImpl (FGenericError &OutError) |
Starts the implementation of the operating system. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | PostLoadOperatingSystemImpl (FGenericError &OutError) |
This method is responsible for performing additional actions after the operating system is loaded. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | FinishInstallationImpl () |
Performs the finishing steps of the installation process. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | InstallStartupProgramsImpl () |
Allows the derived classes to implement their own logic for installing startup programs. This method should be overridden in derived classes to define the actual logic for installing startup programs. | |
virtual OPERATINGSYSTEMSIMULATOR_API void | OnPartitionLoaded (UOperatingSystemPartition &LoadedPartition, const FOperatingSystemPartitionSaveLoad &SaveLoadData) |
Callback method called when a partition is loaded. | |
virtual OPERATINGSYSTEMSIMULATOR_API TSoftClassPtr< UOperatingSystemBaseProgram > | FindProgramFromPackage (const FName &ProgramIdentifier) |
Finds the program corresponding to the given package identifier. This method searches for a program based on the provided package identifier. | |
bool | K2_CanStartOperatingSystem (FGenericError &ReturnError) |
Determines if the operating system can start. | |
Represents an operating system in the simulation.
UOperatingSystem is a subclass of UObject and it contains various properties and methods related to an operating system, such as its name, version, supported devices, installed programs, etc. DO NOT inherit from this class directly.
bool UOperatingSystem::AddNotification | ( | const FGenericError & | GenericError, |
const EOperatingSystemNotificationCategory & | Category, | ||
const EOperatingSystemNotificationType | Verbosity = EOperatingSystemNotificationType::Error ) |
Adds a notification to the operating system. This method allows adding a notification to the operating system with the specified error, category, and verbosity.
GenericError | The error information for the notification. |
Category | The category of the notification. |
Verbosity | Verbosity level. |
bool UOperatingSystem::AddNotification | ( | const FOperatingSystemNotification & | NewNotification | ) |
Adds a notification to the operating system.
This method adds a notification to the operating system. It checks if notifications are enabled in the notification settings before adding the notification. If notifications are not enabled, this method returns false. If notifications are enabled, it creates a notification manager and logs the new notification.
If the new notification is an error, it increments the total error notifications count and plays an error notification sound if enabled. If the new notification is a warning, it increments the total warning notifications count and plays a warning notification sound if enabled. If the new notification is neither an error nor a warning, it plays the default notification sound if enabled.
NewNotification | The notification to be added to the operating system. |
int32 UOperatingSystem::AddRunningProgram | ( | UOperatingSystemBaseProgram * | NewProgram, |
FGenericError & | OutError ) |
Adds a running program to the operating system.
This method adds a running program to the operating system. The program must be installed and the operating system must be in a running state. If the program is a single instance program, it checks if it is already running.
NewProgram | The program to add to the operating system. |
OutError | The error message if the program cannot be added. |
UOperatingSystemPartition * UOperatingSystem::AllocatePartition | ( | const double | SizeInBytes, |
FGenericError & | OutError ) |
AllocatePartition is a method used to allocate a new partition on a specific device.
SizeInBytes | - The size of the partition to allocate in bytes. |
OutError | - Reference to an FGenericError object that will hold any error that occurs during partition allocation. |
void UOperatingSystem::BeginInstallation | ( | UOperatingSystemPartition * | TargetPartition, |
FGenericError & | OutError ) |
Begin installation of this Operating System. This is a simple timer which will call UOperatingSystem::FinishInstallation after the time returned by UOperatingSystem::GetInstallationTime()
TargetPartition | Which partition to install to? Must not be null. |
OutError | [FGenericError&] Outputs error (if any). Use the IsValid in this struct to check if there was any error. |
bool UOperatingSystem::BringBackgroundProgramToFront | ( | UOperatingSystemBaseProgram * | TargetProgram | ) |
Brings a background program to the foreground and activates it. The program must be currently running in the background, otherwise an error will be returned.
TargetProgram | The program to bring to the front. |
void UOperatingSystem::BringWindowToFront | ( | UDraggableWindow * | TargetWindow | ) |
Bring the specified window to the front.
This method is used to bring a draggable window to the front of all other windows in the operating system.
TargetWindow | The window to bring to the front. Must be a valid draggable window. |
bool UOperatingSystem::CanAutoLogin | ( | ) | const |
Checks if auto-login is enabled.
This method returns a boolean value indicating whether the auto-login feature is enabled or not.
void UOperatingSystem::ClearAllNotifications | ( | ) |
Clears all notifications on the operating system.
void UOperatingSystem::CloseAllRunningPrograms | ( | ) |
Closes all running programs in the operating system.
This method iterates over all the running programs in the operating system and calls the CloseProgram
method to close each program. If an error occurs while closing a program, an error is generated and stored in OutError
.
void UOperatingSystem::CloseProgram | ( | UOperatingSystemBaseProgram * | TargetProgram, |
FGenericError & | OutError ) |
Closes the given program.
TargetProgram | The program to close. |
OutError | The error encountered during the process. |
void UOperatingSystem::ConsumeSpaceInGB | ( | const float & | NewSizeInGB, |
UOperatingSystemPartition * | Partition, | ||
FGenericError & | OutError ) |
Consume space on the operating system partition in gigabytes.
NewSizeInGB | The amount of space to consume in gigabytes. |
Partition | The operating system partition on which to consume the space. |
OutError | (out) The error message if the operation fails. |
void UOperatingSystem::ConsumeSpaceInMB | ( | const float & | NewSizeInMB, |
UOperatingSystemPartition * | Partition, | ||
FGenericError & | OutError ) |
Consume the given amount of space in megabytes (MB) from a specific operating system partition.
This method consumes space from the specified partition of the operating system by delegating the task to the associated hard disk object. If the hard disk is not valid, an error is thrown and returned through the OutError parameter. If consuming space from the partition fails, an error notification is added.
NewSizeInMB | The amount of space to consume in megabytes (MB). |
Partition | The operating system partition from which to consume the space. |
OutError | An FGenericError object used to return any errors that occur during the operation. |
|
virtual |
Creates a directory in the given target path.
TargetPath | The target path where the directory will be created. |
DirectoryName | The name of the directory to be created. |
DirectoryClass | The class of the directory to be created. |
TargetPartition | The target partition where the directory will be created. |
bIsFromSaveGame | Specifies whether the directory is created from a save game. |
OutError | A reference to a FGenericError structure that will hold any error information. |
Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.
bool UOperatingSystem::CreateNewUser | ( | const FOperatingSystemUser & | NewUser, |
const bool | bSetAsActive = false ) |
Creates a new user in the operating system.
NewUser | The information of the new user to be created. |
bSetAsActive | Determines if the new user should be set as the active user. |
UDraggableWindow * UOperatingSystem::CreateNewWindow | ( | TWeakObjectPtr< UOperatingSystemBaseProgram > | TargetProgram | ) | const |
Creates a new window for the target program.
This method creates a new window for the target program specified.
TargetProgram | The target program for which the new window is to be created. |
|
static |
Creates a new instance of the operating system associated with the specified device.
This method creates a new instance of the operating system associated with the specified device. If the operating system class is null, an error will be returned indicating that the operating system is missing. Otherwise, a new instance of the operating system will be created and initialized.
OwningDevice | The device that the operating system belongs to. |
OutError | The error object that will be populated if an error occurs during the creation process. |
bool UOperatingSystem::CreateProgramsFromRepository | ( | const TSoftObjectPtr< UOperatingSystemProgramsCollection > & | TargetRepository, |
const bool | bIsInstalledWithOS ) |
Create programs from a given repository.
TargetRepository | The repository from which to create the programs. Must not be null. |
bIsInstalledWithOS | Determines whether the programs are installed with the operating system. |
void UOperatingSystem::DestroyOS | ( | ) |
Destroys the operating system instance.
This method is responsible for completely destroying the operating system instance and freeing up any resources it may have used. It performs the following actions:
|
inlineprotectedvirtual |
Finalizes the pre-installation process.
This method is used to perform any necessary finalization steps before installation. It is called during the pre-installation phase.
OutError | Reference to a FGenericError object that will be used to store any error information that occurs during the finalization process. |
Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.
|
inlinevirtual |
Find a partition in the operating system from a given disk letter.
This method searches for an operating system partition that corresponds to the provided disk letter.
TargetDiskLetter | The disk letter to search for. It should be of type FName. |
Reimplemented in UOperatingSystemNonUnix.
|
inlineprotectedvirtual |
Finds the program corresponding to the given package identifier. This method searches for a program based on the provided package identifier.
ProgramIdentifier | The package identifier of the program to be found. |
Reimplemented in UOperatingSystemUnix.
void UOperatingSystem::FinishInstallation | ( | ) |
Finish the installation of the operating system.
This method is responsible for completing the installation process of the operating system. It performs several tasks such as creating default directories, installing startup programs, finishing the installation implementation, and notifying the user about the completion. After installation, it checks if this is the first start of the operating system and starts it if required.
ParentDevice
has been assigned properly before calling this method.
|
inlineprotectedvirtual |
Performs the finishing steps of the installation process.
This method should be implemented by derived classes to perform any necessary operations to finalize the installation process. It is called after all the installation steps have been completed.
TArray< FOperatingSystemUser > UOperatingSystem::GetAllUsers | ( | ) | const |
Returns an array of all users registered in the operating system. This function retrieves information about all users registered in the operating system.
|
inline |
Get a pointer to the object casted as type T.
|
inline |
Get a pointer to the object casted as type T.
|
inline |
Returns the duration, in seconds, that the blue screen of death has been visible on the screen.
FText UOperatingSystem::GetDeviceName | ( | ) | const |
Returns the device name.
UObject * UOperatingSystem::GetDirectoryIconObject | ( | const FGameplayTag & | TestTag | ) | const |
Retrieves the directory icon object associated with the specified tag.
TestTag | The tag used to determine the directory icon object. |
TArray< UOperatingSystemPartition * > UOperatingSystem::GetDiskPartitions | ( | ) | const |
Retrieves the disk partitions associated with the operating system.
double UOperatingSystem::GetHardDiskSize | ( | FGenericError & | OutError, |
const EOperatingSystemSizeMethod | SizeMethod = EOperatingSystemSizeMethod::GB ) const |
Returns the Hard Disk total size in given method.
OutError | [FGenericError&] If any error this will be valid. |
SizeMethod | [const EOperatingSystemSizeMethod] How you want to represent the return size to be. |
float UOperatingSystem::GetInitialLoadingTime | ( | ) | const |
Gets the initial loading time.
This method returns the initial loading time of the operating system. If the initial loading time has not been cached yet, it will retrieve the value from the LoadingTimeInitial object and cache it for future requests.
float UOperatingSystem::GetInstallationTime | ( | ) | const |
Retrieves the installation time of the operating system.
UOperatingSystemBaseProgram * UOperatingSystem::GetInstalledProgram | ( | const TSoftClassPtr< UOperatingSystemBaseProgram > | TestClass | ) | const |
Retrieves the installed program of the specified class.
This method searches for an installed program in the list of installed programs that matches the specified class. If a matching program is found, it is returned; otherwise nullptr is returned.
TestClass | The pointer to the class of the program to retrieve. |
TArray< UOperatingSystemBaseProgram * > UOperatingSystem::GetInstalledPrograms | ( | ) | const |
[DEPRECATED] Get the list of installed programs.
void UOperatingSystem::GetInstalledProgramsMap | ( | TMap< FName, UOperatingSystemBaseProgram * > & | OutInstalledPrograms | ) |
Gets the TMap of installed programs.
OutInstalledPrograms | TMap of all installed programs with key set to their identifier. |
float UOperatingSystem::GetLoadingTime | ( | ) | const |
Get the loading time.
This method returns the loading time. If the loading time has not been previously set, it will calculate the loading time and store it in a cached variable for future retrieval. The loading time is obtained from the LoadingTime object.
|
inline |
Retrieves the notifications.
UOperatingSystemPartition * UOperatingSystem::GetOperatingSystemPartition | ( | ) | const |
Retrieves the operating system partition.
|
inlinestatic |
Helper function that returns the name of the event that is triggered when a program is restored in the Operating System.
|
static |
Gets the unique ID of the operating system. This method retrieves the unique ID of the operating system represented by the given TestOperatingSystem
object.
TestOperatingSystem | The operating system object to get the unique ID from. |
|
inlinevirtual |
Retrieves the root command associated with the operating system.
Reimplemented in UOperatingSystemUnix.
|
inlinevirtual |
Returns the root user of the operating system. This method retrieves the root user of the operating system and returns it as an optional object. If the root user cannot be determined or is not available, an empty optional object is returned.
Reimplemented in UOperatingSystemUnix.
UOperatingSystemBaseProgram * UOperatingSystem::GetRunningProgram | ( | const TSoftClassPtr< UOperatingSystemBaseProgram > | TestClass | ) | const |
Retrieves the running program that matches the given class.
TestClass | A soft class pointer to the program class. |
UOperatingSystemSettingsData * UOperatingSystem::GetSettings | ( | ) | const |
Retrieves the settings data object for this Operating System.
FText UOperatingSystem::GetSizeAsText | ( | const EOperatingSystemSizeMethod | SizeMethod, |
const UOperatingSystemPartition * | Partition, | ||
FGenericError & | OutError ) const |
Returns the size of the given partition.
SizeMethod | Your preferred method. Bytes, Megabytes or Gigabytes. |
Partition | Target partition to check size. |
OutError | Outputs error (if any). |
float UOperatingSystem::GetStoragePercentage | ( | const UOperatingSystemPartition * | Partition, |
FGenericError & | OutError ) const |
Returns the percentage of storage available. For example: 75%, 40% etc.
|
inline |
Retrieves the display time for toast notifications.
bool UOperatingSystem::HasEnoughSpace | ( | const double & | TestSizeInBytes, |
const UOperatingSystemPartition * | InPartition ) const |
Check if a given partition has enough space for a given size.
TestSizeInBytes | The size to test in bytes. |
InPartition | The partition to check the space on. |
|
inline |
Determines whether the root command and user are valid.
This method checks if the root command and user are both set, indicating that a valid root command and user have been provided.
void UOperatingSystem::InstallationCompleted | ( | const bool | bSwitchToDesktop = true | ) |
Marks the completion of the installation process.
This method sets the 'bIsStartingForTheTime' flag to false in order to indicate that the operating system has finished its initial setup. It also triggers the 'OnFinishSettingUpOperatingSystemPostInstallation' event on the parent device.
Optionally, this method switches the current tab of the operating system widget to the desktop tab.
bSwitchToDesktop | Whether to switch the current tab to the desktop tab (default: true) |
UOperatingSystemBaseProgram * UOperatingSystem::InstallProgramFromClass | ( | FGenericError & | OutErrorIfAny, |
const TSoftClassPtr< UOperatingSystemBaseProgram > | ProgramClass, | ||
UOperatingSystemPartition * | TargetPartition = nullptr ) |
Installs the given program class. If target partition is null, system partition is automatically used.
OutErrorIfAny | Outputs any error. Use the IsValid from this struct to check if there are any errors. |
ProgramClass | Target program class to install |
TargetPartition | Target partition to install. If null, then system partition is automatically used. |
UOperatingSystemBaseProgram * UOperatingSystem::InstallProgramFromPackage | ( | const FName & | ProgramIdentifier, |
FGenericError & | OutErrorIfAny ) |
Installs a program from a package.
This method installs a program from a package specified by the ProgramIdentifier parameter. If the program is found in the package repository, it will be installed and a pointer to the installed program will be returned. If the program is not found, an error message will be assigned to the OutErrorIfAny parameter and a nullptr will be returned.
ProgramIdentifier | The identifier of the program to install. |
OutErrorIfAny | [out] The error message if program installation fails. |
void UOperatingSystem::InstallStartupPrograms | ( | ) |
Install the startup programs for the operating system.
This method checks if the startup programs should be installed and then calls the InstallStartupProgramsImpl() method to perform the actual installation.
|
inlineprotectedvirtual |
Allows the derived classes to implement their own logic for installing startup programs. This method should be overridden in derived classes to define the actual logic for installing startup programs.
bool UOperatingSystem::IsPreInstalledOperatingSystem | ( | ) | const |
Check if the operating system is pre-installed on the parent device.
IsOperatingSystemPreInstalled
method of the parent device. bool UOperatingSystem::IsProgramInBackground | ( | UOperatingSystemBaseProgram * | TestProgram | ) | const |
Determines if the specified program is currently running in the background or not.
TestProgram | A pointer to the UOperatingSystemBaseProgram object to be tested. |
bool UOperatingSystem::IsProgramInstalled | ( | const TSoftClassPtr< UOperatingSystemBaseProgram > | TestClass | ) | const |
Checks if a program is installed. This method checks if a program, represented by the provided UOperatingSystemBaseProgram subclass, is installed on the system.
TestClass | The TSoftClassPtr<UOperatingSystemBaseProgram> representing the program to be checked. |
bool UOperatingSystem::IsProgramRunning | ( | const TSubclassOf< UOperatingSystemBaseProgram > | TestProgramClass | ) | const |
Checks if a program of the specified class is currently running.
TestProgramClass | The class of the program to check. |
bool UOperatingSystem::IsProgramRunning | ( | const TWeakObjectPtr< const UOperatingSystemBaseProgram > | TestProgram | ) | const |
Check if a program is running.
This method checks if a program is currently running based on the provided TestProgram.
TestProgram | A weak pointer to the UOperatingSystemBaseProgram object representing the program to be checked. |
bool UOperatingSystem::IsRestarting | ( | ) | const |
Checks if the operating system is currently restarting.
bool UOperatingSystem::IsRunningOnPortableDevice | ( | ) | const |
Checks to see if this Operating System is running on a portable device actor.
bool UOperatingSystem::IsShuttingDown | ( | ) | const |
Check if the operating system is in the process of shutting down.
This method determines whether the operating system is currently in the process of shutting down. It does this by calling the IsShuttingDown() method of the ParentDevice object.
|
inline |
Checks if the operating system is Unix.
|
protected |
Determines if the operating system can start.
This method checks if the operating system can start successfully. It is a BlueprintImplementableEvent, which means that it can be implemented in Blueprint classes.
ReturnError | [out] A reference to a FGenericError structure that will hold the error message if the operating system cannot start. |
bool UOperatingSystem::LoginUser | ( | const FText & | Username, |
const FText & | Password ) |
Logs the user in with the given username and password.
Username | The username of the user. |
Password | The password of the user. |
void UOperatingSystem::MinimizeProgram | ( | UOperatingSystemBaseProgram * | TargetProgram | ) |
Minimizes the specified program.
TargetProgram | The program to minimize. |
|
protectedvirtual |
Callback triggered when all notifications are cleared.
This function is called when all notifications are cleared in the operating system. It resets the total number of notifications, error notifications, and warning notifications. Then it calls the AllNotificationsCleared() function of the OperatingSystemWidget.
|
inlineprotectedvirtual |
Callback method called when a partition is loaded.
LoadedPartition | The reference to the loaded partition. |
SaveLoadData | The save/load data for the partition. |
Reimplemented in UOperatingSystemNonUnix.
|
protectedvirtual |
This method is called when a new notification should be shown on the operating system.
NewNotification | The new notification to be shown. |
|
inlineprotectedvirtual |
This method is called to validate the object's state. This method should be overridden by derived classes to provide specific validation logic for the object. The validation result should be stored in the OutError parameter. If there are any validation errors, they should be added to the OutError object using its MAKE_ERROR macro.
OutError | Reference to an FGenericError object that will be populated with any validation errors. |
Reimplemented in UOperatingSystemUnix.
void UOperatingSystem::PostLoadOperatingSystem | ( | ) |
Calls the PostLoadOperatingSystemImpl method and handles any error that occurs.
This method is responsible for initializing the operating system after it has been loaded. It calls the PostLoadOperatingSystemImpl method to perform the necessary initialization steps. If an error occurs during the initialization process, it sets the error in the BSODWidget and shows the Blue Screen of Death (BSOD) on the ParentDevice.
|
inlineprotectedvirtual |
This method is responsible for performing additional actions after the operating system is loaded.
OutError | A reference to the FGenericError object that can be used to report any errors that occur during the post-load process. |
Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.
|
inlineprotectedvirtual |
Prepares the operating system for installation.
This method is virtual and can be overridden in derived classes to implement the specific logic for preparing the operating system for installation. The implementation should set the error message in the provided FGenericError object if any error occurs during the preparation process.
OutError | A reference to the FGenericError object to store any error message generated during the preparation process. |
Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.
void UOperatingSystem::ProgramStarted | ( | UOperatingSystemBaseProgram * | StartedProgram, |
const bool | bIsRestored ) |
Notifies the operating system that a program has started.
This method is used to inform the operating system that a program has started. It takes a pointer to the UOperatingSystemBaseProgram object representing the started program, and a boolean indicating whether the program is being restored from a minimized state.
If the started program has a valid taskbar button, this method adds it to the list of taskbar buttons. The taskbar button is identified by the process ID of the started program.
If the program is not being restored, the "OnProgramStarted" event is broadcasted, indicating that the program has started.
StartedProgram | Pointer to the UOperatingSystemBaseProgram object representing the started program. |
bIsRestored | Boolean indicating whether the program is being restored from a minimized state. |
void UOperatingSystem::RefreshPartitions | ( | ) |
Refreshes the partitions of the operating system.
This method updates the partitions of the operating system based on the current state of the underlying hardware device.
void UOperatingSystem::RemovePartition | ( | UOperatingSystemPartition * | PartitionToDelete, |
FGenericError & | OutError ) |
Removes a partition from the operating system.
PartitionToDelete | The partition to be removed. |
OutError | The error message if any error occurs. |
void UOperatingSystem::RestartOS | ( | ) |
Restarts the operating system.
This method is used to restart the operating system. It first closes all the running programs and then initiates the restart process.
void UOperatingSystem::RestoreMinimizedProgram | ( | const UOperatingSystemBaseProgram * | TargetProgram | ) |
Restores a minimized program to the foreground on the operating system's taskbar.
This method attempts to restore the specified program identified by the given TargetProgram. If the program is currently minimized, it will be brought back to the foreground on the taskbar.
TargetProgram | The target program to restore. It must be a valid pointer to an instance of the UOperatingSystemBaseProgram class. |
void UOperatingSystem::SetAutoLogin | ( | const bool | bEnableAutoLogin | ) |
Sets the auto login flag for the operating system.
This method allows the user to enable or disable auto login for the operating system.
bEnableAutoLogin | - The value indicating whether auto login should be enabled or disabled.
|
void UOperatingSystem::SetDeviceName | ( | const FText & | NewName | ) |
Sets the name of the device.
This method allows the user to set the name of the device.
NewName | The new name of the device. |
void UOperatingSystem::SetToInstallStartupPrograms | ( | const bool | bInstall | ) |
Sets whether to install startup programs.
This method allows you to specify whether the operating system should install startup programs.
bInstall | A boolean value indicating whether startup programs should be installed. Set to true if startup programs should be installed, false otherwise. |
bool UOperatingSystem::ShouldInstallStartupPrograms | ( | ) | const |
Determines whether the startup programs should be installed.
false otherwise.
This method checks if the PostInstallStartupPrograms is null or empty. It also checks if the flag bInstallStartupPrograms is set to true. If both conditions are satisfied, the method returns true; otherwise, it returns false.
void UOperatingSystem::ShutdownOS | ( | ) |
Shuts down the operating system.
This method initiates the shutdown process for the operating system. It closes all running programs and triggers the shutdown procedure handled by the operating system widget.
void UOperatingSystem::StartOperatingSystem | ( | const TWeakObjectPtr< const UOperatingSystemSaveGame > | LoadGameInstance, |
FGenericError & | OutError ) |
Start the operating system. This method starts the operating system. It performs the necessary initialization and loads the settings and programs.
LoadGameInstance | A weak pointer to an instance of UOperatingSystemSaveGame containing the saved game data to load. This parameter is optional and can be nullptr if no saved game is available. |
OutError | A reference to an FGenericError object that will store any error that occurs during the startup process. Any error message will be stored in the OutError object. |
|
inlineprotectedvirtual |
Starts the implementation of the operating system.
This method starts the implementation of the operating system. It performs the necessary steps to initiate the operating system functionality.
OutError | Reference to a FGenericError object that will store any errors that occur during the operation. |
Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.
void UOperatingSystem::UninstallProgram | ( | const FName & | ProgramIdentifier, |
FGenericError & | OutErrorIfAny ) |
Uninstalls the given program identifier from this Operating System.
ProgramIdentifier | Identifier of the program to uninstall. |
OutErrorIfAny | Outputs uninstall error (if any). |
void UOperatingSystem::UninstallProgramByClass | ( | const TSoftClassPtr< UOperatingSystemBaseProgram > | ProgramClass, |
FGenericError & | OutErrorIfAny ) |
Uninstalls the given program class from this Operating System.
ProgramClass | Target program class to uninstall. |
OutErrorIfAny | Outputs uninstall error (if any). |
bool UOperatingSystem::UpdateCurrentUserDetails | ( | const FOperatingSystemUser & | UpdatedDetails | ) |
Updates the details for the current user. If you don't want specific settings to change simply leave them empty or null.
UpdatedDetails | Settings to update. If a setting is left null or empty, that is not updated. |
|
protected |
All running programs in background. The key is the Process ID and value is the program.
|
protected |
Specifies whether the application should automatically login the user.
|
protected |
Specifies whether to install startup programs on the operating system.
|
protected |
True if the Operating System is starting for the first time after installation.
|
protected |
Time it takes for BSOD to stay on screen
|
protected |
Current BSOD widget.
|
protected |
Operating System Widget class.
|
protected |
Company that made this operating system. Think of this as just Microsoft or Apple or Canonical etc.
|
protected |
Active user.
|
protected |
Default directories to automatically create when installing this Operating System.
|
protected |
Can be computer name also like JohnDoes-PC.
|
protected |
Icons for each type of directory.
|
protected |
An icon (either texture or user interface material) for this Operating System.
|
protected |
Space required by this OS for installation. Remember, this is all simulated so don't worry about anything related to your PC.
|
protected |
Installation time for installing this Operating System.
|
protected |
All the programs that are currently installed.
|
protected |
Transient variable representing the last draggable window brought to the front.
It is a weak pointer to an instance of UDraggableWindow class. This variable is transient, meaning that it is not serialized and doesn't persist across sessions.
|
protected |
Time it takes for the Operating System to show loading screen and then change to logon screen.
|
protected |
Time it takes for the Operating System to load for the first time after installation. Typically this will be set higher than Loading Time.
|
protected |
Time it takes to transition from Logon screen to Desktop.
|
protected |
These are programs that must be installed with Operating System. For example: File explorer, terminal, web browser etc.
|
protected |
Name of this operating system. Think of this as just Windows or MacOS or Ubuntu etc.
|
protected |
Notification settings.
FOperatingSystemProgramDelegate UOperatingSystem::OnProgramClosed |
Delegate for handling the program closed event.
This delegate can be assigned a blueprint callable function to handle the event when the program is closed.
Example usage:
FOperatingSystemProgramDelegate UOperatingSystem::OnProgramInstalled |
Delegate representing the event when a program is installed in the operating system.
This delegate is used to handle the event when a program is installed in the operating system. It can be assigned a function or method with the appropriate signature to handle the event.
Example usage:
FOperatingSystemProgramDelegate UOperatingSystem::OnProgramStarted |
Delegate representing the event when a program starts in the operating system.
This delegate is used to handle the event when a program starts in the operating system. It can be bound to functions or methods that need to be executed when a program is started.
Usage example:
FOperatingSystemProgramDelegate UOperatingSystem::OnProgramUninstalled |
|
protected |
Settings data for this operating system.
|
protected |
Tag to identify this Operating System.
|
protected |
Reference to the Operating System widget.
|
protected |
The device this Operating System is running on.
|
protected |
List of programs that can be optionally installed after installing the Operating System.
|
protected |
All running programs in this Operating System. The key is the Process ID and value is the program.
|
protected |
A data class that holds all settings (like theme, wallpapers etc) for this Operating System.
|
protected |
List of devices this Operating System supports. If empty, it is assumed all devices are supported.
|
protected |
Structure representing a unique identifier for a target partition in the operating system.
This identifier is transient, meaning it is not meant to be stored or persisted. It is used for temporary identification purposes only.
|
protected |
Transient variable representing the taskbar buttons. It is a TMap that associates integer keys with weak object pointers to UOperatingSystemTaskbarButton objects. Key will be the process ID. Value will be the program.
|
protected |
Timer handle for loading time.
|
protected |
Timer handle for operating system installation.
|
protected |
Total error notifications received.
|
protected |
Total notifications received.
|
protected |
Total warning notifications received.
|
protected |
Current version of this Operating System.
|
protected |
Operating System Widget class.