Exemplo n.º 1
0
void InternalLink::showPrompt(DesuraId id, Args args)
{
	std::string prompt = args.getArgValue("prompt");
	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id );

	if (prompt == "update")
	{
		std::vector<std::string> a;
		a.push_back("reminder=true");

		showUpdateForm(id, Args(a));
	}
	else if (prompt == "launch")
	{
		LaunchItemDialog* form = new LaunchItemDialog(m_pParent);
		regForm(id, form);

		form->setInfo(item);

		form->Show(true);
		form->Raise();
	}
	else if (prompt == "eula")
	{
		showEULA(id);
	}
	else if (prompt == "preload")
	{
		showPreorderPrompt(id, true);
	}
}
Exemplo n.º 2
0
void InternalLink::showUpdateLog(DesuraId id)
{
	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id );
	if (!item)
	{
		//cant upload show prompt
		gcMessageBox(g_pMainApp->getMainWindow(),  Managers::GetString(L"#MF_UPDATELOG_ITEMERROR"), Managers::GetString(L"#MF_ERRTITLE") );
		return;
	}

	ChangeLogForm* form = new ChangeLogForm(m_pParent);
	regForm(id, form);

	form->setInfo(item);
	form->Show(true);	
	form->Raise();
}
Exemplo n.º 3
0
UI::Forms::ItemForm* InternalLink::showItemForm(DesuraId id, UI::Forms::INSTALL_ACTION action, MCFBranch branch, MCFBuild build, bool showForm)
{
	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id );

	if (!item && action != UI::Forms::INSTALL_ACTION::IA_INSTALL && action != UI::Forms::INSTALL_ACTION::IA_INSTALL_TESTMCF)
		return nullptr;

	UI::Forms::ItemForm *form = findForm<UI::Forms::ItemForm>(id, m_vSubForms);
	
	if (!form)
	{
		form = new UI::Forms::ItemForm(m_pParent);
		form->setItemId(id);
		regForm(id, form);
	}

	form->newAction(action, branch, build, showForm);
	return form;
}
Exemplo n.º 4
0
void InternalLink::showUpdateForm(DesuraId id, Args args)
{
	UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id );

	if (!item)
		return;

	if (!HasAllFlags(item->getStatus(), UserCore::Item::ItemInfoI::STATUS_UPDATEAVAL))
		return;
	
	std::string reminder = args.getArgValue("reminder");

	//create new gather info form from
	UpdateInfoForm* form = new UpdateInfoForm(m_pParent);
	regForm(id, form);

	form->setInfo(id, reminder == "true");
	form->Show(true);
}
Exemplo n.º 5
0
void InternalLink::showEULA(DesuraId id)
{
	gcRefPtr<UserCore::Item::ItemInfoI> item = GetUserCore()->getItemManager()->findItemInfo( id );
	if (!item)
	{
		//cant upload show prompt
		gcMessageBox(g_pMainApp->getMainWindow(),  Managers::GetString(L"#MF_NAMERESOLVE"), Managers::GetString(L"#MF_ERRTITLE") );
		return;
	}

	EULAForm* form = new EULAForm(m_pParent);
	regForm(id, form);

	if (form->setInfo(id))
	{
		form->Show(true);
		form->Raise();
	}
}
Exemplo n.º 6
0
void InternalLink::showPrompt(DesuraId id, LinkArgs args)
{
	std::string prompt = args.getArgValue("prompt");
	gcRefPtr<UserCore::Item::ItemInfoI> item = GetUserCore()->getItemManager()->findItemInfo( id );

	if (prompt == "update")
	{
		args.push_back("reminder=true");
		showUpdateForm(id, args);
	}
	else if (prompt == "launch")
	{
		LaunchItemDialog* form = new LaunchItemDialog(m_pParent);
		regForm(id, form);

		form->setInfo(item);

		form->Show(true);
		form->Raise();
	}
	else if (prompt == "eula")
	{
		showEULA(id);
	}
	else if (prompt == "preload")
	{
		showPreorderPrompt(id, true);
	}
	else if (prompt == "needtorunfirst")
	{
		std::string parentId = args.getArgValue("parentid");

		DesuraId pid(parentId.c_str(), "games");
		showNeedToRun(id, pid);
	}
	else
	{
		gcAssert(false);
	}
}
Exemplo n.º 7
0
bool InternalLink::processItemLink(bool &badLink, std::vector<gcString> &list, const char* link)
{
	if (list.size() < 3)
	{
		badLink = true;
		return true;
	}

	std::string key = list[1] + list[2];

	std::map<gcString, gcFrame*>::iterator it = m_mWaitingItemFromMap.find(key);

	if (it != m_mWaitingItemFromMap.end())
	{
		it->second->Raise();
		return false;
	}

	UI::Forms::ItemForm *form = new UI::Forms::ItemForm(m_pParent, list[0].c_str(), list[2].c_str());
	m_mWaitingItemFromMap[key] = form;

	form->Show();

	DesuraId id;

	try
	{
		id = GetWebCore()->nameToId(list[2].c_str(), list[1].c_str());
	}
	catch (gcException &e)
	{
		DesuraId idAsNum(list[2].c_str(), list[1].c_str());

		if (idAsNum.getItem() == 0)
		{
			Warning(gcString("Failed to resolve item name {0} for link {2}: {1}\n", list[2], e, link));
			gcErrorBox(form, Managers::GetString("#MF_ERRTITLE"), Managers::GetString("#MF_NAMERESOLVE"), e);

			m_mWaitingItemFromMap.erase(m_mWaitingItemFromMap.find(key));

			form->Show(false);
			form->Destroy();
			return false;
		}
		else
		{
			id = idAsNum;
		}
	}

	m_mWaitingItemFromMap.erase(m_mWaitingItemFromMap.find(key));

	bool destroyForm = false;
	std::vector<std::string> argList;

	if (id.isOk())
	{
		UI::Forms::ItemForm *formFind = findForm<UI::Forms::ItemForm>(id, m_vSubForms);

		if (!formFind)
		{
			form->setItemId(id);
			regForm(id, form);
		}
		else
		{
			formFind->SetPosition(form->GetPosition());
			form->Show(false);
			destroyForm = true;
		}

		if (list[0] == "install" || list[0] == "launch")
		{
			std::string branch;

			if (list.size() >= 4)
				branch = list[3];

			if (branch.size() > 0)
			{
				argList.push_back(std::string("global=") + branch);
				handleInternalLink(id, ACTION_INSTALL, argList);	
			}
			else
			{
				bool isInstall = (list[0] == "install");
				handleInternalLink(id, isInstall?ACTION_INSTALL:ACTION_LAUNCH, argList);	
			}
		}
		else if (list[0] == "uninstall" || list[0] == "remove")
		{
			handleInternalLink(id, ACTION_UNINSTALL);
		}
		else if (list[0] == "verify")
		{
			handleInternalLink(id, ACTION_VERIFY);
		}
		else if (list[0] == "upload")
		{
			destroyForm = true;
			handleInternalLink(id,  ACTION_UPLOAD);
		}
		else if (list[0] == "resumeupload" && list.size() >= 4)
		{
			destroyForm = true;
			argList.push_back(std::string("key=") + list[3]);
			handleInternalLink(id, ACTION_RESUPLOAD, argList);	//
		}
		else if (list[0] == "makemcf")
		{
			destroyForm = true;
			handleInternalLink(id, ACTION_CREATE);
		}
		else if (list[0] == "test" && list.size() >= 5)
		{
			argList.push_back(std::string("branch=") + list[3]);
			argList.push_back(std::string("build=") + list[4]);
			handleInternalLink(id, ACTION_TEST, argList);
		}
		else
		{
			badLink = true;
		}
	}
	else
	{
		badLink = true;
	}

	if (badLink || destroyForm)
	{
		closeForm(form->GetId());
		form->Show(false);
		form->Destroy();
	}

	return true;
}