Fix compile with MSVC
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
#include "version.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <getopt.h>
|
||||
#ifndef _MSC_VER
|
||||
# include <getopt.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -119,6 +121,7 @@ void CommandlineOptions::RemoveArg(const QString &starts_with, int count) {
|
||||
|
||||
bool CommandlineOptions::Parse() {
|
||||
|
||||
#ifndef _MSC_VER // TODO: Consider QCommandLineOption.
|
||||
static const struct option kOptions[] = {
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"play", no_argument, nullptr, 'p'},
|
||||
@@ -319,6 +322,8 @@ bool CommandlineOptions::Parse() {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -613,8 +613,8 @@ void SongLoader::ErrorMessageReceived(GstMessage *msg) {
|
||||
gchar *debugs = nullptr;
|
||||
|
||||
gst_message_parse_error(msg, &error, &debugs);
|
||||
qLog(Error) << __PRETTY_FUNCTION__ << error->message;
|
||||
qLog(Error) << __PRETTY_FUNCTION__ << debugs;
|
||||
qLog(Error) << error->message;
|
||||
qLog(Error) << debugs;
|
||||
|
||||
QString message_str = error->message;
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ QString GetEnv(const QString &key) {
|
||||
void SetEnv(const char *key, const QString &value) {
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
putenv(QString("%1=%2").arg(key, value).toLocal8Bit().constData());
|
||||
_putenv(QString("%1=%2").arg(key, value).toLocal8Bit().constData());
|
||||
#else
|
||||
setenv(key, value.toLocal8Bit().constData(), 1);
|
||||
#endif
|
||||
@@ -785,7 +785,19 @@ QString DesktopEnvironment() {
|
||||
|
||||
}
|
||||
|
||||
QString UnicodeToAscii(const QString &unicode) {
|
||||
QString UnicodeToAscii(QString unicode) {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
return unicode
|
||||
.replace(QChar(229), "a")
|
||||
.replace(QChar(197), 'A')
|
||||
.replace(QChar(230), "ae")
|
||||
.replace(QChar(198), "AE")
|
||||
.replace(QChar(248), 'o')
|
||||
.replace(QChar(216), 'O');
|
||||
|
||||
#else
|
||||
|
||||
#ifdef LC_ALL
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -816,6 +828,8 @@ QString UnicodeToAscii(const QString &unicode) {
|
||||
|
||||
return ret;
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
}
|
||||
|
||||
QString MacAddress() {
|
||||
|
||||
@@ -132,7 +132,7 @@ QString GetRandomString(const int len, const QString &UseCharacters);
|
||||
|
||||
QString DesktopEnvironment();
|
||||
|
||||
QString UnicodeToAscii(const QString &unicode);
|
||||
QString UnicodeToAscii(QString unicode);
|
||||
|
||||
QString MacAddress();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user