magpie/root.h

39 lines
869 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>
2024-01-20 21:17:21 +00:00
#include <memory>
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>
2024-01-20 21:17:21 +00:00
#include "models/magpie.h"
2023-11-24 23:48:01 +00:00
#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;
2024-01-20 21:17:21 +00:00
Models::Magpie magpie;
std::shared_ptr<API> api;
2023-11-22 23:13:33 +00:00
};