QFDAlert.cpp 999 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "QFDAlert.h"
  2. #include <dbService/ClassSet.h>
  3. #include <Widgets/InfoBar.h>
  4. void QFDAlert::showAlertWithCode(int code, QWidget *w)
  5. {
  6. if (code == QF_CODE_SUCCEEDED) {
  7. return;
  8. }
  9. QString msg;
  10. if (code == QF_CODE_EMPTY_ACCOUNT) {
  11. msg = "账号不能为空";
  12. } else if (code == QF_CODE_EMPTY_PASSWORD) {
  13. msg = "密码不能为空";
  14. } else if (code == QF_CODE_USER_NOT_EXISTS) {
  15. msg = "用户不存在";
  16. } else if (code == QF_CODE_WRONG_PASSWORD) {
  17. msg = "密码错误";
  18. } else if (code == QF_CODE_PASSWORD_NOT_SAME) {
  19. msg = "两次输入密码不一致,请修改后重试";
  20. } else if (code == QF_CODE_PASSWORD_UNCHANGED) {
  21. msg = "不能与旧密码相同,请修改后重试";
  22. } else if (code == QF_CODE_DATA_ERROR) {
  23. msg = "数据错误";
  24. }
  25. if (!msg.isEmpty()) {
  26. InfoBar::warning("提示", msg, Qt::Horizontal, false, 2000, InfoBarPosition::TOP_RIGHT, w);
  27. }
  28. }