Skip to content

Commit b1cae8e

Browse files
Remove details
1 parent 08d7c45 commit b1cae8e

File tree

1 file changed

+6
-49
lines changed

1 file changed

+6
-49
lines changed

Diff for: src/main.cc

+6-49
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ struct callbacks_impl : public install_callbacks,
170170
void update_finished(std::string &filename) final {}
171171
void updater_complete() final {}
172172

173-
bool prompt_user(const char *pVersion, const char *pDetails);
173+
bool prompt_user(const char *pVersion);
174174
};
175175

176176
callbacks_impl::callbacks_impl(HINSTANCE hInstance, int nCmdShow)
@@ -775,57 +775,14 @@ void callbacks_impl::updater_start()
775775
SetWindowTextW(progress_label, copying_label.c_str());
776776
}
777777

778-
bool callbacks_impl::prompt_user(const char *pVersion, const char *pDetails)
778+
bool callbacks_impl::prompt_user(const char *pVersion)
779779
{
780780
const wchar_t *wc_dash = L"-";
781781
const wchar_t *wc_hash = L"#";
782782
const wchar_t *wc_bullet = L"\r\n \u2022 ";
783783
const wchar_t *wc_break = L"\r\n ";
784784
std::wstring wc_version = ConvertToUtf16WS(boost::locale::translate(pVersion));
785-
std::wstring wc_label = ConvertToUtf16WS(boost::locale::translate("There's an update available to install: "));
786-
wc_label.insert(wc_label.size() - 1, wc_version); //account for null terminator
787-
std::wstring wc_details = ConvertToUtf16WS(boost::locale::translate(pDetails));
788-
789-
//tag to heading conversion
790-
std::list<std::pair<std::wstring, std::wstring>> tagsToHeadings;
791-
tagsToHeadings.push_back(std::make_pair(L"#hotfixes", L"Hotfix Changes"));
792-
tagsToHeadings.push_back(std::make_pair(L"#features", L"New Features"));
793-
tagsToHeadings.push_back(std::make_pair(L"#generalfixes", L"General Fixes"));
794-
795-
//format detail string: insert 2 breaks at start -> 1 to have heading on its own line, 1 for spacing, one after heading for spacing
796-
size_t replacePos = 0;
797-
for (const auto &tagHeadingPair : tagsToHeadings) {
798-
replacePos = wc_details.find(tagHeadingPair.first);
799-
if (replacePos != std::wstring::npos) {
800-
wc_details.replace(replacePos, tagHeadingPair.first.size(), tagHeadingPair.second);
801-
if (replacePos != 0) {
802-
wc_details.insert(replacePos, wc_break);
803-
replacePos += +wcslen(wc_break);
804-
}
805-
wc_details.insert(replacePos, wc_break);
806-
wc_details.insert(replacePos + wcslen(wc_break) + tagHeadingPair.second.size(), wc_break);
807-
}
808-
}
809-
//if # isn't followed by a known heading, leave as-is to display custom heading
810-
int endHeading = 0;
811-
replacePos = wc_details.find(wc_hash);
812-
while (replacePos != std::wstring::npos) {
813-
wc_details.insert(replacePos, wc_break);
814-
wc_details.replace(replacePos + wcslen(wc_break), wcslen(wc_hash), wc_break);
815-
endHeading = wc_details.find(wc_dash, replacePos);
816-
if (endHeading != std::wstring::npos) {
817-
wc_details.insert(endHeading, wc_break);
818-
}
819-
replacePos = wc_details.find(wc_hash, replacePos + wcslen(wc_break));
820-
}
821-
//replace '-' with end line + spacing + bullet + spacing
822-
replacePos = wc_details.find(wc_dash);
823-
while (replacePos != std::wstring::npos) {
824-
wc_details.replace(replacePos, wcslen(wc_dash), wc_bullet);
825-
replacePos = wc_details.find(wc_dash, replacePos + wcslen(wc_bullet));
826-
}
827-
//line break at end to look nicer
828-
wc_details.insert(wc_details.length(), wc_break);
785+
std::wstring wc_label = ConvertToUtf16WS(boost::locale::translate("There's an update available. Would you like to install?"));
829786

830787
prompting = true;
831788
ShowWindow(frame, SW_SHOWNORMAL);
@@ -836,7 +793,7 @@ bool callbacks_impl::prompt_user(const char *pVersion, const char *pDetails)
836793
DrawText(hdc, wc_label.c_str(), -1, &progress_label_rect, DT_CALCRECT | DT_NOCLIP);
837794
progress_label_rect.right -= progress_label_rect.left;
838795
blockers_list_rect = {0};
839-
DrawText(hdc, wc_details.c_str(), -1, &blockers_list_rect, DT_CALCRECT | DT_NOCLIP | DT_EDITCONTROL);
796+
DrawText(hdc, wc_version.c_str(), -1, &blockers_list_rect, DT_CALCRECT | DT_NOCLIP | DT_EDITCONTROL);
840797

841798
ReleaseDC(frame, hdc);
842799
SelectObject(hdc, hfontOld);
@@ -847,7 +804,7 @@ bool callbacks_impl::prompt_user(const char *pVersion, const char *pDetails)
847804
repostionUI();
848805

849806
SetWindowTextW(progress_label, wc_label.c_str());
850-
SetWindowTextW(blockers_list, wc_details.c_str());
807+
SetWindowTextW(blockers_list, wc_version.c_str());
851808
SetWindowTextW(continue_button, update_btn_label.c_str());
852809
SetWindowTextW(cancel_button, remind_btn_label.c_str());
853810

@@ -1075,7 +1032,7 @@ extern "C" int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpC
10751032
return 0;
10761033
}
10771034

1078-
if (!cb_impl.prompt_user(params.version.c_str(), params.details.c_str())) {
1035+
if (!cb_impl.prompt_user(params.version.c_str())) {
10791036
handle_exit();
10801037
return 1;
10811038
}

0 commit comments

Comments
 (0)