Пример #1
0
void CAboutWindow::DoModal(HWND parentWnd)
{
	std::tstring aboutMainInstruction;
	aboutMainInstruction = std::tstring(APP_NAME) + _T(" v") + std::tstring(APP_VERSIONSTR);

	std::tstring aboutContent;
	aboutContent += std::tstring(_T("By Jean-Philip Desjardins")) + _T("\r\n");
	aboutContent += std::tstring(_T("<a href=\"http://purei.org\">http://purei.org</a>")) + _T("\r\n");
	aboutContent += _T("\r\n");
	aboutContent += std::tstring(_T("Thanks to Neill Corlett for creating the PSF format and also for his ADSR and reverb analysis.")) + _T("\r\n");
	aboutContent += _T("\r\n");
	aboutContent += std::tstring(_T("Thanks to Koro from KoroSoft for his TaskDialog emulation library and his insights on various Win32 topics.")) + _T("\r\n");

	TASKDIALOGCONFIG taskDialog;
	memset(&taskDialog, 0, sizeof(TASKDIALOGCONFIG));
	taskDialog.cbSize				= sizeof(TASKDIALOGCONFIG);
	taskDialog.dwFlags				= TDF_ALLOW_DIALOG_CANCELLATION | TDF_ENABLE_HYPERLINKS;
	taskDialog.hInstance			= GetModuleHandle(NULL);
	taskDialog.hwndParent			= parentWnd;
	taskDialog.pszWindowTitle		= _T("About");
	taskDialog.pszMainInstruction	= aboutMainInstruction.c_str();
	taskDialog.pszContent			= aboutContent.c_str();
	taskDialog.pszMainIcon			= MAKEINTRESOURCE(IDI_MAIN);
	taskDialog.pfCallback			= &CAboutWindow::TaskDialogCallback;
	TaskDialogIndirectEmulate(&taskDialog, NULL, NULL, NULL);
}
Пример #2
0
void PrepareGameLocation()
{
	CAppConfig::GetInstance().RegisterPreferenceString(PREF_LAUNCHER_GAME_LOCATION, "");

	auto currentGameLocation = Framework::Utf8::ConvertFrom(CAppConfig::GetInstance().GetPreferenceString(PREF_LAUNCHER_GAME_LOCATION));

	//Already setup, don't go any further
	if(!currentGameLocation.empty()) return;

	auto detectedGameLocation = CGameInstallInfo::GetInstallPath();
	if(!detectedGameLocation.empty())
	{
		int pressedButton = 0;
		std::tstring message = string_format(
			_T("The launcher has detected a Final Fantasy XIV installation at this location:\r\n\r\n")
			_T("%s\r\n\r\n")
			_T("Do you want the launcher to use that game location?\r\n\r\n")
			_T("(Selecting \"No\" will ask you for a different game location. You will also be able to change that setting later in the launcher.)"),
			detectedGameLocation.c_str());
		TASKDIALOGCONFIG tdc;
		memset(&tdc, 0, sizeof(tdc));
		tdc.cbSize = sizeof(TASKDIALOGCONFIG);
		tdc.pszWindowTitle		= APP_NAME;
		tdc.dwCommonButtons		= TDCBF_YES_BUTTON | TDCBF_NO_BUTTON;
		tdc.pszMainInstruction	= _T("Confirm Game Location");
		tdc.pszContent			= message.c_str();
		tdc.pszMainIcon			= TD_INFORMATION_ICON;
		HRESULT result = TaskDialogIndirectEmulate(&tdc, &pressedButton, NULL, NULL);
		if(SUCCEEDED(result))
		{
			if(pressedButton == IDYES)
			{
				CAppConfig::GetInstance().SetPreferenceString(PREF_LAUNCHER_GAME_LOCATION, Framework::Utf8::ConvertTo(detectedGameLocation).c_str());
				return;
			}
		}
	}
	else
	{
		int pressedButton = 0;
		const TCHAR* message =
			_T("The launcher couldn't detect a Final Fantasy XIV installation. Do you want to select a game location now?\r\n\r\n")
			_T("(You will also be able to change that setting later in the launcher.)");
		TASKDIALOGCONFIG tdc;
		memset(&tdc, 0, sizeof(tdc));
		tdc.cbSize = sizeof(TASKDIALOGCONFIG);
		tdc.pszWindowTitle		= APP_NAME;
		tdc.dwCommonButtons		= TDCBF_YES_BUTTON | TDCBF_NO_BUTTON;
		tdc.pszMainInstruction	= _T("Select Game Location");
		tdc.pszContent			= message;
		tdc.pszMainIcon			= TD_INFORMATION_ICON;
		HRESULT result = TaskDialogIndirectEmulate(&tdc, &pressedButton, NULL, NULL);
		if(SUCCEEDED(result))
		{
			if(pressedButton == IDNO)
			{
				return;
			}
		}
	}

	//If we get here, then, the user wants to select a new game location
	auto newLocation = Utils::BrowseForGameLocation(NULL);
	if(!newLocation.empty())
	{
		CAppConfig::GetInstance().SetPreferenceString(PREF_LAUNCHER_GAME_LOCATION, Framework::Utf8::ConvertTo(newLocation).c_str());
	}
}