////////////////////////////////////////////////////
// TmioanScreenSaveAppl.h
#pragma once
#include "TmioanApplication.h"
#include <QTimer.h>
#include <QObject.h>
class TmioanScreenSaveAppl
: public TmioanApplication,
QObject{
// Q_OBJECT
// With Q_OBJECT the linker gives an error
// Without Q_OBJECT the timer does not work
// All classes that contain signals or slots must mention Q_OBJECT at the top of their declaration.
// They must also derive (directly or indirectly) from QObject.
private:
public:
TmioanScreenSaveAppl(char *aCompanyName, char *aProductName);
virtual ~TmioanScreenSaveAppl(void);
void Startup(void);
void Shutdown(void);
public slots:
void Advance(void);
void ConfigDialog(void);
};
////////////////////////////////////////////////////
// TmioanScreenSaveAppl.cpp
#include "TmioanScreenSaveAppl.h"
#include "LogFileClass.h"
TmioanScreenSaveAppl::TmioanScreenSaveAppl(char *aCompanyName, char *aProductName)
{
connect(timer, SIGNAL(timeout()), this, SLOT(Advance()));
}
TmioanScreenSaveAppl::~TmioanScreenSaveAppl(void)
{
delete timer;
}
void TmioanScreenSaveAppl::Startup(void)
{
timer->start(50); // millisecond
LogFile.add(lm_INFOLN,"TmioanScreenSaveAppl","Startup()");
}
void TmioanScreenSaveAppl::Shutdown(void)
{
timer->stop();
}
void TmioanScreenSaveAppl::Advance(void)
{
LogFile.add(lm_INFOLN,"TmioanScreenSaveAppl","Advance()");
}
void TmioanScreenSaveAppl::ConfigDialog(void)
{
}
////////////////////////////////////////////////////
// TmioanScreenSaveAppl.h
#pragma once
#include "TmioanApplication.h"
#include <QTimer.h>
#include <QObject.h>
class TmioanScreenSaveAppl: public TmioanApplication, QObject
{
// Q_OBJECT
// With Q_OBJECT the linker gives an error
// Without Q_OBJECT the timer does not work
// All classes that contain signals or slots must mention Q_OBJECT at the top of their declaration.
// They must also derive (directly or indirectly) from QObject.
private:
QTimer *timer;
public:
TmioanScreenSaveAppl(char *aCompanyName, char *aProductName);
virtual ~TmioanScreenSaveAppl(void);
void Startup(void);
void Shutdown(void);
public slots:
void Advance(void);
void ConfigDialog(void);
};
////////////////////////////////////////////////////
// TmioanScreenSaveAppl.cpp
#include "TmioanScreenSaveAppl.h"
#include "LogFileClass.h"
TmioanScreenSaveAppl::TmioanScreenSaveAppl(char *aCompanyName, char *aProductName)
{
timer = new QTimer();
connect(timer, SIGNAL(timeout()), this, SLOT(Advance()));
}
TmioanScreenSaveAppl::~TmioanScreenSaveAppl(void)
{
delete timer;
}
void TmioanScreenSaveAppl::Startup(void)
{
timer->start(50); // millisecond
LogFile.add(lm_INFOLN,"TmioanScreenSaveAppl","Startup()");
}
void TmioanScreenSaveAppl::Shutdown(void)
{
timer->stop();
}
void TmioanScreenSaveAppl::Advance(void)
{
LogFile.add(lm_INFOLN,"TmioanScreenSaveAppl","Advance()");
}
void TmioanScreenSaveAppl::ConfigDialog(void)
{
}
To copy to clipboard, switch view to plain text mode
Bookmarks