APservice/win_template.cpp

140 lines
2.6 KiB
C++
Raw Normal View History

2023-11-14 09:32:56 +01:00
#include "win_template.h"
T_win_template::T_win_template(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("template screen"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win_template::~T_win_template()
{
close();
}
void T_win_template::Nav_back(void)
{
myNextStep=WCS_WIN99BAK;
}
void T_win_template::Nav_home(void)
{
myNextStep=WCS_WIN99MID;
}
void T_win_template::Nav_next(void)
{
myNextStep=WCS_WIN99FWD;
}
bool T_win_template::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_OFF | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win_template::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
//qDebug()<<"fenster1 working: "<< myNextStep;
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}