FIX #4665: Address missing sound on Qt5 Builds (#4733)

* FIX #4665: Address missing sound on Qt5 Builds

* FIX #4665: Address missing sound on Qt5 Builds

* Include both engines
This commit is contained in:
Zach H 2023-02-05 19:05:47 -08:00 committed by GitHub
parent 4c290aec57
commit f25e4785ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -320,6 +320,8 @@ if(WIN32)
PATTERN "imageformats/qtiff.dll" PATTERN "imageformats/qtiff.dll"
PATTERN "imageformats/qwbmp.dll" PATTERN "imageformats/qwbmp.dll"
PATTERN "imageformats/qwebp.dll" PATTERN "imageformats/qwebp.dll"
PATTERN "mediaservice/dsengine.dll"
PATTERN "mediaservice/wmfengine.dll"
PATTERN "platforms/qdirect2d.dll" PATTERN "platforms/qdirect2d.dll"
PATTERN "platforms/qminimal.dll" PATTERN "platforms/qminimal.dll"
PATTERN "platforms/qoffscreen.dll" PATTERN "platforms/qoffscreen.dll"

View file

@ -2,10 +2,13 @@
#include "settingscache.h" #include "settingscache.h"
#include <QAudioOutput>
#include <QDir> #include <QDir>
#include <QMediaPlayer> #include <QMediaPlayer>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QAudioOutput>
#endif
#define DEFAULT_THEME_NAME "Default" #define DEFAULT_THEME_NAME "Default"
#define TEST_SOUND_FILENAME "player_join" #define TEST_SOUND_FILENAME "player_join"
@ -23,7 +26,7 @@ SoundEngine::~SoundEngine()
{ {
if (player) { if (player) {
player->deleteLater(); player->deleteLater();
player = 0; player = nullptr;
} }
} }
@ -48,7 +51,7 @@ void SoundEngine::soundEnabledChanged()
} }
} }
void SoundEngine::playSound(QString fileName) void SoundEngine::playSound(const QString &fileName)
{ {
if (!player) { if (!player) {
return; return;

View file

@ -15,9 +15,9 @@ class SoundEngine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
SoundEngine(QObject *parent = nullptr); explicit SoundEngine(QObject *parent = nullptr);
~SoundEngine(); ~SoundEngine() override;
void playSound(QString fileName); void playSound(const QString &fileName);
QStringMap &getAvailableThemes(); QStringMap &getAvailableThemes();
private: private: