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.6 kB

9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 addContent(const Content* content, long long msSinceEpoch, bool mySelf);
  28. void showHint(long long msSinceEpoch, bool mySelf);
  29. void showContent(const Content* content, bool mySelf);
  30. void showFile(const FileContent* content, bool fromMySelf);
  31. void showImage(const ImageContent* content);
  32. void showText(const TextContent* content);
  33. void showKnock(const KnockContent* content, bool mySelf);
  34. void showUnSupport(const QString &text = "");
  35. void drawDaySeperatorIfNewDay(long long sinceEpoch);
  36. QString textHtmlStr(const TextContent* content);
  37. void parseLink(const QString& link);
  38. private:
  39. const Fellow* mFellow = nullptr;
  40. unordered_map<const Fellow*, QTextDocument*> mDocs;
  41. long long mLastEdit=0;
  42. QString mPressedAnchor;
  43. };
  44. #endif // RECVTEXTEDIT_H

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

Contributors (1)