You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

recvtextedit.h 1.5 kB

9 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef RECVTEXTEDIT_H
  2. #define RECVTEXTEDIT_H
  3. #include "feiqlib/content.h"
  4. #include "feiqlib/fellow.h"
  5. #include <QObject>
  6. #include <unordered_map>
  7. #include <QTextEdit>
  8. using namespace std;
  9. class RecvTextEdit: public QTextEdit
  10. {
  11. Q_OBJECT
  12. public:
  13. RecvTextEdit(QWidget* parent = 0);
  14. protected:
  15. virtual void mousePressEvent(QMouseEvent *e) override;
  16. virtual void mouseReleaseEvent(QMouseEvent *e) override;
  17. public:
  18. void addFellowContent(const Content* content, long long msSinceEpoch);
  19. void addMyContent(const Content* content, long long msSinceEpoch);
  20. void setCurFellow(const Fellow* fellow);
  21. void addWarning(const QString& warning);
  22. const Fellow* curFellow();
  23. signals:
  24. void navigateToFileTask(IdType packetNo, IdType fileId, bool upload);
  25. private:
  26. QString timeStr(long long msSinceEpoch);
  27. void showContent(const Content* content, bool mySelf);
  28. void showFile(const FileContent* content, bool fromMySelf);
  29. void showImage(const ImageContent* content);
  30. void showText(const TextContent* content);
  31. void showKnock(const KnockContent* content, bool mySelf);
  32. void showUnSupport(const QString &text = "");
  33. void drawDaySeperatorIfNewDay(long long sinceEpoch);
  34. QString textHtmlStr(const TextContent* content);
  35. void parseLink(const QString& link);
  36. private:
  37. const Fellow* mFellow = nullptr;
  38. unordered_map<const Fellow*, QTextDocument*> mDocs;
  39. long long mLastEdit=0;
  40. QString mPressedAnchor;
  41. };
  42. #endif // RECVTEXTEDIT_H

mac下的“飞秋”大多数只是飞鸽传书协议,而且未发现令人满意的开源项目,所以基于c++与qt实现了基础的飞秋协议。

Contributors (1)