Commit 1cb1995b by ss.dai

修改推出后进程残留

parent e7c71abe
......@@ -27,7 +27,6 @@ void FmPlugin::SetRemoteInfo(const QString &ip, int port)
bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, QString &error, bool bVerify)
{
return true;
QTcpSocket socket;
// 连接
socket.connectToHost(m_host, m_port);
......
......@@ -14,8 +14,15 @@ void SInfoControl::SetListenPort(int port)
m_port = port;
}
SInfoControl::~SInfoControl()
{
m_bContinue = false;
m_mutex.lock();
}
void SInfoControl::run()
{
m_mutex.lock();
m_tcpServer = new QTcpServer(this);
if(!m_tcpServer->listen(QHostAddress::LocalHost, m_port))
......@@ -29,9 +36,10 @@ void SInfoControl::run()
QString replyData;
QJsonParseError jsonError;
QJsonDocument jsonDoc;
while(true)
m_bContinue = true;
while(m_bContinue)
{
if(!m_tcpServer->waitForNewConnection(60000))
if(!m_tcpServer->waitForNewConnection(1000))
{
continue;
}
......@@ -96,5 +104,8 @@ void SInfoControl::run()
m_tcpSocket->close();
continue;
}
m_tcpServer->close();
m_tcpServer->deleteLater();
QLOG_INFO() << "refundControl exit.";
m_mutex.unlock();
}
......@@ -4,6 +4,7 @@
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMutex>
class SInfoControl : public QObject
{
......@@ -15,6 +16,7 @@ public:
private:
SInfoControl(){}
~SInfoControl();
SInfoControl(SInfoControl const&);
SInfoControl& operator=(SInfoControl const&);
......@@ -22,6 +24,9 @@ private:
QTcpSocket *m_tcpSocket;
int m_port;
QMutex m_mutex;
bool m_bContinue;
public slots:
/* 功能:开启控制器
* 参数:NULL
......
#include "SysTray.h"
#include <QApplication>
#include <QThread>
extern QThread sInfoThread;
extern QThread workThread;
SysTray::SysTray(QObject *parent) :
QSystemTrayIcon(parent)
......@@ -22,5 +25,7 @@ void SysTray::_CreatMenu()
void SysTray::onActionQuitTriggered()
{
qApp->exit();
sInfoThread.terminate();
workThread.terminate();
qApp->exit(-1);
}
......@@ -4,6 +4,11 @@
#include "DTools/configManger.h"
#include "preDefine.h"
#include "QsLog.h"
#include <QProcess>
#include <QThread>
extern QThread sInfoThread;
extern QThread workThread;
FloatForm::FloatForm(QWidget *parent) :
QDialog(parent),
......@@ -57,7 +62,10 @@ void FloatForm::mousePressEvent(QMouseEvent *event)
}
if(event->button()==Qt::RightButton)
{
emit restart();
sInfoThread.terminate();
workThread.terminate();
qApp->exit(-1);
QProcess::startDetached(qApp->applicationFilePath(), QStringList(qApp->applicationFilePath()));
}
}
......@@ -77,8 +85,7 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
}
m_bMouseMove = false;
ConfigManger::GetInstance().setFloatInitPostion(event->globalPos());
m_mouseTimer.stop();
ConfigManger::GetInstance().setFloatInitPostion(this->pos());
}
void FloatForm::_Init()
......
......@@ -52,13 +52,13 @@ void LoadTheme(const QString& theme)
int main(int argc, char *argv[])
{
HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"fmTakeaway" );
// HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"fmTakeaway" );
if (GetLastError() == ERROR_ALREADY_EXISTS) {
CloseHandle(m_hMutex);
m_hMutex = NULL;
return -1;
}
// if (GetLastError() == ERROR_ALREADY_EXISTS) {
// CloseHandle(m_hMutex);
// m_hMutex = NULL;
// return -1;
// }
QApplication a(argc, argv);
g_appDir = a.applicationDirPath();
......
......@@ -102,7 +102,7 @@ void MainForm::MyShow()
void MainForm::_Init()
{
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
//this->showFullScreen();
this->showFullScreen();
// 显示托盘
m_tray.show();
......@@ -218,10 +218,8 @@ void MainForm::onShowSearchOrderResult(const QMap<QString,QString>& orderIdList)
void MainForm::onrestart()
{
sInfoThread.terminate();
workThread.terminate();
qApp->exit();
QProcess::startDetached(qApp->applicationFilePath(), QStringList());
}
void MainForm::_RevertBtnTable()
......
;打印机信息
[Printer]
name=Fax
name=
;悬浮窗参数
[Float]
postion=@Point(197 621)
postion=@Point(100 100)
opacity=0.5
blinkInterval=0.3
soundInterval=2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment