minor chhanges, mostly cleanup

This commit is contained in:
Dorian Zedler 2019-03-27 22:26:59 +01:00
parent 03ec489cfb
commit f62a2f5b94
3 changed files with 34 additions and 22 deletions

View file

@ -23,7 +23,7 @@ Rectangle {
property int set_height: parent.font.pixelSize * 1.4
implicitWidth: set_height * 1.84
implicitHeight: set_height
x: ready_del.width - width - ready_del.rightPadding
x: parent.width - width - parent.rightPadding
y: parent.height / 2 - height / 2
radius: implicitHeight * 0.5
color: parent.checked ? "#17a81a" : "transparent"

View file

@ -31,7 +31,7 @@ AppSettings::AppSettings(QObject* parent)
this->setDefaultSetting("at_marks_en", "false");
this->setDefaultSetting("at_marks_delay", 0);
this->setDefaultSetting("theme", "Default");
this->setDefaultSetting("theme", "Light");
pGlobalAppSettings = this;
}

View file

@ -12,6 +12,7 @@ BaseConn::BaseConn(QObject *parent) : QObject(parent)
this, SLOT(gotError(QAbstractSocket::SocketError)));
this->nextConnectionId = 1;
this->connections = QVariantList({});
}
bool BaseConn::connectToHost() {
@ -66,11 +67,11 @@ void BaseConn::closeConnection()
socket->abort();
}
setState("disconnected");
// for(int i = 0; i < this->waitingRequests.length(); i++){
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
// this->waitingRequests[i].loop->quit();
// return;
// }
// for(int i = 0; i < this->waitingRequests.length(); i++){
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
// this->waitingRequests[i].loop->quit();
// return;
// }
}
void BaseConn::gotError(QAbstractSocket::SocketError err)
@ -79,21 +80,21 @@ void BaseConn::gotError(QAbstractSocket::SocketError err)
QString strError = "unknown";
switch (err)
{
case 0:
strError = "Connection was refused";
break;
case 1:
strError = "Remote host closed the connection";
this->closeConnection();
break;
case 2:
strError = "Host address was not found";
break;
case 5:
strError = "Connection timed out";
break;
default:
strError = "Unknown error";
case 0:
strError = "Connection was refused";
break;
case 1:
strError = "Remote host closed the connection";
this->closeConnection();
break;
case 2:
strError = "Host address was not found";
break;
case 5:
strError = "Connection timed out";
break;
default:
strError = "Unknown error";
}
emit gotError(strError);
@ -236,4 +237,15 @@ bool BaseConn::refreshConnections() {
QVariant BaseConn::getConnections() {
return(connections);
/*
"id": "id of the extention (int)",
"type": "type of the extention (can be: 'STARTPAD', 'TOPPAP')",
"name": "name of the extention",
"ip": "ip-adress of he extention (string)",
"state": "state of the extention (can be: 'disconnected', 'connecting', 'connected')"
*/
//QVariantMap conn = {{"id",0}, {"type","STARTPAD"}, {"name", "startpad1"}, {"ip", "192.168.4.11"}, {"state", "connected"}};
//QVariantMap conn1 = {{"id",0}, {"type","TOPPAD"}, {"name", "buzzer1"}, {"ip", "192.168.4.10"}, {"state", "connected"}};
//QVariantList conns = {conn, conn1};
//return conns;
}