]> Devoid-pointer.net GitWeb - anyanka.git/commitdiff
Use UTF-8 encoding for special characters in Signal
authorMichal Malý <madcatxster@devoid-pointer.net>
Sat, 18 Apr 2015 00:07:48 +0000 (02:07 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sat, 18 Apr 2015 00:07:48 +0000 (02:07 +0200)
signal.cpp
signal.h

index 0b64ef48c5ec4864f88c0d9069e898db52fe6807..a93213b9de4fb8e57ae34e74eda53d23fe65d839 100644 (file)
 #include "signal.h"
 #include <cfloat>
 
-#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<char>(0xE2), static_cast<char>(0x84), static_cast<char>(0x83), 0x00};
+const char Signal::MICROAMPERES_UTF8[] = {static_cast<char>(0xC2), static_cast<char>(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");
index 2e13de9a8dc2b068ddefe14b2f8923dfc36062e6..4eabdf4afd68215ca5e4bbecb5d0b404bf51a919 100644 (file)
--- 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: