示例#1
0
void MainApp::onLoginAcceptedCB(std::pair<bool,bool> &loginInfo)
{
	bool saveLoginInfo = loginInfo.first;
	bool autologin = loginInfo.second;

	if (m_wxLoginForm)
	{
		m_wxLoginForm->Show(false);
		m_wxLoginForm->Destroy();
		m_wxLoginForm = nullptr;
	}

	if (saveLoginInfo)
		GetUserCore()->saveLoginInfo();

	GetUserCore()->getAppUpdateProgEvent() += guiDelegate(this, &MainApp::onAppUpdateProg);
	GetUserCore()->getAppUpdateCompleteEvent() += guiDelegate(this, &MainApp::onAppUpdate);
	GetWebCore()->getCookieUpdateEvent() += guiDelegate(this, &MainApp::onCookieUpdate);
	GetWebCore()->getLoggedOutEvent() += delegate(&onLoggedOutEvent);
	GetUserCore()->getPipeDisconnectEvent() += guiDelegate(this, &MainApp::onPipeDisconnect);

	//trigger this so it sets cookies first time around
	onCookieUpdate();


	admin_developer.setValue(GetUserCore()->isAdmin());
	GetCVarManager()->loadUser(GetUserCore()->getUserId());

	gcWString userName(GetUserCore()->getUserName());
	SetCrashDumpSettings(userName.c_str(), gc_uploaddumps.getBool());

	m_bLoggedIn = true;
	m_iMode = APP_MODE::MODE_ONLINE;

	bool showMain = !(autologin && gc_silentlaunch.getBool());
	showMainForm(false, showMain);

	m_pInternalLink = new InternalLink(this);

	if (!m_bQuiteMode)
		GetUserCore()->getItemManager()->checkItems();

	if (m_wxTBIcon)
		m_wxTBIcon->regEvents();

	if (showMain && !m_bQuiteMode)
		showNews();

	if (m_szDesuraCache != "")
	{
		m_pInternalLink->handleInternalLink(m_szDesuraCache.c_str());
		m_szDesuraCache = "";
	}

	onLoginEvent();
}
示例#2
0
	void OnTestPartResult(const TestPartResult& test_part_result)
	{
		if (!m_bDisableAssertOnFailure && test_part_result.failed() && g_bAssertOnFailure.getBool())
		{
			PAUSE_DEBUGGER();
		}
	}
示例#3
0
文件: host.cpp 项目: DrLabman/QMB
void Host_Frame(float time) {
    double time1, time2;
    static double timetotal;
    static int timecount;
    int i, c, m;

    if (!serverprofile.getBool()) {
        _Host_Frame(time);
        return;
    }

    time1 = Sys_FloatTime();
    _Host_Frame(time);
    time2 = Sys_FloatTime();

    timetotal += time2 - time1;
    timecount++;

    if (timecount < 1000)
        return;

    m = timetotal * 1000 / timecount;
    timecount = 0;
    timetotal = 0;
    c = 0;
    for (i = 0; i < svs.maxclients; i++) {
        if (svs.clients[i].active)
            c++;
    }

    fps_count++;

    Con_Printf("serverprofile: %2i clients %2i msec\n", c, m);
}
示例#4
0
文件: cl_main.cpp 项目: DrLabman/QMB
/**
 * Determines the fraction between the last two messages that the objects
 * should be put at.
 */
float CL_LerpPoint(void) {
	float f, frac;

	f = cl.mtime[0] - cl.mtime[1];

	if (!f || cl_nolerp.getBool() || cls.timedemo || sv.active) {
		cl.time = cl.mtime[0];
		return 1;
	}

	if (f > 0.1) { // dropped packet, or start of demo
		cl.mtime[1] = cl.mtime[0] - 0.1;
		f = 0.1f;
	}
	frac = (cl.time - cl.mtime[1]) / f;
	//Con_Printf ("frac: %f\n",frac);
	if (frac < 0) {
		if (frac < -0.01) {
			cl.time = cl.mtime[1];
			//				Con_Printf ("low frac\n");
		}
		frac = 0;
	} else if (frac > 1) {
		if (frac > 1.01) {
			cl.time = cl.mtime[0];
			//				Con_Printf ("high frac\n");
		}
		frac = 1;
	}

	return frac;
}
示例#5
0
文件: cl_main.cpp 项目: DrLabman/QMB
/**
 * Read all incoming data from the server
 */
int CL_ReadFromServer(void) {
	int ret;

	cl.oldtime = cl.time;
	cl.time += host_frametime;

	do {
		ret = CL_GetMessage();
		if (ret == -1)
			Host_Error("CL_ReadFromServer: lost server connection");
		if (!ret)
			break;

		cl.last_received_message = realtime;
		CL_ParseServerMessage();
	} while (ret && cls.state == ca_connected);

	if (cl_shownet.getBool())
		Con_Printf("\n");

	CL_RelinkEntities();
	CL_UpdateTEnts();

	// bring the links up to date
	return 0;
}
示例#6
0
void SCR_DrawFPS(void) {
	extern CVar show_fps;
	static double lastframetime;
	double t;
	extern int fps_count;
	static int lastfps;
	static int totalfps;
	static int lastsecond;
	int x, y;
	char st[80];

	if (!show_fps.getBool())
		return;

	t = Sys_FloatTime();
	lastfps = 1 / (t - lastframetime);
	if (((int) (t) % 100) > ((int) (lastframetime) % 100)) {
		lastsecond = totalfps;
		totalfps = 0;
	}
	lastframetime = t;
	totalfps += 1;

	sprintf(st, "%3d FPS", lastfps);

	x = vid.conwidth - strlen(st) * 8 - 16;
	y = 0;
	Draw_String(x, y, st);

	sprintf(st, "%3d Last second", lastsecond);
	x = vid.conwidth - strlen(st) * 8 - 16;
	y = 8;
	Draw_String(x, y, st);
}
示例#7
0
void LoginForm::onLogin()
{
	ASSERT_UITHREAD();
	safe_delete(m_pLogThread);

	bool remPass = m_cbRemPass->GetValue();
	gc_savelogin.setValue(remPass);

	if (gc_saveusername.getBool())
	{
		wxString dastr = m_tbUsername->GetValue();
		gc_lastusername.setValue(dastr.ToUTF8());
	}

	SaveCVars();

	if (m_comboProvider)
		gc_login_stage_last.setValue(m_comboProvider->GetStringSelection().ToUTF8());

	Show(false);

	MainApp* temp = dynamic_cast<MainApp*>(GetParent());

	if (temp)
		temp->onLoginAccepted(remPass, m_bAutoLogin);
}
示例#8
0
void DESURA_Warn(const wchar_t* msg)
{
	if (logForm)
		logForm->appendText(msg, Color(0xFF000000));

	if (gc_showerror.getBool())
		ShowLogForm(false);
}
示例#9
0
void SCR_DrawPause(void) {
	qpic_t *pic;

	if (!scr_showpause.getBool()) // turn off for screenshots
		return;

	if (!cl.paused)
		return;

	pic = Draw_CachePic("gfx/pause.lmp");
	Draw_AlphaPic((vid.conwidth - pic->width) / 2, (vid.conheight - 48 - pic->height) / 2, pic, 1);
}
示例#10
0
void MainApp::showLogin(bool skipAutoLogin)
{
	if (!m_wxLoginForm)
		m_wxLoginForm = new LoginForm(this);

	if (!skipAutoLogin && gc_savelogin.getBool())
		m_wxLoginForm->autoLogin();

	m_wxLoginForm->Show(!m_bQuiteMode);

	if (m_wxLoginForm->IsShown())
		m_wxLoginForm->Raise();

}
示例#11
0
void Scr_ShowNumP(void) {
	extern CVar show_fps;
	int x, y;
	char st[80];
	extern int numParticles;

	if (!show_fps.getBool())
		return;

	sprintf(st, "%i Particles in world", numParticles);

	x = vid.conwidth - strlen(st) * 8 - 16;
	y = 16; //vid.conheight - (sb_lines * (vid.conheight/240) )- 16;
	//Draw_TileClear(x, y, strlen(st)*16, 16);
	Draw_String(x, y, st);
}
示例#12
0
void SCR_DrawTurtle(void) {
	static int count;

	if (!scr_showturtle.getBool())
		return;

	if (host_frametime < 0.1) {
		count = 0;
		return;
	}

	count++;
	if (count < 3)
		return;

	Draw_AlphaPic(scr_vrect.x, scr_vrect.y, scr_turtle, 1);
}
示例#13
0
void LoginForm::onTextChange(wxCommandEvent& event)
{
	gcWString defaultText;
	gcTextCtrl* textCtrl;

	if (event.GetId() == m_tbUsername->GetId())
	{
		textCtrl = m_tbUsername;
		defaultText = Managers::GetString(L"#LF_USER");

		if (gc_saveusername.getBool())
		{
			const char* str = gc_lastusername.getString();
			const char* avatar = gc_lastavatar.getString();

			if (gcString(str) != gcString(m_tbUsername->GetValue().c_str().AsWChar()))
			{
				m_imgAvatar->setImage("#login_default_avatar");
			}
			else
			{
				if (avatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(avatar)))
					m_imgAvatar->setImage(avatar);
			}
		}
	}
	else if (event.GetId() == m_tbPasswordDisp->GetId())
	{
		textCtrl = m_tbPasswordDisp;
		defaultText = Managers::GetString(L"#LF_PASS");
	}
	else
	{
		return;
	}

	const char* colorName = "tb-fg";

	if (textCtrl->GetValue() == defaultText)
		colorName = "tb-default-fg";

	wxColor color = wxColor(GetThemeManager().getColor("formlogin", colorName));

	textCtrl->SetForegroundColour(color);
	textCtrl->Refresh();
}
示例#14
0
void MainApp::logIn(const char* user, const char* pass)
{
	gcTrace("User: {0}", user);

	std::lock_guard<std::mutex> a(m_UserLock);

	safe_delete(g_pUserHandle);

	gcString path = UTIL::OS::getAppDataPath();

	g_pUserHandle = (UserCore::UserI*)UserCore::FactoryBuilderUC(USERCORE);
	g_pUserHandle->init(path.c_str(), m_strServiceProvider.c_str());


	try
	{
		//need to do this here as news items will be passed onlogin
		g_pUserHandle->getNewsUpdateEvent() += delegate(this, &MainApp::onNewsUpdate);
		g_pUserHandle->getGiftUpdateEvent() += delegate((MainAppNoUI*)this, &MainAppNoUI::onGiftUpdate);
		g_pUserHandle->getNeedCvarEvent() += delegate(this, &MainApp::onNeedCvar);

		g_pUserHandle->lockDelete();
		g_pUserHandle->logIn(user, pass);
		g_pUserHandle->unlockDelete();

#ifndef DEBUG
		if (gc_enable_api_debugging.getBool())
			g_pUserHandle->getWebCore()->enableDebugging();
#endif
	}
	catch (gcException)
	{
		g_pUserHandle->logOut();

		g_pUserHandle->getNewsUpdateEvent() -= delegate(this, &MainApp::onNewsUpdate);
		g_pUserHandle->getGiftUpdateEvent() -= delegate((MainAppNoUI*)this, &MainAppNoUI::onGiftUpdate);
		g_pUserHandle->getNeedCvarEvent() -= delegate(this, &MainApp::onNeedCvar);

		g_pUserHandle->unlockDelete();

		g_pUserHandle->logOut(false, false);
		safe_delete(g_pUserHandle);
		throw;
	}
}
示例#15
0
void MainApp::showLogin(bool skipAutoLogin, bool webLoggedOut)
{
#ifdef DEBUG
	showUnitTest();
#endif

	if (!m_wxLoginForm)
		m_wxLoginForm = new LoginForm(this);

	if (!skipAutoLogin && gc_savelogin.getBool())
		m_wxLoginForm->autoLogin();

	m_wxLoginForm->Show(!m_bQuiteMode);

	if (m_wxLoginForm->IsShown())
		m_wxLoginForm->Raise();

	if (webLoggedOut)
		m_wxLoginForm->showForcedLogoutPromt();
}
示例#16
0
void MainApp::logIn(const char* user, const char* pass)
{
	Thread::AutoLock a(m_UserLock);

	safe_delete(g_pUserHandle);

	gcString path = UTIL::OS::getAppDataPath();

	g_pUserHandle = (UserCore::UserI*)UserCore::FactoryBuilderUC(USERCORE);
	g_pUserHandle->init(path.c_str());


	try
	{
		//need to do this here as news items will be passed onlogin
		*g_pUserHandle->getNewsUpdateEvent() += delegate(this, &MainApp::onNewsUpdate);
		*g_pUserHandle->getGiftUpdateEvent() += delegate(this, &MainApp::onGiftUpdate);
		*g_pUserHandle->getNeedCvarEvent() += delegate(this, &MainApp::onNeedCvar);

		g_pUserHandle->lockDelete();
		g_pUserHandle->logIn(user, pass);
		g_pUserHandle->unlockDelete();

#ifndef DEBUG
		if (gc_enable_api_debugging.getBool())
			g_pUserHandle->getWebCore()->enableDebugging();
#endif
	}
	catch (gcException)
	{
		g_pUserHandle->logOut();

		*g_pUserHandle->getNewsUpdateEvent() -= delegate(this, &MainApp::onNewsUpdate);
		*g_pUserHandle->getGiftUpdateEvent() -= delegate(this, &MainApp::onGiftUpdate);
		*g_pUserHandle->getNeedCvarEvent() -= delegate(this, &MainApp::onNeedCvar);

		g_pUserHandle->unlockDelete();
		safe_delete(g_pUserHandle);
		throw;
	}
}
示例#17
0
void LoginForm::onLogin()
{
	safe_delete(m_pLogThread);

#ifndef UI_HIDE_AUTOLOGIN
	bool remPass = m_cbRemPass->GetValue();
	gc_savelogin.setValue(remPass);
#else
	bool remPass = false;
#endif

	if (gc_saveusername.getBool())
	{
		wxString dastr = m_tbUsername->GetValue();
		gc_lastusername.setValue((const char*)dastr.c_str());
	}

	Show(false);

	MainApp* temp = dynamic_cast<MainApp*>(GetParent());

	if (temp)
		temp->onLoginAccepted(remPass, m_bAutoLogin);
}
示例#18
0
LoginForm::LoginForm(wxWindow* parent)
	: gcFrame(parent, wxID_ANY, Managers::GetString(L"#LF_TITLE"), wxDefaultPosition, wxSize(420,286), wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxWANTS_CHARS|wxMINIMIZE_BOX, true)
{
	m_comboProvider = nullptr;

	m_bAutoLogin = false;
	m_pNewAccount = nullptr;

	Bind(wxEVT_COMMAND_TEXT_ENTER, &LoginForm::onTextBoxEnter, this);
	Bind(wxEVT_CLOSE_WINDOW, &LoginForm::onClose, this);
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onButtonClick, this);
	Bind(wxEVT_MOVE, &LoginForm::onMove, this);


	m_imgLogo = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 253,81 ));
	m_imgAvatar = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 ));

	m_imgLogo->setImage("#login_logo");
	m_imgAvatar->setImage("#login_default_avatar");

	m_tbUsername = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_USER"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS);
	m_tbPassword = new gcTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS|wxTE_PASSWORD);
	m_tbPasswordDisp = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_PASS"));

	gcString strStagingUrl(gc_login_stage_url.getString());
	gcString strStagingLast(gc_login_stage_last.getString());

	if (strStagingUrl.size() > 0)
	{
		wxArrayString choices;
		choices.Add("Prod");
		choices.Add("Test");

		m_comboProvider = new gcChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);

		if (strStagingLast == "Test")
			m_comboProvider->SetSelection(1);
		else
			m_comboProvider->SetSelection(0);
	}

	m_cbRemPass = new gcCheckBox(this, wxID_ANY, Managers::GetString(L"#LF_AUTO"));
	m_cbRemPass->SetToolTip(Managers::GetString(L"#LF_AUTO_TOOLTIP"));

#ifdef WIN32
	m_cbProxyOff = new gcCheckBox(this, wxID_ANY, Managers::GetString(L"#LF_PROXYOFF"));
	m_cbProxyOff->SetToolTip(Managers::GetString(L"#LF_PROXYOFF_TOOLTIP"));
#endif

	m_cbBypassSSLRevocationCheck = new gcCheckBox( this, wxID_ANY, Managers::GetString( L"#LF_REVOCATION" ) );
	m_cbBypassSSLRevocationCheck->SetToolTip( Managers::GetString( L"#LF_REVOCATION_TOOLTIP" ) );

	m_butSignin = new gcButton(this, wxID_ANY, Managers::GetString(L"#LOGIN"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
	m_butCancel = new gcButton(this, wxID_ANY, Managers::GetString(L"#CANCEL"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);

	m_linkOffline = new LoginLink(this, Managers::GetString(L"#LF_OFFLINE"), wxALIGN_LEFT);
	m_linkNewAccount = new LoginLink(this, Managers::GetString(L"#LF_NEWACCOUNT"), wxALIGN_CENTER);
	m_linkLostPassword = new LoginLink( this, Managers::GetString(L"#LF_LOSTPASS"), wxALIGN_RIGHT);


	m_butTwitter = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42));
	m_butSteam = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42));
	m_butFacebook = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42));
	m_butGoogle = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42));

	m_butTwitter->setDefaultImage("#login_twitter");
	m_butSteam->setDefaultImage("#login_steam");
	m_butFacebook->setDefaultImage("#login_facebook");
	m_butGoogle->setDefaultImage("#login_google");

	m_butTwitter->SetCursor(wxCursor(wxCURSOR_HAND));
	m_butSteam->SetCursor(wxCursor(wxCURSOR_HAND));
	m_butFacebook->SetCursor(wxCursor(wxCURSOR_HAND));
	m_butGoogle->SetCursor(wxCursor(wxCURSOR_HAND));

	m_butTwitter->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this);
	m_butSteam->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this);
	m_butFacebook->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this);
	m_butGoogle->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this);


	//focus gets set to the first child. Redirect input to username box
	m_imgLogo->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this);
	m_imgAvatar->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this);

#ifdef WIN32
	Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this);
	Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this);
	Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this);

	m_imgLogo->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this);
	m_imgLogo->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this);
	m_imgLogo->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this);

	m_imgAvatar->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this);
	m_imgAvatar->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this);
	m_imgAvatar->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this);
#endif

	m_tbUsername->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this);
	m_tbUsername->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_tbUsername->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this);
	m_tbUsername->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this);

	m_tbPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_tbPassword->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this);

	m_tbPasswordDisp->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this);
	m_tbPasswordDisp->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this);

	m_cbRemPass->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
#ifdef WIN32
	m_cbProxyOff->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LoginForm::onCheckBoxClick, this );
#endif

	m_cbBypassSSLRevocationCheck->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LoginForm::onCheckBoxClick, this );

	m_linkOffline->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_linkNewAccount->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_linkLostPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this);

	m_linkOffline->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this);
	m_linkNewAccount->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this);
	m_linkLostPassword->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this);


	m_butCancel->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_butSignin->Bind(wxEVT_CHAR, &LoginForm::onChar, this);

	m_tbUsername->SetValue(Managers::GetString(L"#LF_USER"));
	m_tbPasswordDisp->SetValue(Managers::GetString(L"#LF_PASS"));

	m_tbPassword->Show(false);
	m_tbPasswordDisp->Show(true);


#ifdef WIN32
	wxFlexGridSizer* fgSizer4 = new wxFlexGridSizer( 1, 3, 0, 0 );
#else
	wxFlexGridSizer* fgSizer4 = new wxFlexGridSizer( 1, 2, 0, 0 );
#endif
	fgSizer4->AddGrowableCol( 0 );
	fgSizer4->SetFlexibleDirection( wxBOTH );
	fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	fgSizer4->Add( m_cbRemPass, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

#ifdef WIN32
	fgSizer4->Add( m_cbProxyOff, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
#endif

	fgSizer4->Add( m_cbBypassSSLRevocationCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );



	wxFlexGridSizer* fgSizer4a = new wxFlexGridSizer( 1, 2, 0, 0 );
	fgSizer4a->AddGrowableCol( 0 );
	fgSizer4a->SetFlexibleDirection( wxBOTH );
	fgSizer4a->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer4a->Add( m_butSignin, 0, wxTOP | wxBOTTOM | wxLEFT, 5 );
	fgSizer4a->Add( m_butCancel, 0, wxTOP | wxBOTTOM | wxLEFT, 5 );


	wxFlexGridSizer* fgSizer5 = new wxFlexGridSizer( 1, 3, 0, 0 );
	fgSizer5->AddGrowableCol( 0 );
	fgSizer5->AddGrowableCol( 1 );
	fgSizer5->AddGrowableCol( 2 );
	fgSizer5->AddGrowableRow( 0 );
	fgSizer5->SetFlexibleDirection( wxBOTH );
	fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer5->Add( m_linkOffline, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
	fgSizer5->Add( m_linkNewAccount, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	fgSizer5->Add( m_linkLostPassword, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );


	wxFlexGridSizer* fgSizer6 = new wxFlexGridSizer( 5, 1, 0, 0 );
	fgSizer6->AddGrowableCol( 0 );
	fgSizer6->SetFlexibleDirection( wxBOTH );
	fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	if (m_comboProvider)
	{
		wxFlexGridSizer* fgSizer10 = new wxFlexGridSizer(1, 2, 0, 0);
		fgSizer10->AddGrowableCol(0);
		fgSizer10->Add(m_tbUsername, 0, wxEXPAND, 5);
		fgSizer10->Add(m_comboProvider, 0, wxLEFT, 5);

		fgSizer6->Add(fgSizer10, 0, wxEXPAND | wxLEFT, 5);
	}
	else
	{
		fgSizer6->Add(m_tbUsername, 0, wxEXPAND | wxLEFT, 5);
	}

	fgSizer6->Add( m_tbPassword, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
	fgSizer6->Add( m_tbPasswordDisp, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
	fgSizer6->Add( fgSizer4, 1, wxEXPAND, 5 );
	fgSizer6->Add( fgSizer4a, 1, wxEXPAND, 5 );

	wxFlexGridSizer* fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 );
	fgSizer3->AddGrowableCol( 1 );
	fgSizer3->SetFlexibleDirection( wxBOTH );
	fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer3->Add( m_imgAvatar, 0, 0, 5 );
	fgSizer3->Add( fgSizer6, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );

	wxFlexGridSizer* fgSizerAltLogin = new wxFlexGridSizer(1, 9, 0, 0);
	fgSizerAltLogin->AddGrowableCol(2);
	fgSizerAltLogin->AddGrowableCol(4);
	fgSizerAltLogin->AddGrowableCol(6);
	fgSizerAltLogin->AddGrowableRow(0);
	fgSizerAltLogin->Add(15, 0, 1, wxEXPAND, 5);
	fgSizerAltLogin->Add(m_butTwitter, 0, 0, 5);
	fgSizerAltLogin->Add(0, 0, 1, wxEXPAND, 5);
	fgSizerAltLogin->Add(m_butSteam, 0, 0, 5);
	fgSizerAltLogin->Add(0, 0, 1, wxEXPAND, 5);
	fgSizerAltLogin->Add(m_butFacebook, 0, 0, 5);
	fgSizerAltLogin->Add(0, 0, 1, wxEXPAND, 5);
	fgSizerAltLogin->Add(m_butGoogle, 0, 0, 5);
	fgSizerAltLogin->Add(15, 0, 1, wxEXPAND, 5);

	wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 6, 1, 0, 0 );
	fgSizer2->SetFlexibleDirection( wxBOTH );
	fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer2->Add( m_imgLogo, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 );
	fgSizer2->Add( fgSizer3, 1, wxEXPAND, 5 );
	fgSizer2->Add(0, 9, 1, wxEXPAND, 5);
	fgSizer2->Add(fgSizer5, 1, wxEXPAND, 5);
	fgSizer2->Add(0, 9, 1, wxEXPAND, 5);
	fgSizer2->Add(fgSizerAltLogin, 1, wxEXPAND, 5);



	wxFlexGridSizer* fgSizer1 = new wxFlexGridSizer( 1, 3, 0, 0 );
	fgSizer1->AddGrowableCol( 0 );
	fgSizer1->AddGrowableCol( 2 );
	fgSizer1->AddGrowableRow( 0 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
	fgSizer1->Add( fgSizer2, 1, wxEXPAND, 5 );
	fgSizer1->Add( 0, 15, 1, wxEXPAND|wxBOTTOM, 15 );

	this->SetSizer( fgSizer1 );
	this->Layout();


	m_bSavePos = false;

	m_vTabOrder.push_back(m_tbUsername);
	m_vTabOrder.push_back(m_tbPasswordDisp);
	m_vTabOrder.push_back(m_tbPassword);
	m_vTabOrder.push_back( m_cbRemPass );
#ifdef WIN32
	m_vTabOrder.push_back( m_cbProxyOff );
#endif
	m_vTabOrder.push_back( m_cbBypassSSLRevocationCheck );
	m_vTabOrder.push_back(m_butSignin);
	m_vTabOrder.push_back(m_butCancel);
	m_vTabOrder.push_back(m_linkOffline);
	m_vTabOrder.push_back(m_linkNewAccount);
	m_vTabOrder.push_back(m_linkLostPassword);

	Centre(wxCENTRE_ON_SCREEN);
	SetFocus();

	if (gc_login_x.getInt() == -1 || gc_login_y.getInt() == -1)
	{
		int x = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
		int y = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);

		int w=0;
		int h=0;
		GetSize(&w, &h);

		int newX = (x-w)/2;
		int newY = (y-h)/2;

		if (newX>0 && newY>0)
			SetSize(newX, newY, -1, -1);
	}
	else
	{
#ifdef NIX
		if (! gc_allow_wm_positioning.getBool())
#endif
			setSavedWindowPos(gc_login_x.getInt(), gc_login_y.getInt(), UINT_MAX, UINT_MAX);
	}

	if (gc_savelogin.getBool())
		m_cbRemPass->SetValue(true);

#ifdef WIN32
	bool isProxyOff = gc_saveProxyOff.getBool();
	UTIL::OS::setProxyOff( isProxyOff );
	m_cbProxyOff->SetValue( isProxyOff );
#endif

	bool isBypassSSLRevocationCheck = gc_saveBypassSSLRevocationCheck.getBool();
	UTIL::OS::setBypassSSLRevocationCheck( isBypassSSLRevocationCheck );
	m_cbBypassSSLRevocationCheck->SetValue( isBypassSSLRevocationCheck );

	if (gc_saveusername.getBool())
	{
		const char* str = gc_lastusername.getString();
		const char* avatar = gc_lastavatar.getString();

		if (gcString(str) != "")
		{
			m_tbUsername->SetValue(str);

			m_tbPasswordDisp->Show(false);
			m_tbPassword->Show();
			m_tbPassword->SetFocus();
			Layout();
		}

		if (avatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(avatar)))
			m_imgAvatar->setImage(avatar);
	}

	m_pLogThread = nullptr;
	m_bSavePos = true;
	m_bMouseDrag = false;

	onLoginEvent += guiDelegate(this, &LoginForm::onLogin);
	onLoginErrorEvent += guiDelegate(this, &LoginForm::onLoginError);
	onStartLoginEvent += guiDelegate(this, &LoginForm::onStartLogin);

	Managers::LoadTheme(this, "formlogin");

	Managers::LoadTheme(m_cbRemPass, "formlogin");

#ifdef WIN32
	Managers::LoadTheme(m_cbProxyOff, "formlogin");
#endif

	Managers::LoadTheme( m_cbBypassSSLRevocationCheck, "formlogin" );

	SetSize(wxSize(400,336));

	setFrameRegion();

	onNewAccountLoginEvent += guiDelegate(this, &LoginForm::newAccountLoginCB);
	onNewAccountLoginErrorEvent += guiDelegate(this, &LoginForm::newAccountLoginErrorCB);
}
示例#19
0
void EventHandler::onLogConsoleMsg(const char* message, const char* source, int line)
{
	if (gc_enablebrowserconsole.getBool())
		Warning(gcString("Webkit: {0} [{1} : {2}]\n", message, source, line));
}
示例#20
0
gcMenu* EventHandler::createMenu(ChromiumDLL::ChromiumMenuInfoI* menuInfo)
{
	gcMenu *menu = new gcMenu();
	gcMenu *custom = nullptr;

	if (menuInfo->getCustomCount() > 0)
	{
		for (int x=0; x<menuInfo->getCustomCount(); x++)
		{
			ChromiumDLL::ChromiumMenuItemI* item = menuInfo->getCustomItem(x);

			if (!item || !item->getLabel())
				continue;

			if (!custom)
				custom = new gcMenu();

			gcMenuItem *menuItem = nullptr;

			switch (item->getType())
			{
			case ChromiumDLL::ChromiumMenuItemI::MENUITEM_OPTION:
				menuItem = new gcMenuItem(custom, (item->getAction() + MENU_ID_CUSTOMACTION), item->getLabel());
				break;

			case ChromiumDLL::ChromiumMenuItemI::MENUITEM_CHECKABLEOPTION:
				menuItem = new gcMenuItem(custom, (item->getAction() + MENU_ID_CUSTOMACTION), item->getLabel(), L"", wxITEM_CHECK);
				break;

			case ChromiumDLL::ChromiumMenuItemI::MENUITEM_SEPERATOR:
				custom->AppendSeparator();
				break;

			case ChromiumDLL::ChromiumMenuItemI::MENUITEM_GROUP:
				break;
			}

			if (menuItem)
			{
				custom->Append(menuItem);

				menuItem->Enable(item->isEnabled());

				if (menuItem->IsCheckable())
					menuItem->Check(item->isChecked());
			}
		}
	}

	if (HasAnyFlags(menuInfo->getTypeFlags(), ChromiumDLL::ChromiumMenuInfoI::MENUTYPE_EDITABLE))
	{
		gcMenuItem *undo	= new gcMenuItem(menu, MENU_ID_UNDO, Managers::GetString(L"#CHROME_UNDO"));
		gcMenuItem *redo	= new gcMenuItem(menu, MENU_ID_REDO, Managers::GetString(L"#CHROME_REDO"));
		gcMenuItem *cut		= new gcMenuItem(menu, MENU_ID_CUT, Managers::GetString(L"#CHROME_CUT"));
		gcMenuItem *copy	= new gcMenuItem(menu, MENU_ID_COPY, Managers::GetString(L"#CHROME_COPY"));
		gcMenuItem *paste	= new gcMenuItem(menu, MENU_ID_PASTE, Managers::GetString(L"#CHROME_PASTE"));
		gcMenuItem *del		= new gcMenuItem(menu, MENU_ID_DELETE, Managers::GetString(L"#CHROME_DELETE"));
		gcMenuItem *sall	= new gcMenuItem(menu, MENU_ID_SELECTALL, Managers::GetString(L"#CHROME_SELECTALL"));

		menu->Append(undo);
		menu->Append(redo);
		menu->AppendSeparator();
		menu->Append(cut);
		menu->Append(copy);
		menu->Append(paste);
		menu->Append(del);
		menu->AppendSeparator();
		menu->Append(sall);

		undo->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_UNDO));
		redo->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_REDO));
		cut->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_CUT));
		copy->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_COPY));
		paste->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_PASTE));
		del->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_DELETE));
		sall->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_SELECT_ALL));
	}
	else
	{
		if (HasAnyFlags(menuInfo->getTypeFlags(), ChromiumDLL::ChromiumMenuInfoI::MENUTYPE_SELECTION))
		{
			gcMenuItem *copy	= new gcMenuItem(menu, MENU_ID_COPY, Managers::GetString(L"#CHROME_COPY"));

			menu->Append(copy);

			copy->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_COPY));
		}
		else if (HasAnyFlags(menuInfo->getTypeFlags(), ChromiumDLL::ChromiumMenuInfoI::MENUTYPE_PAGE|ChromiumDLL::ChromiumMenuInfoI::MENUTYPE_FRAME))
		{
			gcMenuItem *back	= new gcMenuItem(menu, MENU_ID_BACK, Managers::GetString(L"#CHROME_BACK"));
			gcMenuItem *forward	= new gcMenuItem(menu, MENU_ID_FORWARD, Managers::GetString(L"#CHROME_FORWARD"));

			menu->Append(back);
			menu->Append(forward);
			menu->Append(MENU_ID_RELOAD, Managers::GetString(L"#CHROME_RELOAD"));
			menu->AppendSeparator();

			menu->Append(MENU_ID_ZOOM_PLUS, Managers::GetString(L"#CHROME_ZOOMIN"));
			menu->Append(MENU_ID_ZOOM_MINUS, Managers::GetString(L"#CHROME_ZOOMOUT"));
			menu->Append(MENU_ID_ZOOM_NORMAL, Managers::GetString(L"#CHROME_ZOOMNORMAL"));
			menu->AppendSeparator();
			menu->Append(MENU_ID_PRINT, Managers::GetString(L"#CHROME_PRINT"));
			menu->Append(MENU_ID_VIEWSOURCE, Managers::GetString(L"#CHROME_VIEWSOURCE"));
			menu->AppendSeparator();
			menu->Append(MENU_ID_VIEWPBROWSER, Managers::GetString(L"#CHROME_VIEWPAGE"));
			menu->Append(MENU_ID_COPYURL, Managers::GetString(L"#CHROME_COPYURL"));

			back->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_GO_BACK));
			forward->Enable(HasAnyFlags(menuInfo->getEditFlags(), ChromiumDLL::ChromiumMenuInfoI::MENU_CAN_GO_FORWARD));
		}

		if (HasAnyFlags(menuInfo->getTypeFlags(), ChromiumDLL::ChromiumMenuInfoI::MENUTYPE_LINK))
		{
			menu->Append(MENU_ID_VIEWLBROWSER, Managers::GetString(L"#CHROME_VIEWLINK"));
		}

		if (HasAnyFlags(menuInfo->getTypeFlags(), ChromiumDLL::ChromiumMenuInfoI::MENUTYPE_IMAGE))
		{
			menu->Append(MENU_ID_VIEWIBROWSER, Managers::GetString(L"#CHROME_VIEWIMAGE"));
		}

		if (gc_browserdebug.getBool())
		{
			menu->AppendSeparator();
			menu->Append(MENU_ID_INSPECTELEMENT, Managers::GetString(L"#CHROME_INSPECTELEMENT"));
		}
	}

	if (custom)
	{
		if (custom->GetMenuItemCount() > 0)
		{
			if (menu->GetMenuItemCount() > 0)
			{
				custom->AppendSeparator();
				custom->AppendSubMenu(menu, Managers::GetString(L"#CHROME_NORMALMENU"));
			}

			menu = custom;
			custom = nullptr;
		}
		else
		{
			safe_delete(custom);
		}
	}

	return menu;
}
示例#21
0
文件: host.cpp 项目: DrLabman/QMB
/**
 * Runs all active servers
 */
void _Host_Frame(float time) {
    static double time1 = 0;
    static double time2 = 0;
    static double time3 = 0;
    int pass1, pass2, pass3;

    if (setjmp(host_abortserver))
        return; // something bad happened, or the server disconnected

    // keep the random time dependent
    rand();

    // decide the simulation time
    if (!Host_FilterTime(time))
        return; // don't run too fast, or packets will flood out

    // get new key events
    Sys_SendKeyEvents();

    // allow mice or other external controllers to add commands
    IN_Commands();

    // process console commands
    Cbuf_Execute();

    NET_Poll();

    // if running the server locally, make intentions now
    if (sv.active)
        CL_SendCmd();

    //-------------------
    // server operations
    //-------------------

    // check for commands typed to the host
    Host_GetConsoleCommands();

    if (sv.active)
        Host_ServerFrame();

    //-------------------
    // client operations
    //-------------------

    // if running the server remotely, send intentions now after
    // the incoming messages have been read
    if (!sv.active)
        CL_SendCmd();

    host_time += host_frametime;

    // fetch results from server
    if (cls.state == ca_connected) {
        CL_ReadFromServer();
    }

    // update video
    if (host_speeds.getBool())
        time1 = Sys_FloatTime();

    SCR_UpdateScreen();

    if (host_speeds.getBool())
        time2 = Sys_FloatTime();

    // update audio
    if (cls.signon == SIGNONS) {
        S_Update(r_origin, vpn, vright, vup);
        CL_DecayLights();
    } else
        S_Update(vec3_origin, vec3_origin, vec3_origin, vec3_origin);

    CDAudio_Update();

    if (host_speeds.getBool()) {
        pass1 = (time1 - time3)*1000;
        time3 = Sys_FloatTime();
        pass2 = (time2 - time1)*1000;
        pass3 = (time3 - time2)*1000;
        Con_Printf("%3i tot %3i server %3i gfx %3i snd\n",
                   pass1 + pass2 + pass3, pass1, pass2, pass3);
    }

    host_framecount++;
}
示例#22
0
LoginForm::LoginForm(wxWindow* parent) : gcFrame(parent, wxID_ANY, Managers::GetString(L"#LF_TITLE"), wxDefaultPosition, wxSize(420,246), wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxWANTS_CHARS|wxMINIMIZE_BOX, true)
{
	m_bAutoLogin = false;
	m_pNewAccount = NULL;

	Bind(wxEVT_COMMAND_TEXT_ENTER, &LoginForm::onTextBoxEnter, this);
	Bind(wxEVT_CLOSE_WINDOW, &LoginForm::onClose, this);
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onButtonClick, this);
	Bind(wxEVT_MOVE, &LoginForm::onMove, this);


	m_imgLogo = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 253,81 ));
	m_imgAvatar = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 ));

	m_imgLogo->setImage("#login_logo");
	m_imgAvatar->setImage("#login_default_avatar");

	m_tbUsername = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_USER"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS);
	m_tbPassword = new gcTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS|wxTE_PASSWORD);
	m_tbPasswordDisp = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_PASS"));

#ifndef UI_HIDE_AUTOLOGIN
	m_cbRemPass = new gcCheckBox(this, wxID_ANY, Managers::GetString(L"#LF_AUTO"));
	m_cbRemPass->SetToolTip(Managers::GetString(L"#LF_AUTO_TOOLTIP"));
#endif

	m_butSignin = new gcButton(this, wxID_ANY, Managers::GetString(L"#LOGIN"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
	m_butCancel = new gcButton(this, wxID_ANY, Managers::GetString(L"#CANCEL"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);

	m_linkOffline = new LoginLink(this, Managers::GetString(L"#LF_OFFLINE"), wxALIGN_LEFT);
	m_linkNewAccount = new LoginLink(this, Managers::GetString(L"#LF_NEWACCOUNT"), wxALIGN_CENTER);
	m_linkLostPassword = new LoginLink( this, Managers::GetString(L"#LF_LOSTPASS"), wxALIGN_RIGHT);

	//focus gets set to the first child. Redirect input to username box
	m_imgLogo->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this);
	m_imgAvatar->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this);

#ifdef WIN32
	Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this);
	Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this);
	Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this);

	m_imgLogo->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this);
	m_imgLogo->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this);
	m_imgLogo->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this);

	m_imgAvatar->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this);
	m_imgAvatar->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this);
	m_imgAvatar->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this);
#endif

	m_tbUsername->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this);
	m_tbUsername->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_tbUsername->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this);
	m_tbUsername->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this);

	m_tbPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_tbPassword->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this);

	m_tbPasswordDisp->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this);
	m_tbPasswordDisp->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this);

#ifndef UI_HIDE_AUTOLOGIN
	m_cbRemPass->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
#endif

	m_linkOffline->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_linkNewAccount->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_linkLostPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this);

	m_linkOffline->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this);
	m_linkNewAccount->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this);
	m_linkLostPassword->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this);


	m_butCancel->Bind(wxEVT_CHAR, &LoginForm::onChar, this);
	m_butSignin->Bind(wxEVT_CHAR, &LoginForm::onChar, this);

	m_tbUsername->SetValue(Managers::GetString(L"#LF_USER"));
	m_tbPasswordDisp->SetValue(Managers::GetString(L"#LF_PASS"));

	m_tbPassword->Show(false);
	m_tbPasswordDisp->Show(true);


	wxFlexGridSizer* fgSizer4 = new wxFlexGridSizer( 1, 3, 0, 0 );
	fgSizer4->AddGrowableCol( 0 );
	fgSizer4->SetFlexibleDirection( wxBOTH );
	fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
#ifndef UI_HIDE_AUTOLOGIN
	fgSizer4->Add( m_cbRemPass, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
#else
	fgSizer4->Add(0,0,0,0);
#endif

	fgSizer4->Add( m_butSignin, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
	fgSizer4->Add( m_butCancel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );

	
	wxFlexGridSizer* fgSizer5 = new wxFlexGridSizer( 1, 3, 0, 0 );
	fgSizer5->AddGrowableCol( 0 );
	fgSizer5->AddGrowableCol( 1 );
	fgSizer5->AddGrowableCol( 2 );
	fgSizer5->AddGrowableRow( 0 );
	fgSizer5->SetFlexibleDirection( wxBOTH );
	fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer5->Add( m_linkOffline, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
	fgSizer5->Add( m_linkNewAccount, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
	fgSizer5->Add( m_linkLostPassword, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
	

	wxFlexGridSizer* fgSizer6 = new wxFlexGridSizer( 4, 1, 0, 0 );
	fgSizer6->AddGrowableCol( 0 );
	fgSizer6->SetFlexibleDirection( wxBOTH );
	fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer6->Add( m_tbUsername, 0, wxEXPAND|wxLEFT, 5 );
	fgSizer6->Add( m_tbPassword, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
	fgSizer6->Add( m_tbPasswordDisp, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
	fgSizer6->Add( fgSizer4, 1, wxEXPAND, 5 );

	wxFlexGridSizer* fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 );
	fgSizer3->AddGrowableCol( 1 );
	fgSizer3->SetFlexibleDirection( wxBOTH );
	fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer3->Add( m_imgAvatar, 0, 0, 5 );
	fgSizer3->Add( fgSizer6, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );


	wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 4, 1, 0, 0 );
	fgSizer2->SetFlexibleDirection( wxBOTH );
	fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer2->Add( m_imgLogo, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 );
	fgSizer2->Add( fgSizer3, 1, wxEXPAND, 5 );
	fgSizer2->Add( 0, 9, 1, wxEXPAND, 5 );
	fgSizer2->Add( fgSizer5, 1, wxEXPAND, 5 );	


	wxFlexGridSizer* fgSizer1 = new wxFlexGridSizer( 1, 3, 0, 0 );
	fgSizer1->AddGrowableCol( 0 );
	fgSizer1->AddGrowableCol( 2 );
	fgSizer1->AddGrowableRow( 0 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
	fgSizer1->Add( fgSizer2, 1, wxEXPAND, 5 );
	fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
	
	this->SetSizer( fgSizer1 );
	this->Layout();


	m_bSavePos = false;

	m_vTabOrder.push_back(m_tbUsername);
	m_vTabOrder.push_back(m_tbPasswordDisp);
	m_vTabOrder.push_back(m_tbPassword);
#ifndef UI_HIDE_AUTOLOGIN
	m_vTabOrder.push_back(m_cbRemPass);
#endif
	m_vTabOrder.push_back(m_butSignin);
	m_vTabOrder.push_back(m_butCancel);
	m_vTabOrder.push_back(m_linkOffline);
	m_vTabOrder.push_back(m_linkNewAccount);
	m_vTabOrder.push_back(m_linkLostPassword);

	Centre(wxCENTRE_ON_SCREEN);
	SetFocus();

	if (gc_login_x.getInt() == -1 || gc_login_y.getInt() == -1)
	{
		int x = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
		int y = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);

		int w=0;
		int h=0;
		GetSize(&w, &h);

		int newX = (x-w)/2;
		int newY = (y-h)/2;

		if (newX>0 && newY>0)
			SetSize(newX, newY, -1, -1);
	}
	else
	{
#ifdef NIX
		if (! gc_allow_wm_positioning.getBool())
#endif
			setSavedWindowPos(gc_login_x.getInt(), gc_login_y.getInt(), UINT_MAX, UINT_MAX);
	}

#ifndef UI_HIDE_AUTOLOGIN
	if (gc_savelogin.getBool())
		m_cbRemPass->SetValue(true);
#endif

	if (gc_saveusername.getBool())
	{
		const char* str = gc_lastusername.getString();
		const char* avatar = gc_lastavatar.getString();

		if (gcString(str) != "")
		{
			m_tbUsername->SetValue(str);

			m_tbPasswordDisp->Show(false);
			m_tbPassword->Show();
			m_tbPassword->SetFocus();
			Layout();
		}

		if (avatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(avatar)))
			m_imgAvatar->setImage(avatar);
	}

	m_pLogThread = NULL;
	m_bSavePos = true;
	m_bMouseDrag = false;

	onLoginEvent += guiDelegate(this, &LoginForm::onLogin);
	onLoginErrorEvent += guiDelegate(this, &LoginForm::onLoginError);
	onStartLoginEvent += guiDelegate(this, &LoginForm::onStartLogin);

	Managers::LoadTheme(this, "formlogin");
	
#ifndef UI_HIDE_AUTOLOGIN
	Managers::LoadTheme(m_cbRemPass, "formlogin");
#endif

#ifdef WIN32
	SetSize(wxSize(420,246));
#endif

	setFrameRegion();
}
示例#23
0
gcUnitTestForm::gcUnitTestForm(wxWindow* parent)
	: gcDialog(parent, wxID_ANY, wxT("Unit Tests Results"), wxDefaultPosition, wxSize(500, 354), wxCAPTION | wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL)
	, m_pThread(nullptr)
	, m_ImageList(16, 16)
	, m_bShouldClose(false)
{
	m_nPassed = 0;
	m_nFailed = 0;
	m_nRunTime = 0;

	showEvent += guiDelegate(this, &gcUnitTestForm::onShow);

	Bind(wxEVT_COMMAND_BUTTON_CLICKED, &gcUnitTestForm::onButtonClicked, this);
	Bind(wxEVT_CLOSE_WINDOW, &gcUnitTestForm::OnClose, this);

	this->SetSizeHints(wxDefaultSize, wxDefaultSize);



	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer(wxHORIZONTAL);

	m_cbAssertOnError = new wxCheckBox(this, wxID_ANY, wxT("Assert On Error"), wxDefaultPosition, wxDefaultSize, 0);
	m_cbAssertOnError->SetValue(true);
	bSizer2->Add(m_cbAssertOnError, 0, wxALL, 5);

	m_cbRunOnStartup = new wxCheckBox(this, wxID_ANY, wxT("Run On Startup"), wxDefaultPosition, wxDefaultSize, 0);
	m_cbRunOnStartup->SetValue(true);
	bSizer2->Add(m_cbRunOnStartup, 0, wxALL, 5);





	m_staticText1 = new wxStaticText(this, wxID_ANY, wxT("Filter:"), wxDefaultPosition, wxDefaultSize, 0);
	m_staticText1->Wrap(-1);
	m_textCtrl1 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
	m_butRun = new wxButton(this, wxID_ANY, wxT("Run"), wxDefaultPosition, wxDefaultSize, 0);
	m_lcStats = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 25), wxLC_REPORT | wxLC_SORT_ASCENDING|wxLC_NO_HEADER);
	m_lcUnitTests = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SORT_ASCENDING);
	m_butClose = new wxButton(this, wxID_ANY, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0);


	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer(wxHORIZONTAL);

	bSizer1->Add(m_staticText1, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxLEFT, 5);
	bSizer1->Add(m_textCtrl1, 1, wxEXPAND | wxALL, 5);
	bSizer1->Add(m_butRun, 0, wxTOP | wxBOTTOM | wxRIGHT, 5);


	wxFlexGridSizer* fgSizer1;
	fgSizer1 = new wxFlexGridSizer(5, 1, 0, 0);
	fgSizer1->AddGrowableCol(0);
	fgSizer1->AddGrowableRow(3);
	fgSizer1->SetFlexibleDirection(wxBOTH);
	fgSizer1->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);

	fgSizer1->Add(bSizer2, 1, wxEXPAND, 5);
	fgSizer1->Add(bSizer1, 1, wxEXPAND, 5);
	fgSizer1->Add(m_lcStats, 1, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5);
	fgSizer1->Add(m_lcUnitTests, 1, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5);
	fgSizer1->Add(m_butClose, 0, wxALIGN_RIGHT | wxBOTTOM | wxRIGHT | wxLEFT, 5);

	this->SetSizer(fgSizer1);
	this->Layout();

	this->Centre(wxBOTH);

	m_cbRunOnStartup->SetValue(g_bRunOnStartup.getBool());
	m_cbAssertOnError->SetValue(g_bAssertOnFailure.getBool());

	m_textCtrl1->SetValue(g_strUnitTestFilter.getString());

	m_cbRunOnStartup->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &gcUnitTestForm::OnRunOnStartupClicked, this);
	m_cbAssertOnError->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &gcUnitTestForm::OnAssertOnErrorClicked, this);
	m_textCtrl1->Bind(wxEVT_COMMAND_TEXT_UPDATED, &gcUnitTestForm::OnTextChanged, this);


	m_icoTestGood = GetGCThemeManager()->getImageHandle("#test_good");
	m_icoTestBad = GetGCThemeManager()->getImageHandle("#test_bad");

	m_ImageList.Add(wxBitmap(m_icoTestBad.getImg()->Scale(16, 16)));
	m_ImageList.Add(wxBitmap(m_icoTestGood.getImg()->Scale(16, 16)));

	m_lcStats->SetImageList(&m_ImageList, wxIMAGE_LIST_NORMAL);
	m_lcStats->SetImageList(&m_ImageList, wxIMAGE_LIST_SMALL);


	m_lcUnitTests->SetImageList(&m_ImageList, wxIMAGE_LIST_NORMAL);
	m_lcUnitTests->SetImageList(&m_ImageList, wxIMAGE_LIST_SMALL);

	g_pTestWatcher->onStartEvent += guiDelegate(this, &gcUnitTestForm::onStart);
	g_pTestWatcher->onEndEvent += guiDelegate(this, &gcUnitTestForm::onEnd);

	g_pTestWatcher->onTestStartEvent += guiDelegate(this, &gcUnitTestForm::onTestStart);
	g_pTestWatcher->onTestResultEvent += guiDelegate(this, &gcUnitTestForm::onTestResult);
	g_pTestWatcher->onTestEndEnd += guiDelegate(this, &gcUnitTestForm::onTestEnd);

	if (g_bRunOnStartup.getBool())
		runTests();
}
示例#24
0
void ItemForm::onShowWinLaunchDialog() 
{
	if (! gc_linux_disable_windows_warning.getBool())
		gcMessageBox(this, Managers::GetString(L"#IF_WINDOWS_LAUNCH_WARNING")); 
} 
示例#25
0
void DESURA_Debug(const wchar_t* msg)
{
	if (logForm && gc_debug.getBool())
		logForm->appendText(msg, Color(0x0000FF00));
}