qt: replace UTF8Encode by UTF16ToUTF8 and UTF8Decode by UTF8ToUTF16

git-svn-id: trunk@18731 -
This commit is contained in:
paul 2009-02-17 13:52:40 +00:00
parent 4f120b8014
commit 705b320a3a
8 changed files with 31 additions and 30 deletions

View File

@ -2848,7 +2848,7 @@ begin
QMimeData_hasURLS(TempMimeData)) then
begin
QMimeData_text(TempMimeData, @Str);
Str := UTF8Encode(Str);
Str := UTF16ToUTF8(Str);
{we must check for null terminator}
if Copy(Str, length(Str), 1) = #0 then
@ -2964,7 +2964,7 @@ begin
for i := 0 to Count - 1 do
begin
QStringList_at(QtList, @Str, i);
Str := UTF8Encode(Str);
Str := UTF16ToUTF8(Str);
List[i] := RegisterFormat(Str);
end;
@ -3086,7 +3086,7 @@ var
Str: WideString;
begin
QPrinter_creator(FHandle, @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
function TQtPrinter.getDevType: Integer;
@ -3099,7 +3099,7 @@ var
Str: WideString;
begin
QPrinter_docName(FHandle, @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
function TQtPrinter.getDoubleSidedPrinting: Boolean;
@ -3142,7 +3142,7 @@ var
Str: WideString;
begin
QPrinter_printProgram(FHandle, @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
function TQtPrinter.getPrintRange: QPrinterPrintRange;
@ -3204,7 +3204,7 @@ var
Str: WideString;
begin
QPrinter_printerName(FHandle, @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
procedure TQtPrinter.setOutputFileName(const AValue: WideString);
@ -3220,7 +3220,7 @@ var
Str: WideString;
begin
QPrinter_outputFileName(FHandle, @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
procedure TQtPrinter.setOrientation(const AValue: QPrinterOrientation);
@ -3449,7 +3449,7 @@ var
W: Widestring;
begin
QStringList_at(FHandle, @W, Index);
Result := Utf8Encode(W);
Result := UTF16ToUTF8(W);
end;
function TQtStringList.GetCount: Integer;

View File

@ -130,7 +130,7 @@ var
Astr: WideString;
begin
QTextEdit_toPlainText(FQtTextEdit,@Astr); // get the memo content
FStringList.Text := UTF8Encode(Astr);
FStringList.Text := UTF16ToUTF8(Astr);
FTextChanged := False;
end;

View File

@ -33,7 +33,8 @@ interface
uses
qt4,
GraphType;
GraphType,
LCLProc;
procedure FillStandardDescription(var Desc: TRawImageDescription);
function GetPixelsPerInch: Integer;
@ -84,7 +85,7 @@ end;
function GetUtf8String(S: String): WideString;
begin
Result := Utf8Decode(S);
Result := UTF8ToUTF16(S);
if (Result = '') and (S <> '') then
Result := S;
end;

View File

@ -2009,7 +2009,7 @@ begin
if (QEvent_type(Event) = QEventKeyPress) and (Length(Text) <> 0) then
begin
UTF8Text := UTF8Encode(Text);
UTF8Text := UTF16ToUTF8(Text);
UTF8Char := UTF8Text;
{$ifdef VerboseQt}
WriteLn('sending char ', UTF8Char);
@ -2062,7 +2062,7 @@ begin
begin
// data was changed
if UTF8Char <> UTF8Text then
Text := UTF8Decode(Utf8Char)
Text := UTF8ToUTF16(Utf8Char)
else
if Word(AChar) <> CharMsg.CharCode then
Text := Char(CharMsg.CharCode);
@ -4146,7 +4146,7 @@ begin
WStr := WStr + QByteArray_at(ByteArr, i);
FilesList := TStringList.Create;
try
FilesList.Text := UTF8Encode(WStr);
FilesList.Text := UTF16ToUTF8(WStr);
{last member of TStringList always contains empty string
since QMimeData always have #13#10#0 at the end.So we cut it here.}
SetLength(Files, FilesList.Count - 1);
@ -6422,7 +6422,7 @@ begin
(QKeyEvent_modifiers(QKeyEventH(Event)) = QtNoModifier) and
(FLineEdit <> nil) and (FLineEdit.hasFocus) then
begin
Str := UTF8Encode(getText);
Str := UTF16ToUTF8(getText);
if TCustomComboBox(LCLObject).Items.IndexOf(Str) < 0 then
TCustomComboBox(LCLObject).AddItem(Str, nil);
end;
@ -9575,7 +9575,7 @@ begin
begin
List := TQtStringList.Create;
getFilters(List.Handle);
index := List.IndexOf(Utf8Encode(filter^));
index := List.IndexOf(UTF16ToUTF8(filter^));
if index <> -1 then
TFileDialog(FDialog).IntfFileTypeChanged(index + 1);
List.Free;
@ -9586,7 +9586,7 @@ procedure TQtFileDialog.CurrentChangedEvent(path: PWideString); cdecl;
begin
if FDialog is TOpenDialog then
begin
TOpenDialog(FDialog).FileName := Utf8Encode(path^);
TOpenDialog(FDialog).FileName := UTF16ToUTF8(path^);
TOpenDialog(FDialog).DoSelectionChange;
end;
end;
@ -9808,7 +9808,7 @@ var
Str: WideString;
begin
QMessageBox_text(QMessageBoxH(Widget), @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
function TQtMessageBox.getDetailText: WideString;
@ -9816,7 +9816,7 @@ var
Str: WideString;
begin
QMessageBox_detailedText(QMessageBoxH(Widget), @Str);
Result := UTF8Encode(Str);
Result := UTF16ToUTF8(Str);
end;
procedure TQtMessageBox.setMessageStr(const AValue: WideString);

View File

@ -1386,7 +1386,7 @@ var
for j := 0 to Result - 1 do
begin
QStringList_at(StrLst, @Str, j);
List.Add(Utf8Encode(Str));
List.Add(UTF16ToUTF8(Str));
end;
finally
QFontDatabase_destroy(FontDB);
@ -2323,7 +2323,7 @@ begin
else
ALogFont^.lfQuality := DEFAULT_QUALITY;
end;
ALogFont^.lfFaceName := UTF8Encode(AFont.getFamily);
ALogFont^.lfFaceName := UTF16ToUTF8(AFont.getFamily);
end;
end
{------------------------------------------------------------------------------

View File

@ -340,7 +340,7 @@ begin
Result := not TQtWidget(AWinControl.Handle).getTextStatic;
if Result then
AText := UTF8Encode(TQtWidget(AWinControl.Handle).getText);
AText := UTF16ToUTF8(TQtWidget(AWinControl.Handle).getText);
end;
class procedure TQtWSWinControl.SetText(const AWinControl: TWinControl;

View File

@ -33,7 +33,7 @@ uses
qt4,
qtobjects, qtwidgets, qtproc,
// RTL + LCL
SysUtils, Classes, LCLType, Dialogs, Controls, Forms, Graphics,
SysUtils, Classes, LCLType, LCLProc, Dialogs, Controls, Forms, Graphics,
// Widgetset
WSDialogs, WSLCLClasses;
@ -355,7 +355,7 @@ begin
QFileDialog_getSaveFileName(@ReturnText, QWidget_parentWidget(QtFileDialog.Widget), @SaveTitle, @saveFileName, @saveFilter, @selectedFilter, 0);
if ReturnText <> '' then
begin
FileDialog.FileName := UTF8Encode(ReturnText);
FileDialog.FileName := UTF16ToUTF8(ReturnText);
FileDialog.UserChoice := mrOK;
end else
FileDialog.UserChoice := mrCancel;
@ -368,9 +368,9 @@ begin
for i := 0 to QStringList_size(ReturnList) - 1 do
begin
QStringList_at(ReturnList, @ReturnText, i);
FileDialog.Files.Add(UTF8Encode(ReturnText));
FileDialog.Files.Add(UTF16ToUTF8(ReturnText));
if i = 0 then
FileDialog.FileName := UTF8Encode(ReturnText);
FileDialog.FileName := UTF16ToUTF8(ReturnText);
end;
ReturnText := FileDialog.Files.Text;
finally
@ -445,7 +445,7 @@ begin
QFileDialog_getExistingDirectory(@ReturnText, QWidget_parentWidget(QtFileDialog.Widget), @SaveTitle, @saveFileName);
if ReturnText <> '' then
begin
FileDialog.FileName := UTF8Encode(ReturnText);
FileDialog.FileName := UTF16ToUTF8(ReturnText);
FileDialog.UserChoice := mrOK;
end else
FileDialog.UserChoice := mrCancel;
@ -542,7 +542,7 @@ begin
TQtWSCommonDialog.GetDialogParent(ACommonDialog));
QFont_family(ReturnFont, @Str);
TFontDialog(ACommonDialog).Font.Name := UTF8Encode(Str);
TFontDialog(ACommonDialog).Font.Name := UTF16ToUTF8(Str);
if QFont_pixelSize(ReturnFont) = -1 then
TFontDialog(ACommonDialog).Font.Size := QFont_pointSize(ReturnFont)

View File

@ -33,7 +33,7 @@ uses
qt4,
qtwidgets, qtobjects, qtproc, QtWSControls,
// LCL
LMessages, LCLMessageGlue,
LMessages, LCLMessageGlue, LCLProc,
SysUtils, Classes, Controls, Graphics, Forms, StdCtrls, ExtCtrls, LCLType,
ImgList,
// Widgetset
@ -473,7 +473,7 @@ begin
ATrayIcon.Handle := PtrInt(SystemTrayIcon);
Text := UTF8Decode(ATrayIcon.Hint);
Text := UTF8ToUTF16(ATrayIcon.Hint);
SystemTrayIcon.setToolTip(Text);
if Assigned(ATrayIcon.PopUpMenu) then