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:
Klaus Basan
2018-08-12 03:12:53 +02:00
parent 7b360e03cc
commit 60b3ed65ab
9 changed files with 69 additions and 15 deletions

View File

@@ -17,6 +17,7 @@
using namespace BlackCore;
using namespace BlackCore::Context;
using namespace BlackGui::Views;
namespace BlackGui
{
@@ -26,11 +27,17 @@ namespace BlackGui
QFrame(parent),
ui(new Ui::CRegisterComponent)
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
Q_ASSERT_X(sGui->getIContextApplication(), Q_FUNC_INFO, "Need application context");
ui->setupUi(this);
connect(sGui->getIContextApplication(), &IContextApplication::registrationChanged, this, &CRegisterComponent::ps_update);
ui->tvp_RegisteredComponents->menuAddItems(CIdentifierView::MenuRefresh);
connect(&m_updateTimer, &QTimer::timeout, this, &CRegisterComponent::update);
connect(sGui->getIContextApplication(), &IContextApplication::registrationChanged, this, &CRegisterComponent::update);
connect(ui->tvp_RegisteredComponents, &CIdentifierView::requestUpdate, this, &CRegisterComponent::update);
// timer is there just in case something goes wrong
connect(&m_updateTimer, &QTimer::timeout, this, &CRegisterComponent::ps_update);
m_updateTimer.setInterval(30 * 1000);
m_updateTimer.start();
}
@@ -38,10 +45,10 @@ namespace BlackGui
CRegisterComponent::~CRegisterComponent()
{ }
void CRegisterComponent::ps_update()
void CRegisterComponent::update()
{
// if not supported, do nothing
if (!sGui || !sGui->supportsContexts()) { return; }
if (!sGui || !sGui->supportsContexts() || sGui->isShuttingDown()) { return; }
ui->tvp_RegisteredComponents->updateContainer(sGui->getIContextApplication()->getRegisteredApplications());
}
} // ns

View File

@@ -35,15 +35,13 @@ namespace BlackGui
//! Destructor
virtual ~CRegisterComponent();
private slots:
//! Update data
void ps_update();
private:
QScopedPointer<Ui::CRegisterComponent> ui;
QTimer m_updateTimer;
};
//! Update data
void update();
};
} // ns
} // ns