mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
(qt) #5219 'QPrintable and non Latin-1 symbols on Ubuntu' -- clean fix by rb07
This commit is contained in:
parent
4d627b79c2
commit
9d6db0da15
2 changed files with 17 additions and 16 deletions
|
@ -41,10 +41,10 @@ Formatter :: initUnits( )
|
|||
unitStrings[SPEED][GB] = tr( "GB/s" );
|
||||
unitStrings[SPEED][TB] = tr( "TB/s" );
|
||||
tr_formatter_speed_init( speed_K,
|
||||
qPrintable( unitStrings[SPEED][KB] ),
|
||||
qPrintable( unitStrings[SPEED][MB] ),
|
||||
qPrintable( unitStrings[SPEED][GB] ),
|
||||
qPrintable( unitStrings[SPEED][TB] ) );
|
||||
unitStrings[SPEED][KB].toUtf8().constData(),
|
||||
unitStrings[SPEED][MB].toUtf8().constData(),
|
||||
unitStrings[SPEED][GB].toUtf8().constData(),
|
||||
unitStrings[SPEED][TB].toUtf8().constData() );
|
||||
|
||||
size_K = 1000;
|
||||
unitStrings[SIZE][B] = tr( "B" );
|
||||
|
@ -53,10 +53,10 @@ Formatter :: initUnits( )
|
|||
unitStrings[SIZE][GB] = tr( "GB" );
|
||||
unitStrings[SIZE][TB] = tr( "TB" );
|
||||
tr_formatter_size_init( size_K,
|
||||
qPrintable( unitStrings[SIZE][KB] ),
|
||||
qPrintable( unitStrings[SIZE][MB] ),
|
||||
qPrintable( unitStrings[SIZE][GB] ),
|
||||
qPrintable( unitStrings[SIZE][TB] ) );
|
||||
unitStrings[SIZE][KB].toUtf8().constData(),
|
||||
unitStrings[SIZE][MB].toUtf8().constData(),
|
||||
unitStrings[SIZE][GB].toUtf8().constData(),
|
||||
unitStrings[SIZE][TB].toUtf8().constData() );
|
||||
|
||||
mem_K = 1024;
|
||||
unitStrings[MEM][B] = tr( "B" );
|
||||
|
@ -65,10 +65,10 @@ Formatter :: initUnits( )
|
|||
unitStrings[MEM][GB] = tr( "GiB" );
|
||||
unitStrings[MEM][TB] = tr( "TiB" );
|
||||
tr_formatter_mem_init( mem_K,
|
||||
qPrintable( unitStrings[MEM][KB] ),
|
||||
qPrintable( unitStrings[MEM][MB] ),
|
||||
qPrintable( unitStrings[MEM][GB] ),
|
||||
qPrintable( unitStrings[MEM][TB] ) );
|
||||
unitStrings[MEM][KB].toUtf8().constData(),
|
||||
unitStrings[MEM][MB].toUtf8().constData(),
|
||||
unitStrings[MEM][GB].toUtf8().constData(),
|
||||
unitStrings[MEM][TB].toUtf8().constData() );
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -101,7 +101,7 @@ Formatter :: memToString( int64_t bytes )
|
|||
else {
|
||||
char buf[128];
|
||||
tr_formatter_mem_B( buf, bytes, sizeof( buf ) );
|
||||
return buf;
|
||||
return QString::fromUtf8( buf );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ Formatter :: sizeToString( int64_t bytes )
|
|||
else {
|
||||
char buf[128];
|
||||
tr_formatter_size_B( buf, bytes, sizeof( buf ) );
|
||||
return buf;
|
||||
return QString::fromUtf8( buf );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ Formatter :: speedToString( const Speed& speed )
|
|||
else {
|
||||
char buf[128];
|
||||
tr_formatter_speed_KBps( buf, speed.KBps( ), sizeof( buf ) );
|
||||
return buf;
|
||||
return QString::fromUtf8( buf );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -969,12 +969,13 @@ void
|
|||
Session :: addNewlyCreatedTorrent( const QString& filename, const QString& localPath )
|
||||
{
|
||||
const QByteArray b64 = AddData(filename).toBase64();
|
||||
const QByteArray localPathUtf8 = localPath.toUtf8();
|
||||
|
||||
tr_variant top, *args;
|
||||
tr_variantInitDict( &top, 2 );
|
||||
tr_variantDictAddStr( &top, TR_KEY_method, "torrent-add" );
|
||||
args = tr_variantDictAddDict( &top, TR_KEY_arguments, 3 );
|
||||
tr_variantDictAddStr( args, TR_KEY_download_dir, qPrintable(localPath) );
|
||||
tr_variantDictAddStr( args, TR_KEY_download_dir, localPathUtf8.constData() );
|
||||
tr_variantDictAddBool( args, TR_KEY_paused, !myPrefs.getBool( Prefs::START ) );
|
||||
tr_variantDictAddRaw( args, TR_KEY_metainfo, b64.constData(), b64.size() );
|
||||
exec( &top );
|
||||
|
|
Loading…
Reference in a new issue