PDA

View Full Version : How to prevent many instances of same application from running ?



AyushExel
10th May 2016, 09:20
I have built an application that plays audio but when I select multiple audio files and press "Enter" , each audio file is played by different instance of same application. I want to prevent multiple copies of my application from running at the same time. Instead I want that if many audio file are run, they should be added in the media player's playlist. How can this be done ?

Lesiok
10th May 2016, 14:17
Look at this solution (https://github.com/kbinani/qt-solutions/tree/master/qtsingleapplication)

AyushExel
11th May 2016, 13:48
Look at this solution (https://github.com/kbinani/qt-solutions/tree/master/qtsingleapplication)
Well QtSingleApplication is not compatible with Qt 5.

Lesiok
11th May 2016, 16:38
Read this article (https://github.com/owncloud/client/issues/3327)

AyushExel
11th May 2016, 17:17
Read this article (https://github.com/owncloud/client/issues/3327)

So I guess that QtLocalPeer is the replacement for QtSingleApplication . Am I correct ? If so, can u provide an example code which shows the usage of QtlocalPeer ?

Lesiok
11th May 2016, 18:05
No, I can't. I do not work with Qt5 only Qt4.
As you probably noticed it is the solution used in QtCreator. Sources of QtCreator are generally available so look for them.

anda_skoa
13th May 2016, 09:32
As far as I understood the linked page, the API is still QtSingleApplication, just a newer implementation based on QtLocalPeer.

Cheers,
_