@@ -170,7 +170,7 @@ struct callbacks_impl : public install_callbacks,
170
170
void update_finished (std::string &filename) final {}
171
171
void updater_complete () final {}
172
172
173
- bool prompt_user (const char *pVersion, const char *pDetails );
173
+ bool prompt_user (const char *pVersion);
174
174
};
175
175
176
176
callbacks_impl::callbacks_impl (HINSTANCE hInstance, int nCmdShow)
@@ -775,57 +775,14 @@ void callbacks_impl::updater_start()
775
775
SetWindowTextW (progress_label, copying_label.c_str ());
776
776
}
777
777
778
- bool callbacks_impl::prompt_user (const char *pVersion, const char *pDetails )
778
+ bool callbacks_impl::prompt_user (const char *pVersion)
779
779
{
780
780
const wchar_t *wc_dash = L" -" ;
781
781
const wchar_t *wc_hash = L" #" ;
782
782
const wchar_t *wc_bullet = L" \r\n \u2022 " ;
783
783
const wchar_t *wc_break = L" \r\n " ;
784
784
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?" ));
829
786
830
787
prompting = true ;
831
788
ShowWindow (frame, SW_SHOWNORMAL);
@@ -836,7 +793,7 @@ bool callbacks_impl::prompt_user(const char *pVersion, const char *pDetails)
836
793
DrawText (hdc, wc_label.c_str (), -1 , &progress_label_rect, DT_CALCRECT | DT_NOCLIP);
837
794
progress_label_rect.right -= progress_label_rect.left ;
838
795
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);
840
797
841
798
ReleaseDC (frame, hdc);
842
799
SelectObject (hdc, hfontOld);
@@ -847,7 +804,7 @@ bool callbacks_impl::prompt_user(const char *pVersion, const char *pDetails)
847
804
repostionUI ();
848
805
849
806
SetWindowTextW (progress_label, wc_label.c_str ());
850
- SetWindowTextW (blockers_list, wc_details .c_str ());
807
+ SetWindowTextW (blockers_list, wc_version .c_str ());
851
808
SetWindowTextW (continue_button, update_btn_label.c_str ());
852
809
SetWindowTextW (cancel_button, remind_btn_label.c_str ());
853
810
@@ -1075,7 +1032,7 @@ extern "C" int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpC
1075
1032
return 0 ;
1076
1033
}
1077
1034
1078
- if (!cb_impl.prompt_user (params.version .c_str (), params. details . c_str () )) {
1035
+ if (!cb_impl.prompt_user (params.version .c_str ())) {
1079
1036
handle_exit ();
1080
1037
return 1 ;
1081
1038
}
0 commit comments