File indexing completed on 2024-05-05 17:33:22

0001 /*
0002  *   SPDX-FileCopyrightText: 2011 Jonathan Thomas <echidnaman@kubuntu.org>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QDateTime>
0010 #include <QVariant>
0011 
0012 #include "ReviewsModel.h"
0013 #include "discovercommon_export.h"
0014 
0015 class DISCOVERCOMMON_EXPORT Review
0016 {
0017 public:
0018     Review(QString name,
0019            QString pkgName,
0020            QString language,
0021            QString summary,
0022            QString reviewText,
0023            QString userName,
0024            const QDateTime &date,
0025            bool show,
0026            quint64 id,
0027            int rating,
0028            int usefulTotal,
0029            int usefulFavorable,
0030            QString packageVersion);
0031     ~Review();
0032 
0033     // Creation date determines greater than/less than
0034     bool operator<(const Review &rhs) const;
0035     bool operator>(const Review &rhs) const;
0036 
0037     QString applicationName() const;
0038     QString packageName() const;
0039     QString packageVersion() const;
0040     QString language() const;
0041     QString summary() const;
0042     QString reviewText() const;
0043     QString reviewer() const;
0044     QDateTime creationDate() const;
0045     bool shouldShow() const;
0046     quint64 id() const;
0047     int rating() const;
0048     int usefulnessTotal() const;
0049     int usefulnessFavorable() const;
0050     ReviewsModel::UserChoice usefulChoice() const;
0051     void setUsefulChoice(ReviewsModel::UserChoice useful);
0052     void addMetadata(const QString &key, const QVariant &value);
0053     QVariant getMetadata(const QString &key);
0054 
0055 private:
0056     QString m_appName;
0057     QDateTime m_creationDate;
0058     bool m_shouldShow;
0059     quint64 m_id;
0060     QString m_language;
0061     QString m_packageName;
0062     int m_rating;
0063     QString m_reviewText;
0064     QString m_reviewer;
0065     int m_usefulnessTotal;
0066     int m_usefulnessFavorable;
0067     ReviewsModel::UserChoice m_usefulChoice;
0068     QString m_summary;
0069     QString m_packageVersion;
0070     QVariantMap m_metadata;
0071 };