Companion custom functions sound playback fixes (#6000)

* [CompanionIcon] Can now add multiple image files to icon for representing different UI states (checked/active/etc).

* [Companion][CustomFunctionsPanel] Fix sound file locked after playback (fixes #5222, fixes #5997); Refactor play button (fixes #4929); Create new QMediaPlayer on each play and load in "LowLatency" mode instead of stream.
This commit is contained in:
Max Paperno
2018-06-29 08:04:45 +02:00
committed by Bertrand Songis
parent cb19949a82
commit 2eec091ac0
4 changed files with 78 additions and 74 deletions
+6 -3
View File
@@ -21,10 +21,11 @@
#ifndef _CUSTOMFUNCTIONS_H_
#define _CUSTOMFUNCTIONS_H_
#include <QMediaPlayer>
#include "modeledit.h"
#include "eeprominterface.h"
#include <QMediaPlayer>
class RawSwitchFilterItemModel;
class TimerEdit;
@@ -66,7 +67,9 @@ class CustomFunctionsPanel : public GenericPanel
void fsw_customContextMenuRequested(QPoint pos);
void refreshCustomFunction(int index, bool modified=false);
void onChildModified();
void playMusic();
bool playSound(int index);
void stopSound(int index);
void toggleSound(bool play);
void onMediaPlayerStateChanged(QMediaPlayer::State state);
void onMediaPlayerError(QMediaPlayer::Error error);
void fswDelete();
@@ -90,7 +93,7 @@ class CustomFunctionsPanel : public GenericPanel
QCheckBox * fswtchParamGV[CPN_MAX_SPECIAL_FUNCTIONS];
QDoubleSpinBox * fswtchParam[CPN_MAX_SPECIAL_FUNCTIONS];
TimerEdit * fswtchParamTime[CPN_MAX_SPECIAL_FUNCTIONS];
QPushButton * playBT[CPN_MAX_SPECIAL_FUNCTIONS];
QToolButton * playBT[CPN_MAX_SPECIAL_FUNCTIONS];
QComboBox * fswtchParamT[CPN_MAX_SPECIAL_FUNCTIONS];
QComboBox * fswtchParamArmT[CPN_MAX_SPECIAL_FUNCTIONS];
QCheckBox * fswtchEnable[CPN_MAX_SPECIAL_FUNCTIONS];