#include <QtGui/QApplication>#include <time.h>#include "mainwindow.h"#include "MyThread.h"#include "Ship.h"#include "Port.h"#include "Scene.h"#include <QTimer>int main(int argc, char *argv[]){ //Generating random number const time_t timer = time(NULL); tm *timerstruct = localtime(&timer); uint sec = timerstruct->tm_sec; qsrand(sec); int random = qrand()%3; QApplication a(argc, argv); MainWindow w; w.setFixedSize(550,600); w.show(); Port* port = new Port; Scene *scene = w.getScene(); int i=1; while(i<4) { MyThread thread(random,port,scene); QObject::connect(&thread, SIGNAL(shipMoves(Ship *, qreal, qreal)), scene, SLOT(moveShip(Ship *, qreal, qreal))); QObject::connect(&thread, SIGNAL(shipRotates(Ship *, qreal, qreal, qreal, qreal)), scene, SLOT(rotateShip(Ship *, qreal, qreal, qreal, qreal))); QObject::connect(&thread, SIGNAL(newShip(Ship*)), scene, SLOT(addNewShip(Ship*))); QTimer timer; timer.singleShot(i*5000, &thread, SLOT(start())); i++; } return a.exec();}