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.

mainwindow.h 2.8 kB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include "fellowlistwidget.h"
  5. #include "searchfellowdlg.h"
  6. #include "recvtextedit.h"
  7. #include "feiqlib/feiqengine.h"
  8. #include "filemanagerdlg.h"
  9. #include "settings.h"
  10. #include <unordered_map>
  11. #include "chooseemojidlg.h"
  12. #include <QFileInfo>
  13. #include "sendtextedit.h"
  14. using namespace std;
  15. namespace Ui {
  16. class MainWindow;
  17. }
  18. class FeiqWin;
  19. Q_DECLARE_METATYPE(shared_ptr<ViewEvent>)
  20. class MainWindow : public QMainWindow, IFeiqView
  21. {
  22. Q_OBJECT
  23. friend class FeiqWin;
  24. public:
  25. explicit MainWindow(QWidget *parent = 0);
  26. ~MainWindow();
  27. void setFeiqWin(FeiqWin* feiqWin);
  28. protected:
  29. void enterEvent(QEvent *event);
  30. signals:
  31. void showErrorAndQuit(const QString& text);
  32. void statChanged(FileTask* fileTask);
  33. void progressChanged(FileTask* fileTask);
  34. void feiqViewEvent(shared_ptr<ViewEvent> event);
  35. private slots:
  36. void finishSearch(const Fellow* fellow);
  37. void openSettings();
  38. void openSearchDlg();
  39. void openDownloadDlg();
  40. void onShowErrorAndQuit(const QString& text);
  41. void navigateToFileTask(IdType packetNo, IdType fileId, bool upload);
  42. void sendKnock();
  43. void sendText();
  44. void openChartTo(const Fellow* fellow);
  45. void handleFeiqViewEvent(shared_ptr<ViewEvent> event);
  46. void refreshFellowList();
  47. void addFellow();
  48. void openChooseEmojiDlg();
  49. void sendFile();
  50. void sendFile(string filepath);
  51. void sendFiles(QList<QFileInfo> files);
  52. private:
  53. void userAddFellow(QString ip);
  54. void notifyUnread(const ViewEvent* event);
  55. void showNotification(const Fellow* fellow, const QString& text);
  56. shared_ptr<Fellow> checkCurFellow();
  57. void showResult(pair<bool, string> ret, const Content *content);
  58. vector<const Fellow*> fellowSearchDriver(const QString& text);
  59. void initFeiq();
  60. void updateUnread(const Fellow* fellow);
  61. int getUnreadCount();
  62. void flushUnread(const Fellow* fellow);
  63. void readEvent(const ViewEvent* event);
  64. void setBadgeNumber(int number);
  65. QString simpleTextOf(const Content* content);
  66. // IFileTaskObserver interface
  67. public:
  68. void onStateChanged(FileTask *fileTask);
  69. void onProgress(FileTask *fileTask);
  70. // IFeiqView interface
  71. public:
  72. void onEvent(shared_ptr<ViewEvent> event);
  73. private:
  74. Ui::MainWindow *ui;
  75. FellowListWidget mFellowList;
  76. SearchFellowDlg* mSearchFellowDlg;
  77. FileManagerDlg* mDownloadFileDlg;
  78. ChooseEmojiDlg* mChooseEmojiDlg;
  79. Settings* mSettings;
  80. FeiqEngine mFeiq;
  81. RecvTextEdit* mRecvTextEdit;
  82. SendTextEdit* mSendTextEdit;
  83. QString mTitle;
  84. unordered_map<const Fellow*, list<shared_ptr<ViewEvent>>> mUnreadEvents;
  85. FeiqWin* mFeiqWin = nullptr;
  86. };
  87. #endif // MAINWINDOW_H

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

Contributors (1)