Updated IPC handler threads for latest MUtilities changes.
This commit is contained in:
parent
7a86b73a93
commit
f1f5a1eacb
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 1
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 14
|
||||
#define VER_LAMEXP_BUILD 1674
|
||||
#define VER_LAMEXP_BUILD 1676
|
||||
#define VER_LAMEXP_CONFG 1558
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -48,23 +48,22 @@ MessageHandlerThread::MessageHandlerThread(MUtils::IPCChannel *const ipcChannel)
|
||||
m_ipcChannel(ipcChannel)
|
||||
{
|
||||
m_aborted = false;
|
||||
m_parameter = new char[MUtils::IPCChannel::MAX_MESSAGE_LEN];
|
||||
}
|
||||
|
||||
MessageHandlerThread::~MessageHandlerThread(void)
|
||||
{
|
||||
delete [] m_parameter;
|
||||
}
|
||||
|
||||
void MessageHandlerThread::run()
|
||||
{
|
||||
m_aborted = false;
|
||||
setTerminationEnabled(true);
|
||||
QStringList params;
|
||||
quint32 command = 0, flags = 0;
|
||||
|
||||
while(!m_aborted)
|
||||
{
|
||||
unsigned int command = 0, flags = 0;
|
||||
if(!m_ipcChannel->read(command, flags, m_parameter, MUtils::IPCChannel::MAX_MESSAGE_LEN))
|
||||
if(!m_ipcChannel->read(command, flags, params))
|
||||
{
|
||||
qWarning("Failed to read next IPC message!");
|
||||
break;
|
||||
@ -81,10 +80,16 @@ void MessageHandlerThread::run()
|
||||
emit otherInstanceDetected();
|
||||
break;
|
||||
case IPC_CMD_ADD_FILE:
|
||||
emit fileReceived(QString::fromUtf8(m_parameter));
|
||||
if(params.count() > 0 )
|
||||
{
|
||||
emit fileReceived(params.first());
|
||||
}
|
||||
break;
|
||||
case IPC_CMD_ADD_FOLDER:
|
||||
emit folderReceived(QString::fromUtf8(m_parameter), TEST_FLAG(IPC_FLAG_ADD_RECURSIVE));
|
||||
if(params.count() > 0 )
|
||||
{
|
||||
emit folderReceived(params.first(), TEST_FLAG(IPC_FLAG_ADD_RECURSIVE));
|
||||
}
|
||||
break;
|
||||
case IPC_CMD_TERMINATE:
|
||||
if(TEST_FLAG(IPC_FLAG_FORCE))
|
||||
@ -105,7 +110,7 @@ void MessageHandlerThread::stop(void)
|
||||
if(!m_aborted)
|
||||
{
|
||||
m_aborted = true;
|
||||
m_ipcChannel->send(0, 0, NULL);
|
||||
m_ipcChannel->send(0, 0, QStringList());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ protected:
|
||||
MUtils::IPCChannel *const m_ipcChannel;
|
||||
|
||||
private:
|
||||
char *m_parameter;
|
||||
volatile bool m_aborted;
|
||||
|
||||
signals:
|
||||
|
@ -63,7 +63,7 @@ void MessageProducerThread::run()
|
||||
//Kill application?
|
||||
if(arguments.contains("kill"))
|
||||
{
|
||||
if(!m_ipcChannel->send(IPC_CMD_TERMINATE, IPC_FLAG_NONE, NULL))
|
||||
if(!m_ipcChannel->send(IPC_CMD_TERMINATE, IPC_FLAG_NONE))
|
||||
{
|
||||
qWarning("Failed to send IPC message!");
|
||||
}
|
||||
@ -71,7 +71,7 @@ void MessageProducerThread::run()
|
||||
}
|
||||
if(arguments.contains("force-kill"))
|
||||
{
|
||||
if(!m_ipcChannel->send(IPC_CMD_TERMINATE, IPC_FLAG_FORCE, NULL))
|
||||
if(!m_ipcChannel->send(IPC_CMD_TERMINATE, IPC_FLAG_FORCE))
|
||||
{
|
||||
qWarning("Failed to send IPC message!");
|
||||
}
|
||||
@ -86,7 +86,7 @@ void MessageProducerThread::run()
|
||||
const QFileInfo file = QFileInfo(value);
|
||||
if(file.exists() && file.isFile())
|
||||
{
|
||||
if(!m_ipcChannel->send(IPC_CMD_ADD_FILE, IPC_FLAG_NONE, MUTILS_UTF8(file.canonicalFilePath())))
|
||||
if(!m_ipcChannel->send(IPC_CMD_ADD_FILE, IPC_FLAG_NONE, QStringList() << file.canonicalFilePath()))
|
||||
{
|
||||
qWarning("Failed to send IPC message!");
|
||||
}
|
||||
@ -101,7 +101,7 @@ void MessageProducerThread::run()
|
||||
const QDir dir = QDir(value);
|
||||
if(dir.exists())
|
||||
{
|
||||
if(!m_ipcChannel->send(IPC_CMD_ADD_FOLDER, IPC_FLAG_NONE, MUTILS_UTF8(dir.canonicalPath())))
|
||||
if(!m_ipcChannel->send(IPC_CMD_ADD_FOLDER, IPC_FLAG_NONE, QStringList() << dir.canonicalPath()))
|
||||
{
|
||||
qWarning("Failed to send IPC message!");
|
||||
}
|
||||
@ -116,7 +116,7 @@ void MessageProducerThread::run()
|
||||
const QDir dir = QDir(value);
|
||||
if(dir.exists())
|
||||
{
|
||||
if(!m_ipcChannel->send(IPC_CMD_ADD_FOLDER, IPC_FLAG_ADD_RECURSIVE, MUTILS_UTF8(dir.canonicalPath())))
|
||||
if(!m_ipcChannel->send(IPC_CMD_ADD_FOLDER, IPC_FLAG_ADD_RECURSIVE, QStringList() << dir.canonicalPath()))
|
||||
{
|
||||
qWarning("Failed to send IPC message!");
|
||||
}
|
||||
@ -127,7 +127,7 @@ void MessageProducerThread::run()
|
||||
|
||||
if(!bSentFiles)
|
||||
{
|
||||
if(!m_ipcChannel->send(IPC_CMD_PING, IPC_FLAG_NONE, "Use running instance!"))
|
||||
if(!m_ipcChannel->send(IPC_CMD_PING, IPC_FLAG_NONE, QStringList() << QLatin1String("Use running instance!")))
|
||||
{
|
||||
qWarning("Failed to send IPC message!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user