minor fixes and additions
This commit is contained in:
parent
0957a913f8
commit
fea01cf503
3 changed files with 22 additions and 3 deletions
|
@ -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";
|
||||
|
|
Reference in a new issue