| 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 KSECURITYLEVELBAR_H |
| 24 |
#define KSECURITYLEVELBAR_H |
| 25 |
|
| 26 |
#include "gui_g.h" |
| 27 |
#include <QWidget> |
| 28 |
|
| 29 |
namespace kdk |
| 30 |
{ |
| 31 |
|
| 32 |
/** @defgroup MessageAlertModule |
| 33 |
* @{ |
| 34 |
*/ |
| 35 |
|
| 36 |
/** |
| 37 |
* @brief 分为三个安全等级 |
| 38 |
* @since 1.0.0 |
| 39 |
*/ |
| 40 |
enum SecurityLevel { |
| 41 |
Low, |
| 42 |
Medium, |
| 43 |
High |
| 44 |
}; |
| 45 |
|
| 46 |
class KSecurityLevelBarPrivate; |
| 47 |
|
| 48 |
/** |
| 49 |
* @brief 密码安全等级提示条,支持三个安全等级 |
| 50 |
*/ |
| 51 |
class GUI_EXPORT KSecurityLevelBar : public QWidget |
| 52 |
{ |
| 53 |
Q_OBJECT |
| 54 |
public: |
| 55 |
explicit KSecurityLevelBar(QWidget *parent = nullptr); |
| 56 |
|
| 57 |
/** |
| 58 |
* @brief 设置安全等级 |
| 59 |
* @param level |
| 60 |
*/ |
| 61 |
void setSecurityLevel(SecurityLevel level); |
| 62 |
|
| 63 |
/** |
| 64 |
* @brief 获取安全等级 |
| 65 |
* @return |
| 66 |
*/ |
| 67 |
SecurityLevel securityLevel(); |
| 68 |
|
| 69 |
protected: |
| 70 |
void paintEvent(QPaintEvent *event); |
| 71 |
|
| 72 |
private: |
| 73 |
Q_DECLARE_PRIVATE(KSecurityLevelBar) |
| 74 |
KSecurityLevelBarPrivate *const d_ptr; |
| 75 |
}; |
| 76 |
} |
| 77 |
/** |
| 78 |
* @example testsecuritylevelbar/widget.h |
| 79 |
* @example testsecuritylevelbar/widget.cpp |
| 80 |
* @} |
| 81 |
*/ |
| 82 |
|
| 83 |
#endif // KSECURITYLEVELBAR_H |