Commit 77005b25 authored by Frédéric Brière's avatar Frédéric Brière
Browse files

radselect: Correctly parse modern versions of radkfile

Ever since the release of xjdic version 24 (back in 2003), some radkfile
entries have included an additional element (either in the form of a JIS
X 0212 hex code or an image filename), which must be excluded when
parsing the stroke count.
parent 734a6b19
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "radicalfile.h" #include "radicalfile.h"
#include <QFile> #include <QFile>
#include <QRegExp>
#include <QString> #include <QString>
#include <QTextCodec> #include <QTextCodec>
#include <QTextStream> #include <QTextStream>
...@@ -79,8 +80,9 @@ bool RadicalFile::loadRadicalFile( QString &radkfile ) ...@@ -79,8 +80,9 @@ bool RadicalFile::loadRadicalFile( QString &radkfile )
m_radicals.insert( *newestRadical, *newestRadical ); m_radicals.insert( *newestRadical, *newestRadical );
} }
delete newestRadical; delete newestRadical;
newestRadical = new Radical( QString( line.at( 2 ) ) QStringList lineElements = line.split( QRegExp( QStringLiteral( "\\s+" ) ) );
, line.rightRef( 2 ).toUInt() ); newestRadical = new Radical( lineElements.at( 1 )
, lineElements.at( 2 ).toUInt() );
} }
else if( newestRadical != nullptr ) else if( newestRadical != nullptr )
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment