void InternalLink::showPreorderPrompt(DesuraId id, bool isPreload) { UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id ); if (!item) return; UserCore::Item::BranchInfoI* bi = item->getCurrentBranch(); if (!bi) { for (size_t x=0; x<item->getBranchCount(); x++) { UserCore::Item::BranchInfoI *temp = item->getBranch(x); if (temp->isPreOrder()) { bi = temp; break; } } } if (!bi) return; const char* str = bi->getPreOrderExpDate(); uint32 days; uint32 hours; std::string time_available = UTIL::MISC::dateTimeToDisplay(str); UTIL::MISC::getTimeDiffFromNow(str, days, hours); gcString title(Managers::GetString("#IF_PRELOADLAUNCH_TITLE"), item->getName()); gcString msg(Managers::GetString("#IF_PRELOADLAUNCH"), item->getName(), days, Managers::GetString(isPreload?"#IF_PRELOADLAUNCH_PRELOADED":"#IF_PRELOADLAUNCH_PREORDERED"), time_available, Managers::GetString(days == 1 ? "#IF_PRELOADLAUNCH_WORD_DAY":"#IF_PRELOADLAUNCH_WORD_DAYS")); PreloadButtonHelper pobh(id); if (pobh.m_bOtherBranches) msg += gcString(Managers::GetString("#IF_PRELOADLAUNCH_INSTALLOTHER_INFO"), item->getName()); gcMessageBox(g_pMainApp->getMainWindow(), msg, title, wxICON_EXCLAMATION|wxCLOSE, &pobh); }
void CreateMCFOverview::setInfo(DesuraId itemId, const char* szPath) { UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(itemId); if (!item && !GetUserCore()->isAdmin()) { GetParent()->Close(); return; } BasePage::setInfo(itemId); if (item) m_labInfo->SetLabel(gcWString(Managers::GetString(L"#CF_COMPLETE"), item->getName())); UTIL::FS::Path path(szPath, "", true); uint64 filesize = UTIL::FS::getFileSize(path); m_szFolderPath = path.getFolderPath(); m_szPath = path.getFullPath(); m_pItem = item; m_labName->SetLabel(path.getFile().getFile()); m_labSize->SetLabel(UTIL::MISC::niceSizeStr(filesize)); m_labPath->SetLabel(path.getShortPath(45, true)); m_labPath->SetToolTip(path.getFullPath()); Layout(); }
void UpdateInfoForm::setInfo(DesuraId id, bool launch) { m_bLaunch = launch; m_uiInternId = id; m_cbReminder->Enable(m_bLaunch); m_cbReminder->Show(m_bLaunch); UserCore::Item::ItemInfoI* item = GetUserCore()->getItemManager()->findItemInfo( id ); if (!item) { Warning("Cant find item for update form.\n"); return; } if (item->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(item->getIcon()))) setIcon(item->getIcon()); m_cbReminder->SetValue(m_bLaunch && item->getOptions() & UserCore::Item::ItemInfoI::OPTION_NOTREMINDUPDATE); SetLabel(gcWString(L"{0} {1}", Managers::GetString(L"#UI_TITLE"), item->getName())); m_ieBrowser->loadUrl(gcWString(L"http://www.desura.com/{0}/{1}/changelog", id.getTypeString(), item->getShortName())); }
void ExeSelectForm::setInfo(DesuraId id) { m_Id = id; UserCore::Item::ItemInfoI *item = m_pItemManager->findItemInfo(id); if (!item) { Close(); return; } if (item->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(item->getIcon()))) { setIcon(item->getIcon()); } gcWString title(Managers::GetString(L"#ES_TITLE"), item->getName()); SetTitle(title); gcWString text(Managers::GetString(L"#ES_LABEL"), item->getName()); m_labInfo->SetLabel(text); m_labInfo->Wrap(350); std::vector<UserCore::Item::Misc::ExeInfoI*> vExeList; item->getExeList(vExeList); gcButton* def = nullptr; for (auto exe : vExeList) { gcWString name(exe->getName()); gcButton* but = new gcButton(this, wxID_ANY, name, wxDefaultPosition, wxSize(150, -1)); m_vButtonList.push_back(but); m_pButtonSizer->Add( but, 0, wxALL, 2 ); if (name.find(L"Play") != std::wstring::npos) def = but; } this->Layout(); if (def) def->SetDefault(); }
void InstallPrompt::setInfo(DesuraId id, const char* path) { UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(id); if (!item || !path) { Close(); return; } m_szPath = gcWString(path); gcWString title(L"{0} {1}", Managers::GetString(L"#IF_INSTALL"), item->getName()); gcWString quest(Managers::GetString(L"#IF_EXISTINGFILES"), item->getName()); SetTitle(title); m_labQuestion->SetLabel(quest); }
void ComplexPrompt::setInfo(DesuraId id) { UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(id); if (!item) { EndModal(wxID_CANCEL); return; } m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_CONFLICT"), item->getName())); m_labInfo->Wrap( 350 ); }
void InstallVerifyInfoPage::init() { UserCore::Item::ItemInfoI *info = getItemInfo(); if (!info) { Close(); return; } m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_VERIFYCONFIRM"), info->getName())); m_labInfo->Wrap( 360 ); }
void CDKeyForm::setInfo(DesuraId id) { m_ItemId = id; UserCore::Item::ItemInfoI *item = m_pItemManager->findItemInfo(id); if (!item) { Close(); return; } this->SetTitle(gcString(Managers::GetString("#CDK_TITLE"), item->getName())); m_pPage->setInfo(m_ItemId); m_pPage->run(); }
void CDKeyForm::setInfo(DesuraId id) { m_ItemId = id; UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(id); if (!item) { Close(); return; } this->SetTitle(gcString("{0}: CD Key", item->getName())); m_pPage->setInfo(m_ItemId); m_pPage->run(); }
void UninstallForm::setInfo(DesuraId id) { m_uiInternId = id; UserCore::Item::ItemInfoI *item = GetUserCore()->getItemManager()->findItemInfo(id); if (!item) { Warning("Item was null for uninstall!"); Close(); } gcWString name(item->getName()); gcWString title(255, L"{0} {0}", GETSTRING(L"#UNF_TITLE"), name.c_str()); this->SetTitle(title.c_str()); showInfo(); }
void CDKInfo::setInfo(DesuraId id, const char* key) { BasePage::setInfo(id); UserCore::Item::ItemInfoI *info = getItemInfo(); if (!info) { GetParent()->Close(); return; } m_butLaunch->Enable(info->isLaunchable()); if (checkForArma(id, key)) return; m_tbCdKey->ChangeValue(key); tokenizeKey(key); UserCore::Item::BranchInfoI* cb = info->getCurrentBranch(); if (cb && cb->isSteamGame()) { m_labInfo->SetLabel(gcWString(Managers::GetString(L"#CDK_INFO_STEAM"), info->getName())); m_labInfo->Wrap(360); m_butActivate = new gcButton(this, wxID_ANY, Managers::GetString(L"#CDK_ACTIVATE")); m_pButtonSizer->Clear(false); m_pButtonSizer->Add( 0, 0, 1, wxEXPAND, 5 ); m_pButtonSizer->Add(m_butActivate, 0, wxTOP|wxBOTTOM|wxLEFT, 5); m_pButtonSizer->Add(m_butLaunch, 0, wxTOP|wxBOTTOM|wxLEFT, 5); m_pButtonSizer->Add(m_butClose, 0, wxALL, 5); Layout(); Refresh(false); setParentSize(-1, 140); } }
void UninstallInfoPage::init() { UserCore::Item::ItemInfoI *info = getItemInfo(); if (!info) { Close(); return; } bool hasPaidBranch = false; for (size_t x=0; x<info->getBranchCount(); x++) { UserCore::Item::BranchInfoI* b = info->getBranch(x); if (b && HasAnyFlags(b->getFlags(), UserCore::Item::BranchInfoI::BF_ONACCOUNT) && !HasAnyFlags(b->getFlags(), UserCore::Item::BranchInfoI::BF_DEMO|UserCore::Item::BranchInfoI::BF_FREE|UserCore::Item::BranchInfoI::BF_TEST)) hasPaidBranch = true; } if (hasPaidBranch) { m_cbAccount->Enable(false); m_cbAccount->SetValue(false); } if (info->getId().getType() == DesuraId::TYPE_LINK) { m_cbAccount->Enable(false); m_cbAccount->SetValue(true); m_cbComplete->Enable(false); m_cbComplete->SetValue(true); } m_labInfo->SetLabel(gcWString(Managers::GetString(L"#UNF_CONFIRM"), info->getName())); m_labInfo->Wrap( 360 ); }
int InstallBranch::setInfo(DesuraId id, bool selectBranch) { m_bSelectBranch = selectBranch; UserCore::Item::ItemInfoI* pItemInfo = GetUserCore()->getItemManager()->findItemInfo(id); if (!pItemInfo) return 1; m_bIsMod = id.getType() == DesuraId::TYPE_MOD; m_bIsExpansion = m_bIsMod == false && pItemInfo->getParentId().getType() == DesuraId::TYPE_GAME; m_Item = id; gcWString parName; gcWString itemName = pItemInfo->getName(); DesuraId par = pItemInfo->getParentId(); UserCore::Item::ItemInfoI *parInfo = NULL; if (par.isOk()) { parInfo = GetUserCore()->getItemManager()->findItemInfo(par); if (parInfo) parName = gcWString(parInfo->getName()); } fixName(parName); fixName(itemName); if (selectBranch == false && m_bIsMod) { m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_NOTFOUND"), itemName, parName)); m_labInfo->Wrap( 350 ); } else if (selectBranch == false && m_bIsExpansion) { m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_NOTFOUND_GAME"), itemName, parName)); m_labInfo->Wrap( 350 ); } else { m_labInfo->SetLabel(gcWString(Managers::GetString(L"#IF_BRANCHINFO"), itemName)); m_labInfo->Wrap( 350 ); } uint32 count = 0; int32 full = -1; uint32 fullReadyCount = 0; m_bBuy = true; UserCore::Item::ItemInfoI *i = pItemInfo; bool isCheckingParent = (m_bIsMod || m_bIsExpansion) && !selectBranch; if (isCheckingParent) { if (!parInfo) { gcMessageBox(GetParent(), Managers::GetString(L"#IF_IIPARENT"), Managers::GetString(L"#IF_IIERRTITLE")); return 1; } i = parInfo; } std::vector<UserCore::Item::BranchInfoI*> bList; for (uint32 x=0; x<i->getBranchCount(); x++) { UserCore::Item::BranchInfoI* bi = i->getBranch(x); if (!bi) continue; uint32 flags = bi->getFlags(); bool noRelease = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES); bool isPreorder = bi->isPreOrder(); bool isDemo = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_DEMO); bool onAccount = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_ONACCOUNT); bool locked = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_MEMBERLOCK|UserCore::Item::BranchInfoI::BF_REGIONLOCK); bool test = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_TEST); bool free = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE); if (noRelease && !isPreorder) continue; if (!onAccount && locked) continue; if (!selectBranch && (isDemo || test)) continue; if ((free || onAccount) && isPreorder && !selectBranch) continue; bool globalFound = false; for (size_t x=0; x<bList.size(); x++) { if (bList[x]->getGlobalId() == bi->getGlobalId()) { globalFound = true; break; } } if (globalFound) continue; if (isDemo || test) { } else if (full == -1 || ((!m_bBuy || onAccount) && !free)) { if (full == -1 || m_bBuy) { //if this is the first full game or this is the first full game that you dont have to buy m_bBuy = (!onAccount && !free); full = count; } if (onAccount || free) fullReadyCount++; } bList.push_back(bi); count++; } for (size_t x=0; x<bList.size(); x++) { UserCore::Item::BranchInfoI* bi = bList[x]; gcString name = bi->getName(); gcWString title; uint32 flags = bi->getFlags(); bool noRelease = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_NORELEASES); bool isPreorder = bi->isPreOrder(); bool onAccount = HasAllFlags(flags, UserCore::Item::BranchInfoI::BF_ONACCOUNT); bool free = HasAnyFlags(flags, UserCore::Item::BranchInfoI::BF_FREE); if (!free) title = gcString("{0} - {1}", name, Managers::GetString("#IF_BROUGHT")); else title = gcString("{0} - {1}", name, Managers::GetString("#IF_FREE")); if (!free && !onAccount) { gcWString cost(bi->getCost()); if (cost == "") cost = gcString(Managers::GetString("#TBA")); title = gcString("{0} - {1}", name, cost.c_str()); } else if (isPreorder) { if (noRelease) title = gcString("{0} - {1}", name, Managers::GetString("#IF_PREORDERED_NORELEASE")); else title = gcString("{0} - {1}", name, Managers::GetString("#IF_PREORDERED")); } m_cbBranchList->Append(title, new BranchData(bi->getBranchId(), bi->getGlobalId())); } count = bList.size(); if (full == -1) full = 0; #ifdef WIN32 if (HasAnyFlags(i->getStatus(), UserCore::Item::ItemInfoI::STATUS_ONCOMPUTER)) m_cbBranchList->Append(Managers::GetString("#IF_ONCOMPUTER"), new BranchData(MCFBranch::BranchFromInt(-1), MCFBranch::BranchFromInt(-1))); else m_cbBranchList->Append(Managers::GetString("#IF_FINDONCOMPUTER"), new BranchData(MCFBranch::BranchFromInt(-2), MCFBranch::BranchFromInt(-2))); #endif m_cbBranchList->SetSelection(full); if (pItemInfo->getIcon() && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(pItemInfo->getIcon()))) setIcon(pItemInfo->getIcon()); SetTitle(gcWString(Managers::GetString(L"#IF_BRANCHTITLE"), itemName)); uint32 ret = 0; if (count == 0) { if (!isCheckingParent) gcMessageBox(GetParent(), Managers::GetString(L"#IF_IINOBRANCHES"), Managers::GetString(L"#IF_IIERRTITLE")); else if (selectBranch) ret = 1; } else if ((count == 1 || fullReadyCount == 1) && !m_bBuy) { ret = 1; } else { wxCommandEvent e; onChoice(e); } return ret; }
wxMenu* TBIModMenu::createMenu(uint32 &lastMenuId) { gcMenu* menu = new gcMenu(); m_IdMapList.clear(); if (!m_pItemManager && GetUserCore()) m_pItemManager = GetUserCore()->getItemManager(); if (!m_pItemManager) return menu; std::vector<UserCore::Item::ItemInfoI*> gList; m_pItemManager->getGameList(gList); std::sort(gList.begin(), gList.end(), [](UserCore::Item::ItemInfoI* left, UserCore::Item::ItemInfoI* right){ return strcmp(left->getName(), right->getName()) <= 0; }); for (size_t x=0; x<gList.size(); x++) { UserCore::Item::ItemInfoI *game = gList[x]; std::vector<UserCore::Item::ItemInfoI*> mList; m_pItemManager->getModList(game->getId(), mList); if (mList.size() == 0) continue; gcMenu* gameMenu = new gcMenu(); std::sort(mList.begin(), mList.end(), [](UserCore::Item::ItemInfoI* left, UserCore::Item::ItemInfoI* right){ return strcmp(left->getName(), right->getName()) <= 0; }); for (size_t y=0; y<mList.size(); y++) { UserCore::Item::ItemInfoI *mod = mList[y]; wxMenuItem* menuItem = new gcMenuItem(gameMenu, lastMenuId, mod->getName()); gameMenu->Append(menuItem); m_IdMapList[lastMenuId] = mod->getId(); loadIcon(menuItem, mod->getIcon()); lastMenuId++; } wxMenuItem* gameItem = new gcMenuItem(gameMenu, wxID_ANY, game->getName(), "", wxITEM_NORMAL, gameMenu); loadIcon(gameItem, game->getIcon()); menu->Append(gameItem); } if (menu->GetMenuItemCount() == 0) { wxMenuItem* noItems = new gcMenuItem(menu, lastMenuId, Managers::GetString(L"#TB_NOITEMS")); lastMenuId++; menu->Append(noItems); noItems->Enable(false); } return menu; }