mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-21 19:55:20 -05:00
Use C++ classic locale for uses outside of Qt
This commit is contained in:
parent
4aff78d1c1
commit
fdd69583ab
@ -3,8 +3,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <locale>
|
||||||
#include <locale.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
@ -239,11 +238,9 @@ int main(int argc, char *argv[])
|
|||||||
QCoreApplication app {argc, argv};
|
QCoreApplication app {argc, argv};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
::setlocale (LC_NUMERIC, "C"); // ensure number forms are in
|
// ensure number forms are in consistent format, do this after
|
||||||
// consistent format, do this
|
// instantiating QApplication so that Qt has correct l18n
|
||||||
// after instantiating
|
std::locale::global (std::locale::classic ());
|
||||||
// QApplication so that Qt has
|
|
||||||
// correct l18n
|
|
||||||
|
|
||||||
// Override programs executable basename as application name.
|
// Override programs executable basename as application name.
|
||||||
app.setApplicationName ("WSJT-X Record Time Signal");
|
app.setApplicationName ("WSJT-X Record Time Signal");
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
// menu that allows each dock window to be hidden or revealed.
|
// menu that allows each dock window to be hidden or revealed.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <clocale>
|
#include <locale>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
@ -52,10 +52,9 @@ int main (int argc, char * argv[])
|
|||||||
QApplication app {argc, argv};
|
QApplication app {argc, argv};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setlocale (LC_NUMERIC, "C"); // ensure number forms are in
|
// ensure number forms are in consistent format, do this after
|
||||||
// consistent format, do this after
|
// instantiating QApplication so that GUI has correct l18n
|
||||||
// instantiating QApplication so
|
std::locale::global (std::locale::classic ());
|
||||||
// that GUI has correct l18n
|
|
||||||
|
|
||||||
app.setApplicationName ("WSJT-X Reference UDP Message Aggregator Server");
|
app.setApplicationName ("WSJT-X Reference UDP Message Aggregator Server");
|
||||||
app.setApplicationVersion ("1.0");
|
app.setApplicationVersion ("1.0");
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <locale>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -263,10 +264,9 @@ int main (int argc, char * argv[])
|
|||||||
QCoreApplication app {argc, argv};
|
QCoreApplication app {argc, argv};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setlocale (LC_NUMERIC, "C"); // ensure number forms are in
|
// ensure number forms are in consistent format, do this after
|
||||||
// consistent format, do this after
|
// instantiating QApplication so that GUI has correct l18n
|
||||||
// instantiating QApplication so
|
std::locale::global (std::locale::classic ());
|
||||||
// that GUI has correct l18n
|
|
||||||
|
|
||||||
app.setApplicationName ("WSJT-X UDP Message Server Daemon");
|
app.setApplicationName ("WSJT-X UDP Message Server Daemon");
|
||||||
app.setApplicationVersion ("1.0");
|
app.setApplicationVersion ("1.0");
|
||||||
|
8
main.cpp
8
main.cpp
@ -130,12 +130,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QLocale locale; // get the current system locale
|
QLocale locale; // get the current system locale
|
||||||
|
|
||||||
// Set C/C++ locale used for logging etc.
|
// reset the C+ & C global locales to the classic C locale
|
||||||
#if defined (Q_OS_WIN)
|
std::locale::global (std::locale::classic ());
|
||||||
std::locale::global (std::locale ("C"));
|
|
||||||
#else
|
|
||||||
std::locale::global (std::locale ("en_US.UTF-8"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Override programs executable basename as application name.
|
// Override programs executable basename as application name.
|
||||||
a.setApplicationName ("WSJT-X");
|
a.setApplicationName ("WSJT-X");
|
||||||
|
Loading…
Reference in New Issue
Block a user