File indexing completed on 2024-05-12 05:04:15
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include <QtQml> 0007 0008 class Poll 0009 { 0010 Q_GADGET 0011 0012 Q_PROPERTY(QString id READ id CONSTANT) 0013 Q_PROPERTY(QDateTime expiresAt READ expiresAt CONSTANT) 0014 Q_PROPERTY(bool expired READ expired CONSTANT) 0015 Q_PROPERTY(bool multiple READ multiple CONSTANT) 0016 Q_PROPERTY(int votesCount READ votesCount CONSTANT) 0017 Q_PROPERTY(int votersCount READ votersCount CONSTANT) 0018 Q_PROPERTY(bool voted READ voted CONSTANT) 0019 Q_PROPERTY(QList<int> ownVotes READ ownVotes CONSTANT) 0020 Q_PROPERTY(QList<QVariantMap> options READ options CONSTANT) 0021 0022 public: 0023 Poll(); 0024 explicit Poll(const QJsonObject &json); 0025 0026 QString id() const; 0027 QDateTime expiresAt() const; 0028 bool expired() const; 0029 bool multiple() const; 0030 int votesCount() const; 0031 int votersCount() const; 0032 bool voted() const; 0033 QList<int> ownVotes() const; 0034 QList<QVariantMap> options() const; 0035 0036 private: 0037 QString m_id; 0038 QDateTime m_expiresAt; 0039 bool m_expired = false; 0040 bool m_multiple = false; 0041 int m_votesCount = 0; 0042 int m_votersCount = 0; 0043 bool m_voted = false; 0044 QList<int> m_ownVotes; 0045 QList<QVariantMap> m_options; 0046 };