Esempio n. 1
0
void PopupHandler::init(){

    breakTime = new QTimer();
    QObject::connect( breakTime, SIGNAL(timeout()), this, SLOT(ShowAllWindows()) );

    countDownTime = new QTimer();
    QObject::connect( countDownTime, SIGNAL(timeout()), this, SLOT( UpdateTimerLabel())  );

    foreach( QMainWindow* winPtr, windows){

        QPalette p = ((QLabel*)winPtr->centralWidget())->palette();
        p.setColor(QPalette::Background, QColor(Qt::black) );
        p.setColor(QPalette::WindowText, QColor(Qt::white) );
        ((QLabel*)winPtr->centralWidget())->setPalette(p);
        ((QLabel*)winPtr->centralWidget())->setAlignment(Qt::AlignCenter);
    }
Esempio n. 2
0
void PADManager::RunTimer(const u32 seconds, const u32 id)		
{
	m_seconds = seconds;
	clock_t t1, t2;
	t1 = t2 = clock() / CLOCKS_PER_SEC;
	while (m_seconds) 
	{
		if (t1 / CLOCKS_PER_SEC + 1 <= (t2 = clock()) / CLOCKS_PER_SEC) 
		{
			UpdateTimerLabel(id);
			m_seconds--;
			t1 = t2;
		}

		if(m_key_pressed)
		{
			m_seconds = 0;
			break;
		}
	}
}