Advertisement
KukuRuzo

psi win patch

Mar 25th, 2024
777
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.47 KB | None | 0 0
  1.  
  2.  
  3. diff --git a/src/activeprofiles_win.cpp b/src/activeprofiles_win.cpp
  4. index e5b0abc0..55114f0a 100644
  5. --- a/src/activeprofiles_win.cpp
  6. +++ b/src/activeprofiles_win.cpp
  7. @@ -99,7 +99,11 @@ public:
  8.      static const DWORD stringListMessage = 1;
  9.  
  10.      bool sendMessage(const QString &to, UINT message, WPARAM wParam, LPARAM lParam) const;
  11. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  12.      bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
  13. +#else
  14. +    bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
  15. +#endif
  16.  
  17.      bool sendStringList(const QString &to, const QStringList &list) const;
  18.  
  19. @@ -163,7 +167,11 @@ bool ActiveProfiles::Private::sendStringList(const QString &to, const QStringLis
  20.      return sendMessage(to, WM_COPYDATA, (WPARAM)winId(), (LPARAM)(LPVOID)&cd);
  21.  }
  22.  
  23. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  24.  bool ActiveProfiles::Private::nativeEvent(const QByteArray &eventType, void *message, long *result)
  25. +#else
  26. +bool ActiveProfiles::Private::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
  27. +#endif
  28.  {
  29.      [[maybe_unused]] static const auto expectedType = QByteArray("windows_generic_MSG");
  30.      Q_ASSERT(eventType == expectedType);
  31. diff --git a/src/applicationinfo.cpp b/src/applicationinfo.cpp
  32. index 880a551d..16903d06 100644
  33. --- a/src/applicationinfo.cpp
  34. +++ b/src/applicationinfo.cpp
  35. @@ -217,7 +217,11 @@ QString ApplicationInfo::homeDir(ApplicationInfo::HomedirType type)
  36.                  }
  37.                  dataDir_ = configDir_;
  38.                  // prefer non-roaming data location for cache which is default for qds:DataLocation
  39. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  40.                  cacheDir_ = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
  41. +#else
  42. +                cacheDir_ = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
  43. +#endif
  44.              } else {
  45.                  configDir_ = dataDir_ = cacheDir_ = base + "/" + name();
  46.              }
  47. diff --git a/src/common.cpp b/src/common.cpp
  48. index 99579b2d..622d6695 100644
  49. --- a/src/common.cpp
  50. +++ b/src/common.cpp
  51. @@ -292,7 +292,13 @@ void soundPlay(const QString &s)
  52.      }
  53.  
  54.  #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
  55. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  56.      QSound::play(str);
  57. +#else
  58. +    QSoundEffect effect;
  59. +    effect.setSource(QUrl::fromLocalFile(str));
  60. +    effect.play();
  61. +#endif
  62.  #else
  63.      QString player = PsiOptions::instance()->getOption("options.ui.notifications.sounds.unix-sound-player").toString();
  64.      if (player == "")
  65. diff --git a/src/mainwin.cpp b/src/mainwin.cpp
  66. index 52c10428..b2aa649f 100644
  67. --- a/src/mainwin.cpp
  68. +++ b/src/mainwin.cpp
  69. @@ -71,7 +71,9 @@
  70.  #include <QVBoxLayout>
  71.  #include <QtAlgorithms>
  72.  #ifdef Q_OS_WIN
  73. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  74.  #include "widgets/thumbnailtoolbar.h"
  75. +#endif
  76.  #include <windows.h>
  77.  #endif
  78.  #ifdef HAVE_X11
  79. @@ -157,7 +159,9 @@ public:
  80.  
  81.  #ifdef Q_OS_WIN
  82.      DWORD                         deactivationTickCount;
  83. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  84.      QPointer<PsiThumbnailToolBar> thumbnailToolBar_;
  85. +#endif
  86.  #endif
  87.  
  88.      void        registerActions();
  89. @@ -1486,6 +1490,7 @@ bool MainWin::nativeEvent(const QByteArray &eventType, MSG *msg, long *result)
  90.      return false;
  91.  }
  92.  
  93. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  94.  void MainWin::updateWinTaskbar(bool enabled)
  95.  {
  96.      if (!enabled) {
  97. @@ -1508,6 +1513,7 @@ void MainWin::updateWinTaskbar(bool enabled)
  98.      }
  99.  }
  100.  #endif
  101. +#endif
  102.  
  103.  void MainWin::updateCaption()
  104.  {
  105. diff --git a/src/tools/globalshortcut/globalshortcutmanager_win.cpp b/src/tools/globalshortcut/globalshortcutmanager_win.cpp
  106. index 0f696e65..abfcf02d 100644
  107. --- a/src/tools/globalshortcut/globalshortcutmanager_win.cpp
  108. +++ b/src/tools/globalshortcut/globalshortcutmanager_win.cpp
  109. @@ -35,7 +35,11 @@ class GlobalShortcutManager::KeyTrigger::Impl : public QWidget {
  110.              qApp->installNativeEventFilter(this);
  111.          }
  112.  
  113. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  114.          virtual bool nativeEventFilter(const QByteArray &eventType, void *m, long *result) Q_DECL_OVERRIDE
  115. +#else
  116. +        bool nativeEventFilter(const QByteArray &eventType, void *m, qintptr *result) override
  117. +#endif
  118.          {
  119.              if (eventType == "windows_generic_MSG") {
  120.                  return impl->nativeEvent(eventType, static_cast<MSG *>(m), result);
  121. @@ -70,7 +74,11 @@ public:
  122.      /**
  123.       * Triggers triggered() signal when the hotkey is activated.
  124.       */
  125. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  126.      bool nativeEvent(const QByteArray &eventType, MSG *m, long *result)
  127. +#else
  128. +    bool nativeEvent(const QByteArray &eventType, MSG *m, qintptr *result)
  129. +#endif
  130.      {
  131.          Q_UNUSED(eventType);
  132.          if (m->message == WM_HOTKEY && m->wParam == id_) {
  133. diff --git a/src/tools/systemwatch/systemwatch_win.cpp b/src/tools/systemwatch/systemwatch_win.cpp
  134. index e367135d..da3f1fbe 100644
  135. --- a/src/tools/systemwatch/systemwatch_win.cpp
  136. +++ b/src/tools/systemwatch/systemwatch_win.cpp
  137. @@ -57,8 +57,11 @@ class WinSystemWatch::EventFilter : public QAbstractNativeEventFilter {
  138.  
  139.  public:
  140.      EventFilter(WinSystemWatch *parent) : syswatch(parent) { qApp->installNativeEventFilter(this); }
  141. -
  142. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  143.      virtual bool nativeEventFilter(const QByteArray &eventType, void *m, long *result) Q_DECL_OVERRIDE
  144. +#else
  145. +    bool nativeEventFilter(const QByteArray &eventType, void *m, qintptr *result) override
  146. +#endif
  147.      {
  148.          if (eventType == "windows_generic_MSG") {
  149.              return syswatch->processWinEvent(static_cast<MSG *>(m), result);
  150. @@ -75,7 +78,11 @@ WinSystemWatch::~WinSystemWatch()
  151.      d = 0;
  152.  }
  153.  
  154. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  155.  bool WinSystemWatch::processWinEvent(MSG *m, long *result)
  156. +#else
  157. +bool WinSystemWatch::processWinEvent(MSG *m, qintptr *result)
  158. +#endif
  159.  {
  160.      Q_UNUSED(result);
  161.      if (WM_POWERBROADCAST == m->message) {
  162. diff --git a/src/tools/systemwatch/systemwatch_win.h b/src/tools/systemwatch/systemwatch_win.h
  163. index 97eb2997..dd04ebcd 100644
  164. --- a/src/tools/systemwatch/systemwatch_win.h
  165. +++ b/src/tools/systemwatch/systemwatch_win.h
  166. @@ -13,7 +13,11 @@ public:
  167.  private:
  168.      class EventFilter;
  169.      EventFilter *d;
  170. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
  171.      bool         processWinEvent(MSG *m, long *result);
  172. +#else
  173. +    bool         processWinEvent(MSG *m, qintptr *result);
  174. +#endif
  175.  };
  176.  
  177.  #endif // SYSTEMWATCH_WIN_H
  178.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement