mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
opt: remove unneccessary translation and QString conversion
This commit is contained in:
parent
a2f0748c0d
commit
eee71f6cdf
|
@ -560,11 +560,11 @@ QString const& AardDictionary::getDescription()
|
|||
{
|
||||
map< string, string >::const_iterator iter = meta.find( "copyright" );
|
||||
if( iter != meta.end() )
|
||||
dictionaryDescription = QString( QObject::tr( "Copyright: %1%2" ) ).arg( QString::fromUtf8( iter->second.c_str() ) ).arg( "\n\n" );
|
||||
dictionaryDescription = QObject::tr( "Copyright: %1%2" ).arg( QString::fromUtf8( iter->second.c_str() ) ).arg( "\n\n" );
|
||||
|
||||
iter = meta.find( "version" );
|
||||
if( iter != meta.end() )
|
||||
dictionaryDescription = QString( QObject::tr( "Version: %1%2" ) ).arg( QString::fromUtf8( iter->second.c_str() ) ).arg( "\n\n" );
|
||||
dictionaryDescription = QObject::tr( "Version: %1%2" ).arg( QString::fromUtf8( iter->second.c_str() ) ).arg( "\n\n" );
|
||||
|
||||
iter = meta.find( "description" );
|
||||
if( iter != meta.end() )
|
||||
|
|
|
@ -391,21 +391,21 @@ namespace
|
|||
char * dictDescription = chunks.getBlock( idxHeader.descriptionAddress, chunk );
|
||||
string str( dictDescription );
|
||||
if( !str.empty() )
|
||||
dictionaryDescription += QString( QObject::tr( "Copyright: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Copyright: %1%2" )
|
||||
.arg( Html::unescape( QString::fromUtf8( str.data(), str.size() ) ) )
|
||||
.arg( "\n\n" );
|
||||
dictDescription += str.size() + 1;
|
||||
|
||||
str = string( dictDescription );
|
||||
if( !str.empty() )
|
||||
dictionaryDescription += QString( QObject::tr( "Author: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Author: %1%2" )
|
||||
.arg( QString::fromUtf8( str.data(), str.size() ) )
|
||||
.arg( "\n\n" );
|
||||
dictDescription += str.size() + 1;
|
||||
|
||||
str = string( dictDescription );
|
||||
if( !str.empty() )
|
||||
dictionaryDescription += QString( QObject::tr( "E-mail: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "E-mail: %1%2" )
|
||||
.arg( QString::fromUtf8( str.data(), str.size() ) )
|
||||
.arg( "\n\n" );
|
||||
dictDescription += str.size() + 1;
|
||||
|
|
|
@ -547,7 +547,7 @@ QString const& GlsDictionary::getDescription()
|
|||
GlsScanner scanner( getDictionaryFilenames()[ 0 ] );
|
||||
string str = Utf8::encode( scanner.getDictionaryAuthor() );
|
||||
if( !str.empty() )
|
||||
dictionaryDescription = QString( QObject::tr( "Author: %1%2" ) )
|
||||
dictionaryDescription = QObject::tr( "Author: %1%2" )
|
||||
.arg( QString::fromUtf8( str.c_str() ) )
|
||||
.arg( "\n\n" );
|
||||
str = Utf8::encode( scanner.getDictionaryDescription() );
|
||||
|
|
|
@ -650,7 +650,7 @@ QString const& SdictDictionary::getDescription()
|
|||
if( !dictionaryDescription.isEmpty() )
|
||||
return dictionaryDescription;
|
||||
|
||||
dictionaryDescription = QString( QObject::tr( "Title: %1%2" ) )
|
||||
dictionaryDescription = QObject::tr( "Title: %1%2" )
|
||||
.arg( QString::fromUtf8( getName().c_str() ) )
|
||||
.arg( "\n\n" );
|
||||
|
||||
|
@ -682,7 +682,7 @@ QString const& SdictDictionary::getDescription()
|
|||
else
|
||||
str = string( data.data(), size );
|
||||
|
||||
dictionaryDescription += QString( QObject::tr( "Copyright: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Copyright: %1%2" )
|
||||
.arg( QString::fromUtf8( str.c_str(), str.size() ) )
|
||||
.arg( "\n\n" );
|
||||
|
||||
|
@ -698,7 +698,7 @@ QString const& SdictDictionary::getDescription()
|
|||
else
|
||||
str = string( data.data(), size );
|
||||
|
||||
dictionaryDescription += QString( QObject::tr( "Version: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Version: %1%2" )
|
||||
.arg( QString::fromUtf8( str.c_str(), str.size() ) )
|
||||
.arg( "\n\n" );
|
||||
}
|
||||
|
|
|
@ -1107,7 +1107,7 @@ QString const& StardictDictionary::getDescription()
|
|||
{
|
||||
QString copyright = QString::fromUtf8( ifo.copyright.c_str() )
|
||||
.replace( "<br>", "\n", Qt::CaseInsensitive );
|
||||
dictionaryDescription += QString( QObject::tr( "Copyright: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Copyright: %1%2" )
|
||||
.arg( copyright )
|
||||
.arg( "\n\n" );
|
||||
}
|
||||
|
@ -1115,7 +1115,7 @@ QString const& StardictDictionary::getDescription()
|
|||
if( !ifo.author.empty() )
|
||||
{
|
||||
QString author = QString::fromUtf8( ifo.author.c_str() );
|
||||
dictionaryDescription += QString( QObject::tr( "Author: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Author: %1%2" )
|
||||
.arg( author )
|
||||
.arg( "\n\n" );
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ QString const& StardictDictionary::getDescription()
|
|||
if( !ifo.email.empty() )
|
||||
{
|
||||
QString email = QString::fromUtf8( ifo.email.c_str() );
|
||||
dictionaryDescription += QString( QObject::tr( "E-mail: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "E-mail: %1%2" )
|
||||
.arg( email )
|
||||
.arg( "\n\n" );
|
||||
}
|
||||
|
@ -1131,7 +1131,7 @@ QString const& StardictDictionary::getDescription()
|
|||
if( !ifo.website.empty() )
|
||||
{
|
||||
QString website = QString::fromUtf8( ifo.website.c_str() );
|
||||
dictionaryDescription += QString( QObject::tr( "Website: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Website: %1%2" )
|
||||
.arg( website )
|
||||
.arg( "\n\n" );
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ QString const& StardictDictionary::getDescription()
|
|||
if( !ifo.date.empty() )
|
||||
{
|
||||
QString date = QString::fromUtf8( ifo.date.c_str() );
|
||||
dictionaryDescription += QString( QObject::tr( "Date: %1%2" ) )
|
||||
dictionaryDescription += QObject::tr( "Date: %1%2" )
|
||||
.arg( date )
|
||||
.arg( "\n\n" );
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ bool DecoderContext::openCodec( QString & errorString )
|
|||
formatContext_ = avformat_alloc_context();
|
||||
if ( !formatContext_ )
|
||||
{
|
||||
errorString = QObject::tr( "avformat_alloc_context() failed." );
|
||||
errorString = "avformat_alloc_context() failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ bool DecoderContext::openCodec( QString & errorString )
|
|||
|
||||
if ( !avioBuffer )
|
||||
{
|
||||
errorString = QObject::tr( "av_malloc() failed." );
|
||||
errorString = "av_malloc() failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ bool DecoderContext::openCodec( QString & errorString )
|
|||
if ( !avioContext_ )
|
||||
{
|
||||
av_free( avioBuffer );
|
||||
errorString = QObject::tr( "avio_alloc_context() failed." );
|
||||
errorString = "avio_alloc_context() failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -188,14 +188,14 @@ bool DecoderContext::openCodec( QString & errorString )
|
|||
ret = avformat_open_input( &formatContext_, NULL, NULL, NULL );
|
||||
if ( ret < 0 )
|
||||
{
|
||||
errorString = QObject::tr( "avformat_open_input() failed: %1." ).arg( avErrorString( ret ) );
|
||||
errorString = QString( "avformat_open_input() failed: %1." ).arg( avErrorString( ret ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = avformat_find_stream_info( formatContext_, NULL );
|
||||
if ( ret < 0 )
|
||||
{
|
||||
errorString = QObject::tr( "avformat_find_stream_info() failed: %1." ).arg( avErrorString( ret ) );
|
||||
errorString = QString( "avformat_find_stream_info() failed: %1." ).arg( avErrorString( ret ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -210,20 +210,20 @@ bool DecoderContext::openCodec( QString & errorString )
|
|||
}
|
||||
if ( !audioStream_ )
|
||||
{
|
||||
errorString = QObject::tr( "Could not find audio stream." );
|
||||
errorString = QString( "Could not find audio stream." );
|
||||
return false;
|
||||
}
|
||||
|
||||
codec_ = avcodec_find_decoder( audioStream_->codecpar->codec_id );
|
||||
if ( !codec_ )
|
||||
{
|
||||
errorString = QObject::tr( "Codec [id: %1] not found." ).arg( audioStream_->codecpar->codec_id );
|
||||
errorString = QString( "Codec [id: %1] not found." ).arg( audioStream_->codecpar->codec_id );
|
||||
return false;
|
||||
}
|
||||
codecContext_ = avcodec_alloc_context3( codec_ );
|
||||
if ( !codecContext_ )
|
||||
{
|
||||
errorString = QObject::tr( "avcodec_alloc_context3() failed." );
|
||||
errorString = QString( "avcodec_alloc_context3() failed." );
|
||||
return false;
|
||||
}
|
||||
avcodec_parameters_to_context( codecContext_, audioStream_->codecpar );
|
||||
|
@ -231,7 +231,7 @@ bool DecoderContext::openCodec( QString & errorString )
|
|||
ret = avcodec_open2( codecContext_, codec_, NULL );
|
||||
if ( ret < 0 )
|
||||
{
|
||||
errorString = QObject::tr( "avcodec_open2() failed: %1." ).arg( avErrorString( ret ) );
|
||||
errorString = QString( "avcodec_open2() failed: %1." ).arg( avErrorString( ret ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ bool DecoderContext::openOutputDevice( QString & errorString )
|
|||
#if (QT_VERSION >= QT_VERSION_CHECK(6,2,0))
|
||||
QAudioDevice m_outputDevice = QMediaDevices::defaultAudioOutput();
|
||||
if(m_outputDevice.isNull()){
|
||||
errorString += QObject::tr( "Can not found default audio output device" );
|
||||
errorString += QString( "Can not found default audio output device" );
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -340,7 +340,7 @@ bool DecoderContext::play( QString & errorString )
|
|||
AVFrame * frame = av_frame_alloc();
|
||||
if ( !frame )
|
||||
{
|
||||
errorString = QObject::tr( "avcodec_alloc_frame() failed." );
|
||||
errorString = QString( "avcodec_alloc_frame() failed." );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue