WSJT-X/widgets/LazyFillComboBox.hpp
Bill Somerville 542ffe8311
Improve audio device handling and error recovery
where possible  audio devices that  disappear are not  forgotten until
the user selects another device, this should allow temporarily missing
devices or forgetting  to switch on devices before  starting WSJT-X to
be  handled more  cleanly. If  all else  fails, visiting  the Settings
dialog and  clicking OK should  get things  going again. Note  that we
still  do not  have  a  reliable way  of  detecting  failed audio  out
devices, in that  case selecting another device and  then returning to
the original should work.

Enumerating  audio devices  is expensive  and on  Linux may  take many
seconds per  device. To avoid  lengthy blocking behaviour until  it is
absolutely necessary,  audio devices are  not enumerated until  one of
the "Settings->Audio" device drop-down lists is opened. Elsewhere when
devices  must be  discovered  the  enumeration stops  as  soon as  the
configured device is  discovered. A status bar message  is posted when
audio devices are being enumerated as a reminder that the UI may block
while this is happening.

The message box warning about  unaccounted-for input audio samples now
only triggers when  >5 seconds of audio appears to  be missing or over
provided. Hopefully this will make the warning less annoying for those
that are  using audio sources  with high and/or variable  latencies. A
status  bar message  is still  posted for  any amount  of audio  input
samples  unaccounted for  >1/5 second,  this message  appearing a  lot
should be considered as notification that  there is a problem with the
audio sub-system, system load is  too high, or time synchronization is
stepping the PC clock rather  than adjusting the frequency to maintain
monotonic clock ticks.
2020-09-20 18:20:16 +01:00

41 lines
657 B
C++

#ifndef LAZY_FILL_COMBO_BOX_HPP__
#define LAZY_FILL_COMBO_BOX_HPP__
#include <QComboBox>
class QWidget;
//
// Class LazyFillComboBox
//
// QComboBox derivative that signals show and hide of the pop up list.
//
class LazyFillComboBox final
: public QComboBox
{
Q_OBJECT
public:
Q_SIGNAL void about_to_show_popup ();
Q_SIGNAL void popup_hidden ();
explicit LazyFillComboBox (QWidget * parent = nullptr)
: QComboBox {parent}
{
}
void showPopup () override
{
Q_EMIT about_to_show_popup ();
QComboBox::showPopup ();
}
void hidePopup () override
{
QComboBox::hidePopup ();
Q_EMIT popup_hidden ();
}
};
#endif