mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
refs #859, allow to trigger digest signal manually
* Useful if the input signal was just a bogus signal used to trigger * Login component shows a use case
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4e7144db08
commit
265b6d33f0
@@ -7,13 +7,20 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/digestsignal.h"
|
||||
#include "digestsignal.h"
|
||||
#include "threadutils.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
void CDigestSignal::ps_inputSignal()
|
||||
void CDigestSignal::inputSignal()
|
||||
{
|
||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||
{
|
||||
// call in correct thread
|
||||
QTimer::singleShot(0, this, &CDigestSignal::inputSignal);
|
||||
return;
|
||||
}
|
||||
|
||||
m_timer.start(); // start or restart
|
||||
m_inputsCount++;
|
||||
if (m_inputsCount >= m_maxInputsPerDigest)
|
||||
@@ -29,4 +36,11 @@ namespace BlackMisc
|
||||
emit digestSignal();
|
||||
}
|
||||
|
||||
void CDigestSignal::init(int maxDelayMs)
|
||||
{
|
||||
QObject::connect(&m_timer, &QTimer::timeout, this, &CDigestSignal::ps_timeout);
|
||||
m_timer.setSingleShot(true);
|
||||
m_timer.setInterval(maxDelayMs);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user