Working IPFS network test!
parent
f777bf2eac
commit
d43289901f
|
@ -67,6 +67,12 @@
|
|||
"bit": "cpp",
|
||||
"cstring": "cpp",
|
||||
"set": "cpp",
|
||||
"valarray": "cpp"
|
||||
"valarray": "cpp",
|
||||
"bitset": "cpp",
|
||||
"csignal": "cpp",
|
||||
"forward_list": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"regex": "cpp",
|
||||
"shared_mutex": "cpp"
|
||||
}
|
||||
}
|
|
@ -39,6 +39,8 @@ set(SOURCES
|
|||
menu.h
|
||||
md-parser.cc
|
||||
md-parser.h
|
||||
network.cc
|
||||
network.h
|
||||
render-area.cc
|
||||
render-area.h
|
||||
)
|
||||
|
@ -63,13 +65,11 @@ get_property(CMAKE_BINARY_DIR GLOBAL PROPERTY COMMONMARKER_BINARY_DIR)
|
|||
get_property(CMAKE_EXTENSIONS_BINARY_DIR GLOBAL PROPERTY COMMONMARKER_EXTENSIONS_BINARY_DIR)
|
||||
|
||||
target_include_directories(${PROJECT_TARGET} PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_EXTENSIONS_BINARY_DIR}
|
||||
${GTKMM_INCLUDE_DIRS}
|
||||
${CAIRO_INCLUDE_DIRS}
|
||||
lib/commonmarker/src
|
||||
lib/ipfs-http-client/include
|
||||
${PROJECT_SOURCE_DIR}/lib/ipfs-http-client/include
|
||||
)
|
||||
|
||||
target_link_directories(${PROJECT_TARGET} PRIVATE
|
||||
|
|
|
@ -28,6 +28,10 @@ MainWindow::MainWindow() : m_vbox(Gtk::ORIENTATION_VERTICAL, 0)
|
|||
add(m_vbox);
|
||||
show_all_children();
|
||||
|
||||
// Just an IPFS test! Fetch a resource from the IPFS network
|
||||
// Assuming you already running a IPFS deamon
|
||||
network.FetchReadme();
|
||||
|
||||
// Setup parser
|
||||
setupParser();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <gtkmm/scrolledwindow.h>
|
||||
#include "render-area.h"
|
||||
#include "menu.h"
|
||||
#include "network.h"
|
||||
|
||||
class Parser;
|
||||
|
||||
|
@ -28,6 +29,7 @@ protected:
|
|||
RenderArea m_renderArea;
|
||||
private:
|
||||
Parser *parser;
|
||||
Network network;
|
||||
|
||||
void setupParser();
|
||||
};
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#ifndef MENU_H
|
||||
#define MENU_H
|
||||
|
||||
#include <signal.h>
|
||||
#include <gtkmm/menubar.h>
|
||||
#include <gtkmm/menu.h>
|
||||
|
@ -32,3 +35,4 @@ protected:
|
|||
private:
|
||||
Gtk::MenuItem* createMenuItem(const Glib::ustring& label_text);
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,19 @@
|
|||
#include "network.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Network::Network()
|
||||
: client("localhost", 5001)
|
||||
{
|
||||
}
|
||||
|
||||
Network::~Network() {
|
||||
}
|
||||
|
||||
void Network::FetchReadme() {
|
||||
// Demo ...
|
||||
std::stringstream contents;
|
||||
client.FilesGet("/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", &contents);
|
||||
std::cout << contents.str() << std::endl;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
#include <ipfs/client.h>
|
||||
|
||||
/**
|
||||
* \class Network
|
||||
* \brief IPFS Network
|
||||
*/
|
||||
class Network
|
||||
{
|
||||
public:
|
||||
Network();
|
||||
virtual ~Network();
|
||||
|
||||
void FetchReadme();
|
||||
private:
|
||||
ipfs::Client client;
|
||||
};
|
||||
#endif
|
Loading…
Reference in New Issue