Files
qt5-legatus-legacy/Lts/Proxies/TrainingAreaBase/Plugins/DebugJsonDir/XDR_QtHandler/XDR_DirHandler.h
T
2026-08-13 18:33:10 +02:00

63 lines
1.3 KiB
C++
Executable File

/**
* Scan directory for new XDR files
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QtCore/QObject>
#include <QtCore/QString>
#ifndef XDR_QTHANDLER_DIR_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define XDR_QTHANDLER_DIR_EXPORT
# else
# ifdef MAKE_XDR_QTHANDLER_DIR_LIB
# define XDR_QTHANDLER_DIR_EXPORT Q_DECL_EXPORT
# else
# define XDR_QTHANDLER_DIR_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
class XDR_DirHandlerIfc;
class XDR_QTHANDLER_DIR_EXPORT XDR_DirHandler : public QObject
{
Q_OBJECT
public:
XDR_DirHandler(const QString &dirToWatch, bool startWatching = true, QObject *parent = nullptr);
~XDR_DirHandler();
void startWatching();
QString dirToWatch() const { return m_dirToWatch; }
protected Q_SLOTS:
virtual void newTelegramArrived(const QString &fullPath) = 0;
private:
QThread *m_workerThread;
XDR_DirHandlerIfc *m_workerObject;
bool m_startWatching;
QString m_dirToWatch;
};
class XDR_QTHANDLER_DIR_EXPORT XDR_DirHandler_emit : public XDR_DirHandler
{
Q_OBJECT
public:
XDR_DirHandler_emit(const QString &dirToWatch, QObject *parent = nullptr)
: XDR_DirHandler(dirToWatch, true, parent)
{}
~XDR_DirHandler_emit()
{}
protected:
virtual void newTelegramArrived(const QString &fullPath)
{
emit newTelegram(fullPath);
}
Q_SIGNALS:
void newTelegram(const QString &fullPath);
};