minor chhanges, mostly cleanup
This commit is contained in:
parent
03ec489cfb
commit
f62a2f5b94
3 changed files with 34 additions and 22 deletions
|
@ -23,7 +23,7 @@ Rectangle {
|
||||||
property int set_height: parent.font.pixelSize * 1.4
|
property int set_height: parent.font.pixelSize * 1.4
|
||||||
implicitWidth: set_height * 1.84
|
implicitWidth: set_height * 1.84
|
||||||
implicitHeight: set_height
|
implicitHeight: set_height
|
||||||
x: ready_del.width - width - ready_del.rightPadding
|
x: parent.width - width - parent.rightPadding
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
radius: implicitHeight * 0.5
|
radius: implicitHeight * 0.5
|
||||||
color: parent.checked ? "#17a81a" : "transparent"
|
color: parent.checked ? "#17a81a" : "transparent"
|
||||||
|
|
|
@ -31,7 +31,7 @@ AppSettings::AppSettings(QObject* parent)
|
||||||
this->setDefaultSetting("at_marks_en", "false");
|
this->setDefaultSetting("at_marks_en", "false");
|
||||||
this->setDefaultSetting("at_marks_delay", 0);
|
this->setDefaultSetting("at_marks_delay", 0);
|
||||||
|
|
||||||
this->setDefaultSetting("theme", "Default");
|
this->setDefaultSetting("theme", "Light");
|
||||||
|
|
||||||
pGlobalAppSettings = this;
|
pGlobalAppSettings = this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ BaseConn::BaseConn(QObject *parent) : QObject(parent)
|
||||||
this, SLOT(gotError(QAbstractSocket::SocketError)));
|
this, SLOT(gotError(QAbstractSocket::SocketError)));
|
||||||
|
|
||||||
this->nextConnectionId = 1;
|
this->nextConnectionId = 1;
|
||||||
|
this->connections = QVariantList({});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseConn::connectToHost() {
|
bool BaseConn::connectToHost() {
|
||||||
|
@ -66,11 +67,11 @@ void BaseConn::closeConnection()
|
||||||
socket->abort();
|
socket->abort();
|
||||||
}
|
}
|
||||||
setState("disconnected");
|
setState("disconnected");
|
||||||
// for(int i = 0; i < this->waitingRequests.length(); i++){
|
// for(int i = 0; i < this->waitingRequests.length(); i++){
|
||||||
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
|
// this->waitingRequests[i].reply = "ERR_NOT_CONNECTED";
|
||||||
// this->waitingRequests[i].loop->quit();
|
// this->waitingRequests[i].loop->quit();
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseConn::gotError(QAbstractSocket::SocketError err)
|
void BaseConn::gotError(QAbstractSocket::SocketError err)
|
||||||
|
@ -79,21 +80,21 @@ void BaseConn::gotError(QAbstractSocket::SocketError err)
|
||||||
QString strError = "unknown";
|
QString strError = "unknown";
|
||||||
switch (err)
|
switch (err)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
strError = "Connection was refused";
|
strError = "Connection was refused";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
strError = "Remote host closed the connection";
|
strError = "Remote host closed the connection";
|
||||||
this->closeConnection();
|
this->closeConnection();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
strError = "Host address was not found";
|
strError = "Host address was not found";
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
strError = "Connection timed out";
|
strError = "Connection timed out";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strError = "Unknown error";
|
strError = "Unknown error";
|
||||||
}
|
}
|
||||||
|
|
||||||
emit gotError(strError);
|
emit gotError(strError);
|
||||||
|
@ -236,4 +237,15 @@ bool BaseConn::refreshConnections() {
|
||||||
|
|
||||||
QVariant BaseConn::getConnections() {
|
QVariant BaseConn::getConnections() {
|
||||||
return(connections);
|
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;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue