Bump version + updated changelog.
[simple-x264-launcher.git] / src / thread_ipc_recv.cpp
blobf998b034bf1475dcd963d6d0d608fbe758796d44
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
23 #include "thread_ipc_recv.h"
25 //Internal
26 #include "Global.h"
27 #include "cli.h"
28 #include "ipc.h"
30 //MUtils
31 #include <MUtils/Global.h>
32 #include <MUtils/IPCChannel.h>
33 #include <MUtils/OSSupport.h>
35 //Qt
36 #include <QStringList>
37 #include <QApplication>
38 #include <QFileInfo>
39 #include <QDir>
41 //CRT
42 #include <limits.h>
44 ////////////////////////////////////////////////////////////
45 // Constructor & Destructor
46 ////////////////////////////////////////////////////////////
48 IPCThread_Recv::IPCThread_Recv(MUtils::IPCChannel *const ipcChannel)
50 m_ipcChannel(ipcChannel)
52 m_stopFlag = false;
55 IPCThread_Recv::~IPCThread_Recv(void)
59 ////////////////////////////////////////////////////////////
60 // Thread Main
61 ////////////////////////////////////////////////////////////
63 void IPCThread_Recv::run()
65 setTerminationEnabled(true);
66 QStringList params;
67 quint32 command, flags;
69 while(!m_stopFlag)
71 if(m_ipcChannel->read(command, flags, params))
73 if(command != IPC_OPCODE_NOOP)
75 emit receivedCommand(command, params, flags);
78 else
80 qWarning("Failed to read next IPC message!");
81 break;
86 ////////////////////////////////////////////////////////////
87 // Public Methods
88 ////////////////////////////////////////////////////////////
90 void IPCThread_Recv::stop(void)
92 if(!m_stopFlag)
94 m_stopFlag = true;
95 m_ipcChannel->send(0, 0, QStringList());
99 ////////////////////////////////////////////////////////////
100 // EVENTS
101 ////////////////////////////////////////////////////////////
103 /*NONE*/