1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
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.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "Thread_MessageHandler.h"
26 #include <QSharedMemory>
27 #include <QSystemSemaphore>
28 #include <QMessageBox>
32 ////////////////////////////////////////////////////////////
34 ////////////////////////////////////////////////////////////
36 MessageHandlerThread::MessageHandlerThread(void)
39 m_parameter
= new char[4096];
42 MessageHandlerThread::~MessageHandlerThread(void)
44 delete [] m_parameter
;
47 void MessageHandlerThread::run()
50 setTerminationEnabled(true);
54 unsigned int command
= 0;
55 lamexp_ipc_read(&command
, m_parameter
, 4096);
56 if(!command
) continue;
61 emit
fileReceived(QString::fromUtf8(m_parameter
));
64 emit
folderReceived(QString::fromUtf8(m_parameter
), false);
67 emit
folderReceived(QString::fromUtf8(m_parameter
), true);
70 if(!_stricmp(m_parameter
, "Force!"))
76 emit
killSignalReceived();
80 emit
otherInstanceDetected();
83 qWarning("Received an unknown IPC message! (command=%u)", command
);
89 void MessageHandlerThread::stop(void)
94 lamexp_ipc_send(0, "");
98 ////////////////////////////////////////////////////////////
100 ////////////////////////////////////////////////////////////