You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iAppBase/ZxSingleInstance.h

45 lines
715 B
C

#pragma once
#include <QObject>
#include "iAppBase_global.h"
class QString;
class QStringList;
class QLocalServer;
class QWidget;
// 单例
class I_APPBASE_EXPORT ZxSingleInstance : public QObject
{
Q_OBJECT
public:
ZxSingleInstance(const QString& sServerName);
~ZxSingleInstance();
// 检查前一个进程, 如果存在则把命令参数传过去.
bool redirect(int argc, char** argv);
// 启动服务器
bool startServer();
protected slots:
// 处理命令行, 并返回相关的界面元素
virtual QWidget* onCommand(const QStringList &args);
private slots:
void onNewConnection();
private:
QString m_sServerName;
QLocalServer* m_pServer;
};