|
@@ -4,13 +4,8 @@
|
|
#include "../include/climanager.h"
|
|
#include "../include/climanager.h"
|
|
#include "../include/cmdmanager.h"
|
|
#include "../include/cmdmanager.h"
|
|
#include "../include/config.h"
|
|
#include "../include/config.h"
|
|
-#include <boost/asio.hpp>
|
|
|
|
-#include <boost/filesystem.hpp>
|
|
|
|
-#include <boost/lexical_cast.hpp>
|
|
|
|
#include <json/json.h>
|
|
#include <json/json.h>
|
|
|
|
|
|
-using boost::lexical_cast;
|
|
|
|
-using boost::asio::buffer;
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
namespace CmdManager {
|
|
namespace CmdManager {
|
|
@@ -68,8 +63,8 @@ void CmdManager::emitFileList() {
|
|
if (it->second.method.size()) {
|
|
if (it->second.method.size()) {
|
|
snprintf(speedbuf, 256, "%.2f B/s", it->second.speed);
|
|
snprintf(speedbuf, 256, "%.2f B/s", it->second.speed);
|
|
progstr = it->second.type + " via " + it->second.method + "\n" + std::to_string(it->second.progress) + "%" + " @ " + speedbuf;
|
|
progstr = it->second.type + " via " + it->second.method + "\n" + std::to_string(it->second.progress) + "%" + " @ " + speedbuf;
|
|
- }
|
|
|
|
- else progstr = it->second.type + "\n" + std::to_string(it->second.progress) + "%";
|
|
|
|
|
|
+ } else
|
|
|
|
+ progstr = it->second.type + "\n" + std::to_string(it->second.progress) + "%";
|
|
emit qmlHandler->receivingUpdateFile(it->first.c_str(), progstr.c_str(), it->second.type == "Queued" || it->second.type == "Sending");
|
|
emit qmlHandler->receivingUpdateFile(it->first.c_str(), progstr.c_str(), it->second.type == "Queued" || it->second.type == "Sending");
|
|
}
|
|
}
|
|
// else emit plain entry
|
|
// else emit plain entry
|
|
@@ -126,7 +121,7 @@ void CmdManager::handleList(Json::Value root) {
|
|
auto fileNames = root["names"];
|
|
auto fileNames = root["names"];
|
|
for (int i = 0; i < fileNames.size(); i++) {
|
|
for (int i = 0; i < fileNames.size(); i++) {
|
|
emit qmlHandler->receivingListFile(QString::fromStdString(fileNames[i].asString()), QString::fromStdString(sizebuf), QString("Decryptable"),
|
|
emit qmlHandler->receivingListFile(QString::fromStdString(fileNames[i].asString()), QString::fromStdString(sizebuf), QString("Decryptable"),
|
|
- boost::filesystem::exists(fileNames[i].asString()));
|
|
|
|
|
|
+ !!ifstream(fileNames[i].asString()));
|
|
filemap[fileNames[i].asString()] = {false, "", "", 0, 0};
|
|
filemap[fileNames[i].asString()] = {false, "", "", 0, 0};
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -145,7 +140,7 @@ void CmdManager::handleExtendedList(Json::Value root) {
|
|
for (Json::Value f : files) {
|
|
for (Json::Value f : files) {
|
|
snprintf(sizebuf, 256, "%.2f", f["size"].asFloat());
|
|
snprintf(sizebuf, 256, "%.2f", f["size"].asFloat());
|
|
emit qmlHandler->receivingListFile(QString::fromStdString(f["name"].asString()), QString::fromStdString(sizebuf),
|
|
emit qmlHandler->receivingListFile(QString::fromStdString(f["name"].asString()), QString::fromStdString(sizebuf),
|
|
- QString::fromStdString(f["encrypted"].asString()), boost::filesystem::exists(f["name"].asString()));
|
|
|
|
|
|
+ QString::fromStdString(f["encrypted"].asString()), !!ifstream(f["name"].asString()));
|
|
filemap[f["name"].asString()] = {false, "", "", 0, 0};
|
|
filemap[f["name"].asString()] = {false, "", "", 0, 0};
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|