api started

This commit is contained in:
Tim Blume 2021-01-02 00:19:42 +01:00
parent 4d5f0fd233
commit efa3677d69
4 changed files with 52 additions and 5 deletions

View file

@ -36,6 +36,8 @@ add_executable(littlesnitch
editandresend.h editandresend.h
addonhandler.h addonhandler.h
include/api.h include/api.h
include/httpsender.h
include/httpreceiver.h
mainwindow.ui mainwindow.ui
editandresend.ui editandresend.ui
) )

View file

@ -78,12 +78,12 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>120</y> <y>120</y>
<width>781</width> <width>881</width>
<height>404</height> <height>441</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch> <horstretch>1</horstretch>
<verstretch>1</verstretch> <verstretch>1</verstretch>
</sizepolicy> </sizepolicy>
@ -110,14 +110,20 @@
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum> <enum>QLayout::SetMaximumSize</enum>
</property> </property>
<item row="0" column="0"> <item row="0" column="0" colspan="2">
<widget class="QSplitter" name="splitter_3"> <widget class="QSplitter" name="splitter_3">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch> <horstretch>1</horstretch>
<verstretch>1</verstretch> <verstretch>1</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="sizeIncrement"> <property name="sizeIncrement">
<size> <size>
<width>1</width> <width>1</width>

18
include/httpreceiver.h Normal file
View file

@ -0,0 +1,18 @@
#pragma once
#include <include/api.h>
#include <QObject>
namespace http {
#define HTTPReceiverInterfaceIID "bigsnitch.api.HTTPReceiverInterface/100"
class ReceiverInterface {
public:
virtual ~ReceiverInterface() = default;
};
}
Q_DECLARE_INTERFACE(http::ReceiverInterface, HTTPReceiverInterfaceIID)

21
include/httpsender.h Normal file
View file

@ -0,0 +1,21 @@
#pragma once
#include <include/api.h>
#include <QObject>
namespace http {
#define HTTPSenderInterfaceIID "bigsnitch.api.HTTPSenderInterface/100"
class SenderInterface {
public:
virtual ~SenderInterface() = default;
virtual int send(http::Request request);
virtual bool received(int id);
virtual std::optional<http::Response> receive(int id);
};
}
Q_DECLARE_INTERFACE(http::SenderInterface, HTTPSenderInterfaceIID)