matrixion/src/ui/NhekoGlobalObject.h

53 lines
1.4 KiB
C
Raw Normal View History

2021-05-13 09:23:56 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QObject>
#include <QPalette>
2021-05-15 00:35:34 +03:00
#include "Theme.h"
#include "UserProfile.h"
2021-05-13 09:23:56 +03:00
class Nheko : public QObject
{
Q_OBJECT
Q_PROPERTY(QPalette colors READ colors NOTIFY colorsChanged)
Q_PROPERTY(QPalette inactiveColors READ inactiveColors NOTIFY colorsChanged)
2021-05-15 00:35:34 +03:00
Q_PROPERTY(Theme theme READ theme NOTIFY colorsChanged)
2021-05-13 12:32:20 +03:00
Q_PROPERTY(int avatarSize READ avatarSize CONSTANT)
Q_PROPERTY(int paddingSmall READ paddingSmall CONSTANT)
Q_PROPERTY(int paddingMedium READ paddingMedium CONSTANT)
Q_PROPERTY(int paddingLarge READ paddingLarge CONSTANT)
2021-05-13 09:23:56 +03:00
2021-05-15 00:35:34 +03:00
Q_PROPERTY(UserProfile *currentUser READ currentUser NOTIFY profileChanged)
2021-05-13 09:23:56 +03:00
public:
Nheko();
QPalette colors() const;
QPalette inactiveColors() const;
2021-05-15 00:35:34 +03:00
Theme theme() const;
2021-05-13 09:23:56 +03:00
2021-05-13 12:32:20 +03:00
int avatarSize() const { return 40; }
int paddingSmall() const { return 4; }
int paddingMedium() const { return 8; }
int paddingLarge() const { return 20; }
2021-05-15 00:35:34 +03:00
UserProfile *currentUser() const;
2021-05-13 09:52:02 +03:00
Q_INVOKABLE void openLink(QString link) const;
2021-05-15 00:35:34 +03:00
private slots:
void updateUserProfile();
2021-05-13 09:23:56 +03:00
signals:
void colorsChanged();
2021-05-15 00:35:34 +03:00
void profileChanged();
2021-05-13 09:52:02 +03:00
2021-05-15 00:35:34 +03:00
private:
QScopedPointer<UserProfile> currentUser_;
};