Runtime fixes for QT4 support.

This commit is contained in:
Neel Patel
2016-02-23 09:10:49 +00:00
committed by Dave Page
parent 2de7b4c0a0
commit 3b7886e61e
6 changed files with 23 additions and 8 deletions

View File

@@ -29,6 +29,17 @@
#include "ConfigWindow.h"
#include "Server.h"
#include <QTime>
void delay( int milliseconds )
{
QTime endTime = QTime::currentTime().addMSecs( milliseconds );
while( QTime::currentTime() < endTime )
{
QCoreApplication::processEvents( QEventLoop::AllEvents, 100 );
}
}
int main(int argc, char * argv[])
{
// Create the QT application
@@ -47,8 +58,8 @@ int main(int argc, char * argv[])
// Hence - putting this code in a code block so the scope of the socket
// variable vanishes to make that socket available.
{
QTcpSocket socket;
socket.bind(0, QAbstractSocket::DontShareAddress);
QUdpSocket socket;
socket.bind(0, QUdpSocket::ShareAddress);
port = socket.localPort();
}
@@ -69,7 +80,7 @@ int main(int argc, char * argv[])
// This is a hack. Wait a second and then check to see if the server thread
// is still running. If it's not, we probably had a startup error
QThread::sleep(1);
delay(1000);
// Any errors?
if (server->isFinished() || server->getError().length() > 0)
@@ -127,7 +138,7 @@ int main(int argc, char * argv[])
exit(1);
}
QThread::sleep(1);
delay(1000);
}
// Create & show the main window