Application
The main application class that manages the launcher’s global state and resources.
Class: Application
Header: launcher/Application.h
Inherits: QApplication
Constructor
Application ( int & argc, char ** argv);
Creates the main application instance with command-line arguments.
Key Methods
Returns the global settings object for the application.
Returns the instance list manager containing all Minecraft instances.
Returns the account list for managing Minecraft accounts.
Returns the network access manager for HTTP requests.
Returns the HTTP metadata cache for managing downloaded files.
Returns the metadata index for Minecraft versions and components.
Path Management
Returns the root installation directory path.
Returns the data directory path where instances are stored.
Returns the Java installation path.
Instance Management
bool launch (
BaseInstance * instance ,
LaunchMode mode = LaunchMode :: Normal ,
std :: shared_ptr < MinecraftTarget > targetToJoin = nullptr ,
shared_qobject_ptr < MinecraftAccount > accountToUse = nullptr ,
const QString & offlineName = QString ()
);
Launches a Minecraft instance with optional server joining and account selection. bool kill ( BaseInstance * instance );
Terminates a running instance.
Capabilities
enum Capability {
None = 0 ,
SupportsMSA = 1 << 0 , // Microsoft Account support
SupportsFlame = 1 << 1 , // CurseForge API support
SupportsGameMode = 1 << 2 , // Linux GameMode support
SupportsMangoHud = 1 << 3 // MangoHud overlay support
};
Check capabilities with:
const Capabilities caps = APPLICATION -> capabilities ();
if (caps & Application ::SupportsMSA) {
// Microsoft authentication is available
}
Example Usage
#include "Application.h"
// Access the singleton application instance
auto * app = APPLICATION;
// Get global settings
SettingsObject * settings = app -> settings ();
// Get instance list
InstanceList * instances = app -> instances ();
// Launch an instance
BaseInstance * instance = instances -> getInstanceById ( "my_instance" );
if (instance) {
app -> launch (instance);
}
BaseInstance
Base class for all Minecraft instances, providing common functionality.
Class: BaseInstance
Header: launcher/BaseInstance.h
Inherits: QObject
Constructor
BaseInstance (
SettingsObject * globalSettings,
std ::unique_ptr < SettingsObject > settings,
const QString & rootDir
);
Identity and Naming
Returns the unique instance ID.
Returns the display name of the instance.
Sets the display name of the instance.
Returns the title used for instance windows.
Path Management
Returns the root directory of the instance.
Returns the game root directory (usually same as instanceRoot).
Returns the mods directory path (pure virtual, implemented by subclasses).
Status and State
enum class Status {
Present , // Instance is valid and present
Gone // Instance was removed or invalidated
};
Returns the current status of the instance.
Returns true if the instance is currently running.
Time Tracking
Returns total playtime in milliseconds.
Returns last session duration in milliseconds.
Returns timestamp of last launch (milliseconds since epoch).
setLastLaunch(qint64 val)
Sets the last launch timestamp.
Settings and Configuration
Returns instance-specific settings object.
Returns user notes for this instance.
Sets user notes for this instance.
Launch Commands
Returns command to execute before launching.
Returns command to execute after game exits.
Returns wrapper command for the game process.
Managed Pack Support
Show Managed Pack Methods
Returns true if this is a managed modpack instance.
Returns the pack type (e.g., “curseforge”, “modrinth”).
Returns the pack’s unique identifier.
getManagedPackVersionID()
Returns the current version identifier.
void setManagedPack (
const QString & type ,
const QString & id ,
const QString & name ,
const QString & versionId ,
const QString & version
);
Configures this instance as a managed pack.
Signals
signals:
void propertiesChanged ( BaseInstance * inst );
void runningStatusChanged ( bool running );
void statusChanged ( Status from , Status to );
Example Usage
#include "BaseInstance.h"
BaseInstance * instance = /* ... */ ;
// Get instance information
qDebug () << "Instance:" << instance -> name ();
qDebug () << "ID:" << instance -> id ();
qDebug () << "Path:" << instance -> instanceRoot ();
qDebug () << "Total playtime:" << instance -> totalTimePlayed () / 1000 << "seconds" ;
// Configure instance
instance -> setName ( "My Survival World" );
instance -> setNotes ( "Modded survival with friends" );
// Check if it's a managed pack
if ( instance -> isManagedPack ()) {
qDebug () << "Pack type:" << instance -> getManagedPackType ();
qDebug () << "Pack ID:" << instance -> getManagedPackID ();
}
InstanceList
Manages the collection of all Minecraft instances.
Class: InstanceList
Header: launcher/InstanceList.h
Inherits: QAbstractListModel
Constructor
InstanceList (
SettingsObject * settings,
const QString & instDir,
QObject * parent = 0
);
Accessing Instances
Returns the instance at the specified index.
Returns the total number of instances.
getInstanceById(QString id)
Finds an instance by its unique ID. Returns nullptr if not found. O(n) complexity.
getInstanceByManagedName(const QString& managed_name)
Finds an instance by its managed pack name. O(n) complexity.
Group Management
Returns list of all instance groups.
getInstanceGroup(const InstanceId& id)
Returns the group ID for an instance.
setInstanceGroup(const InstanceId& id, GroupId name)
Assigns an instance to a group.
deleteGroup(const GroupId& name)
Deletes a group (instances remain ungrouped).
renameGroup(const GroupId& src, const GroupId& dst)
Renames a group.
Instance Operations
bool trashInstance ( const InstanceId & id );
Moves an instance to trash. Can be undone. bool undoTrashInstance ();
Restores the last trashed instance. void deleteInstance ( const InstanceId & id );
Permanently deletes an instance (cannot be undone). Task * wrapInstanceTask ( InstanceTask * task );
Wraps an instance creation task for execution. QString getStagedInstancePath ();
Creates a staging area for instance creation. bool commitStagedInstance (
const QString & keyPath ,
const InstanceName & instanceName ,
QString groupName ,
const InstanceTask &
);
Commits a staged instance to the instance list.
Model Roles
enum AdditionalRoles {
GroupRole = Qt ::UserRole,
InstancePointerRole = 0x 34B1CB48 , // Returns BaseInstance*
InstanceIDRole = 0x 34B1CB49 // Returns instance ID
};
Signals
signals:
void instancesChanged ();
void groupsChanged ( QSet < QString > groups );
void instanceSelectRequest ( QString instanceId );
Example Usage
#include "InstanceList.h"
#include "Application.h"
// Get the instance list from the application
InstanceList * list = APPLICATION -> instances ();
// Iterate through all instances
for ( int i = 0 ; i < list -> count (); i ++ ) {
BaseInstance * inst = list -> at (i);
qDebug () << inst -> name () << "-" << inst -> id ();
}
// Find a specific instance
BaseInstance * inst = list -> getInstanceById ( "my_instance_id" );
if (inst) {
qDebug () << "Found instance:" << inst -> name ();
}
// Group management
list -> setInstanceGroup ( "my_instance_id" , "Modded" );
QStringList groups = list -> getGroups ();
// Trash an instance (can be undone)
if ( list -> trashInstance ( "old_instance_id" )) {
qDebug () << "Instance moved to trash" ;
// Changed your mind? Restore it
list -> undoTrashInstance ();
}