Files
  • main.cpp
  • Signin.qml
  • main.qml
  • request.cpp
  • request.h
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <QGuiApplication>
#include <QQmlApplicationEngine>

#include <iostream>

#include "tcp_client.h"
#include "message.h"
#include "observer.h"
#include "request.h"
#include "root_certificates.h"

#include <QDebug>
#include <QObject>
#include <QQuickItem>
#include <QQmlContext>


int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;

    boost::asio::io_context io_context;
    tcp::resolver resolver(io_context);
    boost::asio::ssl::context ctx{ssl::context::sslv23_client};
    load_root_certificates(ctx);
    tcp_client c(io_context);
    request request(io_context, ctx);

    engine.rootContext()->setContextProperty("tcp_client", &c);
    engine.rootContext()->setContextProperty("http1", &request);
    QObject::connect(&request,&request::login,[](){
        qDebug() << "Login Successfull" <<endl;
    });

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}