18 lines
411 B
C++
18 lines
411 B
C++
#pragma once
|
|
#include <QLocalServer>
|
|
#include <QLocalSocket>
|
|
|
|
class AppInstanceManager : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
static AppInstanceManager* instance();
|
|
void notifyActivate(); // 向其他实例发送激活信号
|
|
static bool isAlreadyRunning();
|
|
|
|
signals:
|
|
void raiseRequested(); // 触发窗口激活
|
|
|
|
private:
|
|
explicit AppInstanceManager(QObject *parent = nullptr);
|
|
QLocalServer *m_server;
|
|
}; |