From 3ee53de11a796e5e8dd6e8b1c15923588fc26e4e Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Fri, 15 Jun 2018 15:40:33 +0300 Subject: [PATCH] Cleaning the source I start everything from scratch --- src/Influence.pro | 25 ------------------------- src/contactmanager.cpp | 10 ---------- src/contactmanager.h | 12 ------------ src/json.hpp | 7 ------- src/main.hpp | 3 --- src/network.cpp | 30 ------------------------------ src/network.hpp | 16 ---------------- src/sql.cpp | 1 - src/sql.h | 3 --- 9 files changed, 107 deletions(-) delete mode 100644 src/Influence.pro delete mode 100644 src/contactmanager.cpp delete mode 100644 src/contactmanager.h delete mode 100644 src/json.hpp delete mode 100644 src/main.hpp delete mode 100644 src/network.cpp delete mode 100644 src/network.hpp delete mode 100644 src/sql.cpp delete mode 100644 src/sql.h diff --git a/src/Influence.pro b/src/Influence.pro deleted file mode 100644 index dbea0bc..0000000 --- a/src/Influence.pro +++ /dev/null @@ -1,25 +0,0 @@ -QT -= gui -QT += network - -CONFIG += c++11 console -CONFIG -= app_bundle - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which as been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - main.cpp \ - network.cpp \ - contactmanager.cpp - -HEADERS += \ - network.h \ - contactmanager.h diff --git a/src/contactmanager.cpp b/src/contactmanager.cpp deleted file mode 100644 index b4b361a..0000000 --- a/src/contactmanager.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "contactmanager.h" - -ContactManager::sendPing(QHostAddress ip) -{ - json ping; - ping["peerID"] = QHostAddress::AnyIPv6; - ping["action"] = "ping"; - QString str = ping.dump(); - Network::send(str, ip); -} diff --git a/src/contactmanager.h b/src/contactmanager.h deleted file mode 100644 index 0bf623f..0000000 --- a/src/contactmanager.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef CONTACTMANAGER_H -#define CONTACTMANAGER_H - -#include "network.hpp" - -class ContactManager -{ -private: - sendPing(QHostAddress ip); -}; - -#endif // CONTACTMANAGER_H \ No newline at end of file diff --git a/src/json.hpp b/src/json.hpp deleted file mode 100644 index 0411e0d..0000000 --- a/src/json.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef JSON_HPP -#define JSON_HPP - -#include "lib/json/json.hpp" -using json = nlohmann::json; - -#endif \ No newline at end of file diff --git a/src/main.hpp b/src/main.hpp deleted file mode 100644 index 23cca53..0000000 --- a/src/main.hpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "json.cpp" -#include "contactmanager.cpp" -#include "network.cpp" \ No newline at end of file diff --git a/src/network.cpp b/src/network.cpp deleted file mode 100644 index 4fab750..0000000 --- a/src/network.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "network.h" - -class Network -{ - Network() - { - socket = new QUdpSocket(this); - socket->bind(QHostAddress::AnyIPv6, 6552); - connect(socket, SIGNAL(readyRead()), SLOT(read())); - } - void send(QString str, QHostAddress ip) - { - QByteArray data; - QDataStream out(&data, QIODevice::WriteOnly); - out << qint64(0); - out << str; - out.device()->seek(qint64(0)); - out << qint64(data.size() - sizeof(qint64)); - socket->writeDatagram(data, QHostAddress(ip), 6552); - } - void read() - { - QByteArray buffer; - buffer.resize(socket->pendingDatagramSize()); - socket->readDatagram(buffer.data(), buffer.size(), - &sender;, &senderPort;); - qDebug() << "Message from: " << sender.toString(); - qDebug() << "Message: " << buffer; - } -} diff --git a/src/network.hpp b/src/network.hpp deleted file mode 100644 index c1f7ce0..0000000 --- a/src/network.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef NETWORK_HPP -#define NETWORK_HPP - -#include "lib/json/json.hpp" -#include -using json = nlohmann::json; - -class network -{ - public: - send(QString str, QHostAddress ip); - private: - read(); -}; - -#endif // NETWORK_H diff --git a/src/sql.cpp b/src/sql.cpp deleted file mode 100644 index b699ec9..0000000 --- a/src/sql.cpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/src/sql.h b/src/sql.h deleted file mode 100644 index c5ec75b..0000000 --- a/src/sql.h +++ /dev/null @@ -1,3 +0,0 @@ -#include -#include -