diff options
author | George Hazan <ghazan@miranda.im> | 2021-06-14 19:56:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-06-14 19:56:48 +0300 |
commit | 0b162a8362eeaa3a2f743aad3439a3dbed359c09 (patch) | |
tree | 3ab09db08bbf68c9cb7242793994a0c192a7eaa3 | |
parent | b59f0f79952056fadf809c676749eed052810b23 (diff) |
Weather:
- added Snow Shower/Rain Shower conditions' detection;
- status icon replaced with condition icon in the frame
-rw-r--r-- | protocols/Weather/src/weather_conv.cpp | 6 | ||||
-rw-r--r-- | protocols/Weather/src/weather_mwin.cpp | 22 |
2 files changed, 15 insertions, 13 deletions
diff --git a/protocols/Weather/src/weather_conv.cpp b/protocols/Weather/src/weather_conv.cpp index 0b5749c12f..06202d2e1a 100644 --- a/protocols/Weather/src/weather_conv.cpp +++ b/protocols/Weather/src/weather_conv.cpp @@ -342,9 +342,15 @@ WORD GetIcon(const wchar_t *cond, WIDATA *Data) if (wcsstr(cond, L"fog") || wcsstr(cond, L"mist") || wcsstr(cond, L"smoke") || wcsstr(cond, L"sand") || wcsstr(cond, L"dust") || wcsstr(cond, L"haze")) return FOG; + if (wcsstr(cond, L"snow shower")) + return SSHOWER; + if (wcsstr(cond, L"snow") || wcsstr(cond, L"ice") || wcsstr(cond, L"freezing") || wcsstr(cond, L"wintry")) return SNOW; + if (wcsstr(cond, L"rain shower")) + return RSHOWER; + if (wcsstr(cond, L"drizzle") || wcsstr(cond, L"rain")) return RAIN; diff --git a/protocols/Weather/src/weather_mwin.cpp b/protocols/Weather/src/weather_mwin.cpp index a1cfff3ddd..3ba118d646 100644 --- a/protocols/Weather/src/weather_mwin.cpp +++ b/protocols/Weather/src/weather_mwin.cpp @@ -25,12 +25,12 @@ static HANDLE hFontHook; HGENMENU hMwinMenu; -typedef struct +struct MWinDataType { MCONTACT hContact; HWND hAvt; BOOL haveAvatar; -} MWinDataType; +}; #define WM_REDRAWWIN (WM_USER + 17369) @@ -44,9 +44,9 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); data->hContact = (DWORD_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams; - data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD, - 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, g_plugin.getInst(), nullptr); - if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact); + data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD, 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, 0, g_plugin.getInst(), 0); + if (data->hAvt) + SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact); break; case WM_DESTROY: @@ -137,14 +137,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara HICON hIcon = nullptr; if (!data->haveAvatar) { - int statusIcon = g_plugin.getWord(data->hContact, "Status"); - picSize = GetSystemMetrics(SM_CXICON); - hIcon = Skin_LoadProtoIcon(MODULENAME, statusIcon, true); - if ((INT_PTR)hIcon == CALLSERVICE_NOTFOUND) { - picSize = GetSystemMetrics(SM_CXSMICON); - hIcon = Skin_LoadProtoIcon(MODULENAME, statusIcon); - } + hIcon = GetStatusIconBig(data->hContact); } LOGFONT lfnt, lfnt1; @@ -211,7 +205,9 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara DeleteObject(hFont); } EndPaint(hwnd, &ps); - IcoLib_ReleaseIcon(hIcon); + + if (hIcon) + DestroyIcon(hIcon); } break; } |