From 7242b836af9ef6268689cbbb97b913871d38000a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Sat, 18 Apr 2015 02:07:48 +0200 Subject: [PATCH] Use UTF-8 encoding for special characters in Signal --- signal.cpp | 13 ++++--------- signal.h | 4 ++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/signal.cpp b/signal.cpp index 0b64ef4..a93213b 100644 --- a/signal.cpp +++ b/signal.cpp @@ -22,13 +22,8 @@ #include "signal.h" #include -#ifdef _MSC_VER -#define DEGREES_CELSIUS_STRING QString::fromWCharArray(L"\u00B0C") -#define MICROAMPERES_STRING QString::fromWCharArray(L"\u03BCA") -#else -#define DEGREES_CELSIUS_STRING QString::fromUtf8(u8"\u00B0C") -#define MICROAMPERES_STRING QString::fromUtf8(u8"\u03BCA") -#endif +const char Signal::DEGREES_CELSIUS_UTF8[] = {static_cast(0xE2), static_cast(0x84), static_cast(0x83), 0x00}; +const char Signal::MICROAMPERES_UTF8[] = {static_cast(0xC2), static_cast(0xB5), 0x41, 0x00}; const QString Signal::RES_CCD("CCD"); const QString Signal::RES_CURRENT("Current"); @@ -37,9 +32,9 @@ const QString Signal::RES_POWER("Power"); const QString Signal::RES_PRESSURE("Pressure"); const QString Signal::RES_TEMPERATURE("Temperature"); const QString Signal::RES_VOLTAGE("Voltage"); -const QString Signal::DEGREES_CELSIUS_SI = DEGREES_CELSIUS_STRING; +const QString Signal::DEGREES_CELSIUS_SI = QString::fromUtf8(Signal::DEGREES_CELSIUS_UTF8); const QString Signal::KILOVOTLS_SI("KV"); -const QString Signal::MICROAMPERES_SI = MICROAMPERES_STRING; +const QString Signal::MICROAMPERES_SI = QString::fromUtf8(Signal::MICROAMPERES_UTF8); const QString Signal::MILLIAU_SI("mAU"); const QString Signal::MILLIBARS_SI("mbar"); const QString Signal::MILLIVOLTS_SI("mV"); diff --git a/signal.h b/signal.h index 2e13de9..4eabdf4 100644 --- a/signal.h +++ b/signal.h @@ -107,6 +107,9 @@ private: const XUnit m_xunit; const YUnit m_yunit; + static const char DEGREES_CELSIUS_UTF8[]; + static const char MICROAMPERES_UTF8[]; + static const QString RES_ABSORBANCE; static const QString RES_CCD; static const QString RES_CURRENT; @@ -123,6 +126,7 @@ private: static const QString MILLIVOLTS_SI; static const QString WATTS_SI; + signals: public slots: -- 2.43.5