Cleaned up object deletion for notifications
This commit is contained in:
parent
b3df2985b7
commit
8ceef83f2e
@ -2181,6 +2181,9 @@ both here.</string>
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="azel_path_group_box">
|
<widget class="QGroupBox" name="azel_path_group_box">
|
||||||
|
<property name="visible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>AzEl Directory</string>
|
<string>AzEl Directory</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -18,11 +18,15 @@ NotificationAudio::NotificationAudio(QObject *parent) :
|
|||||||
NotificationAudio::~NotificationAudio(){
|
NotificationAudio::~NotificationAudio(){
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
delete m_decoder;
|
if(m_decoder){
|
||||||
m_decoder = nullptr;
|
delete m_decoder;
|
||||||
|
m_decoder = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
delete m_audio;
|
if(m_audio){
|
||||||
m_audio = nullptr;
|
delete m_audio;
|
||||||
|
m_audio = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize an audio device
|
// initialize an audio device
|
||||||
@ -52,15 +56,11 @@ void NotificationAudio::init(const QAudioDeviceInfo &device, const QAudioFormat&
|
|||||||
}
|
}
|
||||||
|
|
||||||
// play an audio file
|
// play an audio file
|
||||||
void NotificationAudio::play(const QString &filePath) {
|
void NotificationAudio::play(const QString &filePath){
|
||||||
if(m_state == NotificationAudio::Playing){
|
if(m_state == NotificationAudio::Playing){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
playFile(filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotificationAudio::playFile(const QString &filePath){
|
|
||||||
if(!m_init || !m_decoder || !m_audio){
|
if(!m_init || !m_decoder || !m_audio){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@ private:
|
|||||||
bool m_init;
|
bool m_init;
|
||||||
bool m_isDecodingFinished;
|
bool m_isDecodingFinished;
|
||||||
|
|
||||||
void playFile(const QString &filePath);
|
|
||||||
void resetBuffers();
|
void resetBuffers();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user