SuspectData.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include <QObject>
  2. #ifndef SUSPECTDATA_H
  3. #define SUSPECTDATA_H
  4. class SuspectData : public QObject {
  5. Q_OBJECT
  6. public:
  7. SuspectData() : _hasFlag(false), _profile(0), _roleId(0), _flipped(false), _excluded(false), _isKiller(false) {}
  8. Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged())
  9. bool hasFlag() const { return _hasFlag; }
  10. Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged())
  11. bool flipped() const { return _flipped; }
  12. Q_PROPERTY(bool excluded READ excluded NOTIFY excludedChanged())
  13. bool excluded() const { return _excluded; }
  14. Q_PROPERTY(int profile READ profile NOTIFY profileChanged())
  15. int profile() const { return _profile; }
  16. Q_PROPERTY(int role READ role NOTIFY roleChanged())
  17. int role() const { return _roleId; }
  18. Q_PROPERTY(QString roleText READ roleText NOTIFY roleChanged())
  19. QString roleText() const { return _role; }
  20. Q_PROPERTY(bool isKiller READ isKiller/* NOTIFY excludedChanged()*/)
  21. bool isKiller() const { return _isKiller; }
  22. Q_PROPERTY(QList<int> evidences READ evidences NOTIFY evidencesChanged())
  23. QList<int> evidences() const { return _evidences; /*if (_evidences) {return _evidences;} else { QList<int>return QList<int>};*/}
  24. void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();}
  25. void setProfile(int profile) { _profile = profile; emit profileChanged();}
  26. void setRole(int roleId, QString role) { _roleId = roleId; _role = role; emit roleChanged();}
  27. void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); }
  28. void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); }
  29. void exclude() { if (_excluded) return; _excluded = true; emit excludedChanged(); }
  30. void include() { if(!_excluded) return; _excluded = false; emit excludedChanged(); }
  31. void setIsKiller(bool isKiller) { _isKiller = isKiller; }
  32. void resetEvidences() {_evidences.clear(); emit evidencesChanged();}
  33. void assignEvidence(int evidenceId) { _evidences << evidenceId; emit evidencesChanged(); }
  34. void reloadEvidences() { emit roleChanged(); }
  35. signals:
  36. void hasFlagChanged();
  37. void flippedChanged();
  38. void excludedChanged();
  39. void profileChanged();
  40. void roleChanged();
  41. void evidencesChanged();
  42. private:
  43. bool _hasFlag;
  44. int _profile;
  45. int _roleId;
  46. QString _role;
  47. bool _flipped;
  48. bool _excluded;
  49. bool _isKiller;
  50. QList<int> _evidences;
  51. };
  52. #endif // SUSPECTDATA_H