equal
deleted
inserted
replaced
19 |
19 |
20 #include <QList> |
20 #include <QList> |
21 #include <QImage> |
21 #include <QImage> |
22 #include <QThread> |
22 #include <QThread> |
23 #include <QApplication> |
23 #include <QApplication> |
|
24 #include <QProcessEnvironment> |
24 |
25 |
25 #include "tcpBase.h" |
26 #include "tcpBase.h" |
26 #include "hwconsts.h" |
27 #include "hwconsts.h" |
27 #include "MessageDialog.h" |
28 #include "MessageDialog.h" |
|
29 #include "gameuiconfig.h" |
28 |
30 |
29 #ifdef HWLIBRARY |
31 #ifdef HWLIBRARY |
30 extern "C" { |
32 extern "C" { |
31 void RunEngine(int argc, char ** argv); |
33 void RunEngine(int argc, char ** argv); |
32 |
34 |
102 if (IPCSocket) |
104 if (IPCSocket) |
103 IPCSocket->deleteLater(); |
105 IPCSocket->deleteLater(); |
104 |
106 |
105 } |
107 } |
106 |
108 |
107 TCPBase::TCPBase(bool demoMode, QObject *parent) : |
109 TCPBase::TCPBase(bool demoMode, bool usesCustomLanguage, QObject *parent) : |
108 QObject(parent), |
110 QObject(parent), |
109 m_hasStarted(false), |
111 m_hasStarted(false), |
110 m_isDemoMode(demoMode), |
112 m_isDemoMode(demoMode), |
111 m_connected(false), |
113 m_connected(false), |
|
114 m_usesCustomLanguage(usesCustomLanguage), |
112 IPCSocket(0) |
115 IPCSocket(0) |
113 { |
116 { |
114 process = 0; |
117 process = 0; |
115 |
118 |
116 if(!IPCServer) |
119 if(!IPCServer) |
181 #ifdef QT_DEBUG |
184 #ifdef QT_DEBUG |
182 // redirect everything written on stdout/stderr |
185 // redirect everything written on stdout/stderr |
183 process->setProcessChannelMode(QProcess::ForwardedChannels); |
186 process->setProcessChannelMode(QProcess::ForwardedChannels); |
184 #endif |
187 #endif |
185 |
188 |
|
189 // If game config uses non-system locale, we set the environment |
|
190 // of the engine first |
|
191 if(m_usesCustomLanguage) |
|
192 { |
|
193 QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); |
|
194 QString hwengineLang = QLocale().name() + ".UTF8"; |
|
195 qDebug("Setting hwengine environment: LANG=%s", qPrintable(hwengineLang)); |
|
196 // TODO: Check if this is correct and works on all systems |
|
197 env.insert("LANG", QLocale().name() + ".UTF8"); |
|
198 process->setProcessEnvironment(env); |
|
199 } |
|
200 qDebug("Starting hwengine ..."); |
186 process->start(bindir->absolutePath() + "/hwengine", arguments); |
201 process->start(bindir->absolutePath() + "/hwengine", arguments); |
187 #endif |
202 #endif |
188 m_hasStarted = true; |
203 m_hasStarted = true; |
189 } |
204 } |
190 |
205 |