X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fforms%2Fupdate%2FfrmUpdate.cpp;h=bb46cd1559e3e49fb0428096aa4c6722e20acdd2;hb=66ebed13414439cd56161faa2abcff7744ab4588;hp=213ac3327800c8ac3777fa312b2e51d0cbd1eaf6;hpb=22339c898f8c04af609419f036828323b26f480f;p=xestiacalendar%2F.git diff --git a/source/forms/update/frmUpdate.cpp b/source/forms/update/frmUpdate.cpp index 213ac33..bb46cd1 100644 --- a/source/forms/update/frmUpdate.cpp +++ b/source/forms/update/frmUpdate.cpp @@ -22,9 +22,9 @@ size_t WritebackFuncUpdate(char *ptr, size_t size, size_t nmemb, wxString *strea // Write back function for getting version information. - wxString Data; + wxString data; //wxString *PageInput; - Data = wxString::FromUTF8((char *)ptr); + data = wxString::FromUTF8((char *)ptr); stream->Append(Data); @@ -47,54 +47,55 @@ void frmUpdate::FetchData() CURL *conn; conn = curl_easy_init(); - CURLcode conncode; + CURLcode connCode; - wxString PageData; - wxString PageHeader; + wxString pageData; + wxString pageHeader; - wxString UpdateAddress = wxT("http://update.xestia.co.uk/xestiacalendar/"); - UpdateAddress.Append(XSDCAL_SOURCE); + wxString updateAddress = wxT("http://update.xestia.co.uk/xestiacalendar/"); + updateAddress.Append(XSDCAL_SOURCE); - curl_easy_setopt(conn, CURLOPT_URL, (const char*)UpdateAddress.mb_str(wxConvUTF8)); + curl_easy_setopt(conn, CURLOPT_URL, (const char*)updateAddress.mb_str(wxConvUTF8)); curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(conn, CURLOPT_TIMEOUT, 3); curl_easy_setopt(conn, CURLOPT_FAILONERROR, TRUE); curl_easy_setopt(conn, CURLOPT_USERAGENT, XSDCAL_USERAGENT); curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, WritebackFuncUpdate); - curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData); - curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader); + curl_easy_setopt(conn, CURLOPT_WRITEDATA, &pageData); + curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &pageHeader); curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1); - conncode = (curl_easy_perform(conn)); + connCode = (curl_easy_perform(conn)); // Split the data received. - PageData.Trim(); + pageData.Trim(); - wxString SupportCode = PageData.Left(1); - wxString VersionCode = PageData.Mid(1, wxString::npos); - wxString RunningVer = wxString::Format(wxT("%s"), XSDCAL_VERSION); - double VersionCodeDouble; - double CurrentVerDouble; + wxString supportCode = pageData.Left(1); + wxString versionCode = pageData.Mid(1, wxString::npos); + wxString runningVer = wxString::Format(wxT("%s"), XSDCAL_VERSION); + + double availableVersion; + double currentVersion; // Setup the running version. - lblRunningVer->SetLabel(RunningVer); + lblRunningVer->SetLabel(runningVer); // Setup the build type. - wxString BuildType = wxT(XSDCAL_SOURCE); - lblBuildType->SetLabel(BuildType); + wxString buildType = wxT(XSDCAL_SOURCE); + lblBuildType->SetLabel(buildType); - if (conncode != CURLE_OK){ + if (connCode != CURLE_OK){ - lblAvailableVer->SetLabel(wxT("Unable to determine.")); + lblAvailableVer->SetLabel(_("Unable to determine.")); curl_easy_cleanup(conn); curl_global_cleanup(); - lblUpdateMessage->SetLabel(wxT("An error has occurred. The error message is: ") + wxString::Format(wxT("%s"), curl_easy_strerror(conncode))); + lblUpdateMessage->SetLabel(_("An error has occurred. The error message is: ") + wxString::Format(wxT("%s"), curl_easy_strerror(connCode))); return; @@ -106,17 +107,17 @@ void frmUpdate::FetchData() // Setup the avaiable version. - RunningVer.ToDouble(&CurrentVerDouble); + runningVer.ToDouble(¤tVersion); - if (VersionCode.ToDouble(&VersionCodeDouble)){ + if (versionCode.ToDouble(&availableVersion)){ - lblAvailableVer->SetLabel(VersionCode); + lblAvailableVer->SetLabel(versionCode); } else { - lblAvailableVer->SetLabel(wxT("Unable to determine.")); + lblAvailableVer->SetLabel(_("Unable to determine.")); - lblUpdateMessage->SetLabel(wxT("Cannot determine the available version at this time. Please retry in a while.")); + lblUpdateMessage->SetLabel(_("Cannot determine the available version at this time. Please retry in a while.")); return; @@ -129,13 +130,13 @@ void frmUpdate::FetchData() // Write message about getting the update // from Xestia Gelforn. - if (CurrentVerDouble >= VersionCodeDouble){ + if (currentVersion >= availableVersion){ - lblUpdateMessage->SetLabel(wxT("Xestia Calendar is up to date.\n\nFor a small yearly cost, prebuilt packages and support is available from Xestia PREMIUM (https://premium.xestia.co.uk).")); + lblUpdateMessage->SetLabel(_("Xestia Calendar is up to date.\n\nFor a small yearly cost, prebuilt packages and support is available from Xestia PREMIUM (https://premium.xestia.co.uk).")); } else { - lblUpdateMessage->SetLabel(wxT("An updated version of Xestia Calendar is available from Xestia Gelforn (https://gelforn.xestia.co.uk/).\n\nFor a small yearly cost, prebuilt packages and support is available from Xestia PREMIUM (https://premium.xestia.co.uk).")); + lblUpdateMessage->SetLabel(_("An updated version of Xestia Calendar is available from Xestia Gelforn (https://gelforn.xestia.co.uk/).\n\nFor a small yearly cost, prebuilt packages and support is available from Xestia PREMIUM (https://premium.xestia.co.uk).")); } @@ -145,37 +146,37 @@ void frmUpdate::FetchData() // Display message based on type returned. - if (CurrentVerDouble >= VersionCodeDouble){ + if (currentVersion >= availableVersion){ - wxString UpdateMessage = wxT("Xestia Calendar is up to date.\n\n"); + wxString updateMessage = _("Xestia Calendar is up to date.\n\n"); - if (SupportCode == wxT("U")){ + if (supportCode == wxT("U")){ - UpdateMessage.Append(wxT("An updated version of Xestia Calendar is available from Xestia PREMIUM (https://premium.xestia.co.uk) but will require your operating system to be updated.")); + updateMessage.Append(_("An updated version of Xestia Calendar is available from Xestia PREMIUM (https://premium.xestia.co.uk) but will require your operating system to be updated.")); - } else if (SupportCode == wxT("X")){ + } else if (supportCode == wxT("X")){ - UpdateMessage.Append(wxT("Xestia Calendar is no longer supported on the operating system you are using. Please visit the Xestia PREMIUM website (https://premium.xestia.co.uk) for a list of supported operating systems.")); + updateMessage.Append(_("Xestia Calendar is no longer supported on the operating system you are using. Please visit the Xestia PREMIUM website (https://premium.xestia.co.uk) for a list of supported operating systems.")); } - lblUpdateMessage->SetLabel(UpdateMessage); + lblUpdateMessage->SetLabel(updateMessage); } - if (SupportCode == wxT("S")){ + if (supportCode == wxT("S")){ - lblUpdateMessage->SetLabel(wxT("An updated version of Xestia Calendar for your system is available from Xestia PREMIUM (https://premium.xestia.co.uk)")); + lblUpdateMessage->SetLabel(_("An updated version of Xestia Calendar for your system is available from Xestia PREMIUM (https://premium.xestia.co.uk)")); - } else if (SupportCode == wxT("U")){ + } else if (supportCode == wxT("U")){ - lblUpdateMessage->SetLabel(wxT("An updated version of Xestia Calendar is available from Xestia PREMIUM (https://premium.xestia.co.uk) but will require your operating system to be updated.")); + lblUpdateMessage->SetLabel(_("An updated version of Xestia Calendar is available from Xestia PREMIUM (https://premium.xestia.co.uk) but will require your operating system to be updated.")); - } else if (SupportCode == wxT("X")){ + } else if (supportCode == wxT("X")){ - lblUpdateMessage->SetLabel(wxT("Xestia Calendar is no longer supported on the operating system you are using. Please visit the Xestia PREMIUM website (https://premium.xestia.co.uk) for a list of supported operating systems.")); + lblUpdateMessage->SetLabel(_("Xestia Calendar is no longer supported on the operating system you are using. Please visit the Xestia PREMIUM website (https://premium.xestia.co.uk) for a list of supported operating systems.")); }