use string table COM-115
authorVolker Birk <vb@pep.foundation>
Fri, 03 Jul 2020 10:55:44 +0200
branchCOM-115
changeset 434bf1832802558
parent 433 cc2cfea6789a
child 435 3367345dcf6b
use string table
CMainWindow.cpp
CMainWindow.h
GateKeeper.cpp
pEpCOMServerAdapter.rc
resource.h
     1.1 --- a/CMainWindow.cpp	Fri Jul 03 08:04:28 2020 +0200
     1.2 +++ b/CMainWindow.cpp	Fri Jul 03 10:55:44 2020 +0200
     1.3 @@ -16,7 +16,7 @@
     1.4      nid.uFlags = NIF_ICON | NIF_TIP | NIF_GUID | NIF_MESSAGE;
     1.5      nid.hWnd = m_hWnd;
     1.6      nid.guidItem = nidGUID;
     1.7 -    StringCchCopy(nid.szTip, ARRAYSIZE(nid.szTip), _T("p≡p Updates"));
     1.8 +    StringCchCopy(nid.szTip, ARRAYSIZE(nid.szTip), r(IDS_PROJNAME).c_str());
     1.9      nid.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_LOGO));
    1.10      nid.uCallbackMessage = WM_PEP_NOTIFICATION;
    1.11      Shell_NotifyIcon(NIM_ADD, &nid);
    1.12 @@ -96,7 +96,7 @@
    1.13  
    1.14      switch (index) {
    1.15      case UPDATE_NOW:
    1.16 -        ShowNotificationInfo(_T("Searching for updates"), _T("p≡p is searching for updates. When an update is available p≡p will start an installer."));
    1.17 +        ShowNotificationInfo(r(IDS_UPDATESTITLE), r(IDS_UPDATESTEXT));
    1.18          pEp::GateKeeper::gatekeeper()->update_now();
    1.19          bHandled = true;
    1.20          break;
    1.21 @@ -117,6 +117,14 @@
    1.22      return S_OK;
    1.23  }
    1.24  
    1.25 +CMainWindow::tstring CMainWindow::r(UINT resid)
    1.26 +{
    1.27 +    LPCTSTR rstr;
    1.28 +    size_t rsize = LoadString(GetModuleHandle(NULL), resid, (LPWSTR) &rstr, 0);
    1.29 +    tstring str = tstring(rstr, rsize);
    1.30 +    return str;
    1.31 +}
    1.32 +
    1.33  void CMainWindow::ShowNotificationInfo(tstring title, tstring text)
    1.34  {
    1.35      NOTIFYICONDATA nid = {};
     2.1 --- a/CMainWindow.h	Fri Jul 03 08:04:28 2020 +0200
     2.2 +++ b/CMainWindow.h	Fri Jul 03 10:55:44 2020 +0200
     2.3 @@ -1,5 +1,6 @@
     2.4  #pragma once
     2.5  #include "stdafx.h"
     2.6 +#include "resource.h"
     2.7  
     2.8  using namespace ATL;
     2.9  
    2.10 @@ -28,5 +29,6 @@
    2.11      LRESULT OnMenuCommand(UINT /*nMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
    2.12  
    2.13      typedef std::basic_string<TCHAR> tstring;
    2.14 +    static tstring r(UINT resid);
    2.15      void ShowNotificationInfo(tstring title, tstring text);
    2.16  };
     3.1 --- a/GateKeeper.cpp	Fri Jul 03 08:04:28 2020 +0200
     3.2 +++ b/GateKeeper.cpp	Fri Jul 03 10:55:44 2020 +0200
     3.3 @@ -7,6 +7,7 @@
     3.4  using namespace std;
     3.5  
     3.6  extern CMainWindow mainWindow;
     3.7 +auto r = CMainWindow::r;
     3.8  
     3.9  // from https://msdn.microsoft.com/en-us/library/windows/desktop/dd388945(v=vs.85).aspx
    3.10  
    3.11 @@ -523,7 +524,7 @@
    3.12              InternetReadFile(hUrl, iv, sizeof(iv), &reading);
    3.13  
    3.14              if (reading)
    3.15 -                mainWindow.ShowNotificationInfo(_T("Downloading update"), _T("An update for p≡p arrived and is being downloaded."));
    3.16 +                mainWindow.ShowNotificationInfo(r(IDS_DOWNLOADTITLE), r(IDS_DOWNLOADTEXT));
    3.17  
    3.18              if (reading) do {
    3.19                  static char buffer[1024 * 1024];
     4.1 Binary file pEpCOMServerAdapter.rc has changed
     5.1 Binary file resource.h has changed