Beispiel #1
0
gcWebControl::gcWebControl(wxWindow* parent, const char* defaultUrl, const char* unused) : gcPanel(parent, wxID_ANY)
{
	Bind(wxEVT_MOUSEWHEEL, &gcWebControl::onMouseScroll, this);
	Bind(wxEVT_SIZE, &gcWebControl::onResize, this);
	Bind(wxEVT_COMMAND_MENU_SELECTED, &gcWebControl::onMenuClicked, this);
	
#ifdef WIN32
	Bind(wxEVT_ERASE_BACKGROUND, &gcWebControl::onPaintBg, this);
	Bind(wxEVT_PAINT, &gcWebControl::onPaint, this);
#else
	Bind(wxEVT_SET_FOCUS, &gcWebControl::onFocus, this);
#endif
	

	m_bStartedLoading = false;
	gcString loadingurl = gcString(GetGCThemeManager()->getWebPage("loading"));
	loadingurl += gcString("?url={0}", UTIL::STRING::urlEncode(gcString(defaultUrl)));

	m_pEventHandler = new EventHandler(this);

#ifdef WIN32
	m_pChromeBrowser = NewChromiumBrowser((HWND)GetHWND(), PRODUCT_NAME, loadingurl.c_str());
#else
	GtkWidget* gtkParent = this->GetConnectWidget();
	GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
	
	if (!gtkParent)
		return;
	
	GdkColor blackCol;
	gdk_color_parse("black", &blackCol);
	
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_NORMAL, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_ACTIVE, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_PRELIGHT, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_SELECTED, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_INSENSITIVE, &blackCol);
	
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_NORMAL, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_ACTIVE, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_PRELIGHT, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_SELECTED, &blackCol);
	gtk_widget_modify_bg(GTK_WIDGET(vbox), GTK_STATE_INSENSITIVE, &blackCol);
	
	gtk_container_add(GTK_CONTAINER(gtkParent), vbox);
	
	m_pChromeBrowser = NewChromiumBrowser((int*)vbox, PRODUCT_NAME, loadingurl.c_str());
#endif

	if (!m_pChromeBrowser)
		m_pChromeBrowser = new gcWebFakeBrowser(this);

	m_pChromeBrowser->setEventCallback(m_pEventHandler);

	onPageStartEvent += guiDelegate(this, &gcWebControl::onStartLoad);
	onAnyPageLoadEvent += guiDelegate(this, &gcWebControl::onPageLoad);

	m_szHomeUrl = defaultUrl;
	m_bContentLoaded = false;
}
Beispiel #2
0
gcWebControl::gcWebControl(wxWindow* parent, const char* defaultUrl, CreateBrowserFn createBrowserFn)
	: gcPanel(parent, wxID_ANY)
{
	Bind(wxEVT_MOUSEWHEEL, &gcWebControl::onMouseScroll, this);
	Bind(wxEVT_SIZE, &gcWebControl::onResize, this);
	Bind(wxEVT_COMMAND_MENU_SELECTED, &gcWebControl::onMenuClicked, this);
	
	Bind(wxEVT_ERASE_BACKGROUND, &gcWebControl::onPaintBg, this);
	Bind(wxEVT_PAINT, &gcWebControl::onPaint, this);
	Bind(wxEVT_SET_FOCUS, &gcWebControl::onFocus, this);	

	m_bStartedLoading = false;
	gcString loadingurl = gcString(GetGCThemeManager()->getWebPage("loading"));
	loadingurl += gcString("?url={0}", UTIL::STRING::urlEncode(gcString(defaultUrl)));

	m_pEventHandler = new EventHandler(this);

	if (createBrowserFn)
		m_pChromeBrowser = createBrowserFn(this, loadingurl.c_str());
	else
		m_pChromeBrowser = CreateBrowser(this, loadingurl.c_str());

	if (!m_pChromeBrowser)
		m_pChromeBrowser = new gcWebFakeBrowser(this);

	m_pChromeBrowser->setEventCallback(m_pEventHandler);

	onPageStartEvent += guiDelegate(this, &gcWebControl::onStartLoad);
	onAnyPageLoadEvent += guiDelegate(this, &gcWebControl::onPageLoad);

	m_szHomeUrl = defaultUrl;
	m_bContentLoaded = false;
}
HtmlToolBarControl::~HtmlToolBarControl()
{
	onPageStartLoadingEvent -= guiDelegate(this, &HtmlToolBarControl::onPageStartLoading);
	onPageEndLoadingEvent -= guiDelegate(this, &HtmlToolBarControl::onPageFinishLoading);

	safe_delete(m_vCrumbList);
}
Beispiel #4
0
void UploadInfoPage::onResume()
{
	UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(getItemId());

	if (!item && !GetUserCore()->isAdmin())
	{	
		Close();
		return;
	}

	m_tbItemFile->SetLabel( Managers::GetString(L"#UDF_RESUMEDIR"));

	m_butUpload->Enable(false);
	m_tbItemFile->Enable(false);
	m_butFile->Enable(false);

	m_bResume = true;

	safe_delete(m_pUpInfo);
	m_pUpInfo = new WebCore::Misc::ResumeUploadInfo();

	m_pResumeThread = GetThreadManager()->newUploadResumeThread(getItemId(), m_szKey.c_str(), m_pUpInfo);

	*m_pResumeThread->getErrorEvent() += guiDelegate(this, &UploadInfoPage::onError);
	*m_pResumeThread->getCompleteStringEvent() += guiDelegate(this, &UploadInfoPage::onResumeCompleteCB);

	m_pResumeThread->start();

	Show();
	Raise();
}
Beispiel #5
0
void HtmlTabPage::constuctBrowser()
{
	if (m_pWebControl)
		return;

	newBrowser(m_szHomePage.c_str());
	m_pWebPanel->Show(true);

	m_pWebControl->onNewURLEvent += delegate(this, &HtmlTabPage::onNewUrl);
	m_pWebControl->onPageLoadEvent += guiDelegate(this, &HtmlTabPage::onPageLoad);

	if (m_pControlBar)
	{
		m_pWebControl->onPageStartEvent += delegate(&m_pControlBar->onPageStartLoadingEvent);
		m_pWebControl->onPageLoadEvent += delegate(&m_pControlBar->onPageEndLoadingEvent);
	}

	m_pWebControl->onClearCrumbsEvent += guiDelegate(this, &HtmlTabPage::clearCrumbs);
	m_pWebControl->onAddCrumbEvent += guiDelegate(this, &HtmlTabPage::addCrumb);
	m_pWebControl->onFindEvent += guiDelegate(this, &HtmlTabPage::onFind);

	m_pBSBrowserSizer->Add( m_pWebPanel, 1, wxEXPAND, 5 );	

	Layout();
	Refresh();

	m_pWebControl->forceResize();
}
void PasswordReminder::onButtonClicked( wxCommandEvent& event )
{
	if (event.GetId() == m_butSend->GetId())
	{
		if (!isEmailValid())
		{
			gcMessageBox(this, Managers::GetString(L"#PR_VALIDEMAIL"), Managers::GetString(L"#PR_ERRTITLE"));
			return;
		}

		m_butSend->Enable(false);
		m_tbEmail->Enable(false);

		wxString str = m_tbEmail->GetValue();
		gcString email((const wchar_t*)str.c_str());

		m_pThread = new PassReminderThread(email.c_str());
		m_pThread->onCompleteEvent += guiDelegate(this, &PasswordReminder::onComplete);
		m_pThread->onErrorEvent += guiDelegate(this, &PasswordReminder::onError);
		m_pThread->start();
	}
	else
	{
		Close();
	}
}
Beispiel #7
0
HtmlTabPage::~HtmlTabPage()
{
	if (m_pControlBar)
	{
		gcAssert(m_pControlBar.unique());
		m_pControlBar.reset();
	}

	if (m_pWebControl)
	{
		m_pWebControl->onNewURLEvent -= delegate(this, &HtmlTabPage::onNewUrl);
		m_pWebControl->onClearCrumbsEvent -= guiDelegate(this, &HtmlTabPage::clearCrumbs);
		m_pWebControl->onAddCrumbEvent -= guiDelegate(this, &HtmlTabPage::addCrumb);
		m_pWebControl->onFindEvent -= guiDelegate(this, &HtmlTabPage::onFind);
	}

	auto userCore = GetUserCore();

	if (userCore)
	{
		auto cip = userCore->getCIPManager();

		if (cip)
			cip->getItemsUpdatedEvent() -= guiDelegate(this, &HtmlTabPage::onCIPUpdate);
	}
}
Beispiel #8
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);
}
ItemToolBarControl::ItemToolBarControl(wxWindow* parent) : BaseToolBarControl(parent)
{
	m_butExpand = new gcImageButton(this, BUTTON_EXPAND, wxDefaultPosition, wxSize( 19,19 ), 0 );
	m_butExpand->setDefaultImage(("#items_expand"));
	m_butExpand->setHoverImage(("#items_expand_hover"));
	m_butExpand->SetToolTip(Managers::GetString(L"#DM_EXPAND"));

	m_butContract = new gcImageButton(this, BUTTON_CONTRACT, wxDefaultPosition, wxSize( 19,19 ), 0 );
	m_butContract->setDefaultImage(("#items_contract"));
	m_butContract->setHoverImage(("#items_contract_hover"));
	m_butContract->SetToolTip(Managers::GetString(L"#DM_CONTRACT"));

#ifdef ENABLE_SEARCH
	m_pSearch = new SearchControl(this);
	m_pSearch->onSearchEvent += delegate(&onSearchEvent);
	m_pSearch->onFullSearchEvent += delegate(&onSearchEvent);
#else
	m_pSearch = nullptr;
#endif

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

	createButtons();

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

	fgSizer1->Add( m_pFGContentSizer, 0, 0, 4 );
	fgSizer1->Add( 3, 0, 1, 0, 4 );
	fgSizer1->Add( m_butExpand, 0, wxTOP|wxBOTTOM, 4 );
	

#ifdef ENABLE_SEARCH
	fgSizer1->Add( m_butContract, 0, wxTOP|wxBOTTOM, 4 );
	fgSizer1->Add( m_pSearch, 0, wxTOP|wxBOTTOM, 4);
	fgSizer1->Add( m_pSearch->getButton(), 0, wxTOP|wxBOTTOM|wxRIGHT, 4);
#else
	fgSizer1->Add( m_butContract, 0, wxTOP|wxBOTTOM|wxRIGHT, 4 );
#endif

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

	auto userCore = GetUserCore();

	if (userCore && GetUploadMng())
	{
		userCore->getItemsAddedEvent() += guiDelegate(this, &ItemToolBarControl::onItemsAdded);
		userCore->getLoginItemsLoadedEvent() += guiDelegate(this, &ItemToolBarControl::onLoginItemsLoaded);
		GetUploadMng()->getUpdateEvent() += guiDelegate(this, &ItemToolBarControl::onUploadItemsAdded);
	}
}
Beispiel #10
0
LoginForm::~LoginForm()
{
	onLoginEvent -= guiDelegate(this, &LoginForm::onLogin);
	onLoginErrorEvent -= guiDelegate(this, &LoginForm::onLoginError);
	onStartLoginEvent -= guiDelegate(this, &LoginForm::onStartLogin);

	safe_delete(m_pLogThread);
}
Beispiel #11
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();
}
Beispiel #12
0
DesuraControl::~DesuraControl()
{
	auto userCore = GetUserCore();

	if (userCore)
	{
		userCore->getNewAvatarEvent() -= guiDelegate(this, &DesuraControl::onNewAvatar);
		userCore->getAppUpdateProgEvent() -= guiDelegate(this, &DesuraControl::onDesuraUpdate);
	}
}
ItemToolBarControl::~ItemToolBarControl()
{
	auto userCore = GetUserCore();

	if (userCore)
	{
		userCore->getItemsAddedEvent() -= guiDelegate(this, &ItemToolBarControl::onItemsAdded);
		userCore->getLoginItemsLoadedEvent() -= guiDelegate(this, &ItemToolBarControl::onLoginItemsLoaded);
	}

	if (GetUploadMng())
		GetUploadMng()->getUpdateEvent() -= guiDelegate(this, &ItemToolBarControl::onUploadItemsAdded);
}
Beispiel #14
0
void ChangeDirForm::start(const char* dest, UserCore::UserI* user)
{
	m_pThread = new ChangeDirThread(dest, user);

	m_pThread->onErrorEvent += guiDelegate(this, &ChangeDirForm::onError);
	m_pThread->onProgressEvent += guiDelegate(this, &ChangeDirForm::onProgress);
	m_pThread->onCompleteEvent += guiDelegate(this, &ChangeDirForm::onComplete);
	m_pThread->onStageEvent += guiDelegate(this, &ChangeDirForm::onStageChange);

	m_pThread->start();

	gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
	if (par)
		par->setProgressState(gcFrame::P_NORMAL);
}
Beispiel #15
0
gcSpinningBar::gcSpinningBar( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size) : gcPanel(parent, id, pos, size, wxSIMPLE_BORDER)
{
#ifdef WIN32
	g_TimerLock.lock();
	g_SpinnerMap[GetId()] = this;
	g_TimerLock.unlock();
#endif

	SetBackgroundColour( wxColour( 125, 255, 125 ) );

	Bind(wxEVT_PAINT, &gcSpinningBar::onPaint, this);
	Bind(wxEVT_ERASE_BACKGROUND, &gcSpinningBar::onEraseBg, this);

	m_imgProg = GetGCThemeManager()->getImageHandle("#spinningbar");
	m_uiOffset = 0;

#ifdef WIN32
	m_tId = ::SetTimer((HWND)GetHWND(), GetId(), 75, TimerProc);
#else
	m_tId = g_timeout_add(75, (GSourceFunc)TimerProc, (gpointer)this);
#endif

	m_bNotifyRedraw = false;
	onNeedRedrawEvent += guiDelegate(this, &gcSpinningBar::onNeedRedraw);
}
Beispiel #16
0
void UploadInfoPage::initUpload(const char* path)
{
	if (m_pUpInfo)
	{
		fileValidation(path);
	}
	else
	{
		m_pPrepThread = GetThreadManager()->newUploadPrepThread(getItemId(), path);

		*m_pPrepThread->getErrorEvent() += guiDelegate(this, &UploadInfoPage::onError);
		*m_pPrepThread->getCompleteStringEvent() += guiDelegate(this, &UploadInfoPage::onComplete);

		m_pPrepThread->start();
	}
}
Beispiel #17
0
void MainApp::logOut(bool bShowLogin, bool autoLogin, bool webLoggedOut)
{
	gcTrace("");

	m_pInternalLink->closeAll();
	safe_delete(m_pInternalLink);

	closeMainForm();
	wxTheApp->ProcessIdle();

	{
		std::lock_guard<std::mutex> a(m_UserLock);
		if (g_pUserHandle)
		{
			auto user = g_pUserHandle;

			g_pUserHandle = nullptr;
			DesuraJSBinding::gs_pItemManager = nullptr;

			user->getPipeDisconnectEvent() -= guiDelegate(this, &MainApp::onPipeDisconnect);
			user->logOut(!autoLogin);

			user->getAppUpdateProgEvent()				-= guiDelegate(this, &MainApp::onAppUpdateProg);
			user->getAppUpdateCompleteEvent()			-= guiDelegate(this, &MainApp::onAppUpdate);
			user->getWebCore()->getCookieUpdateEvent() -= guiDelegate(this, &MainApp::onCookieUpdate);
			user->getWebCore()->getLoggedOutEvent()		-= delegate(&onLoggedOutEvent);

			user->destroy();
		}
	}

	GetCVarManager()->saveAll();
	GetCVarManager()->cleanUserCvars();

	m_bLoggedIn = false;
	m_iMode = APP_MODE::MODE_UNINT;

	if (bShowLogin)
		showLogin(!autoLogin, webLoggedOut);

	HideLogForm();

	DeleteCookies();
	SetCrashDumpSettings(nullptr, true);
}
void TaskBarIcon::tagItems()
{
	if (!GetUserCore())
		return;

	std::vector<UserCore::Item::ItemInfoI*> gList;
	GetUserCore()->getItemManager()->getGameList(gList, true);

	for (size_t x=0; x<gList.size(); x++)
	{
		UserCore::Item::ItemInfoI* game = gList[x];

		if (game->getStatus() & UserCore::Item::ItemInfoI::STATUS_DELETED || (!(game->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)) && (game->getStatus() & UserCore::Item::ItemInfoI::STATUS_DEVELOPER)))
		{
			*game->getInfoChangeEvent() -= guiDelegate(this, &TaskBarIcon::onItemChanged);
			continue;
		}

		if (!(game->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)))
			continue;

		*game->getInfoChangeEvent() += guiDelegate(this, &TaskBarIcon::onItemChanged);

#ifdef WIN32
		std::vector<UserCore::Item::ItemInfoI*> mList;
		GetUserCore()->getItemManager()->getModList(game->getId(), mList, true);

		for (size_t y=0; y<mList.size(); y++)
		{
			UserCore::Item::ItemInfoI* mod = mList[y];

			if (mod->getStatus() & UserCore::Item::ItemInfoI::STATUS_DELETED || (!(mod->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)) && (mod->getStatus() & UserCore::Item::ItemInfoI::STATUS_DEVELOPER)))
			{
				*mod->getInfoChangeEvent() -= guiDelegate(this, &TaskBarIcon::onItemChanged);
				continue;
			}

			if (!(mod->getStatus() & (UserCore::Item::ItemInfoI::STATUS_ONACCOUNT|UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)))
				continue;

			*mod->getInfoChangeEvent() += guiDelegate(this, &TaskBarIcon::onItemChanged);
		}
#endif
	}
}
Beispiel #19
0
HtmlTabPage::HtmlTabPage(wxWindow* parent, gcString homePage, PAGE area) 
	: BaseTabPage(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxNO_BORDER )
	, m_szHomePage(homePage)
	, m_pBSBrowserSizer(new wxBoxSizer(wxVERTICAL))
	, m_SearchArea(area)
{
	SetBackgroundColour(wxColour( 0, 0, 0 ));

	m_pControlBar = std::shared_ptr<HtmlToolBarControl>(new HtmlToolBarControl(parent), [this](HtmlToolBarControl *pControl){
		pControl->onSearchEvent -= guiDelegate(this, &HtmlTabPage::onSearch);
		pControl->onFullSearchEvent -= guiDelegate(this, &HtmlTabPage::onFullSearch);
		pControl->onButtonClickedEvent -= guiDelegate(this, &HtmlTabPage::onButtonClicked);

		if (m_pControlBar)
		{
			m_pWebControl->onPageStartEvent -= delegate(&pControl->onPageStartLoadingEvent);
			m_pWebControl->onPageLoadEvent -= delegate(&pControl->onPageEndLoadingEvent);
		}

		pControl->Destroy();
	});

	m_pControlBar->onSearchEvent += guiDelegate(this, &HtmlTabPage::onSearch);
	m_pControlBar->onFullSearchEvent += guiDelegate(this, &HtmlTabPage::onFullSearch);
	m_pControlBar->onButtonClickedEvent += guiDelegate(this, &HtmlTabPage::onButtonClicked);

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

	if (GetUserCore())
		GetUserCore()->getCIPManager()->getItemsUpdatedEvent() += guiDelegate(this, &HtmlTabPage::onCIPUpdate);
}
Beispiel #20
0
DesuraControl::~DesuraControl()
{
	for (size_t x=0; x<m_vTabInfo.size(); x++)
	{
		if (m_vTabInfo[x]->page)
			m_vTabInfo[x]->page->Destroy();

		if (m_vTabInfo[x]->header)
			m_vTabInfo[x]->header->Destroy();

		safe_delete(m_vTabInfo[x]);
	}

	if (GetUserCore())
	{
		*GetUserCore()->getNewAvatarEvent() -= guiDelegate(this, &DesuraControl::onNewAvatar);
		*GetUserCore()->getAppUpdateProgEvent() -= guiDelegate(this, &DesuraControl::onDesuraUpdate);
	}
}
Beispiel #21
0
void CDProcess::start(bool generateDump)
{
	if (generateDump)
	{
		m_pThread = new CrashDumpThread();
		m_labStatus->SetLabel(Managers::GetString(L"#CRASH_GENERATEINFO"));
	}
	else
	{
		m_pThread = new CrashDumpUploadThread();
		m_labStatus->SetLabel(Managers::GetString(L"#CRASH_UPLOADINFO"));
	}

	m_pThread->onErrorEvent += guiDelegate(this, &CDProcess::onError);
	m_pThread->onCompleteEvent += guiDelegate(this, &CDProcess::onComplete);
	m_pThread->onProgressEvent += guiDelegate(this, &CDProcess::onProgress);

	m_pThread->start();
}
void CreateProgPage::run()
{
	if (!getItemInfo() && !GetUserCore()->isAdmin())
		return;

	Show(true);
	Raise();

	if (m_pThread)
		return;

	m_pThread = GetThreadManager()->newCreateMCFThread(getItemId(), m_szFolderPath.c_str());

	*m_pThread->getMcfProgressEvent() += guiDelegate(this, &CreateProgPage::onProgress);
	*m_pThread->getErrorEvent() += guiDelegate(this, &CreateProgPage::onError);
	*m_pThread->getCompleteStringEvent() += guiDelegate(this, &CreateProgPage::onComplete);

	m_pThread->start();
}
Beispiel #23
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);
}
Beispiel #24
0
//we use a thread here as md5 checks on large files take a while
void UploadInfoPage::fileValidation(const char* path)
{
	if (m_pVFThread && m_pVFThread->isRunning())
		return;

	safe_delete(m_pVFThread);

	m_pVFThread = new fileValidateThread(path, m_pUpInfo->szHash.c_str(), m_pUpInfo->size);
	m_pVFThread->onCompleteEvent += guiDelegate(this, &UploadInfoPage::onFileValidationComplete);
	m_pVFThread->start();
}
Beispiel #25
0
void UploadInfoPage::dispose()
{
	if (m_pVFThread)
		m_pVFThread->onCompleteEvent -= guiDelegate(this, &UploadInfoPage::onFileValidationComplete);

	safe_delete(m_pUpInfo);
	safe_delete(m_pVFThread);
	safe_delete(m_pPrepThread);
	safe_delete(m_pResumeThread);
	safe_delete(m_pUpInfo);
}
Beispiel #26
0
void MainApp::logOut(bool bShowLogin, bool autoLogin)
{
	m_pInternalLink->closeAll();
	safe_delete(m_pInternalLink);

	{
		Thread::AutoLock a(m_UserLock);
		if (g_pUserHandle)
		{
			UserCore::UserI* user = g_pUserHandle;
			g_pUserHandle = NULL;

			user->logOut(!autoLogin);

			*user->getAppUpdateProgEvent()				-= guiDelegate(this, &MainApp::onAppUpdateProg);
			*user->getAppUpdateCompleteEvent()			-= guiDelegate(this, &MainApp::onAppUpdate);
			*user->getWebCore()->getCookieUpdateEvent() -= guiDelegate(this, &MainApp::onCookieUpdate);
			*user->getPipeDisconnectEvent()				-= guiDelegate(this, &MainApp::onPipeDisconnect);

			safe_delete(user);
		}
	}

	GetCVarManager()->saveAll();
	GetCVarManager()->cleanUserCvars();

	closeMainForm();

	m_bLoggedIn = false;
	m_iMode = MODE_UNINT;

	if (bShowLogin)
		showLogin(!autoLogin);

	HideLogForm();

	DeleteCookies();
	SetCrashDumpSettings(NULL, true);
}
Beispiel #27
0
CDKProgress::CDKProgress(wxWindow* parent, bool launch)
	: BasePage(parent)
{
	m_bLaunch = launch;

	m_labInfo = new wxStaticText( this, wxID_ANY, Managers::GetString("#CDK_PROGRESSINFO"), wxDefaultPosition, wxDefaultSize, 0 );
	m_pbProgress = new gcSpinningBar(this, wxID_ANY, wxDefaultPosition, wxSize( -1,22 ));
	m_butClose = new gcButton( this, wxID_ANY, Managers::GetString("#CLOSE"), wxDefaultPosition, wxDefaultSize, 0 );

	wxBoxSizer* bSizer1 = new wxBoxSizer( wxHORIZONTAL );
	bSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
	bSizer1->Add( m_butClose, 0, wxALL, 5 );


	wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 2, 1, 0, 0 );
	fgSizer2->AddGrowableCol( 0 );
	fgSizer2->SetFlexibleDirection( wxBOTH );
	fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	fgSizer2->Add( m_labInfo, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	fgSizer2->Add( m_pbProgress, 0, wxEXPAND|wxALL, 5 );


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

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


	setParentSize(-1, 140);
	onCompleteEvent += guiDelegate(this, &CDKProgress::onComplete);
	onErrorEvent += guiDelegate(this, &CDKProgress::onError);
}
Beispiel #28
0
void gcFrame::setupPositionSave(const char* name, bool saveMax, int defWidth, int defHeight)
{
	if (m_pCVarInfo)
		return;

	if (defWidth == -1)
		defWidth = GetDefaultSize().GetWidth();

	if (defHeight == -1)
		defHeight = GetDefaultSize().GetHeight();
		
	m_pCVarInfo = new CVarInfo();
	m_pCVarInfo->setupPositionSave(name, saveMax, defWidth, defHeight);

	if (saveMax)
	{
		//Need to do this as at this stage inheritance may not be full formed and Maximize doesnt work correctly.
		onFormMaxEvent += guiDelegate(this, &gcFrame::onFormMax);
		onFormMaxEvent();
	}
}
Beispiel #29
0
GCUpdateInfo::GCUpdateInfo(wxWindow* parent)
	: gcFrame(parent, wxID_ANY, wxT("#UF_TITLE"), wxDefaultPosition, wxSize( 445,300 ), wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL)
{
	Bind(wxEVT_CLOSE_WINDOW, &GCUpdateInfo::onFormClose, this);
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, &GCUpdateInfo::onButClick, this);

	SetTitle(Managers::GetString(L"#UF_TITLE"));

	m_labInfo = new wxStaticText( this, wxID_ANY, Managers::GetString(L"#UF_INFO"), wxDefaultPosition, wxDefaultSize, 0 );

	m_ieBrowser = new gcMiscWebControl( this, "about:blank", "DesuraUpdate");
	m_ieBrowser->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVECAPTION ) );
	m_ieBrowser->onPageLoadEvent += guiDelegate(this, &GCUpdateInfo::onPageLoad);

	m_butRestartNow = new gcButton( this, wxID_ANY, Managers::GetString(L"#UF_RESTART_NOW"), wxDefaultPosition, wxSize( 100,-1 ), 0 );
	m_butRestartLater = new gcButton( this, wxID_ANY, Managers::GetString(L"#UF_RESTART_LATER"), wxDefaultPosition, wxSize( 100,-1 ), 0 );


	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxHORIZONTAL );
	bSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
	bSizer1->Add( m_butRestartNow, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
	bSizer1->Add( m_butRestartLater, 0, wxALL, 5 );

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

	fgSizer1->Add( m_labInfo, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
	fgSizer1->Add( m_ieBrowser, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
	fgSizer1->Add( bSizer1, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
	
	this->SetSizer( fgSizer1 );
	this->Layout();

	centerOnParent();
}
Beispiel #30
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;
}