mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
refs #199, added unique id to context.
A unique id allows to detect roundtrips when redirecting output (qDebug, qWarning)
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
#ifndef BLACKCORE_CONTEXT_H
|
#ifndef BLACKCORE_CONTEXT_H
|
||||||
#define BLACKCORE_CONTEXT_H
|
#define BLACKCORE_CONTEXT_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include "blackcore/context_runtime_config.h"
|
#include "blackcore/context_runtime_config.h"
|
||||||
#include "blackcore/context_runtime.h"
|
#include "blackcore/context_runtime.h"
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -12,9 +13,6 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
class CContext : public QObject
|
class CContext : public QObject
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
CRuntimeConfig::ContextMode m_mode;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CContext() {}
|
~CContext() {}
|
||||||
@@ -39,6 +37,12 @@ namespace BlackCore
|
|||||||
return static_cast<CRuntime *>(this->parent());
|
return static_cast<CRuntime *>(this->parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Mode
|
||||||
|
CRuntimeConfig::ContextMode getMode() const { return this->m_mode; }
|
||||||
|
|
||||||
|
//! Unique id
|
||||||
|
qint64 getUniqueId() const { return this->m_contextId; }
|
||||||
|
|
||||||
//
|
//
|
||||||
// cross context access
|
// cross context access
|
||||||
//
|
//
|
||||||
@@ -75,9 +79,16 @@ namespace BlackCore
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CContext(CRuntimeConfig::ContextMode mode, QObject *parent) : QObject(parent), m_mode(mode)
|
CContext(CRuntimeConfig::ContextMode mode, QObject *parent) :
|
||||||
|
QObject(parent), m_mode(mode), m_contextId(QDateTime::currentMSecsSinceEpoch())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//! Re-emit signal locally
|
||||||
|
//! \details proxy uses slot to send signal, and on implementation side this re-emitted as signal
|
||||||
|
void reEmitSignalFromProxy(const QString &signalName);
|
||||||
|
|
||||||
|
CRuntimeConfig::ContextMode m_mode; //!< How context is used
|
||||||
|
qint64 m_contextId; //!< unique identifer, avoid redirection rountrips
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
Reference in New Issue
Block a user