Handle settings. Handle object-parent.

This commit is contained in:
Gerhard Hoffmann 2023-11-10 13:12:59 +01:00
parent ad4bae4bfb
commit 0ee7df32b5
4 changed files with 25 additions and 6 deletions

View File

@ -13,16 +13,15 @@
#include <cstdlib>
ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
: m_errorCode("")
: VMCInterface(parent)
, m_errorCode("")
, m_errorDescription("")
, m_pluginInfo("")
, m_serialPortName("")
, m_useDebug(false)
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
, m_eventReceiver(nullptr) {
this->setParent(parent);
}
ATBVMCPlugin::~ATBVMCPlugin() {
@ -30,8 +29,12 @@ ATBVMCPlugin::~ATBVMCPlugin() {
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *eventReceiver,
QSettings const &settings) {
Q_UNUSED(eventReceiver);
Q_UNUSED(settings);
m_eventReceiver = eventReceiver;
m_settings = &settings;
// Beachte: QSettings hat .fileName().
// Damit kann man dann ATBSystem benutzen.
return PLUGIN_STATE::NOT_INITIALIZED;
}

View File

@ -2,6 +2,7 @@
#define ATBVMCPLUGIN_H
#include <QObject>
#include <QSettings>
#include "src/ATBAPP/VMCInterface.h"
#include "src/ATBAPP/ATBAPPplugin.h"
@ -9,7 +10,11 @@
#include "version.h"
#include "include/interfaces.h"
#include "vmc.h"
class ATBHMIconfig;
class AppControl;
class ATBSystem;
class ATBVMCPlugin : public VMCInterface {
Q_OBJECT
@ -56,6 +61,7 @@ private:
bool m_useDebug;
PLUGIN_STATE m_pluginState;
QObject* m_eventReceiver;
QSettings const *m_settings;
};
#endif // ATBDEVICECONTROLLERPLUGIN_H

View File

@ -11,6 +11,10 @@
#include "ATBAPPplugin.h"
class ATBHMIconfig;
class AppControl;
class ATBSystem;
class UnifiedDCVMCInterface : public QObject, public ATBAPPplugin {
Q_OBJECT
@ -43,7 +47,7 @@ public:
STOP_RECEIPT, // e.g. Szeged Stop
};
explicit UnifiedDCVMCInterface() = default;
explicit UnifiedDCVMCInterface(QObject *parent = nullptr) : QObject(parent) {}
virtual ~UnifiedDCVMCInterface() {}
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QSettings const &settings) = 0;

View File

@ -16,6 +16,9 @@ namespace nsVMCInterface {
using TICKET_VARIANT = UnifiedDCVMCInterface::TICKET_VARIANT;
}
class ATBHMIconfig;
class VMCInterface : public UnifiedDCVMCInterface {
Q_OBJECT
@ -24,6 +27,9 @@ class VMCInterface : public UnifiedDCVMCInterface {
public:
explicit VMCInterface(QObject *parent = nullptr)
: UnifiedDCVMCInterface(parent) {}
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QSettings const &settings) override {
return initVMCPlugin(eventReceiver, settings);
}