예제 #1
0
파일: IODlg.cpp 프로젝트: zh0ng/pwd_console
//多线程
UINT CIODlg::Comd(LPVOID pParam)
{

	controller = new CController;
	initState();
	//controller->alarm();
	BYTE m_data;
	while (ISSTART)
	{
		Sleep(10);
		char c = controller->getKeyCode();
		CCOutput::outputChar("key=", c);
		if (c == 'O')
		{
			// 开锁操作
			startUnlock();
		}
		else if (c == '#')
		{
			completeInput();
		}
		else if (c == '*')
		{
			del();
		}
		else if (c == 'A')
		{
			setStateText("请输入管理员密码");
			password = "";
			state = ADMIN_PWD;
		}
		else if (c == 'M')
		{
			setStateText("请输入原密码");
			password = "";
			state = IDENTIFY_PWD;
		}
		else if (state != INIT_STATE)
		{
			password += c;
			TRACE(password.c_str());
			TRACE("\n");
		}

		displayPassword();
	}

	return 0;
}
예제 #2
0
파일: IODlg.cpp 프로젝트: zh0ng/pwd_console
void CIODlg::initState()
{
	numError = 0;
	password = "";
	setStateText("选择对应的操作  M:修改密码, O:解锁");
	state = INIT_STATE;
}
예제 #3
0
Mg3dScene::Mg3dScene(QWidget*parent):QGLView(parent),d_ptr(new Mg3dScenePrivate)
{

	/////////////////////

	d_ptr->showGrid = false;
	d_ptr->showReference = false;

	d_ptr->reference = new Mg3DReference();
	d_ptr->reference->setAxisLenght(20);

	d_ptr->axisNode = d_ptr->reference->createReferenceAxis();
	d_ptr->gridsNode = d_ptr->reference->createReferenceGrids();
	d_ptr->axisNode->setParent(this);
	d_ptr->gridsNode->setParent(this);


	d_ptr->fboVertices.appendVertex(QVector3D(-1,-1,0));//0
	d_ptr->fboVertices.appendVertex(QVector3D(1,-1,0));//1
	d_ptr->fboVertices.appendVertex(QVector3D(1,1,0));//2
	d_ptr->fboVertices.appendVertex(QVector3D(-1,1,0));//3

	d_ptr->fboVertices.appendIndices(0,1,2);
	d_ptr->fboVertices.appendIndices(2,3,0);


	setStateTextSize(1);
	setStateText(0,"FPS : undefined");
}
예제 #4
0
파일: IODlg.cpp 프로젝트: zh0ng/pwd_console
void CIODlg::checkPassword()
{
	if (password == realPassword)
	{
		setStateText("密码正确,绿灯亮十秒");
		controller->successUnlock();
	}
	else
	{
		numError++;
		if (numError >= 3 && numError % 3 == 0)
		{
			setStateText("报警,绿灯亮5秒");
			//报警
			controller->alarm();
		}
	}
	initState();
}
예제 #5
0
파일: IODlg.cpp 프로젝트: zh0ng/pwd_console
void CIODlg::completeInput()
{
	if (state == START_UNLOCK)
		checkPassword();
	else if (state == IDENTIFY_PWD)
	{
		if (password == realPassword)
		{
			setStateText("原密码正确,请输入新密码");
			password = "";
			state = SET_NEW_PWD;
		}
		else
		{
			// 进入初始状态
			initState();
		}
	}
	else if (state == SET_NEW_PWD)
	{
		realPassword = password;
		initState();
	}
	else if (state == ADMIN_PWD)
	{
		if (password == realPassword)
		{
			realPassword = "******";
			initState();
		}
		else
		{
			// 退出程序
			OnCancel();
		}
	}
}
예제 #6
0
파일: IODlg.cpp 프로젝트: zh0ng/pwd_console
void CIODlg::startUnlock()
{
	password = "";
	state = START_UNLOCK;
	setStateText("请输入密码");
}
예제 #7
0
void Mg3dScene::updateFps()
{
	int elapsed =qMax(d_ptr->fpsTime.elapsed(),1);
	d_ptr->fpsManager.addNewTime(elapsed);
	setStateText(0,d_ptr->fpsManager.fpsString());
}