magpie/root.h

35 lines
779 B
C++

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <iostream>
#include <stdexcept>
#include <QString>
#include <QUrl>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "API/api.h"
class Root : public QGuiApplication {
Q_OBJECT
public:
Root(const QUrl& root, int& argc, char* argv[]);
~Root();
bool notify(QObject* receiver, QEvent* e) override;
private slots:
void onObjectCreated(QObject* obj, const QUrl& objUrl);
void onAPIAddressChanged(const QUrl& url);
void onStoreTokens(const QString& access, const QString& renew);
private:
QUrl root;
QQmlApplicationEngine engine;
QQmlContext* context;
API api;
};