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: Created Sept. 5, 2013, 10:43 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,9 +13,11 @@
#include "sddl.h"
#include "PluginUtil.h"
#include "PluginUserSettings.h"
+#include "../shared/Utils.h"
#include "../shared/Dictionary.h"
Felix Dahlke 2013/09/11 15:22:59 As before, no need to add another line of whitespa
+
#ifdef DEBUG_HIDE_EL
DWORD profileTime = 0;
#endif
@@ -213,6 +215,10 @@
DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr)
{
+ INITCOMMONCONTROLSEX commControls;
+ commControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ commControls.dwICC = ICC_USEREX_CLASSES | ICC_STANDARD_CLASSES | ICC_BAR_CLASSES;
Wladimir Palant 2013/09/11 13:07:06 Isn't ICC_BAR_CLASSES enough for a tooltip?
+ InitCommonControlsEx(&commControls);
Wladimir Palant 2013/09/11 13:07:06 Given that common controls are used by the Notific
Felix Dahlke 2013/09/11 15:22:59 I'd rather keep this where it is, the call is not
Wladimir Palant 2013/09/12 14:13:34 It is. Looking at the documentation, InitCommonCon
Felix Dahlke 2013/09/12 14:23:49 Then let's put it in the NotificationMessage class
Oleksandr 2013/09/12 14:26:26 NotificationMessage sounds best for me as well the
if (thisPtr == NULL)
return 0;
if (!((CPluginClass*)thisPtr)->InitObject(true))
@@ -1270,7 +1276,14 @@
case ID_MENU_UPDATE:
{
CPluginClient* client = CPluginClient::GetInstance();
- client->CheckForUpdates();
+ notifMessage.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");
+
+ notifMessage.Show(checkingText.c_str(), TTI_INFO);
+ notifMessage.SetTextAndIcon(checkingText.c_str(), checkingTitle.c_str(), TTI_INFO);
Wladimir Palant 2013/09/11 13:07:06 Assuming that NotificationMessage is our class, th
+ client->CheckForUpdates(m_hPaneWnd);
}
break;
case ID_MENU_DISABLE:
@@ -1777,7 +1790,42 @@
if (tab)
{
tab->OnActivate();
+ RECT rect;
+ GetWindowRect(pClass->m_hPaneWnd, &rect);
+ pClass->notifMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2);
}
+ pClass->notifMessage.Hide();
Wladimir Palant 2013/09/11 13:07:06 Shouldn't the notification be only hidden if we ge
+ }
+ break;
+ case WM_WINDOWPOSCHANGING:
+ {
+ RECT rect;
+ GetWindowRect(pClass->m_hPaneWnd, &rect);
+ pClass->notifMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2);
Wladimir Palant 2013/09/11 13:07:06 Shouldn't we check whether the notification is act
+ }
+ 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->notifMessage.SetTextAndIcon(upToDateText.c_str(), upToDateTitle.c_str(), 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->notifMessage.SetTextAndIcon(errorText.c_str(), errorText.c_str(), 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->notifMessage.SetTextAndIcon(downloadingText.c_str(), downloadingTitle.c_str(), TTI_ERROR);
}
break;
}

Powered by Google App Engine
This is Rietveld