From f236032cf988950c12ebd8ff5e3cd3f9778ea55a Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Thu, 10 Dec 2020 19:18:00 -0500 Subject: Allow adding unique userdata to instances --- singleapplication.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'singleapplication.cpp') diff --git a/singleapplication.cpp b/singleapplication.cpp index a4f842e..276ceee 100644 --- a/singleapplication.cpp +++ b/singleapplication.cpp @@ -36,7 +36,7 @@ * @param options Optional flags to toggle specific behaviour * @param timeout Maximum time blocking functions are allowed during app load */ -SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary, Options options, int timeout ) +SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary, Options options, int timeout, QString userData ) : app_t( argc, argv ), d_ptr( new SingleApplicationPrivate( this ) ) { Q_D( SingleApplication ); @@ -51,6 +51,10 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda // Store the current mode of the program d->options = options; + // Add any unique user data + if ( ! userData.isEmpty() ) + d->addAppData( userData ); + // Generating an application ID used for identifying the shared memory // block and QLocalServer d->genBlockServerName(); @@ -262,3 +266,9 @@ void SingleApplication::abortSafely() delete d; ::exit( EXIT_FAILURE ); } + +QStringList SingleApplication::userData() +{ + Q_D( SingleApplication ); + return d->appData(); +} -- cgit v1.2.1