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 924 B

9 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. void showNotify(const QString& title, const QString& content)
  9. {
  10. (void)title;
  11. (void)content;
  12. }
  13. void hideAllNotify()
  14. {
  15. }
  16. void setBadgeNumber(int number)
  17. {
  18. (void)number;
  19. }
  20. };
  21. PlatformDepend::PlatformDepend()
  22. {
  23. #ifdef Q_OS_OSX
  24. mImpl = new OsxPlatform();
  25. #else
  26. mImpl = new MockPlatform();
  27. #endif
  28. }
  29. PlatformDepend::~PlatformDepend()
  30. {
  31. delete mImpl;
  32. }
  33. PlatformDepend &PlatformDepend::instance()
  34. {
  35. static PlatformDepend me;
  36. return me;
  37. }
  38. void PlatformDepend::showNotify(const QString &title, const QString &content)
  39. {
  40. mImpl->showNotify(title, content);
  41. }
  42. void PlatformDepend::hideAllNotify()
  43. {
  44. mImpl->hideAllNotify();
  45. }
  46. void PlatformDepend::setBadgeNumber(int number)
  47. {
  48. mImpl->setBadgeNumber(number);
  49. }

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

Contributors (1)