mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
remove uselesscode
the gdDebug gdWarning method, set the QTextCodec, does not seem to take effect
This commit is contained in:
parent
3262fe4fe4
commit
5fdfaa5aec
49
gddebug.cc
49
gddebug.cc
|
@ -4,61 +4,30 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "gddebug.hh"
|
#include "gddebug.hh"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#if(QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
#if( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||||
#include <QtCore5Compat/QTextCodec>
|
#include <QtCore5Compat/QTextCodec>
|
||||||
#else
|
#else
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QFile * logFilePtr;
|
QFile * logFilePtr;
|
||||||
static QTextCodec * utf8Codec;
|
|
||||||
|
|
||||||
void gdWarning(const char *msg, ...)
|
void gdWarning( const char * msg, ... )
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start( ap, msg );
|
||||||
QTextCodec *localeCodec = 0;
|
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
|
||||||
{
|
|
||||||
if( utf8Codec == 0 )
|
|
||||||
utf8Codec = QTextCodec::codecForName( "UTF8" );
|
|
||||||
|
|
||||||
localeCodec = QTextCodec::codecForLocale();
|
|
||||||
QTextCodec::setCodecForLocale( utf8Codec );
|
|
||||||
}
|
|
||||||
|
|
||||||
qWarning() << QString().vasprintf( msg, ap );
|
qWarning() << QString().vasprintf( msg, ap );
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
va_end( ap );
|
||||||
{
|
|
||||||
QTextCodec::setCodecForLocale( localeCodec );
|
|
||||||
}
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdDebug(const char *msg, ...)
|
void gdDebug( const char * msg, ... )
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start( ap, msg );
|
||||||
// QTextCodec *localeCodec = 0;
|
|
||||||
|
|
||||||
// if( logFilePtr && logFilePtr->isOpen() )
|
|
||||||
// {
|
|
||||||
// if( utf8Codec == 0 )
|
|
||||||
// utf8Codec = QTextCodec::codecForName( "UTF8" );
|
|
||||||
|
|
||||||
// localeCodec = QTextCodec::codecForLocale();
|
|
||||||
// QTextCodec::setCodecForLocale( utf8Codec );
|
|
||||||
// }
|
|
||||||
|
|
||||||
qDebug().noquote() << QString().vasprintf( msg, ap );
|
qDebug().noquote() << QString().vasprintf( msg, ap );
|
||||||
|
|
||||||
// if( logFilePtr && logFilePtr->isOpen() )
|
va_end( ap );
|
||||||
// {
|
|
||||||
// QTextCodec::setCodecForLocale( localeCodec );
|
|
||||||
// }
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue