| 1 |
/* |
| 2 |
* libkysdk-qtwidgets's Library |
| 3 |
* |
| 4 |
* Copyright (C) 2023, KylinSoft Co., Ltd. |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 3 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this library. If not, see <https://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* Authors: Zhen Sun <[email protected]> |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef KCOMMENTPANEL_H |
| 24 |
#define KCOMMENTPANEL_H |
| 25 |
|
| 26 |
#include "gui_g.h" |
| 27 |
#include <QWidget> |
| 28 |
|
| 29 |
namespace kdk |
| 30 |
{ |
| 31 |
|
| 32 |
/** |
| 33 |
* @defgroup CommentsPanel |
| 34 |
*/ |
| 35 |
class KCommentPanelPrivate; |
| 36 |
|
| 37 |
/** |
| 38 |
* @brief 提供六种评论等级 |
| 39 |
*/ |
| 40 |
enum StarLevel { |
| 41 |
LevelZero = 0, |
| 42 |
LevelOne, |
| 43 |
LevelTwo, |
| 44 |
LevelThree, |
| 45 |
LevelFour, |
| 46 |
LevelFive |
| 47 |
}; |
| 48 |
|
| 49 |
/** |
| 50 |
* @brief 显示用户评论的详细信息 |
| 51 |
* @since 1.0.0 |
| 52 |
*/ |
| 53 |
class GUI_EXPORT KCommentPanel : public QWidget |
| 54 |
{ |
| 55 |
Q_OBJECT |
| 56 |
|
| 57 |
public: |
| 58 |
explicit KCommentPanel(QWidget *parent = nullptr); |
| 59 |
|
| 60 |
/** |
| 61 |
* @brief 设置评论用户头像 |
| 62 |
*/ |
| 63 |
void setIcon(const QIcon &); |
| 64 |
|
| 65 |
/** |
| 66 |
* @brief 设置评论时间 |
| 67 |
*/ |
| 68 |
void setTime(const QString &); |
| 69 |
|
| 70 |
/** |
| 71 |
* @brief 设置评论用户昵称 |
| 72 |
*/ |
| 73 |
void setName(const QString &); |
| 74 |
|
| 75 |
/** |
| 76 |
* @brief 设置评论文本 |
| 77 |
*/ |
| 78 |
void setText(const QString &); |
| 79 |
|
| 80 |
/** |
| 81 |
* @brief 设置等级 |
| 82 |
* @param level |
| 83 |
*/ |
| 84 |
void setGrade(StarLevel level); |
| 85 |
|
| 86 |
protected: |
| 87 |
void paintEvent(QPaintEvent *event) override; |
| 88 |
|
| 89 |
private: |
| 90 |
Q_DECLARE_PRIVATE(KCommentPanel) |
| 91 |
KCommentPanelPrivate *const d_ptr; |
| 92 |
}; |
| 93 |
} |
| 94 |
|
| 95 |
#endif // KCOMMENTPANEL_H |