LogWnd::LogWnd( QWidget * parent, QtLua::State * st ) : QWidget( parent ), Binder( st ) { pd = new PD(); pd->linesCnt = 128; pd->ui.setupUi( this ); connect( st, SIGNAL(output(const QString &)), this, SLOT(log(const QString &)) ); connect( this, SIGNAL(sigLog(const QString &)), this, SLOT(slotLog(const QString &)), Qt::QueuedConnection ); connect( this, SIGNAL(sigLinesCnt(int)), this, SLOT(slotLinesCnt(int)), Qt::QueuedConnection ); connect( this, SIGNAL(sigClear()), this, SLOT(slotClear()), Qt::QueuedConnection ); connect( pd->ui.clear, SIGNAL(clicked()), this, SLOT(slotClear()), Qt::QueuedConnection ); }
int sigClear(int taskId, int sig) { // check for task if ((taskId >= 0) && tcb[taskId].name) { tcb[taskId].signal &= ~sig; return 0; } else if (taskId == -1) { for (taskId=0; taskId<MAX_TASKS; taskId++) { sigClear(taskId, sig); } return 0; } // error return 1; }
void LogWnd::clear() { emit sigClear(); }