Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginClass.cpp

Issue 11557015: Tooltip notification. Check for update fixes. (Closed)
Patch Set: Addressing comments Created Sept. 16, 2013, 1:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -13,7 +13,7 @@
#include "sddl.h"
#include "PluginUtil.h"
#include "PluginUserSettings.h"
-
+#include "../shared/Utils.h"
#include "../shared/Dictionary.h"
#ifdef DEBUG_HIDE_EL
@@ -24,7 +24,6 @@
typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPRECT);
typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE);
-
HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL };
DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABLED, IDI_ICON_DEACTIVATED };
@@ -595,6 +594,10 @@
}
}
}
+ if (notificationMessage.IsVisible())
+ {
+ notificationMessage.Hide();
Wladimir Palant 2013/09/19 08:59:16 I think IsVisible() check should happen inside the
+ }
DEBUG_GENERAL("Tab change end");
return VARIANT_TRUE;
}
@@ -1270,7 +1273,12 @@
case ID_MENU_UPDATE:
{
CPluginClient* client = CPluginClient::GetInstance();
- client->CheckForUpdates();
+ notificationMessage.SetParent(m_hPaneWnd);
+ Dictionary* dictionary = Dictionary::GetInstance();
+ std::wstring checkingText = dictionary->Lookup("updater", "checking-for-updates-text");
+ std::wstring checkingTitle = dictionary->Lookup("updater", "checking-for-updates-title");
+ notificationMessage.Show(checkingText, checkingTitle, TTI_INFO);
+ client->CheckForUpdates(m_hPaneWnd);
}
break;
case ID_MENU_DISABLE:
@@ -1777,7 +1785,48 @@
if (tab)
{
tab->OnActivate();
+ RECT rect;
+ GetWindowRect(pClass->m_hPaneWnd, &rect);
+ pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2);
}
+ if (LOWORD(wParam) == UIS_CLEAR)
+ {
+ pClass->notificationMessage.Hide();
+ }
+ }
+ break;
+ case WM_WINDOWPOSCHANGING:
+ {
+ RECT rect;
+ GetWindowRect(pClass->m_hPaneWnd, &rect);
+ if (pClass->notificationMessage.IsVisible())
+ {
+ pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2);
+ }
+ }
+ break;
+ case WM_ALREADY_UP_TO_DATE:
+ {
+ Dictionary* dictionary = Dictionary::GetInstance();
+ std::wstring upToDateText = dictionary->Lookup("updater", "update-already-up-to-date-text");
+ std::wstring upToDateTitle = dictionary->Lookup("updater", "update-already-up-to-date-title");
+ pClass->notificationMessage.SetTextAndIcon(upToDateText, upToDateTitle, TTI_INFO);
+ }
+ break;
+ case WM_UPDATE_CHECK_ERROR:
+ {
+ Dictionary* dictionary = Dictionary::GetInstance();
+ std::wstring errorText = dictionary->Lookup("updater", "update-error-text");
+ std::wstring errorTitle = dictionary->Lookup("updater", "update-error-title");
+ pClass->notificationMessage.SetTextAndIcon(errorText, errorText, TTI_ERROR);
+ }
+ break;
+ case WM_DOWNLOADING_UPDATE:
+ {
+ Dictionary* dictionary = Dictionary::GetInstance();
+ std::wstring downloadingText = dictionary->Lookup("updater", "downloading-update-text");
+ std::wstring downloadingTitle = dictionary->Lookup("updater", "downloading-update-title");
+ pClass->notificationMessage.SetTextAndIcon(downloadingText, downloadingTitle, TTI_ERROR);
}
break;
}

Powered by Google App Engine
This is Rietveld