Exemplo n.º 1
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);
}
Exemplo n.º 2
0
void MainApp::Init(int argc, wxCmdLineArgsArray &argv)
{
	gcTrace("");

	if (argc > 0)
	{
		for (int x=0; x<argc; x++)
		{
			wxString str = argv[x].MakeLower();

			if (str == "-dgl")
				m_bQuiteMode = true;

			if (str.StartsWith("desura://"))
				m_szDesuraCache = gcString(argv[x].ToStdString());
		}
	}

	//char *comAppPath = nullptr;
	//UTIL::OS::getAppDataPath(&comAppPath);
	//UTIL::FS::recMakeFolder(comAppPath);
	//safe_delete(comAppPath);

	InitLogging();
	cc_PrintVersion();
	cc_CheckCert();
	Msg("Logging Has started\n");
	Msg("\n\n");

	InitManagers();
	InitLocalManagers();

	std::string val = UTIL::OS::getConfigValue(REGRUN);
	gc_autostart.setValue( val.size() > 0 );

	//because logging gets init first we need to man reg it
	RegLogWithWindow();

	//because logging gets init before managers we need to reapply the color scheme.
	LoggingapplyTheme();
	loadFrame(wxDEFAULT_FRAME_STYLE);

#ifndef NIX
	if (!m_bQuiteMode)
		m_wxTBIcon = new TaskBarIcon(this);
#endif
	m_wxTBIcon = nullptr;

	std::string szAppid = UTIL::OS::getConfigValue(APPID);

	uint32 appid = -1;

	if (szAppid.size() > 0)
		appid = Safe::atoi(szAppid.c_str());

	if (appid == BUILDID_BETA || appid == BUILDID_INTERNAL)
		gc_uploaddumps.setValue(true);
}
Exemplo n.º 3
0
void LoginForm::onMove(wxMoveEvent  &event)
{
	if (m_bSavePos)
	{
		gc_login_x.setValue(GetPosition().x);
		gc_login_y.setValue(GetPosition().y);
	}

	event.Skip();
}
Exemplo n.º 4
0
void DesuraJSSettings::setValue(gcString name, gcString val)
{
	CVar* cvar = GetCVarManager()->findCVar(name.c_str());

	if (cvar && val != gcString(cvar->getString()))
		cvar->setValue(val.c_str());
}
Exemplo n.º 5
0
MainApp::MainApp()
{
	Bind(wxEVT_CLOSE_WINDOW, &MainApp::onClose, this);

	m_wxLoginForm = nullptr;
	m_wxTBIcon = nullptr;
	m_wxMainForm = nullptr;
	
	m_bQuiteMode = false;
	m_bLoggedIn = false;
	m_iMode = MODE_LOGOUT;

	//need to overide the value in corecount if not set
	if (gc_corecount.getInt() == 0)
	{
		//need to change the value so it will trigger the cvar callback
		gc_corecount.setValue(1);
		gc_corecount.setValue(0);
	}

	m_pOfflineDialog = nullptr;
	m_pInternalLink = nullptr;
#ifdef WITH_GTEST
	m_UnitTestForm = nullptr;
#endif
	onLoginAcceptedEvent += guiDelegate(this, &MainApp::onLoginAcceptedCB);
	onInternalLinkEvent += guiDelegate(this, &MainApp::onInternalLink);
	onInternalLinkStrEvent += guiDelegate(this, &MainApp::onInternalStrLink);
	onNotifyGiftUpdateEvent += guiDelegate(this, &MainApp::onNotifyGiftUpdate);
}
Exemplo n.º 6
0
bool validateUsernameChange(const CVar* cvar, const char* newValue)
{
	if (gcString(newValue) == gcString(cvar->getString()))
		return false;

	gc_lastavatar.setValue("");
	return true;
}
Exemplo n.º 7
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();
}
Exemplo n.º 8
0
void LoginForm::onCheckBoxClick( wxCommandEvent& event )
{
#ifdef WIN32
	if ( event.GetId() == m_cbProxyOff->GetId() )
	{
		bool isProxyOff = event.IsChecked();
		m_cbProxyOff->SetValue( isProxyOff );
		gc_saveProxyOff.setValue( isProxyOff );
		UTIL::OS::setProxyOff( isProxyOff );
	}
	else
#endif
		if ( event.GetId() == m_cbBypassSSLRevocationCheck->GetId() )
		{
			bool isBypassSSLRevocationCheck = event.IsChecked();
			m_cbBypassSSLRevocationCheck->SetValue( isBypassSSLRevocationCheck );
			gc_saveBypassSSLRevocationCheck.setValue( isBypassSSLRevocationCheck );
			UTIL::OS::setBypassSSLRevocationCheck( isBypassSSLRevocationCheck );
		}
}
Exemplo n.º 9
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);
}
Exemplo n.º 10
0
MainApp::MainApp()
{
	Bind(wxEVT_CLOSE_WINDOW, &MainApp::onClose, this);

	//need to override the value in core count if not set
	if (gc_corecount.getInt() == 0)
	{
		//need to change the value so it will trigger the cvar callback
		gc_corecount.setValue(1);
		gc_corecount.setValue(0);
	}

	onLoginAcceptedEvent += guiDelegate(this, &MainApp::onLoginAcceptedCB);
	onInternalLinkEvent += guiDelegate(this, &MainApp::onInternalLink);
	onInternalLinkStrEvent += guiDelegate(this, &MainApp::onInternalStrLink);
	onNotifyGiftUpdateEvent += guiDelegate(this, &MainApp::onNotifyGiftUpdate);

	onLoggedOutEvent += guiDelegate(this, &MainApp::onLoggedOut);
}
Exemplo n.º 11
0
void MainApp::getSteamUser(WCSpecialInfo *info, wxWindow *parent)
{
	if (gc_steamuser.getString() && strcmp(gc_steamuser.getString(), "") != 0)
	{
		info->result = gc_steamuser.getString();
		info->handled = true;
	}
	else
	{
		SteamUserDialog dlg(parent?parent:this);
		dlg.ShowModal();

		const char *steamuser = dlg.getSteamUser();

		if (steamuser)
		{
			gc_steamuser.setValue(steamuser);
			info->result = steamuser;
			info->handled = true;
		}
	}
}
Exemplo n.º 12
0
DesuraControl::DesuraControl(gcFrame* parent, bool offline, const char* szProvider) 
	: gcPanel(parent)
{
	m_iIndex = -1;
	m_bDownloadingUpdate = false;
	m_uiUpdateProgress = 0;

	this->SetBackgroundColour( wxColor(GetGCThemeManager()->getColor("headerbottomborder", "bg")));
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	auto userCore = GetUserCore();

	if (userCore)
		userCore->getNewAvatarEvent() += guiDelegate(this, &DesuraControl::onNewAvatar);

	parent->onActiveEvent += guiDelegate(this, &DesuraControl::onActiveToggle);


	m_pMainMenuButton = new MainMenuButton(this, offline);

	m_pAvatar = new gcImageButton( this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 ), wxTAB_TRAVERSAL );

#ifdef WIN32
	m_pAvatar->SetCursor(wxCURSOR_HAND);
#endif

	const char* szUsername = Managers::GetString("#MP_OFFLINE");
	const char* szAvatar = nullptr;
	
	if (userCore)
	{
		szAvatar = GetUserCore()->getAvatar();

		if (!offline)
			szUsername = GetUserCore()->getUserName();
	}
		

	if (szAvatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(szAvatar)))
	{
		gc_lastavatar.setValue(szAvatar);
		m_pAvatar->setDefaultImage(szAvatar);
	}
	else
	{
		m_pAvatar->setDefaultImage("#icon_avatar");
	}

	m_pFiller = new DesuraMenuFiller(this);
	m_pFiller->SetMinSize( wxSize( 25,38 ) );
	
	m_pUsernameBox = new UsernameBox(this, szUsername);
	m_pMenuStrip = new MenuStrip(this);

	m_sizerContent = new wxFlexGridSizer( 1, 1, 0, 0 );
	m_sizerContent->AddGrowableCol( 0 );
	m_sizerContent->AddGrowableRow( 0 );
	m_sizerContent->SetFlexibleDirection( wxBOTH );
	m_sizerContent->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	wxFlexGridSizer* fgSizer3;

	fgSizer3 = new wxFlexGridSizer( 1, 4, 0, 0 );

	fgSizer3->AddGrowableCol( 2 );
	fgSizer3->SetFlexibleDirection( wxBOTH );
	fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	fgSizer3->Add( m_pUsernameBox, 1, wxEXPAND, 5 );
	fgSizer3->Add( m_pMenuStrip, 1, wxEXPAND, 5 ); 	// main buttons across the top
	fgSizer3->Add( m_pFiller, 1, wxEXPAND, 5 );

	
	m_sizerHeader = new wxBoxSizer( wxVERTICAL ); 
	



	wxFlexGridSizer* fgSizer4;
	fgSizer4 = new wxFlexGridSizer( 1, 2, 0, 0 );
	fgSizer4->SetFlexibleDirection( wxBOTH );
	fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	if (!offline)
	{
		m_bButtonStrip = new ButtonStrip( this );
		fgSizer4->Add( m_bButtonStrip, 1, wxEXPAND|wxBOTTOM, 1 ); // mail buttons
	}
	else
	{
		m_bButtonStrip = nullptr;
		fgSizer4->Add( 5, 0, 1, wxEXPAND, 5 );
	}

	fgSizer4->AddGrowableCol( 1 );
	fgSizer4->Add( m_sizerHeader, 1, wxEXPAND, 5 ); // arrows, home button,


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

	fgSizer2->Add( fgSizer3, 1, wxEXPAND, 5 );
	fgSizer2->Add( fgSizer4, 1, wxEXPAND, 5 );


	wxFlexGridSizer* fgSizer1;
	fgSizer1 = new wxFlexGridSizer( 1, 4, 0, 0 );
	fgSizer1->AddGrowableCol( 2 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	fgSizer1->Add( m_pMainMenuButton, 1, 0, 5 );
	fgSizer1->Add( m_pAvatar, 1, wxSHAPED, 5 );
	fgSizer1->Add( fgSizer2, 1, wxEXPAND, 5 );

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

	fgSizer5->Add( fgSizer1, 1, wxEXPAND, 5 );

	if (gcString(szProvider).size() > 0)
	{
		gcString strProv("Warning: Staging Environment {0}. Client Updates Disabled", szProvider);
		wxStaticText *pText = new wxStaticText(this, wxID_ANY, strProv, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);

		pText->SetForegroundColour(*wxBLACK);
		pText->SetBackgroundColour(wxColour(255, 128, 64));
		pText->SetFont(wxFont(16, 70, 90, 90, false, wxEmptyString));

		fgSizer5->Add(pText, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 10);

		fgSizer5->AddGrowableRow(2);
	}
	else
	{
		fgSizer5->AddGrowableRow(1);
	}

	fgSizer5->Add( m_sizerContent, 1, wxEXPAND, 5 );
	
	this->SetSizer( fgSizer5 );
	this->Layout();

	if (userCore)
		userCore->getAppUpdateProgEvent() += guiDelegate(this, &DesuraControl::onDesuraUpdate);

	m_bOffline = offline;
}
Exemplo n.º 13
0
DesuraControl::DesuraControl(gcFrame* parent, bool offline) : gcPanel(parent)
{
	m_iIndex = -1;
	m_bDownloadingUpdate = false;
	m_uiUpdateProgress = 0;

	this->SetBackgroundColour( wxColor(GetGCThemeManager()->getColor("headerbottomborder", "bg")));
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	*GetUserCore()->getNewAvatarEvent() += guiDelegate(this, &DesuraControl::onNewAvatar);

	parent->onActiveEvent += guiDelegate(this, &DesuraControl::onActiveToggle);


	m_pMainMenuButton = new MainMenuButton(this, offline);

	m_pAvatar = new gcImageButton( this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 ), wxTAB_TRAVERSAL );

#ifdef WIN32
	m_pAvatar->SetCursor(wxCURSOR_HAND);
#endif

	const char* szAvatar = GetUserCore()->getAvatar();
	if (szAvatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(szAvatar)))
	{
		gc_lastavatar.setValue(szAvatar);
		m_pAvatar->setDefaultImage(szAvatar);
	}
	else
	{
		m_pAvatar->setDefaultImage("#icon_avatar");
	}

	m_pFiller = new DesuraMenuFiller(this);
	m_pFiller->SetMinSize( wxSize( 25,38 ) );
	
	m_pUsernameBox = new UsernameBox(this, offline?"Offline":GetUserCore()->getUserName());
	m_pMenuStrip = new MenuStrip(this);

	m_sizerContent = new wxFlexGridSizer( 1, 1, 0, 0 );
	m_sizerContent->AddGrowableCol( 0 );
	m_sizerContent->AddGrowableRow( 0 );
	m_sizerContent->SetFlexibleDirection( wxBOTH );
	m_sizerContent->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	wxFlexGridSizer* fgSizer3;

	fgSizer3 = new wxFlexGridSizer( 1, 4, 0, 0 );

	fgSizer3->AddGrowableCol( 2 );
	fgSizer3->SetFlexibleDirection( wxBOTH );
	fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	fgSizer3->Add( m_pUsernameBox, 1, wxEXPAND, 5 );
	fgSizer3->Add( m_pMenuStrip, 1, wxEXPAND, 5 ); 	// main buttons across the top
	fgSizer3->Add( m_pFiller, 1, wxEXPAND, 5 );

	
	m_sizerHeader = new wxBoxSizer( wxVERTICAL ); 
	



	wxFlexGridSizer* fgSizer4;
	fgSizer4 = new wxFlexGridSizer( 1, 2, 0, 0 );
	fgSizer4->SetFlexibleDirection( wxBOTH );
	fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	if (!offline)
	{
		m_bButtonStrip = new ButtonStrip( this );
		fgSizer4->Add( m_bButtonStrip, 1, wxEXPAND|wxBOTTOM, 1 ); // mail buttons
	}
	else
	{
		m_bButtonStrip = NULL;
		fgSizer4->Add( 5, 0, 1, wxEXPAND, 5 );
	}

	fgSizer4->AddGrowableCol( 1 );
	fgSizer4->Add( m_sizerHeader, 1, wxEXPAND, 5 ); // arrows, home button,


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

	fgSizer2->Add( fgSizer3, 1, wxEXPAND, 5 );
	fgSizer2->Add( fgSizer4, 1, wxEXPAND, 5 );


	wxFlexGridSizer* fgSizer1;
	fgSizer1 = new wxFlexGridSizer( 1, 4, 0, 0 );
	fgSizer1->AddGrowableCol( 2 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	fgSizer1->Add( m_pMainMenuButton, 1, 0, 5 );
	fgSizer1->Add( m_pAvatar, 1, wxSHAPED, 5 );
	fgSizer1->Add( fgSizer2, 1, wxEXPAND, 5 );

	wxFlexGridSizer* fgSizer5;
	fgSizer5 = new wxFlexGridSizer( 2, 1, 0, 0 );
	fgSizer5->AddGrowableCol( 0 );
	fgSizer5->AddGrowableRow( 1 );
	fgSizer5->SetFlexibleDirection( wxBOTH );
	fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	fgSizer5->Add( fgSizer1, 1, wxEXPAND, 5 );
	fgSizer5->Add( m_sizerContent, 1, wxEXPAND, 5 );
	
	this->SetSizer( fgSizer5 );
	this->Layout();

	*GetUserCore()->getAppUpdateProgEvent() += guiDelegate(this, &DesuraControl::onDesuraUpdate);

	m_bOffline = offline;
}
Exemplo n.º 14
0
void DesuraControl::onNewAvatar(gcString& image)
{
	m_pAvatar->setDefaultImage(image.c_str());
	gc_lastavatar.setValue(image.c_str());
}
Exemplo n.º 15
0
void gcUnitTestForm::OnRunOnStartupClicked(wxCommandEvent& event)
{
	g_bRunOnStartup.setValue(m_cbRunOnStartup->IsChecked());
}
Exemplo n.º 16
0
void gcUnitTestForm::OnTextChanged(wxCommandEvent& event)
{
	g_strUnitTestFilter.setValue((const char*)m_textCtrl1->GetValue());
}
Exemplo n.º 17
0
void gcUnitTestForm::OnAssertOnErrorClicked(wxCommandEvent& event)
{
	g_bAssertOnFailure.setValue(m_cbAssertOnError->IsChecked());
}