Ejemplo n.º 1
0
void page0::changePage()
{
    if (first_time == true)
    {
        ui->label->update();
        /* if fcrts is not running or if it is in Zombie status, start it */
        if (system("PID=`pidof fcrts` && test $PID != '' && test \"`grep -c zombie /proc/$PID/status`\" -eq 0"))
        {
            LOG_PRINT(info_e, "Cannot find the run-time active process. Start it [%s].\n", RUNTIME);
            QProcess *myProcess = new QProcess();
            myProcess->start(RUNTIME);
        }

        if(CommStart() == false)
        {
            LOG_PRINT(error_e, "cannot find start the communication with the the run-time.\n");
            exit(0);
        }
        first_time = false;
    
        /* pre-load */
        page * p;
        ui->progressBar->setValue(1);
        for (int pageIndex = 0; pageIndex < userPageList.count(); pageIndex++)
        {
            create_next_page(&p, userPageList.at(pageIndex).toAscii().data());
            if (p != NULL)
            {
                LOG_PRINT(verbose_e,"created page '%s'\n", userPageList.at(pageIndex).toAscii().data());
                ScreenHash.insert(userPageList.at(pageIndex).toAscii().data(), p);
            }
            else
            {
                LOG_PRINT(error_e,"Cannot create page '%s'\n", userPageList.at(pageIndex).toAscii().data());
            }
            ui->progressBar->setValue(pageIndex + 1);
        }
        hideAll();
    }

    /* Check the date. if it is unset 01 Jan 1970 start with time_set page */
    time_t rt = 0;
    struct tm *pt = NULL;
    rt = time(NULL);
    pt = localtime(&rt);
    if (pt != NULL && pt->tm_year == 70 && pt->tm_mon == 0 && pt->tm_mday == 1)
    {
        if (goto_page("time_set", false) == false && goto_page(STARTPAGE_DEF, false) == false && goto_page(HomePage, false) == false && goto_page(HOMEPAGE_DEF, false) == false )
        {
            QMessageBox::critical(0,QApplication::trUtf8("Invalid Page"), QApplication::trUtf8("Cannot show any of Default pages '%1', '%2' and home pages '%3'. '%4'").arg("time_set").arg(STARTPAGE_DEF).arg(HomePage).arg(HOMEPAGE_DEF));
        }
    }

    /* go to the home page */
    else if (goto_page(StartPage, false) == false && goto_page(STARTPAGE_DEF, false) == false && goto_page(HomePage, false) == false && goto_page(HOMEPAGE_DEF, false) == false )
    {
        QMessageBox::critical(0,QApplication::trUtf8("Invalid Page"), QApplication::trUtf8("Cannot show any of Default pages '%1', '%2' and home pages '%3'. '%4'").arg(StartPage).arg(STARTPAGE_DEF).arg(HomePage).arg(HOMEPAGE_DEF));
    }
    this->hide();
}
Ejemplo n.º 2
0
TInt E32Main()
	{
	TInt err;
	
	Test.Start(_L("Comm Driver Tests"));
	CommStart();
    Test.Printf(_L("Insert plug in then press a key\r\n"));
	Test.Getch();

	TEST(CTrapCleanup::New()!=NULL);
	CActiveScheduler* Scheduler = new CActiveScheduler;
	TEST(Scheduler!=NULL);
	CActiveScheduler::Install(Scheduler);
/*
	CTestSignals* testsignals = NULL;
	TRAP(err, testsignals = CTestSignals::NewL(0));
	TEST(err==KErrNone);
	testsignals->Start();
	Scheduler->Start();
	delete testsignals;
	
	CTestRandTerm* testrandterm = NULL;
	TRAP(err, testrandterm = CTestRandTerm::NewL(0));
	TEST(err==KErrNone);
	testrandterm->Start();
	Scheduler->Start();
	delete testrandterm;

	CTestPerf* testperf = NULL;
	TRAP(err, testperf = CTestPerf::NewL(0));
	TEST(err==KErrNone);
	testperf->Start();
	Scheduler->Start();
	delete testperf;
*/

	CTestXonXoff* testx = NULL;
	TRAP(err, testx = CTestXonXoff::NewL(0));
	TEST(err==KErrNone);
	testx->Start();
	Scheduler->Start();
	delete testx;

/*
	CTestXonXoff* testx1 = NULL;
	TRAP(err, testx1 = CTestXonXoff::NewL(0));
	TEST(err==KErrNone);
	testx1->Start();

	CTestXonXoff* testx2 = NULL;
	TRAP(err, testx2 = CTestXonXoff::NewL(1));
	TEST(err==KErrNone);
	testx2->Start();

	Scheduler->Start();

	delete testx1;
	delete testx2;
*/
	Test.End();
	return KErrNone;
	}