mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Ref T301, application contexts pings (by re-registering) identifiers again. By that it can be detected if the GUI is crashed
* ping timer in proxy * utility function in timestamp list * adjusted UI component displaying identifiers in core
This commit is contained in:
@@ -37,6 +37,10 @@ namespace BlackCore
|
||||
CLogHandler::instance()->logRemoteMessage(message);
|
||||
}
|
||||
});
|
||||
|
||||
m_pingTimer.setObjectName(serviceName + "::m_pingTimer");
|
||||
connect(&m_pingTimer, &QTimer::timeout, this, &CContextApplicationProxy::reRegisterApplications);
|
||||
m_pingTimer.start(PingIdentifiersMs);
|
||||
}
|
||||
|
||||
void CContextApplicationProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
@@ -156,13 +160,15 @@ namespace BlackCore
|
||||
m_dBusInterface->callDBus(QLatin1String("callHotkeyAction"), action, argument, origin);
|
||||
}
|
||||
|
||||
BlackMisc::CIdentifier CContextApplicationProxy::registerApplication(const CIdentifier &application)
|
||||
CIdentifier CContextApplicationProxy::registerApplication(const CIdentifier &application)
|
||||
{
|
||||
m_proxyPingIdentifiers.insert(application);
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::CIdentifier>(QLatin1String("registerApplication"), application);
|
||||
}
|
||||
|
||||
void CContextApplicationProxy::unregisterApplication(const CIdentifier &application)
|
||||
{
|
||||
m_proxyPingIdentifiers.remove(application);
|
||||
m_dBusInterface->callDBus(QLatin1String("unregisterApplication"), application);
|
||||
}
|
||||
|
||||
@@ -200,6 +206,17 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<QString>(QLatin1String("dotCommandsHtmlHelp"));
|
||||
}
|
||||
|
||||
void CContextApplicationProxy::reRegisterApplications()
|
||||
{
|
||||
if (!m_dBusInterface) { return; }
|
||||
if (m_proxyPingIdentifiers.isEmpty()) { return; }
|
||||
const CIdentifierList identifiers = m_proxyPingIdentifiers; // copy so member can be modified
|
||||
for (const CIdentifier &identifier : identifiers)
|
||||
{
|
||||
this->registerApplication(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
bool CContextApplicationProxy::isContextResponsive(const QString &dBusAddress, QString &msg, int timeoutMs)
|
||||
{
|
||||
const bool connected = CDBusServer::isDBusAvailable(dBusAddress, msg, timeoutMs);
|
||||
|
||||
Reference in New Issue
Block a user