From 510da32865c8ed78f9ffb3e57e23e2cfea132b0d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Sep 2018 18:47:56 +0300 Subject: Popups: - fixes #1564 (Move popups fonts/colors settings into submenu SkypeWeb VKontakte) - more code cleaning --- protocols/FacebookRM/src/proto.cpp | 12 ++---------- protocols/Gadu-Gadu/src/popups.cpp | 8 ++++---- protocols/JabberG/src/jabber_misc.cpp | 8 ++++---- protocols/MSN/src/msn_misc.cpp | 13 ++++++------- protocols/SkypeWeb/src/skype_popups.cpp | 6 +++--- protocols/VKontakte/src/vk_proto.cpp | 4 ++-- 6 files changed, 21 insertions(+), 30 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index dd24b8af02..1f265f2d0c 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -917,7 +917,8 @@ void FacebookProto::InitPopups() char name[256]; wchar_t desc[256]; - POPUPCLASS ppc = { sizeof(ppc) }; + POPUPCLASS ppc = {}; + ppc.cbSize = sizeof(ppc); ppc.flags = PCF_UNICODE; ppc.PluginWindowProc = PopupDlgProc; ppc.lParam = APF_RETURN_HWND; @@ -930,27 +931,22 @@ void FacebookProto::InitPopups() ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("facebook")); ppc.colorBack = RGB(191, 0, 0); // red ppc.colorText = RGB(255, 255, 255); // white - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Newsfeeds mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts")); mir_snprintf(name, "%s_%s", m_szModuleName, "Newsfeed"); - ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("newsfeed")); ppc.colorBack = RGB(255, 255, 255); // white ppc.colorText = RGB(0, 0, 0); // black - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Notifications mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); - ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notification")); ppc.colorBack = RGB(59, 89, 152); // Facebook's blue ppc.colorText = RGB(255, 255, 255); // white - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Others @@ -959,7 +955,6 @@ void FacebookProto::InitPopups() ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("facebook")); ppc.colorBack = RGB(255, 255, 255); // white ppc.colorText = RGB(0, 0, 0); // black - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Friendship changes @@ -968,7 +963,6 @@ void FacebookProto::InitPopups() ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("friendship")); ppc.colorBack = RGB(47, 71, 122); // Facebook's darker blue ppc.colorText = RGB(255, 255, 255); // white - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Ticker @@ -977,7 +971,6 @@ void FacebookProto::InitPopups() ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("newsfeed")); ppc.colorBack = RGB(255, 255, 255); // white ppc.colorText = RGB(0, 0, 0); // black - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // On this day (memories) @@ -986,7 +979,6 @@ void FacebookProto::InitPopups() ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("memories")); ppc.colorBack = RGB(255, 255, 255); // white ppc.colorText = RGB(0, 0, 0); // black - ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); } diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index ecce63ae83..dd9c32d105 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -82,21 +82,21 @@ void GaduProto::initpopups() puc.pszName = szName; puc.pszDescription.w = szDescr; + mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify"); + mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notifications")); puc.colorBack = RGB(173, 206, 247); puc.colorText = GetSysColor(COLOR_WINDOWTEXT); puc.hIcon = CopyIcon(LoadIconEx("main", FALSE)); ReleaseIconEx("main", FALSE); puc.iSeconds = 4; - mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notifications")); - mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify"); hPopupNotify = Popup_RegisterClass(&puc); + mir_snprintf(szName, "%s_%s", m_szModuleName, "Error"); + mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Errors")); puc.colorBack = RGB(191, 0, 0); // Red puc.colorText = RGB(255, 245, 225); // Yellow puc.iSeconds = 60; puc.hIcon = (HICON)LoadImage(nullptr, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED); - mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Errors")); - mir_snprintf(szName, "%s_%s", m_szModuleName, "Error"); hPopupError = Popup_RegisterClass(&puc); } diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index eba91277ee..ccba91f5b7 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -404,16 +404,16 @@ void CJabberProto::SetContactOfflineStatus(MCONTACT hContact) void CJabberProto::InitPopups(void) { - wchar_t desc[256]; - mir_snwprintf(desc, TranslateT("%s errors"), m_tszUserName); - char name[256]; - mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); + wchar_t desc[256]; POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_UNICODE; ppc.pszName = name; ppc.pszDescription.w = desc; + + mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors")); ppc.hIcon = LoadIconEx("main"); ppc.colorBack = RGB(191, 0, 0); //Red ppc.colorText = RGB(255, 245, 225); //Yellow diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 9f95bb34f8..fbb46bdd6c 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -801,27 +801,26 @@ void CMsnProto::InitPopups(void) ppc.pszName = name; ppc.pszDescription.w = desc; + mir_snprintf(name, "%s_%s", m_szModuleName, "Hotmail"); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Hotmail")); ppc.colorBack = RGB(173, 206, 247); ppc.colorText = GetSysColor(COLOR_WINDOWTEXT); ppc.iSeconds = 3; - mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Hotmail")); - mir_snprintf(name, "%s_%s", m_szModuleName, "Hotmail"); hPopupHotmail = Popup_RegisterClass(&ppc); + mir_snprintf(name, "%s_%s", m_szModuleName, "Notify"); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); ppc.colorBack = RGB(173, 206, 247); ppc.colorText = GetSysColor(COLOR_WINDOWTEXT); ppc.iSeconds = 3; - mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); - mir_snprintf(name, "%s_%s", m_szModuleName, "Notify"); hPopupNotify = Popup_RegisterClass(&ppc); + mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors")); ppc.hIcon = (HICON)LoadImage(nullptr, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED); ppc.colorBack = RGB(191, 0, 0); //Red ppc.colorText = RGB(255, 245, 225); //Yellow ppc.iSeconds = 60; - - mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors")); - mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); hPopupError = Popup_RegisterClass(&ppc); } diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 06aac781c4..e20178b2a5 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -10,7 +10,7 @@ void CSkypeProto::InitPopups() ppc.pszName = name; ppc.pszDescription.w = desc; - mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); ppc.hIcon = GetIcon(IDI_NOTIFY); ppc.colorBack = RGB(255, 255, 255); @@ -18,7 +18,7 @@ void CSkypeProto::InitPopups() ppc.iSeconds = 5; m_PopupClasses.insert(Popup_RegisterClass(&ppc)); - mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors")); mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); ppc.hIcon = GetIcon(IDI_ERRORICON); ppc.colorBack = RGB(255, 255, 255); @@ -26,7 +26,7 @@ void CSkypeProto::InitPopups() ppc.iSeconds = -1; m_PopupClasses.insert(Popup_RegisterClass(&ppc)); - mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Calls")); mir_snprintf(name, "%s_%s", m_szModuleName, "Call"); ppc.hIcon = GetIcon(IDI_CALL); ppc.colorBack = RGB(255, 255, 255); diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index c8ec72fd91..52b4f69bc6 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -417,7 +417,7 @@ void CVkProto::InitPopups(void) ppc.PluginWindowProc = PopupDlgProc; ppc.lParam = APF_RETURN_HWND; - mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors")); mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); ppc.hIcon = Skin_LoadIcon(SKINICON_ERROR); ppc.colorBack = RGB(191, 0, 0); // Red @@ -425,7 +425,7 @@ void CVkProto::InitPopups(void) ppc.iSeconds = 60; m_hPopupClassError = Popup_RegisterClass(&ppc); - mir_snwprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications")); + mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION)); ppc.colorBack = RGB(190, 225, 255); // Blue -- cgit v1.2.3