Commit fea01cf5 authored by Dorian Zedler's avatar Dorian Zedler

minor fixes and additions

parent 0957a913
......@@ -87,6 +87,9 @@ public slots:
Q_INVOKABLE bool connectToHost();
//function to connect to the base station
Q_INVOKABLE bool init();
Q_INVOKABLE void deInit();
Q_INVOKABLE void closeConnection();
void gotError(QAbstractSocket::SocketError err);
......
......@@ -129,9 +129,9 @@ Window {
opacity: ( speedBackend.state < 3 ) ? 1:0
width: parent.width * 0.8
width: parent.width * 0.7
text: ""
text: qsTr("Click Start to start")
color: appTheme.style.textColor
......@@ -147,6 +147,7 @@ Window {
Behavior on text {
FadeAnimation{
target: topLa
fadeDuration: 200
}
}
}
......
......@@ -48,13 +48,26 @@ bool BaseConn::connectToHost() {
// stop the timer as the connection has been established
timer.stop();
connect(this->socket, &QTcpSocket::readyRead, this, &BaseConn::readyRead);
this->connection_progress = 100;
this->connection_progress = 50;
if(!this->init()){
this->closeConnection();
return false;
}
this->setState("connected");
return(true);
}
bool BaseConn::init() {
return true;
}
void BaseConn::deInit() {
this->connections.clear();
}
void BaseConn::closeConnection()
{
this->connections = QVariantList({});
......@@ -72,6 +85,8 @@ void BaseConn::closeConnection()
default:
socket->abort();
}
this->deInit();
setState("disconnected");
// for(int i = 0; i < this->waitingRequests.length(); i++){
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment