107 lines
2.5 KiB
C++
Executable File
107 lines
2.5 KiB
C++
Executable File
#pragma once
|
|
|
|
#include <LtsSession/ltssession_export.h>
|
|
#include <LtsWidgets/lts_dialog.h>
|
|
#include <Core/core_ftc.h>
|
|
|
|
#include <QPointer>
|
|
#include <memory>
|
|
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
|
|
/*
|
|
Anmerkungen:
|
|
slotTryLock
|
|
-> slotTryLock
|
|
-> tryLockEntityRequest
|
|
<- onTryLockEntityReply
|
|
emit signalLockDialog | emit signalUnlockDialog
|
|
|
|
PpmGuiPlugin:
|
|
- ParticipantOrganisationDialog (asSupportService==false)
|
|
a) avoid disabling by overloading ::lock() -> yes
|
|
b) use tryLockTopicNew -> yes
|
|
|
|
- ParticipantEdit (asSupportService==false||true)
|
|
a) avoid disabling by overloading ::lock() -> yes
|
|
b) use tryLockTopicNew -> yes
|
|
|
|
3 TacticalOrganisation
|
|
-> left and right <-
|
|
onReinitLeft, onReinitRight
|
|
*/
|
|
|
|
namespace LtsSession
|
|
{
|
|
class LTSSESSION_EXPORT TopicLockHandler : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
TopicLockHandler();
|
|
~TopicLockHandler();
|
|
|
|
bool init(const std::shared_ptr<Core::Interface::Ftc> &coreFtc, int exerciseId);
|
|
|
|
bool isLocked() const { return m_locked; }
|
|
LtsWidgets::TopicInfo getTopicInfo() const { return m_topicInfo; }
|
|
|
|
public slots:
|
|
void slotTryLock(const LtsWidgets::TopicInfo &topicInfo);
|
|
bool slotUnlock();
|
|
void slotFinalize(); // unlock, finally delete
|
|
|
|
signals:
|
|
void signalLockDialog(const QString &lockedBy);
|
|
void signalUnlockDialog();
|
|
|
|
private:
|
|
bool lock();
|
|
bool unlock();
|
|
std::string objStateAsString() const;
|
|
|
|
std::shared_ptr<Core::Interface::Ftc> m_coreFtc;
|
|
|
|
LtsWidgets::TopicInfo m_topicInfo;
|
|
int m_lockEntityId{0}; // reply.id(); / set by reply of ddsCall
|
|
|
|
int m_exerciseId{0};
|
|
bool m_locked{false};
|
|
bool m_askedForLock{false}; // reply does not tell..
|
|
bool m_deleteAfterAnswer{false};
|
|
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
|
|
|
|
class LTSSESSION_EXPORT TopicLockHanderData : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
TopicLockHanderData();
|
|
~TopicLockHanderData();
|
|
void init(const std::shared_ptr<Core::Interface::Ftc> &coreFtc, int exerciseId);
|
|
|
|
void unlock();
|
|
void slotTryLock(const LtsWidgets::TopicInfo &topicInfo);
|
|
bool isLocked() const;
|
|
LtsWidgets::TopicInfo getTopicInfo() const;
|
|
const QString &getLockedBy() const { return m_lockedBy; }
|
|
|
|
Q_SIGNALS:
|
|
void lockDataChanged();
|
|
|
|
private Q_SLOTS:
|
|
void slotLock(const QString &lockedBy);
|
|
void slotUnlock();
|
|
public:
|
|
QString m_debugName;
|
|
private:
|
|
QPointer<TopicLockHandler> m_topicLockHandler;
|
|
QString m_lockedBy;
|
|
};
|
|
|
|
|
|
} // namespace LtsSession
|