Commit faf6465b authored by CodeCrafter912's avatar CodeCrafter912

- fixed text color of timer not working on Qt 5.9

- some cleanup
parent 0fd48139
......@@ -32,7 +32,7 @@ BaseConn::BaseConn(QObject *parent) : QObject(parent)
}
void BaseConn::connectToHost() {
qDebug() << "connecting";
qDebug() << "+--- connecting";
setState("connecting");
connect(this->timeoutTimer, SIGNAL(timeout()), this, SLOT(connectionTimeout()));
......@@ -72,7 +72,7 @@ void BaseConn::deInit() {
void BaseConn::closeConnection()
{
qDebug() << "closing connection";
qDebug() << "+--- closing connection";
switch (socket->state())
{
case 0:
......@@ -112,7 +112,6 @@ void BaseConn::gotError(QAbstractSocket::SocketError err)
}
emit gotError(strError);
qDebug() << "got socket error: " << strError;
}
// -------------------------------------
......@@ -167,7 +166,6 @@ QVariantMap BaseConn::sendCommand(int header, QJsonValue data){
requestObj.insert("data", data);
QString jsonRequest = QJsonDocument(requestObj).toJson();
qDebug() << "sending command:" << jsonRequest;
timer->setSingleShot(true);
// quit the loop when the timer times out
......@@ -321,7 +319,7 @@ void BaseConn::socketReplyRecieved(QString reply) {
void BaseConn::doConnectionAttempt()
{
if(this->state == "disconnected") {
qDebug() << "trying to connect";
qDebug() << "+--- trying to connect";
this->connectToHost();
}
......@@ -344,7 +342,6 @@ void BaseConn::setState(QString newState){
// ------------------
void BaseConn::handleUpdate(QVariantMap data) {
qDebug() << "got update: " << data;
int header = data["header"].toInt();
switch (header) {
case 9001:
......
......@@ -118,9 +118,9 @@ Window {
height: parent.height * 0.8
elide: "ElideRight"
color: [4].includes(baseConn.timers[index]["state"]) ? "#6bd43b" :
[2,5,6].includes(baseConn.timers[index]["state"]) ? "#e03b2f":
"black"
color: [4].indexOf(baseConn.timers[index]["state"]) >= 0 ? "#6bd43b" :
[2,5,6].indexOf(baseConn.timers[index]["state"]) >= 0 ? "#e03b2f":
"black"
text: baseConn.timers[index]["text"]
......@@ -132,7 +132,6 @@ Window {
font.pixelSize: height
font.family: timerFont.name
minimumPixelSize: 1
}
Label {
......@@ -217,7 +216,7 @@ Window {
text: appSettings.baseStationIp
onTextChanged: {
onEditingFinished: {
appSettings.baseStationIp = text
baseConn.ipAddress = text
}
......
......@@ -4,7 +4,7 @@ CONFIG += c++11
CONFIG -= app_bundle
TARGET = ScStwMonitor
VERSION = 1.0
VERSION = 1.1
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
......
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