mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 399153 - Software update should support unicode strings for the UI. r=bsmedberg, r=ehsan
This commit is contained in:
parent
717a80b907
commit
5fc26f8476
@ -209,7 +209,6 @@ endif
|
||||
|
||||
PACKAGER_NO_LIBS = 1
|
||||
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
|
||||
include $(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/installer/windows/charset.mk
|
||||
|
||||
repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
|
||||
repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES)
|
||||
@ -342,8 +341,7 @@ ifdef MOZ_UPDATER
|
||||
libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
cat $< $(srcdir)/updater_append.ini $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||
sed -e "s/%AB_CD%/$(AB_CD)/" | \
|
||||
iconv -f UTF-8 -t $(WIN_INSTALLER_CHARSET) > $(FINAL_TARGET)/updater.ini
|
||||
sed -e "s/%AB_CD%/$(AB_CD)/" > $(FINAL_TARGET)/updater.ini
|
||||
else
|
||||
cat $< $(srcdir)/updater_append.ini | \
|
||||
sed -e "s/%AB_CD%/$(AB_CD)/" > $(FINAL_TARGET)/updater.ini
|
||||
|
@ -66,7 +66,10 @@ ifeq ($(OS_ARCH),WINNT)
|
||||
USE_STATIC_LIBS = 1
|
||||
HAVE_PROGRESSUI = 1
|
||||
RCINCLUDE = updater.rc
|
||||
CPPSRCS += progressui_win.cpp
|
||||
CPPSRCS += \
|
||||
progressui_win.cpp \
|
||||
readstrings.cpp \
|
||||
$(NULL)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,comctl32 ws2_32 shell32)
|
||||
DEFINES += -DUNICODE -D_UNICODE
|
||||
ifndef GNU_CC
|
||||
|
@ -44,12 +44,12 @@
|
||||
#include <io.h>
|
||||
#include "resource.h"
|
||||
#include "progressui.h"
|
||||
#include "readstrings.h"
|
||||
#include "errors.h"
|
||||
|
||||
#define TIMER_ID 1
|
||||
#define TIMER_INTERVAL 100
|
||||
|
||||
#define MAX_INFO_LENGTH 512
|
||||
|
||||
#define RESIZE_WINDOW(hwnd, extrax, extray) \
|
||||
{ \
|
||||
RECT windowSize; \
|
||||
@ -70,7 +70,6 @@
|
||||
|
||||
static float sProgress; // between 0 and 100
|
||||
static BOOL sQuit = FALSE;
|
||||
static HFONT sSystemFont = 0;
|
||||
|
||||
static BOOL
|
||||
GetStringsFile(WCHAR filename[MAX_PATH])
|
||||
@ -96,7 +95,7 @@ UpdateDialog(HWND hDlg)
|
||||
static void
|
||||
ResizeDialogToFit(HWND hDlg)
|
||||
{
|
||||
WCHAR text[MAX_INFO_LENGTH];
|
||||
WCHAR text[MAX_TEXT_LEN];
|
||||
RECT infoSize, textSize;
|
||||
HFONT hInfoFont, hOldFont;
|
||||
|
||||
@ -173,15 +172,6 @@ CenterDialog(HWND hDlg)
|
||||
SWP_NOSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
SetItemText(HWND hwnd, const WCHAR *key, const WCHAR *ini)
|
||||
{
|
||||
WCHAR text[MAX_INFO_LENGTH];
|
||||
if (!GetPrivateProfileStringW(L"Strings", key, NULL, text, sizeof(text), ini))
|
||||
return;
|
||||
SetWindowTextW(hwnd, text);
|
||||
}
|
||||
|
||||
static void
|
||||
InitDialog(HWND hDlg)
|
||||
{
|
||||
@ -189,23 +179,23 @@ InitDialog(HWND hDlg)
|
||||
if (!GetStringsFile(filename))
|
||||
return;
|
||||
|
||||
SetItemText(hDlg, L"Title", filename);
|
||||
SetItemText(GetDlgItem(hDlg, IDC_INFO), L"Info", filename);
|
||||
char path[MAX_PATH];
|
||||
WideCharToMultiByte(CP_UTF8, 0, filename, -1, path,
|
||||
sizeof(path)/sizeof(path[0]), NULL, NULL );
|
||||
StringTable uiStrings;
|
||||
if (ReadStrings(path, &uiStrings) != OK)
|
||||
return;
|
||||
|
||||
// On Win9x, we need to send WM_SETFONT for l10n builds. Yes, we shouldn't
|
||||
// use the system font. For example, if the text has Japanese characters on
|
||||
// Win98-en, then the text may not be displayed correctly. We should perhaps
|
||||
// support loading a font named in updater.ini; however, even then there are
|
||||
// cases where it might not work properly.
|
||||
if (!sSystemFont) {
|
||||
NONCLIENTMETRICS ncm;
|
||||
memset(&ncm, 0, sizeof(ncm));
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
||||
sSystemFont = CreateFontIndirect(&ncm.lfMessageFont);
|
||||
}
|
||||
if (sSystemFont)
|
||||
SendDlgItemMessage(hDlg, IDC_INFO, WM_SETFONT, (WPARAM)sSystemFont, 0L);
|
||||
WCHAR szwTitle[MAX_TEXT_LEN];
|
||||
WCHAR szwInfo[MAX_TEXT_LEN];
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, uiStrings.title, strlen(uiStrings.title) + 1,
|
||||
szwTitle, sizeof(szwTitle)/sizeof(szwTitle[0]));
|
||||
MultiByteToWideChar(CP_UTF8, 0, uiStrings.info, strlen(uiStrings.info) + 1,
|
||||
szwInfo, sizeof(szwInfo)/sizeof(szwInfo[0]));
|
||||
|
||||
SetWindowTextW(hDlg, szwTitle);
|
||||
SetWindowTextW(GetDlgItem(hDlg, IDC_INFO), szwInfo);
|
||||
|
||||
// Set dialog icon
|
||||
HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DIALOG));
|
||||
@ -235,10 +225,6 @@ DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_TIMER:
|
||||
if (sQuit) {
|
||||
EndDialog(hDlg, 0);
|
||||
if (sSystemFont) {
|
||||
DeleteObject(sSystemFont);
|
||||
sSystemFont = 0;
|
||||
}
|
||||
} else {
|
||||
UpdateDialog(hDlg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user