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.

platformdepend.cpp 1.2 kB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "platformdepend.h"
  2. #ifdef Q_OS_OSX
  3. #include "osx/osxplatform.h"
  4. #endif
  5. class MockPlatform : public IPlatform
  6. {
  7. public:
  8. long showNotify(const QString& title, const QString& content, const QString& data)
  9. {
  10. (void)title;
  11. (void)content;
  12. (void)data;
  13. return 0;
  14. }
  15. void hideAllNotify()
  16. {
  17. }
  18. void setBadgeNumber(int number)
  19. {
  20. (void)number;
  21. }
  22. };
  23. PlatformDepend::PlatformDepend()
  24. {
  25. #ifdef Q_OS_OSX
  26. mImpl = new OsxPlatform();
  27. #else
  28. mImpl = new MockPlatform();
  29. #endif
  30. }
  31. PlatformDepend::~PlatformDepend()
  32. {
  33. delete mImpl;
  34. }
  35. PlatformDepend &PlatformDepend::instance()
  36. {
  37. static PlatformDepend me;
  38. return me;
  39. }
  40. long PlatformDepend::showNotify(const QString &title, const QString &content, const QString &fellowIp)
  41. {
  42. return mImpl->showNotify(title, content, fellowIp);
  43. }
  44. void PlatformDepend::hideAllNotify()
  45. {
  46. mImpl->hideAllNotify();
  47. }
  48. void PlatformDepend::setBadgeNumber(int number)
  49. {
  50. mImpl->setBadgeNumber(number);
  51. }
  52. void PlatformDepend::setMainWnd(MainWindow *mainWnd)
  53. {
  54. IPlatform::setMainWnd(mainWnd);
  55. mImpl->setMainWnd(mainWnd);
  56. }

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

Contributors (1)