QTfrontend/game.cpp
changeset 177 c67c15e6fae3
parent 174 0b2c5b22f644
child 178 efdc2a63be8e
equal deleted inserted replaced
176:533d03041dcd 177:c67c15e6fae3
   219 }
   219 }
   220 
   220 
   221 void HWGame::ClientRead()
   221 void HWGame::ClientRead()
   222 {
   222 {
   223 	readbuffer.append(IPCSocket->readAll());
   223 	readbuffer.append(IPCSocket->readAll());
       
   224 	onClientRead();
       
   225 }
       
   226 
       
   227 void HWGame::onClientRead()
       
   228 {
   224 	quint8 msglen;
   229 	quint8 msglen;
   225 	quint32 bufsize;
   230 	quint32 bufsize;
   226 	while (((bufsize = readbuffer.size()) > 0) &&
   231 	while (((bufsize = readbuffer.size()) > 0) &&
   227 			((msglen = readbuffer.data()[0]) < bufsize))
   232 			((msglen = readbuffer.data()[0]) < bufsize))
   228 	{
   233 	{
   245 				.arg(IPCServer->errorString()));
   250 				.arg(IPCServer->errorString()));
   246 	}
   251 	}
   247 
   252 
   248 	demo = new QByteArray;
   253 	demo = new QByteArray;
   249 	QProcess * process;
   254 	QProcess * process;
   250 	QStringList arguments;
       
   251 	process = new QProcess;
   255 	process = new QProcess;
   252 	connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
   256 	connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError)));
       
   257 	QStringList arguments=setArguments();
       
   258 	process->start(bindir->absolutePath() + "/hwengine", arguments);
       
   259 }
       
   260 
       
   261 QStringList HWGame::setArguments()
       
   262 {
       
   263 	QStringList arguments;
   253 	arguments << resolutions[0][config->vid_Resolution()];
   264 	arguments << resolutions[0][config->vid_Resolution()];
   254 	arguments << resolutions[1][config->vid_Resolution()];
   265 	arguments << resolutions[1][config->vid_Resolution()];
   255 	arguments << "16";
   266 	arguments << "16";
   256 	arguments << "46631";
   267 	arguments << "46631";
   257 	arguments << (config->vid_Fullscreen() ? "1" : "0");
   268 	arguments << (config->vid_Fullscreen() ? "1" : "0");
   258 	arguments << (config->isSoundEnabled() ? "1" : "0");
   269 	arguments << (config->isSoundEnabled() ? "1" : "0");
   259 	arguments << tr("en.txt");
   270 	arguments << tr("en.txt");
   260 	arguments << "128";
   271 	arguments << "128";
   261 	process->start(bindir->absolutePath() + "/hwengine", arguments);
   272 	return arguments;
   262 }
   273 }
   263 
   274 
   264 void HWGame::StartProcessError(QProcess::ProcessError error)
   275 void HWGame::StartProcessError(QProcess::ProcessError error)
   265 {
   276 {
   266 	QMessageBox::critical(0, tr("Error"),
   277 	QMessageBox::critical(0, tr("Error"),