MainWindow::MainWindow(QApplication *a, QHostAddress ip, quint16 port, QByteArray l, QString skin, double mouseSensitivity, QObject *parent) : QObject(parent) { app = a; repaintTimer = new QTimer; repaintTimer->setInterval(16); stopBot = false; widget = new DrawGl(app, skin, mouseSensitivity); widget->legacy = this; widget->setMinimumHeight(480); widget->setMinimumWidth(640); login = l; qDebug() << "connecting to " + ip.toString() + ":" + QString::number(port); input = new NetworkClass(ip, port, QString::fromLocal8Bit(login)); QObject::connect(repaintTimer, SIGNAL(timeout()), widget, SLOT(repaint())); QObject::connect(input, SIGNAL(gameStart()), this, SLOT(gameStart())); QObject::connect(input, SIGNAL(connectionFailed()), this, SLOT(connectionFailed())); QObject::connect(input, SIGNAL(successConnection()), this, SLOT(connectedSuccess())); QObject::connect(widget, SIGNAL(runCommand(QString)), input, SLOT(runCommand(QString))); QObject::connect(widget, SIGNAL(destroyed()), this, SLOT(legalStop())); ctrlPressed = false; finished = false; widget->a = input; repaintTimer->start(); input->start(); thread = new CalculationThread(widget, input); for (int i = 0; i < 100; i++) for (int j = 0; j < 100; j++) for (int k = 0; k < 100; k++) progress[i][j][k] = false; }
/*! \~russian * \brief Внутренний слот класса. Высылает сигнал об супешности соединения. * * \code * QObject::connect( tcpObj, SIGNAL( connectedSuccess() ), * anotherObj, SLOT ( slotConnectedSuccess()) ); * \endcode */ void TcpClient::slotConnected() { emit connectedSuccess(); }