CDlgAbout::CDlgAbout(QWidget *parent) : QDialog(parent), ui(new Ui::CDlgAbout) { ui->setupUi(this); CTool::SetWindowsGeometry(this); QString szVersion(tr("Version:%1.%2.%3.%4").arg(QString::number(REVISION_VERSION_NUMBER), QString::number(MINOR_VERSION_NUMBER), QString::number(REVISION_VERSION_NUMBER), BUILD_VERSION )); ui->lbVersion->setText(szVersion); ui->lbDate->setText(tr("Build date:%1 %2").arg(__DATE__, __TIME__)); ui->lbAuthor->setText(tr("Author: KangLin\nEmail or MSN:[email protected]")); ui->lbHome->setOpenExternalLinks(true); ui->lbHome->setText(tr("Home page:") + "<a href=\"https://github.com/KangLin/rabbitim\">https://github.com/KangLin/rabbitim</a>"); ui->lbCopyright->setText(tr(" Copyright (C) 2014 - %1 KangLin Studio").arg(QString::number(QDate::currentDate().year()))); QString szFile; #ifdef MOBILE szFile = ":/file/ChangeLog"; AppendFile(ui->txtChange, szFile); szFile = ":/file/License"; AppendFile(ui->txtLicense, szFile); szFile = ":/file/Authors"; AppendFile(ui->txtThinks, szFile); #else szFile = CGlobal::Instance()->GetDirApplication() + QDir::separator() + "ChangeLog.md"; AppendFile(ui->txtChange, szFile); szFile = CGlobal::Instance()->GetDirApplication() + QDir::separator() + "License.md"; AppendFile(ui->txtLicense, szFile); szFile = CGlobal::Instance()->GetDirApplication() + QDir::separator() + "Authors.txt"; AppendFile(ui->txtThinks, szFile); #endif }
LPSTR CExceptionHandler::GetVersionInformation() { LPSTR szResult = NULL; LPVOID lpData = NULL; // (( scope )) { stringstream szDetails; // Load the version information. wstring szFilename(GetModuleFileNameEx()); DWORD dwHandle = 0; DWORD dwSize = GetFileVersionInfoSize(szFilename.c_str(), &dwHandle); if (dwSize == 0) { goto __end; } lpData = malloc(dwSize); if (!GetFileVersionInfo(szFilename.c_str(), dwHandle, dwSize, lpData)) { goto __end; } // Get the product name. UINT uLen; LPCWSTR szData; if (!VerQueryValue(lpData, L"\\StringFileInfo\\040904b0\\ProductName", (LPVOID*)&szData, &uLen)) { goto __end; } szDetails << "ProductName=" << ConvertToMultiByte(szData) << "\n"; // Get the vendor. if (!VerQueryValue(lpData, L"\\StringFileInfo\\040904b0\\CompanyName", (LPVOID*)&szData, &uLen)) { goto __end; } szDetails << "Vendor=" << ConvertToMultiByte(szData) << "\n"; // Get the application version. VS_FIXEDFILEINFO * lpffi; if (!VerQueryValue(lpData, L"\\", (LPVOID *)&lpffi, &uLen)) { goto __end; } ASSERT(lpffi != NULL); wstring szVersion(Format( L"%d.%d.%d.%d", (INT)HIWORD(lpffi->dwProductVersionMS), (INT)LOWORD(lpffi->dwProductVersionMS), (INT)HIWORD(lpffi->dwProductVersionLS), (INT)LOWORD(lpffi->dwProductVersionLS))); szDetails << "Version=" << ConvertToMultiByte(szVersion) << "\n"; // Build the server URL. szDetails << "ServerURL=" << ConvertToMultiByte(CRASH_SERVER_URL) << "\n"; wstring szCookie; if (CSettings(FALSE).GetStatisticsCookie(szCookie)) { szDetails << "Cookie=" << ConvertToMultiByte(szCookie) << "\n"; } szResult = _strdup(szDetails.str().c_str()); } __end: if (lpData != NULL) { free(lpData); } return szResult; }