mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Part of work for #212: Make GD source to be ready for Qt5.
Replaced deprecated to/fromAscii with to/fromLatin1
This commit is contained in:
parent
845f5294a6
commit
9faf843ab7
2
about.cc
2
about.cc
|
@ -15,7 +15,7 @@ About::About( QWidget * parent ): QDialog( parent )
|
|||
if ( !versionFile.open( QFile::ReadOnly ) )
|
||||
version = tr( "[Unknown]" );
|
||||
else
|
||||
version = QString::fromAscii( versionFile.readAll() ).trimmed();
|
||||
version = QString::fromLatin1( versionFile.readAll() ).trimmed();
|
||||
|
||||
ui.version->setText( version );
|
||||
|
||||
|
|
|
@ -492,9 +492,9 @@ void ArticleRequest::bodyFinished()
|
|||
+ "</div>";
|
||||
|
||||
head += "<span class=\"gdarticlebody gdlangfrom-";
|
||||
head += LangCoder::intToCode2( activeDict->getLangFrom() ).toAscii().data();
|
||||
head += LangCoder::intToCode2( activeDict->getLangFrom() ).toLatin1().data();
|
||||
head += "\" lang=\"";
|
||||
head += LangCoder::intToCode2( activeDict->getLangTo() ).toAscii().data();
|
||||
head += LangCoder::intToCode2( activeDict->getLangTo() ).toLatin1().data();
|
||||
head += "\">";
|
||||
|
||||
if ( errorString.size() )
|
||||
|
|
|
@ -147,7 +147,7 @@ sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(
|
|||
|
||||
if ( contextsEncoded.size() )
|
||||
{
|
||||
QByteArray ba = QByteArray::fromBase64( contextsEncoded.toAscii() );
|
||||
QByteArray ba = QByteArray::fromBase64( contextsEncoded.toLatin1() );
|
||||
|
||||
QBuffer buf( & ba );
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ void ArticleView::showDefinition( QString const & word, unsigned group,
|
|||
|
||||
buf.close();
|
||||
|
||||
req.addQueryItem( "contexts", QString::fromAscii( buf.buffer().toBase64() ) );
|
||||
req.addQueryItem( "contexts", QString::fromLatin1( buf.buffer().toBase64() ) );
|
||||
}
|
||||
|
||||
QString mutedDicts = getMutedForGroup( group );
|
||||
|
@ -497,7 +497,7 @@ void ArticleView::tryMangleWebsiteClickedUrl( QUrl & url, Contexts & contexts )
|
|||
{
|
||||
// Looks this way
|
||||
|
||||
contexts[ ca.mid( 7 ) ] = QString::fromAscii( url.toEncoded() );
|
||||
contexts[ ca.mid( 7 ) ] = QString::fromLatin1( url.toEncoded() );
|
||||
|
||||
QUrl target;
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ Group loadGroup( QDomElement grp, unsigned * nextId = 0 )
|
|||
g.icon = grp.attribute( "icon" );
|
||||
|
||||
if ( !grp.attribute( "iconData" ).isEmpty() )
|
||||
g.iconData = QByteArray::fromBase64( grp.attribute( "iconData" ).toAscii() );
|
||||
g.iconData = QByteArray::fromBase64( grp.attribute( "iconData" ).toLatin1() );
|
||||
|
||||
if ( !grp.attribute( "shortcut" ).isEmpty() )
|
||||
g.shortcut = QKeySequence::fromString( grp.attribute( "shortcut" ) );
|
||||
|
@ -819,7 +819,7 @@ void saveGroup( Group const & data, QDomElement & group )
|
|||
{
|
||||
QDomAttr iconData = dd.createAttribute( "iconData" );
|
||||
|
||||
iconData.setValue( QString::fromAscii( data.iconData.toBase64() ) );
|
||||
iconData.setValue( QString::fromLatin1( data.iconData.toBase64() ) );
|
||||
|
||||
group.setAttributeNode( iconData );
|
||||
}
|
||||
|
|
2
dsl.cc
2
dsl.cc
|
@ -1009,7 +1009,7 @@ QString const& DslDictionary::getDescription()
|
|||
|
||||
qint32 gdLang, annLang;
|
||||
QString langStr;
|
||||
gdLang = LangCoder::code2toInt( QLocale::system().name().left( 2 ).toAscii().data() );
|
||||
gdLang = LangCoder::code2toInt( QLocale::system().name().left( 2 ).toLatin1().data() );
|
||||
for(;;)
|
||||
{
|
||||
data.clear();
|
||||
|
|
4
forvo.cc
4
forvo.cc
|
@ -100,7 +100,7 @@ void ForvoDictionary::loadIcon() throw()
|
|||
#if 0
|
||||
if ( languageCode.size() == 2 )
|
||||
{
|
||||
QString countryCode = Language::countryCodeForId( LangCoder::code2toInt( languageCode.toAscii().data() ) );
|
||||
QString countryCode = Language::countryCodeForId( LangCoder::code2toInt( languageCode.toLatin1().data() ) );
|
||||
|
||||
if ( countryCode.size() )
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ void ForvoArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
|||
|
||||
QUrl reqUrl = QUrl::fromEncoded(
|
||||
QString( "http://apifree.forvo.com/key/" + key + "/format/xml/action/word-pronunciations/word/" +
|
||||
QString::fromAscii( QUrl::toPercentEncoding( gd::toQString( str ) ) ) + "/language/" + languageCode
|
||||
QString::fromLatin1( QUrl::toPercentEncoding( gd::toQString( str ) ) ) + "/language/" + languageCode
|
||||
).toUtf8() );
|
||||
|
||||
// DPRINTF( "req: %s\n", reqUrl.toEncoded().data() );
|
||||
|
|
|
@ -56,7 +56,7 @@ QString decode( const char *str )
|
|||
|
||||
char separator()
|
||||
{
|
||||
return QDir::separator().toAscii();
|
||||
return QDir::separator().toLatin1();
|
||||
}
|
||||
|
||||
string dirname( string const & str )
|
||||
|
|
|
@ -81,7 +81,7 @@ void DictGroupWidget::groupIconActivated( int index )
|
|||
QString formatList( " (" );
|
||||
|
||||
for( int x = 0; x < supImageFormats.size(); ++x )
|
||||
formatList += "*." + QString::fromAscii( supImageFormats[ x ] ) + " ";
|
||||
formatList += "*." + QString::fromLatin1( supImageFormats[ x ] ) + " ";
|
||||
|
||||
formatList.chop( 1 );
|
||||
formatList.append( ")" );
|
||||
|
|
|
@ -763,7 +763,7 @@ vector< DataFiles > findDataFiles( QString const & path )
|
|||
QString localizedName;
|
||||
|
||||
if ( dictBaseId.size() == 2 )
|
||||
localizedName = Language::localizedNameForId( LangCoder::code2toInt( dictBaseId.toAscii().data() ) );
|
||||
localizedName = Language::localizedNameForId( LangCoder::code2toInt( dictBaseId.toLatin1().data() ) );
|
||||
|
||||
QString dictName = dictId;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ QString LangCoder::intToCode2( quint32 val )
|
|||
code[ 0 ] = val & 0xFF;
|
||||
code[ 1 ] = ( val >> 8 ) & 0xFF;
|
||||
|
||||
return QString::fromAscii( code, 2 );
|
||||
return QString::fromLatin1( code, 2 );
|
||||
}
|
||||
|
||||
quint32 LangCoder::code3toInt(const std::string& code3)
|
||||
|
@ -130,7 +130,7 @@ quint32 LangCoder::guessId( const QString & lang )
|
|||
}
|
||||
|
||||
// still not found - try to match by 2-symbol code
|
||||
return code2toInt( lstr.left(2).toAscii().data() );
|
||||
return code2toInt( lstr.left(2).toLatin1().data() );
|
||||
}
|
||||
|
||||
QPair<quint32,quint32> LangCoder::findIdsForName( QString const & name )
|
||||
|
|
|
@ -59,7 +59,7 @@ Preferences::Preferences( QWidget * parent, Config::Preferences const & p ):
|
|||
continue; // We skip qt's own localizations
|
||||
|
||||
sortedLocs.insertMulti(
|
||||
Language::localizedNameForId( LangCoder::code2toInt( lang.toAscii().data() ) ),
|
||||
Language::localizedNameForId( LangCoder::code2toInt( lang.toLatin1().data() ) ),
|
||||
QPair< QIcon, QString >(
|
||||
QIcon( QString( ":/flags/%1.png" ).arg( i->mid( 3, 2 ).toLower() ) ),
|
||||
i->mid( 0, i->size() - 3 ) ) );
|
||||
|
|
|
@ -97,7 +97,7 @@ sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str,
|
|||
for( int x = 1; x <= 16; ++x )
|
||||
{
|
||||
urlString.replace( QString( "%25GDISO%1%25" ).arg( x ),
|
||||
QTextCodec::codecForName( QString( "ISO 8859-%1" ).arg( x ).toAscii() )->fromUnicode( inputWord ).toPercentEncoding() );
|
||||
QTextCodec::codecForName( QString( "ISO 8859-%1" ).arg( x ).toLatin1() )->fromUnicode( inputWord ).toPercentEncoding() );
|
||||
|
||||
if ( x == 10 )
|
||||
x = 12; // Skip encodings 11..12, they don't exist
|
||||
|
|
4
xdxf.cc
4
xdxf.cc
|
@ -1055,14 +1055,14 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
{
|
||||
// Read the xdxf
|
||||
|
||||
string str = stream.attributes().value( "lang_from" ).toString().toAscii().data();
|
||||
string str = stream.attributes().value( "lang_from" ).toString().toLatin1().data();
|
||||
|
||||
if ( str.size() > 3 )
|
||||
str.resize( 3 );
|
||||
|
||||
idxHeader.langFrom = LangCoder::findIdForLanguageCode3( str.c_str() );
|
||||
|
||||
str = stream.attributes().value( "lang_to" ).toString().toAscii().data();
|
||||
str = stream.attributes().value( "lang_to" ).toString().toLatin1().data();
|
||||
|
||||
if ( str.size() > 3 )
|
||||
str.resize( 3 );
|
||||
|
|
Loading…
Reference in a new issue