Skip to content

Commit 30a13b9

Browse files
committed
Move QSoundEffect and PlayAudioAlert to gui sections
1 parent c408a02 commit 30a13b9

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/util.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,19 @@ QSize CMinimumStackedLayout::sizeHint() const
758758
}
759759
return QStackedLayout::sizeHint();
760760
}
761+
762+
void PlayAudioAlert ( QUrl soundUrl )
763+
{
764+
QSoundEffect* sf = new QSoundEffect();
765+
QObject::connect ( sf, &QSoundEffect::playingChanged, sf, [sf]() {
766+
if ( !sf->isPlaying() )
767+
{
768+
sf->deleteLater();
769+
}
770+
} );
771+
sf->setSource ( soundUrl );
772+
sf->play();
773+
}
761774
#endif
762775

763776
/******************************************************************************\
@@ -1679,16 +1692,3 @@ QString TruncateString ( QString str, int position )
16791692
}
16801693
return str.left ( position );
16811694
}
1682-
1683-
void PlayAudioAlert ( QUrl soundUrl )
1684-
{
1685-
QSoundEffect* sf = new QSoundEffect();
1686-
QObject::connect ( sf, &QSoundEffect::playingChanged, sf, [sf]() {
1687-
if ( !sf->isPlaying() )
1688-
{
1689-
sf->deleteLater();
1690-
}
1691-
} );
1692-
sf->setSource ( soundUrl );
1693-
sf->play();
1694-
}

src/util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#include <QElapsedTimer>
7676
#include <QTextBoundaryFinder>
7777
#include <QTimer>
78-
#include <QSoundEffect>
7978

8079
#ifndef DISABLE_SRV_DNS
8180
# include <QDnsLookup>
@@ -96,6 +95,7 @@
9695
# include <QDesktopServices>
9796
# include <QKeyEvent>
9897
# include <QStackedLayout>
98+
# include <QSoundEffect>
9999
# include "ui_aboutdlgbase.h"
100100
#endif
101101

@@ -491,6 +491,8 @@ class CMinimumStackedLayout : public QStackedLayout
491491
CMinimumStackedLayout ( QWidget* parent = nullptr ) : QStackedLayout ( parent ) {}
492492
virtual QSize sizeHint() const override;
493493
};
494+
495+
void PlayAudioAlert ( QUrl soundUrl );
494496
#endif
495497

496498
/******************************************************************************\
@@ -1409,5 +1411,3 @@ struct EnumClassHash
14091411
}
14101412
};
14111413
#endif
1412-
1413-
void PlayAudioAlert ( QUrl soundUrl );

0 commit comments

Comments
 (0)