magpie/root.h

35 lines
779 B
C
Raw Normal View History

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