|
@@ -110,15 +110,15 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
string cmd = command.asString();
|
|
|
qInfo() << QString::fromStdString("Received command " + cmd);
|
|
|
|
|
|
- if (cmd.compare("status")) {
|
|
|
+ if (!cmd.compare("status")) {
|
|
|
emit footerSetStatus(root["response"].asString().c_str());
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("close")) {
|
|
|
+ else if (!cmd.compare("close")) {
|
|
|
programActive = false;
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("list")) {
|
|
|
+ else if (!cmd.compare("list")) {
|
|
|
if (root["accept"] == true) {
|
|
|
emit receivingClearFileList();
|
|
|
|
|
@@ -133,7 +133,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd == "connect") {
|
|
|
+ else if (!cmd.compare("connect")) {
|
|
|
if (root["accept"].asBool()) {
|
|
|
} else {
|
|
|
emit ipPopupSetStatus(root["error"].asString().c_str());
|
|
@@ -141,7 +141,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("version")) {
|
|
|
+ else if (!cmd.compare("version")) {
|
|
|
if (root["accept"] == true) {
|
|
|
emit ipPopupClose();
|
|
|
emit loginSignupPopupOpen();
|
|
@@ -154,7 +154,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("login")) {
|
|
|
+ else if (!cmd.compare("login")) {
|
|
|
if (root["accept"] == true) {
|
|
|
emit loginSignupPopupClose();
|
|
|
} else {
|
|
@@ -163,7 +163,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("signup")) {
|
|
|
+ else if (!cmd.compare("signup")) {
|
|
|
if (root["accept"] == true) {
|
|
|
emit loginSignupPopupClose();
|
|
|
} else {
|
|
@@ -172,7 +172,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("put")) {
|
|
|
+ else if (!cmd.compare("put")) {
|
|
|
if (root["accept"] == false) {
|
|
|
QString errorMessage = QString::fromStdString(
|
|
|
string("Error when uploading file " + root["file"].asString() +
|
|
@@ -181,11 +181,11 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("putdata")) {
|
|
|
+ else if (!cmd.compare("putdata")) {
|
|
|
// TODO: Show speed and handle Error
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("get")) {
|
|
|
+ else if (!cmd.compare("get")) {
|
|
|
if (root["accept"] == false) {
|
|
|
QString errorMessage = QString::fromStdString(
|
|
|
string("Error when downloading file " + root["file"].asString() +
|
|
@@ -194,7 +194,7 @@ void QMLHandler::handleJSON(string buffer) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- else if (cmd.compare("getdata")) {
|
|
|
+ else if (!cmd.compare("getdata")) {
|
|
|
// TODO: Show speed and handle Error
|
|
|
}
|
|
|
}
|
|
@@ -217,13 +217,6 @@ void QMLHandler::readPipeLoop() {
|
|
|
|
|
|
if (inPipeStatus.revents & POLLIN) {
|
|
|
readOffset += read(inpipefd[0], buf + readOffset, 1);
|
|
|
-
|
|
|
- if (buf[readOffset - 1] == '\n') {
|
|
|
- pollCount = 10;
|
|
|
- } else {
|
|
|
- pollCount = 0;
|
|
|
- }
|
|
|
-
|
|
|
pollCount = 0;
|
|
|
|
|
|
} else {
|