TileData.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include "EvidenceType.h"
  2. #ifndef TILEDATA_H
  3. #define TILEDATA_H
  4. class TileData : public QObject {
  5. Q_OBJECT
  6. public:
  7. TileData() : _hasFlag(false), _hasEvidence(false), _type(new EvidenceType), _hint(-1), _flipped(false), _description(""), _property(-1), _suspect(-1) {}
  8. Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged)
  9. bool hasFlag() const { return _hasFlag; }
  10. Q_PROPERTY(bool hasEvidence READ hasEvidence NOTIFY hasEvidenceChanged)
  11. bool hasEvidence() const { return _hasEvidence; }
  12. Q_PROPERTY(int hint READ hint NOTIFY hintChanged)
  13. int hint() const { return _hint; }
  14. Q_PROPERTY(EvidenceType *type READ type NOTIFY typeChanged)
  15. EvidenceType* type() const { return _type; }
  16. Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged())
  17. bool flipped() const { return _flipped; }
  18. Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
  19. QString description() const { return _description; }
  20. int propertyId() const { return _property; }
  21. int suspectId() const { return _suspect; }
  22. void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();}
  23. void setHasEvidence(bool evidence) {if(evidence==_hasEvidence) return; _hasEvidence = evidence; emit hasEvidenceChanged();}
  24. void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); }
  25. void setType(EvidenceType* type) { _type = type; emit typeChanged(); }
  26. void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); }
  27. void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); }
  28. void setDescription(QString description) { _description = description; emit descriptionChanged(); }
  29. void setPropertyId(int property) { _property = property; emit propertyChanged(); }
  30. void setSuspectId(int suspect) { _suspect = suspect; emit suspectChanged(); }
  31. signals:
  32. void flippedChanged();
  33. void hasFlagChanged();
  34. void hintChanged();
  35. void typeChanged();
  36. void hasEvidenceChanged();
  37. void descriptionChanged();
  38. void propertyChanged();
  39. void suspectChanged();
  40. private:
  41. bool _hasFlag;
  42. bool _hasEvidence;
  43. EvidenceType *_type;
  44. int _hint;
  45. bool _flipped;
  46. QString _description;
  47. int _property;
  48. int _suspect;
  49. };
  50. #endif // TILEDATA_H