mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-08-11 07:02:21 +08:00
修改限制单例运行,再次启动时拉起现有实例
This commit is contained in:
parent
c2e665ecb6
commit
6bd8fc7a1e
14
src/main.cpp
14
src/main.cpp
@ -89,7 +89,19 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
// 限制单实例运行
|
||||
if (!a.setSingleInstance("spark-store")) {
|
||||
if(!a.setSingleInstance("spark-store"))
|
||||
{
|
||||
qDebug() << "The application is already running!";
|
||||
QDBusInterface iface("com.gitee.spark.store",
|
||||
"/com/gitee/spark/store",
|
||||
"com.gitee.spark.store",
|
||||
QDBusConnection::sessionBus());
|
||||
|
||||
QString arg1 = argv[1];
|
||||
|
||||
iface.asyncCall("activeWindow",arg1);
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user