File indexing completed on 2024-04-28 05:02:28

0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include <QJSEngine>
0007 
0008 #include "identity.h"
0009 #include "post.h"
0010 
0011 class Navigation : public QObject
0012 {
0013     Q_OBJECT
0014     QML_ELEMENT
0015     QML_SINGLETON
0016 
0017 public:
0018     static Navigation *create(QQmlEngine *, QJSEngine *)
0019     {
0020         auto inst = &instance();
0021         QJSEngine::setObjectOwnership(inst, QJSEngine::ObjectOwnership::CppOwnership);
0022         return inst;
0023     }
0024 
0025     static Navigation &instance();
0026 
0027 Q_SIGNALS:
0028     void openStatusComposer();
0029     void replyTo(const QString &inReplyTo, const QVariant &mentions, int visibility, Identity *authorIdentity, Post *post);
0030     void openAccount(const QString &accountId);
0031     void openThread(const QString &postId);
0032     void openFullScreenImage(const QVariant &attachments, Identity *identity, int currentIndex);
0033     void openTag(const QString &tag);
0034     void reportPost(Identity *identity, const QString &postId);
0035     void reportUser(Identity *identity);
0036     void openList(const QString &listId, const QString &listName);
0037 
0038 private:
0039     Navigation() = default;
0040 };