mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Replace qetsingleapplication by singleApplication.
See : https://github.com/itay-grudev/SingleApplication git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5481 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qetapp.h"
|
||||
#include "singleapplication.h"
|
||||
#include "qet.h"
|
||||
|
||||
/**
|
||||
* @brief main
|
||||
@@ -37,5 +39,21 @@ int main(int argc, char **argv)
|
||||
#else
|
||||
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
|
||||
#endif
|
||||
return(QETApp(argc, argv).exec());
|
||||
|
||||
SingleApplication app(argc, argv);
|
||||
|
||||
if (app.isSecondary())
|
||||
{
|
||||
QStringList strl = app.arguments();
|
||||
//Remove the first argument, it's the binary file
|
||||
strl.takeFirst();
|
||||
QString message = "launched-with-args: " + QET::joinWithSpaces(strl);
|
||||
app.sendMessage(message.toUtf8());
|
||||
return 0;
|
||||
}
|
||||
|
||||
QETApp qetapp;
|
||||
QObject::connect(&app, &SingleApplication::receivedMessage, &qetapp, &QETApp::receiveMessage);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user