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.
|
|
|
|
|
#ifndef _H_QSIGNLEAPPLICATION_H_
|
|
|
|
|
|
#define _H_QSIGNLEAPPLICATION_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
|
class QMainWindow;
|
|
|
|
|
|
class QLocalServer;
|
|
|
|
|
|
|
|
|
|
|
|
class SingleApplication : public QApplication
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
SingleApplication(int &args, char **argv, QString strServerName);
|
|
|
|
|
|
bool getInstanceRunning() const; // <20>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
QMainWindow *getMainWindow() const;
|
|
|
|
|
|
|
|
|
|
|
|
void setMainWindow(QMainWindow *value);
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void newLocalConnection();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
void initLocalConnection(); // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void newLocalServer(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool instanceRunning{ false }; // <20>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
QLocalServer *localServer{ nullptr }; // <20><><EFBFBD><EFBFBD>socket Server<65><72><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1>ؽ<EFBFBD><D8BD>̼<EFBFBD>ͨ<EFBFBD>ţ<EFBFBD>
|
|
|
|
|
|
QString m_serverName; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
QMainWindow *mainWindow{ nullptr }; // MainWindowָ<77><D6B8>
|
|
|
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
|
|
|
Example:
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
|
|
|
|
SingleApplication a(argc, argv, "lp_report");
|
|
|
|
|
|
if (!a.getInstanceRunning())
|
|
|
|
|
|
{
|
|
|
|
|
|
slpsf_mark_report w;
|
|
|
|
|
|
a.setMainWindow(&w);
|
|
|
|
|
|
w.show();
|
|
|
|
|
|
return a.exec();
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|