1
0
Fork 0

GUI: set general encoding to UTF-8

This commit is contained in:
Mr. eXoDia 2014-09-11 21:17:12 +02:00
parent 003150a4e5
commit 817b2ef2f7
4 changed files with 12 additions and 6 deletions

View File

@ -444,7 +444,7 @@ QString HexDump::byteToString(byte_t byte, ByteViewMode_e mode)
case AsciiByte:
{
QChar wChar((char)byte);
QChar wChar = QChar::fromLatin1((char)byte);
if(wChar.isPrint() == true)
wStr = QString(wChar);
@ -489,7 +489,7 @@ QString HexDump::wordToString(uint16 word, WordViewMode_e mode)
case UnicodeWord:
{
QChar wChar((char)word & 0xFF);
QChar wChar = QChar::fromLatin1((char)word & 0xFF);
if(wChar.isPrint() == true && (word >> 8) == 0)
wStr = QString(wChar);
else

View File

@ -71,13 +71,13 @@ QString CPUInfoBox::getSymbolicName(int_t addr)
finalText = addrText;
if(addr == (addr & 0xFF))
{
QChar c = QChar((char)addr);
QChar c = QChar::fromLatin1((char)addr);
if(c.isPrint())
finalText += QString(" '%1'").arg((char)addr);
}
else if(addr == (addr & 0xFFF)) //UNICODE?
{
QChar c = QChar((wchar_t)addr);
QChar c = QChar::fromLatin1((wchar_t)addr);
if(c.isPrint())
finalText += " L'" + QString(c) + "'";
}

View File

@ -69,7 +69,7 @@ void CalculatorDialog::validateExpression()
ui->txtOct->setText(inFormat(ans, N_OCT));
if((ans == (ans & 0xFF)))
{
QChar c = QChar((char)ans);
QChar c = QChar::fromLatin1((char)ans);
if(c.isPrint())
ui->txtAscii->setText("'" + QString(c) + "'");
else
@ -80,7 +80,7 @@ void CalculatorDialog::validateExpression()
ui->txtAscii->setCursorPosition(1);
if((ans == (ans & 0xFFF))) //UNICODE?
{
QChar c = QChar((wchar_t)ans);
QChar c = QChar::fromLatin1((wchar_t)ans);
if(c.isPrint())
ui->txtUnicode->setText("L'" + QString(c) + "'");
else

View File

@ -1,6 +1,7 @@
#include "main.h"
#include <QAbstractEventDispatcher>
#include <QMessageBox>
#include <QTextCodec>
#include "Bridge.h"
#include "Configuration.h"
#include "MainWindow.h"
@ -60,6 +61,11 @@ int main(int argc, char* argv[])
qRegisterMetaType<byte_t>("byte_t");
qRegisterMetaType<DBGSTATE>("DBGSTATE");
// Set QString codec to UTF-8
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
// Init communication with debugger
Bridge::initBridge();