Now when you click on the "Connect" button, the button stops being available, and the text on it changes to "Waiting..." until any message is not displayed.

This commit is contained in:
Denis Davydov 2018-06-28 16:38:28 +03:00
parent 1d68c85c0e
commit bbfcfd00d9

View File

@ -18,6 +18,8 @@ MainWindow::~MainWindow()
void MainWindow::on_connectToPeer_clicked()
{
ui->connectToPeer->setEnabled(false);
ui->connectToPeer->setText("Ожидание...");
QJsonObject j;
j["peerID"] = my_ipv6;
j["action"] = "createSession";
@ -40,6 +42,8 @@ void MainWindow::slotTimerAlarm()
int ret = QMessageBox::critical(this,QObject::tr("Error"),tr("Timeout Error"));
timer->stop();
delete timer;
ui->connectToPeer->setEnabled(true);
ui->connectToPeer->setText("Подключиться");
}
}
@ -48,4 +52,6 @@ void MainWindow::peerReceiverConnected()
{
receive = true;
int ret = QMessageBox::information(this,QObject::tr("Info"),tr("Peer Available!"));
ui->connectToPeer->setEnabled(true);
ui->connectToPeer->setText("Подключиться");
}