-#include "cpp_features.hh"
#include "sptr.hh"
#include "ex.hh"
#include "mutex.hh"
@@ -144,11 +143,11 @@ public:
/// Returns the match with the given zero-based index, which should be less
/// than matchesCount().
- WordMatch operator [] ( size_t index ) THROW_SPEC( exIndexOutOfRange );
+ WordMatch operator [] ( size_t index ) ;
/// Returns all the matches found. Since no further locking can or would be
/// done, this can only be called after the request has finished.
- vector< WordMatch > & getAllMatches() THROW_SPEC( exRequestUnfinished );
+ vector< WordMatch > & getAllMatches() ;
/// Returns true if the match was uncertain -- that is, there may be more
/// results in the dictionary itself, the dictionary index isn't good enough
@@ -188,11 +187,11 @@ public:
/// Writes "size" bytes starting from "offset" of the data read to the given
/// buffer. "size + offset" must be <= than dataSize().
void getDataSlice( size_t offset, size_t size, void * buffer )
- THROW_SPEC( exSliceOutOfRange );
+ ;
/// Returns all the data read. Since no further locking can or would be
/// done, this can only be called after the request has finished.
- vector< char > & getFullData() THROW_SPEC( exRequestUnfinished );
+ vector< char > & getFullData() ;
DataRequest(): hasAnyData( false ) {}
@@ -344,7 +343,7 @@ public:
/// be stored. The whole operation is supposed to be fast, though some
/// dictionaries, the network ones particularly, may of course be slow.
virtual sptr< WordSearchRequest > prefixMatch( wstring const &,
- unsigned long maxResults ) THROW_SPEC( std::exception )=0;
+ unsigned long maxResults ) =0;
/// Looks up a given word in the dictionary, aiming to find different forms
/// of the given word by allowing suffix variations. This means allowing words
@@ -357,14 +356,14 @@ public:
virtual sptr< WordSearchRequest > stemmedMatch( wstring const &,
unsigned minLength,
unsigned maxSuffixVariation,
- unsigned long maxResults ) THROW_SPEC( std::exception );
+ unsigned long maxResults ) ;
/// Finds known headwords for the given word, that is, the words for which
/// the given word is a synonym. If a dictionary can't perform this operation,
/// it should leave the default implementation which always returns an empty
/// result.
virtual sptr< WordSearchRequest > findHeadwordsForSynonym( wstring const & )
- THROW_SPEC( std::exception );
+ ;
/// For a given word, provides alternate writings of it which are to be looked
/// up alongside with it. Transliteration dictionaries implement this. The
@@ -385,14 +384,14 @@ public:
vector< wstring > const & alts,
wstring const & context = wstring(),
bool ignoreDiacritics = false )
- THROW_SPEC( std::exception )=0;
+ =0;
/// Loads contents of a resource named 'name' into the 'data' vector. This is
/// usually a picture file referenced in the article or something like that.
/// The default implementation always returns the non-existing resource
/// response.
virtual sptr< DataRequest > getResource( string const & /*name*/ )
- THROW_SPEC( std::exception );
+ ;
/// Returns a results of full-text search of given string similar getArticle().
virtual sptr< DataRequest > getSearchResults( QString const & searchString,
@@ -480,6 +479,9 @@ bool needToRebuildIndex( vector< string > const & dictionaryFiles,
/// dictionaries.
QString generateRandomDictionaryId();
+QMap< std::string, sptr< Dictionary::Class > >
+dictToMap( std::vector< sptr< Dictionary::Class > > const & dicts );
+
}
#endif
diff --git a/dictionarybar.cc b/dictionarybar.cc
index 74ff65f1..8ad0ad0c 100644
--- a/dictionarybar.cc
+++ b/dictionarybar.cc
@@ -211,7 +211,7 @@ void DictionaryBar::showContextMenu( QContextMenuEvent * event, bool extended )
{
QString command( editDictionaryCommand );
command.replace( "%GDDICT%", "\"" + dictFilename + "\"" );
- if( !QProcess::startDetached( command ) )
+ if( !QProcess::startDetached( command ,QStringList()) )
QApplication::beep();
}
diff --git a/dictserver.cc b/dictserver.cc
index fdc464e5..65761655 100644
--- a/dictserver.cc
+++ b/dictserver.cc
@@ -103,7 +103,7 @@ bool connectToServer( QTcpSocket & socket, QString const & url,
QString authCommand = QString( "AUTH " );
QString authString = msgId;
- int pos = serverUrl.userInfo().indexOf( QRegExp( "[:;]" ) );
+ int pos = serverUrl.userInfo().indexOf( QRegularExpression( "[:;]" ) );
if( pos > 0 )
{
authCommand += serverUrl.userInfo().left( pos );
@@ -200,11 +200,11 @@ public:
if( pos < 0 )
url = "dict://" + url;
- databases = database_.split( QRegExp( "[ ,;]" ), Qt::SkipEmptyParts );
+ databases = database_.split( QRegularExpression( "[ ,;]" ), Qt::SkipEmptyParts );
if( databases.isEmpty() )
databases.append( "*" );
- strategies = strategies_.split( QRegExp( "[ ,;]" ), Qt::SkipEmptyParts );
+ strategies = strategies_.split( QRegularExpression( "[ ,;]" ), Qt::SkipEmptyParts );
if( strategies.isEmpty() )
strategies.append( "prefix" );
}
@@ -222,11 +222,11 @@ public:
{ return 0; }
virtual sptr< WordSearchRequest > prefixMatch( wstring const &,
- unsigned long maxResults ) THROW_SPEC( std::exception );
+ unsigned long maxResults ) ;
virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts,
wstring const &, bool )
- THROW_SPEC( std::exception );
+ ;
virtual quint32 getLangFrom() const
{ return langId; }
@@ -830,7 +830,7 @@ void DictServerArticleRequest::run()
while( it.hasNext() )
{
QRegularExpressionMatch match = it.next();
- articleNewText += articleText.midRef( pos, match.capturedStart() - pos );
+ articleNewText += articleText.mid( pos, match.capturedStart() - pos );
pos = match.capturedEnd();
QString phonetic_text = match.captured( 1 );
@@ -840,7 +840,7 @@ void DictServerArticleRequest::run()
}
if( pos )
{
- articleNewText += articleText.midRef( pos );
+ articleNewText += articleText.mid( pos );
articleText = articleNewText;
articleNewText.clear();
}
@@ -852,7 +852,7 @@ void DictServerArticleRequest::run()
while( it.hasNext() )
{
QRegularExpressionMatch match = it.next();
- articleNewText += articleText.midRef( pos, match.capturedStart() - pos );
+ articleNewText += articleText.mid( pos, match.capturedStart() - pos );
pos = match.capturedEnd();
QString link = match.captured( 1 );
@@ -866,7 +866,7 @@ void DictServerArticleRequest::run()
}
if( pos )
{
- articleNewText += articleText.midRef( pos );
+ articleNewText += articleText.mid( pos );
articleText = articleNewText;
articleNewText.clear();
}
@@ -918,7 +918,7 @@ void DictServerArticleRequest::cancel()
sptr< WordSearchRequest > DictServerDictionary::prefixMatch( wstring const & word,
unsigned long maxResults )
- THROW_SPEC( std::exception )
+
{
(void) maxResults;
if ( word.size() > 80 )
@@ -934,7 +934,7 @@ sptr< WordSearchRequest > DictServerDictionary::prefixMatch( wstring const & wor
sptr< DataRequest > DictServerDictionary::getArticle( wstring const & word,
vector< wstring > const &,
wstring const &, bool )
- THROW_SPEC( std::exception )
+
{
if ( word.size() > 80 )
{
@@ -949,7 +949,7 @@ sptr< DataRequest > DictServerDictionary::getArticle( wstring const & word,
} // Anonimuos namespace
vector< sptr< Dictionary::Class > > makeDictionaries( Config::DictServers const & servers )
- THROW_SPEC( std::exception )
+
{
vector< sptr< Dictionary::Class > > result;
diff --git a/dictserver.hh b/dictserver.hh
index 39d093e5..fa387d8a 100644
--- a/dictserver.hh
+++ b/dictserver.hh
@@ -12,7 +12,7 @@ using std::string;
vector< sptr< Dictionary::Class > > makeDictionaries(
Config::DictServers const & servers )
- THROW_SPEC( std::exception );
+ ;
}
diff --git a/dictzip.c b/dictzip.c
index fd362239..1ac3c62d 100644
--- a/dictzip.c
+++ b/dictzip.c
@@ -349,11 +349,13 @@ static enum DZ_ERRORS dict_read_header( const char *filename,
}
header->chunks = xmalloc( sizeof( header->chunks[0] )
* header->chunkCount );
- if( header->chunks == 0 ) {
- return DZ_ERR_NOMEMORY;
- }
+ if( header->chunks == 0 )
+ {
+ fclose( str );
+ return DZ_ERR_NOMEMORY;
+ }
- for (i = 0; i < header->chunkCount; i++) {
+ for (i = 0; i < header->chunkCount; i++) {
header->chunks[i] = getc( str ) << 0;
header->chunks[i] |= getc( str ) << 8;
}
diff --git a/docs/_config.yml b/docs/_config.yml
new file mode 100644
index 00000000..c4192631
--- /dev/null
+++ b/docs/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-cayman
\ No newline at end of file
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 00000000..c3569675
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,22 @@
+## Welcome to GitHub Pages
+
+This page serves as a release note page
+
+### Releases
+
+https://github.com/xiaoyifang/goldendict/releases
+
+
+### version guideline
+https://github.com/xiaoyifang/goldendict/wiki/Version--guideline
+
+the first version has been named as 22.2.xxx.commit_hash.
+
+22 means 2022 year.
+
+2 means 2th month of the year.
+
+
+### Support or Contact
+
+Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out.
diff --git a/dsl.cc b/dsl.cc
index 6be3be6d..b6b845a1 100644
--- a/dsl.cc
+++ b/dsl.cc
@@ -217,10 +217,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
- THROW_SPEC( std::exception );
+ ;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
- THROW_SPEC( std::exception );
+ ;
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
int searchMode, bool matchCase,
@@ -580,7 +580,7 @@ void DslDictionary::loadArticle( uint32_t address,
if ( !articleBody )
{
// throw exCantReadFile( getDictionaryFilenames()[ 0 ] );
- articleData = GD_NATIVE_TO_WS( L"\n\r\t" ) + gd::toWString( QString( "DICTZIP error: " ) + dict_error_str( dz ) );
+articleData = U"\n\r\t" + gd::toWString( QString( "DICTZIP error: " ) + dict_error_str( dz ) );
}
else
{
@@ -616,7 +616,7 @@ void DslDictionary::loadArticle( uint32_t address,
{
size_t begin = pos;
- pos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), begin );
+ pos = articleData.find_first_of( U"\n\r" , begin );
if ( pos == wstring::npos )
pos = articleData.size();
@@ -741,7 +741,7 @@ void DslDictionary::loadArticle( uint32_t address,
if( insidedCard )
{
// Check for next insided headword
- wstring::size_type hpos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), pos );
+ wstring::size_type hpos = articleData.find_first_of( U"\n\r" , pos );
if ( hpos == wstring::npos )
hpos = articleData.size();
@@ -820,13 +820,11 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
return result;
}
- if ( node.tagName == GD_NATIVE_TO_WS( L"b" ) )
+ if( node.tagName == U"b" )
result += "" + processNodeChildren( node ) + "";
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"i" ) )
+ else if( node.tagName == U"i" )
result += "" + processNodeChildren( node ) + "";
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"u" ) )
+ else if( node.tagName == U"u" )
{
string nodeText = processNodeChildren( node );
@@ -836,39 +834,32 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
result += "" + nodeText + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"c" ) )
+ else if( node.tagName == U"c" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"*" ) )
+ else if( node.tagName == U"*" )
{
string id = "O" + getId().substr( 0, 7 ) + "_" +
QString::number( articleNom ).toStdString() +
"_opt_" + QString::number( optionalPartNom++ ).toStdString();
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"m" ) )
- result += "" + processNodeChildren( node ) + "
";
+ else if( node.tagName == U"m" )
+ result += "" + processNodeChildren( node ) + "
";
else
if ( node.tagName.size() == 2 && node.tagName[ 0 ] == L'm' &&
iswdigit( node.tagName[ 1 ] ) )
result += "" + processNodeChildren( node ) + "
";
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"trn" ) )
+ else if( node.tagName == U"trn" )
result += "" + processNodeChildren( node ) + "";
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"ex" ) )
+ else if( node.tagName == U"ex" )
result += "" + processNodeChildren( node ) + "";
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"com" ) )
+ else if( node.tagName == U"com" )
result += "" + processNodeChildren( node ) + "";
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"s" ) || node.tagName == GD_NATIVE_TO_WS( L"video" ) )
+ else if( node.tagName == U"s" || node.tagName == U"video" )
{
string filename = Filetype::simplifyString( Utf8::encode( node.renderAsText() ), false );
string n = resourceDir1 + FsEncoding::encode( filename );
@@ -1013,8 +1004,7 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
+ "\">" + processNodeChildren( node ) + "";
}
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"url" ) )
+ else if( node.tagName == U"url" )
{
string link = Html::escape( Filetype::simplifyString( Utf8::encode( node.renderAsText() ), false ) );
if( QUrl::fromEncoded( link.c_str() ).scheme().isEmpty() )
@@ -1037,13 +1027,11 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"!trs" ) )
+ else if( node.tagName == U"!trs" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"p") )
+ else if( node.tagName == U"p" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"'" ) )
+ else if( node.tagName == U"'" )
{
// There are two ways to display the stress: by adding an accent sign or via font styles.
// We generate two spans, one with accented data and another one without it, so the
@@ -1101,8 +1088,7 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
+ "" + data + Utf8::encode( wstring( 1, 0x301 ) )
+ "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"lang" ) )
+ else if( node.tagName == U"lang" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"ref" ) )
+ else if( node.tagName == U"ref" )
{
QUrl url;
@@ -1158,8 +1143,7 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
result += string( ""
+ processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"@" ) )
+ else if( node.tagName == U"@" )
{
// Special case - insided card header was not parsed
@@ -1174,23 +1158,19 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
result += string( ""
+ processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"sub" ) )
+ else if( node.tagName == U"sub" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"sup" ) )
+ else if( node.tagName == U"sup" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"t" ) )
+ else if( node.tagName == U"t" )
{
result += "" + processNodeChildren( node ) + "";
}
- else
- if ( node.tagName == GD_NATIVE_TO_WS( L"br" ) )
+ else if( node.tagName == U"br" )
{
result += "
";
}
@@ -1377,7 +1357,7 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword,
{
size_t begin = pos;
- pos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), begin );
+ pos = articleData.find_first_of( U"\n\r" , begin );
if ( articleHeadword.empty() )
{
@@ -1445,7 +1425,7 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword,
if( insidedCard )
{
// Check for next insided headword
- wstring::size_type hpos = articleData.find_first_of( GD_NATIVE_TO_WS( L"\n\r" ), pos );
+ wstring::size_type hpos = articleData.find_first_of( U"\n\r" , pos );
if ( hpos == wstring::npos )
hpos = articleData.size();
@@ -1797,7 +1777,7 @@ sptr< Dictionary::DataRequest > DslDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
- THROW_SPEC( std::exception )
+
{
return new DslArticleRequest( word, alts, *this, ignoreDiacritics );
}
@@ -1983,7 +1963,7 @@ void DslResourceRequest::run()
}
sptr< Dictionary::DataRequest > DslDictionary::getResource( string const & name )
- THROW_SPEC( std::exception )
+
{
return new DslResourceRequest( *this, name );
}
@@ -2008,7 +1988,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing & initializing,
int maxPictureWidth, unsigned int maxHeadwordSize )
- THROW_SPEC( std::exception )
+
{
vector< sptr< Dictionary::Class > > dictionaries;
@@ -2075,37 +2055,37 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
try { // Here we intercept any errors during the read to save line at
// which the incident happened. We need alive scanner for that.
- if ( scanner.getDictionaryName() == GD_NATIVE_TO_WS( L"Abbrev" ) )
- continue; // For now just skip abbreviations
+ if( scanner.getDictionaryName() == U"Abbrev" )
+ continue; // For now just skip abbreviations
- // Building the index
- initializing.indexingDictionary( Utf8::encode( scanner.getDictionaryName() ) );
+ // Building the index
+ initializing.indexingDictionary( Utf8::encode( scanner.getDictionaryName() ) );
- gdDebug( "Dsl: Building the index for dictionary: %s\n",
- gd::toQString( scanner.getDictionaryName() ).toUtf8().data() );
+ gdDebug( "Dsl: Building the index for dictionary: %s\n",
+ gd::toQString( scanner.getDictionaryName() ).toUtf8().data() );
- File::Class idx( indexFile, "wb" );
+ File::Class idx( indexFile, "wb" );
- IdxHeader idxHeader;
+ IdxHeader idxHeader;
- memset( &idxHeader, 0, sizeof( idxHeader ) );
+ memset( &idxHeader, 0, sizeof( idxHeader ) );
- // We write a dummy header first. At the end of the process the header
- // will be rewritten with the right values.
+ // We write a dummy header first. At the end of the process the header
+ // will be rewritten with the right values.
- idx.write( idxHeader );
+ idx.write( idxHeader );
- string dictionaryName = Utf8::encode( scanner.getDictionaryName() );
+ string dictionaryName = Utf8::encode( scanner.getDictionaryName() );
- idx.write( (uint32_t) dictionaryName.size() );
- idx.write( dictionaryName.data(), dictionaryName.size() );
+ idx.write( (uint32_t)dictionaryName.size() );
+ idx.write( dictionaryName.data(), dictionaryName.size() );
- string soundDictName = Utf8::encode( scanner.getSoundDictionaryName() );
- if( !soundDictName.empty() )
- {
- idxHeader.hasSoundDictionaryName = 1;
- idx.write( (uint32_t) soundDictName.size() );
- idx.write( soundDictName.data(), soundDictName.size() );
+ string soundDictName = Utf8::encode( scanner.getSoundDictionaryName() );
+ if( !soundDictName.empty() )
+ {
+ idxHeader.hasSoundDictionaryName = 1;
+ idx.write( (uint32_t)soundDictName.size() );
+ idx.write( soundDictName.data(), soundDictName.size() );
}
idxHeader.dslEncoding = scanner.getEncoding();
@@ -2163,7 +2143,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
if ( eof )
break;
- curString.erase( 0, curString.find_first_not_of( GD_NATIVE_TO_WS( L" \t" ) ) );
+ curString.erase( 0, curString.find_first_not_of( U" \t" ) );
if ( keys.size() )
expandTildes( curString, keys.front() );
diff --git a/dsl.hh b/dsl.hh
index 958cbed0..8641723f 100644
--- a/dsl.hh
+++ b/dsl.hh
@@ -17,7 +17,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing &,
int maxPictureWidth, unsigned int maxHeadwordSize )
- THROW_SPEC( std::exception );
+ ;
}
diff --git a/dsl_details.cc b/dsl_details.cc
index 843224f4..ddc02922 100644
--- a/dsl_details.cc
+++ b/dsl_details.cc
@@ -144,12 +144,10 @@ string findCodeForDslId( int id )
bool isAtSignFirst( wstring const & str )
{
// Test if '@' is first in string except spaces and dsl tags
- QRegExp reg( "[ \\t]*(?:\\[[^\\]]+\\][ \\t]*)*@", Qt::CaseInsensitive, QRegExp::RegExp2 );
- return reg.indexIn( gd::toQString( str ) ) == 0;
+ QRegularExpression reg( "[ \\t]*(?:\\[[^\\]]+\\][ \\t]*)*@", QRegularExpression::PatternOption::CaseInsensitiveOption);
+ return gd::toQString( str ).indexOf (reg) == 0;
}
-
-
/////////////// ArticleDom
wstring ArticleDom::Node::renderAsText( bool stripTrsTag ) const
@@ -160,7 +158,7 @@ wstring ArticleDom::Node::renderAsText( bool stripTrsTag ) const
wstring result;
for( list< Node >::const_iterator i = begin(); i != end(); ++i )
- if( !stripTrsTag || i->tagName != GD_NATIVE_TO_WS( L"!trs" ) )
+ if( !stripTrsTag || i->tagName != U"!trs" )
result += i->renderAsText( stripTrsTag );
return result;
@@ -169,8 +167,7 @@ wstring ArticleDom::Node::renderAsText( bool stripTrsTag ) const
// Returns true if src == 'm' and dest is 'mX', where X is a digit
static inline bool checkM( wstring const & dest, wstring const & src )
{
- return ( src == GD_NATIVE_TO_WS( L"m" ) && dest.size() == 2 &&
- dest[ 0 ] == L'm' && iswdigit( dest[ 1 ] ) );
+ return ( src == U"m" && dest.size() == 2 && dest[ 0 ] == L'm' && iswdigit( dest[ 1 ] ) );
}
ArticleDom::ArticleDom( wstring const & str, string const & dictName,
@@ -252,7 +249,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
wstring linkText = Folding::trimWhitespace( *entry );
ArticleDom nodeDom( linkText, dictName, headword_ );
- Node link( Node::Tag(), GD_NATIVE_TO_WS( L"@" ), wstring() );
+ Node link( Node::Tag(), U"@" , wstring() );
for( Node::iterator n = nodeDom.root.begin(); n != nodeDom.root.end(); ++n )
link.push_back( *n );
@@ -262,13 +259,13 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
{
root.push_back( link );
if( entry != allLinkEntries.end() ) // Add line break before next entry
- root.push_back( Node( Node::Tag(), GD_NATIVE_TO_WS( L"br" ), wstring() ) );
+ root.push_back( Node( Node::Tag(), U"br" , wstring() ) );
}
else
{
stack.back()->push_back( link );
if( entry != allLinkEntries.end() )
- stack.back()->push_back( Node( Node::Tag(), GD_NATIVE_TO_WS( L"br" ), wstring() ) );
+ stack.back()->push_back( Node( Node::Tag(), U"br" , wstring() ) );
}
}
@@ -349,7 +346,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
}
// If the tag is [t], we update the transcriptionCount
- if ( name == GD_NATIVE_TO_WS( L"t" ) )
+ if( name == U"t" )
{
if ( isClosing )
{
@@ -361,7 +358,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
}
// If the tag is [s], we update the mediaCount
- if ( name == GD_NATIVE_TO_WS( L"s" ) )
+ if( name == U"s" )
{
if ( isClosing )
{
@@ -374,14 +371,13 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
if ( !isClosing )
{
- if ( name == GD_NATIVE_TO_WS( L"m" ) ||
- ( name.size() == 2 && name[ 0 ] == L'm' && iswdigit( name[ 1 ] ) ) )
+ if( name == U"m" || ( name.size() == 2 && name[ 0 ] == L'm' && iswdigit( name[ 1 ] ) ) )
{
// Opening an 'mX' or 'm' tag closes any previous 'm' tag
- closeTag( GD_NATIVE_TO_WS( L"m" ), stack, false );
+ closeTag( U"m" , stack, false );
}
openTag( name, attrs, stack );
- if ( name == GD_NATIVE_TO_WS( L"br" ) )
+ if( name == U"br" )
{
// [br] tag don't have closing tag
closeTag( name, stack );
@@ -465,7 +461,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
processUnsortedParts( linkText, true );
ArticleDom nodeDom( linkText, dictName, headword_ );
- Node link( Node::Tag(), GD_NATIVE_TO_WS( L"ref" ), wstring() );
+ Node link( Node::Tag(), U"ref" , wstring() );
for( Node::iterator n = nodeDom.root.begin(); n != nodeDom.root.end(); ++n )
link.push_back( *n );
@@ -640,7 +636,7 @@ void ArticleDom::openTag( wstring const & name,
{
list< Node > nodesToReopen;
- if( name == GD_NATIVE_TO_WS( L"m" ) || checkM( name, GD_NATIVE_TO_WS( L"m" ) ) )
+ if( name == U"m" || checkM( name, U"m" ) )
{
// All tags above [m] tag will be closed and reopened after
// to avoid break this tag by closing some other tag.
@@ -734,7 +730,7 @@ void ArticleDom::closeTag( wstring const & name,
nodesToReopen.push_back( Node( Node::Tag(), stack.back()->tagName,
stack.back()->tagAttrs ) );
- if ( stack.back()->empty() && stack.back()->tagName != GD_NATIVE_TO_WS( L"br" ) )
+ if( stack.back()->empty() && stack.back()->tagName != U"br" )
{
// Empty nodes except [br] tag are deleted since they're no use
@@ -780,7 +776,7 @@ void ArticleDom::closeTag( wstring const & name,
}
}
-void ArticleDom::nextChar() THROW_SPEC( eot )
+void ArticleDom::nextChar()
{
if ( !*stringPos )
throw eot();
@@ -825,7 +821,7 @@ bool ArticleDom::atSignFirstInLine()
/////////////// DslScanner
-DslScanner::DslScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex ):
+DslScanner::DslScanner( string const & fileName ) :
encoding( Utf8::Windows1252 ), readBufferPtr( readBuffer ),
readBufferLeft( 0 ), linesRead( 0 )
{
@@ -917,19 +913,15 @@ DslScanner::DslScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex ):
bool isLangTo = false;
bool isSoundDict = false;
- if ( !str.compare( 0, 5, GD_NATIVE_TO_WS( L"#NAME" ), 5 ) )
+ if( !str.compare( 0, 5, U"#NAME" , 5 ) )
isName = true;
- else
- if ( !str.compare( 0, 15, GD_NATIVE_TO_WS( L"#INDEX_LANGUAGE" ), 15 ) )
+ else if( !str.compare( 0, 15, U"#INDEX_LANGUAGE" , 15 ) )
isLangFrom = true;
- else
- if ( !str.compare( 0, 18, GD_NATIVE_TO_WS( L"#CONTENTS_LANGUAGE" ), 18 ) )
+ else if( !str.compare( 0, 18, U"#CONTENTS_LANGUAGE" , 18 ) )
isLangTo = true;
- else
- if ( !str.compare( 0, 17, GD_NATIVE_TO_WS( L"#SOUND_DICTIONARY" ), 17 ) )
+ else if( !str.compare( 0, 17, U"#SOUND_DICTIONARY" , 17 ) )
isSoundDict = true;
- else
- if ( str.compare( 0, 17, GD_NATIVE_TO_WS( L"#SOURCE_CODE_PAGE" ), 17 ) )
+ else if( str.compare( 0, 17, U"#SOURCE_CODE_PAGE" , 17 ) )
continue;
// Locate the argument
@@ -962,14 +954,11 @@ DslScanner::DslScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex ):
// We don't need that!
GD_FDPRINTF( stderr, "Warning: encoding was specified in a Unicode file, ignoring.\n" );
}
- else
- if ( !wcscasecmp( arg.c_str(), GD_NATIVE_TO_WS( L"Latin" ) ) )
+ else if( !arg.compare( U"Latin" ) )
encoding = Utf8::Windows1252;
- else
- if ( !wcscasecmp( arg.c_str(), GD_NATIVE_TO_WS( L"Cyrillic" ) ) )
+ else if( !arg.compare( U"Cyrillic" ) )
encoding = Utf8::Windows1251;
- else
- if ( !wcscasecmp( arg.c_str(), GD_NATIVE_TO_WS( L"EasternEuropean" ) ) )
+ else if( !arg.compare( U"EasternEuropean" ) )
encoding = Utf8::Windows1250;
else
{
@@ -995,8 +984,7 @@ DslScanner::~DslScanner() throw()
gzclose( f );
}
-bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_word ) THROW_SPEC( Ex,
- Iconv::Ex )
+bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_word )
{
offset = (size_t)( gztell( f ) - readBufferLeft/*+pos*/ );
@@ -1042,7 +1030,7 @@ bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_wo
#ifdef __WIN32
out=line.toStdU32String();
#else
- out=line.toStdWString();
+ out=line.toStdU32String();
#endif
return true;
@@ -1050,7 +1038,7 @@ bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_wo
}
bool DslScanner::readNextLineWithoutComments( wstring & out, size_t & offset , bool only_headword)
- THROW_SPEC( Ex, Iconv::Ex )
+
{
wstring str;
bool commentToNextLine = false;
@@ -1163,6 +1151,12 @@ void expandOptionalParts( wstring & str, list< wstring > * result,
list< wstring > * headwords;
headwords = inside_recurse ? result : &expanded;
+ //if str is too long ,it can never be headwords.
+ //todo?
+ if( str.size() > 100 )
+ {
+ return;
+ }
for( ; x < str.size(); )
{
wchar ch = str[ x ];
@@ -1257,8 +1251,8 @@ void expandOptionalParts( wstring & str, list< wstring > * result,
}
}
-static const wstring openBraces( GD_NATIVE_TO_WS( L"{{" ) );
-static const wstring closeBraces( GD_NATIVE_TO_WS( L"}}" ) );
+static const wstring openBraces( U"{{" );
+static const wstring closeBraces( U"}}" );
void stripComments( wstring & str, bool & nextLine )
{
@@ -1357,11 +1351,11 @@ namespace
quint32 dslLanguageToId( wstring const & name )
{
- static wstring newSp( GD_NATIVE_TO_WS( L"newspelling" ) );
- static wstring st( GD_NATIVE_TO_WS( L"standard" ) );
- static wstring ms( GD_NATIVE_TO_WS( L"modernsort" ) );
- static wstring ts( GD_NATIVE_TO_WS( L"traditionalsort" ) );
- static wstring prc( GD_NATIVE_TO_WS( L"prc" ) );
+ static wstring newSp( U"newspelling" );
+ static wstring st( U"standard" );
+ static wstring ms( U"modernsort" );
+ static wstring ts( U"traditionalsort" );
+ static wstring prc( U"prc" );
// Any of those endings are to be removed
diff --git a/dsl_details.hh b/dsl_details.hh
index 0b22335d..2349c349 100644
--- a/dsl_details.hh
+++ b/dsl_details.hh
@@ -10,7 +10,11 @@
#include
#include "dictionary.hh"
#include "iconv.hh"
+#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#else
#include
+#endif
#include
#include "utf8.hh"
@@ -91,7 +95,7 @@ private:
unsigned transcriptionCount; // >0 = inside a [t] tag
unsigned mediaCount; // >0 = inside a [s] tag
- void nextChar() THROW_SPEC( eot );
+ void nextChar() ;
/// Information for diagnostic purposes
string dictionaryName;
@@ -125,7 +129,7 @@ public:
DEF_EX( exUnknownCodePage, "The .dsl file specified an unknown code page", Ex )
DEF_EX( exEncodingError, "Encoding error", Ex ) // Should never happen really
- DslScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex );
+ DslScanner( string const & fileName ) ;
~DslScanner() throw();
/// Returns the detected encoding of this file.
@@ -154,10 +158,10 @@ public:
/// If end of file is reached, false is returned.
/// Reading begins from the first line after the headers (ones which start
/// with #).
- bool readNextLine( wstring &, size_t & offset, bool only_head_word = false ) THROW_SPEC( Ex, Iconv::Ex );
+ bool readNextLine( wstring &, size_t & offset, bool only_head_word = false ) ;
/// Similar readNextLine but strip all DSL comments {{...}}
- bool readNextLineWithoutComments( wstring &, size_t & offset, bool only_headword = false ) THROW_SPEC( Ex, Iconv::Ex );
+ bool readNextLineWithoutComments( wstring &, size_t & offset, bool only_headword = false ) ;
/// Returns the number of lines read so far from the file.
unsigned getLinesRead() const
diff --git a/editdictionaries.cc b/editdictionaries.cc
index 239dca5b..37626f16 100644
--- a/editdictionaries.cc
+++ b/editdictionaries.cc
@@ -11,17 +11,19 @@ using std::vector;
EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
vector< sptr< Dictionary::Class > > & dictionaries_,
+ QMap > & dictMap_,
Instances::Groups & groupInstances_,
QNetworkAccessManager & dictNetMgr_ ):
QDialog( parent, Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ),
cfg( cfg_ ),
dictionaries( dictionaries_ ),
+ dictMap(dictMap_),
groupInstances( groupInstances_ ),
dictNetMgr( dictNetMgr_ ),
origCfg( cfg ),
sources( this, cfg ),
orderAndProps( new OrderAndProps( this, cfg.dictionaryOrder, cfg.inactiveDictionaries,
- dictionaries ) ),
+ dictionaries, dictMap ) ),
groups( new Groups( this, dictionaries, cfg.groups, orderAndProps->getCurrentDictionaryOrder() ) ),
dictionariesChanged( false ),
groupsChanged( false ),
@@ -73,8 +75,12 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
void EditDictionaries::editGroup( unsigned id )
{
+ ui.tabs->setTabVisible( 0, false );
+
if ( id == Instances::Group::AllGroupId )
+ {
ui.tabs->setCurrentIndex( 1 );
+ }
else
{
ui.tabs->setCurrentIndex( 2 );
@@ -207,15 +213,14 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
groupInstances.clear(); // Those hold pointers to dictionaries, we need to
// free them.
-
ui.tabs->setUpdatesEnabled( false );
- ui.tabs->removeTab( 1 );
- ui.tabs->removeTab( 1 );
+
+
groups.reset();
orderAndProps.reset();
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
-
+ dictMap = Dictionary::dictToMap(dictionaries);
// If no changes to groups were made, update the original data
bool noGroupEdits = ( origCfg.groups == savedGroups );
@@ -240,13 +245,15 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
if ( rebuildGroups )
{
- orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries );
+ orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries, dictMap );
+ groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() );
+
+ ui.tabs->removeTab( 1 );
+ ui.tabs->removeTab( 1 );
ui.tabs->insertTab( 1, orderAndProps.get(), QIcon(":/icons/book.svg"), tr( "&Dictionaries" ) );
- groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() );
ui.tabs->insertTab( 2, groups.get(), QIcon(":/icons/bookcase.svg"), tr( "&Groups" ) );
- ui.tabs->setUpdatesEnabled( true );
if ( noGroupEdits )
origCfg.groups = groups->getGroups();
@@ -257,6 +264,8 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
if ( noInactiveEdits )
origCfg.inactiveDictionaries = orderAndProps->getCurrentInactiveDictionaries();
}
+ ui.tabs->setUpdatesEnabled( true );
+
}
void EditDictionaries::helpRequested()
diff --git a/editdictionaries.hh b/editdictionaries.hh
index 14affb18..a6de3819 100644
--- a/editdictionaries.hh
+++ b/editdictionaries.hh
@@ -23,6 +23,7 @@ public:
EditDictionaries( QWidget * parent, Config::Class & cfg,
std::vector< sptr< Dictionary::Class > > & dictionaries,
+ QMap > & dictMap_,
Instances::Groups & groupInstances, // We only clear those on rescan
QNetworkAccessManager & dictNetMgr );
@@ -73,6 +74,7 @@ private:
Config::Class & cfg;
std::vector< sptr< Dictionary::Class > > & dictionaries;
+ QMap > & dictMap;
Instances::Groups & groupInstances;
QNetworkAccessManager & dictNetMgr;
diff --git a/epwing.cc b/epwing.cc
index fa61ed53..cd5eec5c 100644
--- a/epwing.cc
+++ b/epwing.cc
@@ -120,10 +120,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
- THROW_SPEC( std::exception );
+ ;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
- THROW_SPEC( std::exception );
+ ;
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
int searchMode, bool matchCase,
@@ -153,13 +153,13 @@ public:
virtual sptr< Dictionary::WordSearchRequest > prefixMatch( wstring const &,
unsigned long )
- THROW_SPEC( std::exception );
+ ;
virtual sptr< Dictionary::WordSearchRequest > stemmedMatch( wstring const &,
unsigned minLength,
unsigned maxSuffixVariation,
unsigned long maxResults )
- THROW_SPEC( std::exception );
+ ;
protected:
@@ -657,7 +657,7 @@ sptr< Dictionary::DataRequest > EpwingDictionary::getArticle( wstring const & wo
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
- THROW_SPEC( std::exception )
+
{
return new EpwingArticleRequest( word, alts, *this, ignoreDiacritics );
}
@@ -785,7 +785,7 @@ void EpwingResourceRequest::run()
}
sptr< Dictionary::DataRequest > EpwingDictionary::getResource( string const & name )
- THROW_SPEC( std::exception )
+
{
return new EpwingResourceRequest( *this, name );
}
@@ -932,7 +932,7 @@ void EpwingWordSearchRequest::findMatches()
sptr< Dictionary::WordSearchRequest > EpwingDictionary::prefixMatch(
wstring const & str, unsigned long maxResults )
- THROW_SPEC( std::exception )
+
{
return new EpwingWordSearchRequest( *this, str, 0, -1, true, maxResults );
}
@@ -940,7 +940,7 @@ sptr< Dictionary::WordSearchRequest > EpwingDictionary::prefixMatch(
sptr< Dictionary::WordSearchRequest > EpwingDictionary::stemmedMatch(
wstring const & str, unsigned minLength, unsigned maxSuffixVariation,
unsigned long maxResults )
- THROW_SPEC( std::exception )
+
{
return new EpwingWordSearchRequest( *this, str, minLength, (int)maxSuffixVariation,
false, maxResults );
@@ -952,14 +952,12 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
- THROW_SPEC( std::exception )
+
{
vector< sptr< Dictionary::Class > > dictionaries;
vector< string > dictFiles;
- QByteArray catName;
- catName += QDir::separator();
- catName += "catalogs";
+ QByteArray catName = QString("%1catalogs").arg(QDir::separator()).toUtf8();
for( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end();
++i )
diff --git a/epwing.hh b/epwing.hh
index 9b94e3d0..8ce85e26 100644
--- a/epwing.hh
+++ b/epwing.hh
@@ -13,7 +13,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
- THROW_SPEC( std::exception );
+ ;
}
#endif // __EPWING_HH__INCLUDED__
diff --git a/epwing_book.cc b/epwing_book.cc
index 18f38298..4ed8c931 100644
--- a/epwing_book.cc
+++ b/epwing_book.cc
@@ -13,6 +13,9 @@
#include "wstring_qt.hh"
#include "folding.hh"
#include "epwing_charmap.hh"
+#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#endif
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
#define _FILE_OFFSET_BITS 64
@@ -550,7 +553,8 @@ bool EpwingBook::setSubBook( int book_nom )
if( f.open( QFile::ReadOnly | QFile::Text ) )
{
QTextStream ts( &f );
- ts.setCodec( "UTF-8" );
+ //todo?
+// ts.setCodec( "UTF-8" );
QString line = ts.readLine();
while( !line.isEmpty() )
@@ -853,7 +857,7 @@ bool EpwingBook::getNextHeadword( EpwingHeadword & head )
{
EB_Position pos;
- QRegExp badLinks( "#(v|n)\\d" );
+ QRegularExpression badLinks( "#(v|n)\\d" );
// At first we check references queue
while( !LinksQueue.isEmpty() )
@@ -1031,7 +1035,8 @@ void EpwingBook::fixHeadword( QString & headword )
return;
QString fixed = headword;
- fixed.remove( QRegExp( "/[^/]+/", Qt::CaseSensitive ) );
+ QRegularExpression leadingSlashRx( "/[^/]+/" );
+ fixed.remove(leadingSlashRx );
if( isHeadwordCorrect( fixed ) )
{
@@ -1202,8 +1207,8 @@ void EpwingBook::finalizeText( QString & text )
// Replace references
int pos = 0;
- QRegExp reg1( "" );
- QRegExp reg2( "" );
+ QRegularExpression reg1( "" );
+ QRegularExpression reg2( "" );
EContainer cont( this, true );
@@ -1239,13 +1244,14 @@ void EpwingBook::finalizeText( QString & text )
QString link = "";
- text.replace( reg1.cap(), link );
+ //todo ? iterate cap ,or replace as a whole?
+ text.replace( reg1, link );
pos = text.indexOf( reg2, pos );
if( pos < 0 )
break;
- text.replace( reg2.cap(), "" );
+ text.replace( reg2, "" );
}
}
@@ -1732,8 +1738,7 @@ QByteArray EpwingBook::handleReference( EB_Hook_Code code, const unsigned int *
if( refOpenCount > refCloseCount )
return QByteArray();
- QString str;
- str.sprintf( "", refOpenCount );
+ QString str=QString( "").arg( refOpenCount );
refOpenCount += 1;
return str.toUtf8();
}
@@ -1747,7 +1752,7 @@ QByteArray EpwingBook::handleReference( EB_Hook_Code code, const unsigned int *
refOffsets.append( argv[ 2 ] );
QString str;
- str.sprintf( "", refCloseCount );
+ str.asprintf( "", refCloseCount );
refCloseCount += 1;
return str.toUtf8();
diff --git a/epwing_book.hh b/epwing_book.hh
index d7be2d3c..5e2b99b5 100644
--- a/epwing_book.hh
+++ b/epwing_book.hh
@@ -12,7 +12,11 @@
#include "mutex.hh"
#include
+#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#else
#include
+#endif
#include
#include
#include
diff --git a/epwing_charmap.cc b/epwing_charmap.cc
index 78994a96..c08c4a65 100644
--- a/epwing_charmap.cc
+++ b/epwing_charmap.cc
@@ -19,9 +19,9 @@ QByteArray EpwingCharmap::mapToUtf8( QString const & code )
return QByteArray();
}
-void EpwingCharmap::addEntry( QString const & code, QChar ch )
+void EpwingCharmap::addEntry( QString const & code, int ch )
{
- charMap[ code ] = ch;
+ charMap[ code ] = QChar(ch);
}
EpwingCharmap::EpwingCharmap()
diff --git a/epwing_charmap.hh b/epwing_charmap.hh
index 37eed5aa..546b10b9 100644
--- a/epwing_charmap.hh
+++ b/epwing_charmap.hh
@@ -20,7 +20,7 @@ public:
private:
EpwingCharmap();
- void addEntry( QString const & code, QChar ch );
+ void addEntry( QString const & code, int ch );
QMap< QString, QChar > charMap;
};
diff --git a/externalviewer.cc b/externalviewer.cc
index 71683fc3..ac76003c 100644
--- a/externalviewer.cc
+++ b/externalviewer.cc
@@ -10,7 +10,7 @@
ExternalViewer::ExternalViewer( const char * data, int size,
QString const & extension, QString const & viewerCmdLine_,
QObject * parent)
- THROW_SPEC( exCantCreateTempFile ):
+ :
QObject( parent ),
tempFile( QDir::temp().filePath( QString( "gd-XXXXXXXX." ) + extension ) ),
viewer( this ),
@@ -31,7 +31,7 @@ ExternalViewer::ExternalViewer( const char * data, int size,
GD_DPRINTF( "%s\n", tempFile.fileName().toLocal8Bit().data() );
}
-void ExternalViewer::start() THROW_SPEC( exCantRunViewer )
+void ExternalViewer::start()
{
connect( &viewer, SIGNAL( finished( int, QProcess::ExitStatus ) ),
this, SLOT( deleteLater() ) );
diff --git a/externalviewer.hh b/externalviewer.hh
index a17f967c..b7bb6ba6 100644
--- a/externalviewer.hh
+++ b/externalviewer.hh
@@ -8,7 +8,6 @@
#include
#include
#include "ex.hh"
-#include "cpp_features.hh"
/// An external viewer, opens resources in other programs
class ExternalViewer: public QObject
@@ -29,11 +28,11 @@ public:
ExternalViewer( const char * data, int size,
QString const & extension, QString const & viewerCmdLine,
QObject * parent = 0 )
- THROW_SPEC( exCantCreateTempFile );
+ ;
// Once this is called, the object will be deleted when it's done, even if
// the function throws.
- void start() THROW_SPEC( exCantRunViewer );
+ void start() ;
/// If the external process is running, requests its termination and returns
/// false - expect the QObject::destroyed() signal to be emitted soon.
diff --git a/extlineedit.cc b/extlineedit.cc
index ecaa7bda..e2ba7de3 100644
--- a/extlineedit.cc
+++ b/extlineedit.cc
@@ -110,14 +110,12 @@ void ExtLineEdit::updateButtonPositions()
iconPos = (iconPos == Left ? Right : Left);
if (iconPos == ExtLineEdit::Right) {
- int right;
- getTextMargins(0, 0, &right, 0);
- const int iconoffset = right + 4;
+ QMargins qm=textMargins();
+ const int iconoffset = qm.right() + 4;
iconButtons[i]->setGeometry(contentRect.adjusted(width() - iconoffset, 0, 0, 0));
} else {
- int left;
- getTextMargins(&left, 0, 0, 0);
- const int iconoffset = left + 4;
+ QMargins qm=textMargins();
+ const int iconoffset = qm.left() + 4;
iconButtons[i]->setGeometry(contentRect.adjusted(0, 0, -width() + iconoffset, 0));
}
}
diff --git a/favoritespanewidget.cc b/favoritespanewidget.cc
index 392b4156..c5e4847e 100644
--- a/favoritespanewidget.cc
+++ b/favoritespanewidget.cc
@@ -907,7 +907,8 @@ void FavoritesModel::removeItemsForIndexes( const QModelIndexList & idxList )
for( int i = lowestLevel; i >= 0; i-- )
{
QModelIndexList idxSublist = itemsToDelete[ i ];
- std::sort( idxSublist.begin(), idxSublist.end(), qGreater< QModelIndex >() );
+ // std::greater does not work as operator < not implemented
+ std::sort( idxSublist.begin(), idxSublist.end(), std::not2( std::less< QModelIndex >() ) );
it = idxSublist.begin();
for( ; it != idxSublist.end(); ++it )
diff --git a/ffmpegaudio.cc b/ffmpegaudio.cc
index e38f8bc6..172185ec 100644
--- a/ffmpegaudio.cc
+++ b/ffmpegaudio.cc
@@ -52,9 +52,6 @@ AudioService & AudioService::instance()
AudioService::AudioService()
{
-#if LIBAVFORMAT_VERSION_MAJOR < 58 || ( LIBAVFORMAT_VERSION_MAJOR == 58 && LIBAVFORMAT_VERSION_MINOR < 9 )
- av_register_all();
-#endif
ao_initialize();
}
@@ -94,7 +91,11 @@ struct DecoderContext
QByteArray audioData_;
QDataStream audioDataStream_;
AVFormatContext * formatContext_;
+#if LIBAVCODEC_VERSION_MAJOR < 59
AVCodec * codec_;
+#else
+ const AVCodec * codec_;
+#endif
AVCodecContext * codecContext_;
AVIOContext * avioContext_;
AVStream * audioStream_;
@@ -151,11 +152,8 @@ bool DecoderContext::openCodec( QString & errorString )
return false;
}
-#if LIBAVCODEC_VERSION_MAJOR < 56 || ( LIBAVCODEC_VERSION_MAJOR == 56 && LIBAVCODEC_VERSION_MINOR < 56 )
- unsigned char * avioBuffer = ( unsigned char * )av_malloc( kBufferSize + FF_INPUT_BUFFER_PADDING_SIZE );
-#else
unsigned char * avioBuffer = ( unsigned char * )av_malloc( kBufferSize + AV_INPUT_BUFFER_PADDING_SIZE );
-#endif
+
if ( !avioBuffer )
{
errorString = QObject::tr( "av_malloc() failed." );
@@ -198,11 +196,7 @@ bool DecoderContext::openCodec( QString & errorString )
// Find audio stream, use the first audio stream if available
for ( unsigned i = 0; i < formatContext_->nb_streams; i++ )
{
-#if LIBAVCODEC_VERSION_MAJOR < 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR < 33 )
- if ( formatContext_->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO )
-#else
- if ( formatContext_->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO )
-#endif
+ if ( formatContext_->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO )
{
audioStream_ = formatContext_->streams[i];
break;
@@ -214,15 +208,6 @@ bool DecoderContext::openCodec( QString & errorString )
return false;
}
-#if LIBAVCODEC_VERSION_MAJOR < 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR < 33 )
- codecContext_ = audioStream_->codec;
- codec_ = avcodec_find_decoder( codecContext_->codec_id );
- if ( !codec_ )
- {
- errorString = QObject::tr( "Codec [id: %1] not found." ).arg( codecContext_->codec_id );
- return false;
- }
-#else
codec_ = avcodec_find_decoder( audioStream_->codecpar->codec_id );
if ( !codec_ )
{
@@ -236,7 +221,6 @@ bool DecoderContext::openCodec( QString & errorString )
return false;
}
avcodec_parameters_to_context( codecContext_, audioStream_->codecpar );
-#endif
ret = avcodec_open2( codecContext_, codec_, NULL );
if ( ret < 0 )
@@ -313,9 +297,7 @@ void DecoderContext::closeCodec()
{
audioStream_->discard = AVDISCARD_ALL;
avcodec_close( codecContext_ );
-#if LIBAVCODEC_VERSION_MAJOR > 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR >= 33 )
avcodec_free_context( &codecContext_ );
-#endif
}
avformat_close_input( &formatContext_ );
@@ -397,11 +379,7 @@ void DecoderContext::closeOutputDevice()
bool DecoderContext::play( QString & errorString )
{
-#if LIBAVCODEC_VERSION_MAJOR < 55 || ( LIBAVCODEC_VERSION_MAJOR == 55 && LIBAVCODEC_VERSION_MINOR < 28 )
- AVFrame * frame = avcodec_alloc_frame();
-#else
AVFrame * frame = av_frame_alloc();
-#endif
if ( !frame )
{
errorString = QObject::tr( "avcodec_alloc_frame() failed." );
@@ -417,22 +395,6 @@ bool DecoderContext::play( QString & errorString )
if ( packet.stream_index == audioStream_->index )
{
AVPacket pack = packet;
-#if LIBAVCODEC_VERSION_MAJOR < 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR < 37 )
- int gotFrame = 0;
- do
- {
- int len = avcodec_decode_audio4( codecContext_, frame, &gotFrame, &pack );
- if ( !Utils::AtomicInt::loadAcquire( isCancelled_ ) && gotFrame )
- {
- playFrame( frame );
- }
- if( len <= 0 || Utils::AtomicInt::loadAcquire( isCancelled_ ) )
- break;
- pack.size -= len;
- pack.data += len;
- }
- while( pack.size > 0 );
-#else
int ret = avcodec_send_packet( codecContext_, &pack );
/* read all the output frames (in general there may be any number of them) */
while( ret >= 0 )
@@ -444,30 +406,13 @@ bool DecoderContext::play( QString & errorString )
playFrame( frame );
}
-#endif
+
}
- // av_free_packet() must be called after each call to av_read_frame()
-#if LIBAVCODEC_VERSION_MAJOR < 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR < 7 )
- av_free_packet( &packet );
-#else
+
av_packet_unref( &packet );
-#endif
+
}
-#if LIBAVCODEC_VERSION_MAJOR < 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR < 37 )
- if ( !Utils::AtomicInt::loadAcquire( isCancelled_ ) &&
- codecContext_->codec->capabilities & CODEC_CAP_DELAY )
- {
- av_init_packet( &packet );
- int gotFrame = 0;
- while ( avcodec_decode_audio4( codecContext_, frame, &gotFrame, &packet ) >= 0 && gotFrame )
- {
- if ( Utils::AtomicInt::loadAcquire( isCancelled_ ) )
- break;
- playFrame( frame );
- }
- }
-#else
/* flush the decoder */
av_init_packet( &packet );
packet.data = NULL;
@@ -480,28 +425,10 @@ bool DecoderContext::play( QString & errorString )
break;
playFrame( frame );
}
-#endif
-
-#if LIBAVCODEC_VERSION_MAJOR < 54
- av_free( frame );
-#elif LIBAVCODEC_VERSION_MAJOR < 55 || ( LIBAVCODEC_VERSION_MAJOR == 55 && LIBAVCODEC_VERSION_MINOR < 28 )
- avcodec_free_frame( &frame );
-#else
av_frame_free( &frame );
-#endif
-
return true;
}
-static inline int32_t toInt32( double v )
-{
- if ( v >= 1.0 )
- return 0x7fffffffL;
- else if ( v <= -1.0 )
- return 0x80000000L;
- return floor( v * 2147483648.0 );
-}
-
bool DecoderContext::normalizeAudio( AVFrame * frame, vector & samples )
{
int lineSize = 0;
diff --git a/file.cc b/file.cc
index bfb9514e..9391028a 100644
--- a/file.cc
+++ b/file.cc
@@ -88,7 +88,7 @@ bool exists( char const * filename ) throw()
#endif
}
-void Class::open( char const * filename, char const * mode ) THROW_SPEC( exCantOpen )
+void Class::open( char const * filename, char const * mode )
{
QFile::OpenMode openMode = QIODevice::Text;
const char * pch = mode;
@@ -118,19 +118,19 @@ void Class::open( char const * filename, char const * mode ) THROW_SPEC( exCantO
throw exCantOpen( std::string( filename ) + ": " + f.errorString().toUtf8().data() );
}
-Class::Class( char const * filename, char const * mode ) THROW_SPEC( exCantOpen ):
+Class::Class( char const * filename, char const * mode ) :
writeBuffer( 0 )
{
open( filename, mode );
}
Class::Class( std::string const & filename, char const * mode )
- THROW_SPEC( exCantOpen ): writeBuffer( 0 )
+ : writeBuffer( 0 )
{
open( filename.c_str(), mode );
}
-void Class::read( void * buf, qint64 size ) THROW_SPEC( exReadError, exWriteError )
+void Class::read( void * buf, qint64 size )
{
if ( !size )
return;
@@ -144,7 +144,7 @@ void Class::read( void * buf, qint64 size ) THROW_SPEC( exReadError, exWriteErro
throw exReadError();
}
-size_t Class::readRecords( void * buf, qint64 size, size_t count ) THROW_SPEC( exWriteError )
+size_t Class::readRecords( void * buf, qint64 size, size_t count )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -153,7 +153,7 @@ size_t Class::readRecords( void * buf, qint64 size, size_t count ) THROW_SPEC( e
return result < 0 ? result : result / size;
}
-void Class::write( void const * buf, qint64 size ) THROW_SPEC( exWriteError, exAllocation )
+void Class::write( void const * buf, qint64 size )
{
if ( !size )
return;
@@ -201,7 +201,7 @@ void Class::write( void const * buf, qint64 size ) THROW_SPEC( exWriteError, exA
}
size_t Class::writeRecords( void const * buf, qint64 size, size_t count )
- THROW_SPEC( exWriteError )
+
{
flushWriteBuffer();
@@ -210,7 +210,7 @@ size_t Class::writeRecords( void const * buf, qint64 size, size_t count )
}
char * Class::gets( char * s, int size, bool stripNl )
- THROW_SPEC( exWriteError )
+
{
if ( writeBuffer )
flushWriteBuffer();
@@ -237,7 +237,7 @@ char * Class::gets( char * s, int size, bool stripNl )
return result;
}
-std::string Class::gets( bool stripNl ) THROW_SPEC( exReadError, exWriteError )
+std::string Class::gets( bool stripNl )
{
char buf[ 1024 ];
@@ -247,7 +247,7 @@ std::string Class::gets( bool stripNl ) THROW_SPEC( exReadError, exWriteError )
return std::string( buf );
}
-void Class::seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
+void Class::seek( qint64 offset )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -256,7 +256,7 @@ void Class::seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError();
}
-void Class::seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
+void Class::seekCur( qint64 offset )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -265,7 +265,7 @@ void Class::seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError();
}
-void Class::seekEnd( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
+void Class::seekEnd( qint64 offset )
{
if ( writeBuffer )
flushWriteBuffer();
@@ -274,12 +274,12 @@ void Class::seekEnd( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError();
}
-void Class::rewind() THROW_SPEC( exSeekError, exWriteError )
+void Class::rewind()
{
seek( 0 );
}
-qint64 Class::tell() THROW_SPEC( exSeekError )
+qint64 Class::tell()
{
qint64 result = f.pos();
@@ -292,7 +292,7 @@ qint64 Class::tell() THROW_SPEC( exSeekError )
return result;
}
-bool Class::eof() THROW_SPEC( exWriteError )
+bool Class::eof()
{
if ( writeBuffer )
flushWriteBuffer();
@@ -300,14 +300,14 @@ bool Class::eof() THROW_SPEC( exWriteError )
return f.atEnd();
}
-QFile & Class::file() THROW_SPEC( exWriteError )
+QFile & Class::file()
{
flushWriteBuffer();
return f;
}
-void Class::close() THROW_SPEC( exWriteError )
+void Class::close()
{
releaseWriteBuffer();
f.close();
@@ -328,7 +328,7 @@ Class::~Class() throw()
}
}
-void Class::flushWriteBuffer() THROW_SPEC( exWriteError )
+void Class::flushWriteBuffer()
{
if ( writeBuffer && writeBufferLeft != WriteBufferSize )
{
@@ -341,7 +341,7 @@ void Class::flushWriteBuffer() THROW_SPEC( exWriteError )
}
}
-void Class::releaseWriteBuffer() THROW_SPEC( exWriteError )
+void Class::releaseWriteBuffer()
{
flushWriteBuffer();
diff --git a/file.hh b/file.hh
index 5bcd2ec1..81281647 100644
--- a/file.hh
+++ b/file.hh
@@ -8,7 +8,6 @@
#include
#include
#include
-#include "cpp_features.hh"
#include "ex.hh"
/// A simple wrapper over FILE * operations with added write-buffering,
@@ -42,29 +41,29 @@ class Class
char * writeBuffer;
qint64 writeBufferLeft;
- void open( char const * filename, char const * mode ) THROW_SPEC( exCantOpen );
+ void open( char const * filename, char const * mode ) ;
public:
- Class( char const * filename, char const * mode ) THROW_SPEC( exCantOpen );
+ Class( char const * filename, char const * mode ) ;
- Class( std::string const & filename, char const * mode ) THROW_SPEC( exCantOpen );
+ Class( std::string const & filename, char const * mode ) ;
/// Reads the number of bytes to the buffer, throws an error if it
/// failed to fill the whole buffer (short read, i/o error etc).
- void read( void * buf, qint64 size ) THROW_SPEC( exReadError, exWriteError );
+ void read( void * buf, qint64 size ) ;
template< typename T >
- void read( T & value ) THROW_SPEC( exReadError, exWriteError )
+ void read( T & value )
{ read( &value, sizeof( value ) ); }
template< typename T >
- T read() THROW_SPEC( exReadError, exWriteError )
+ T read()
{ T value; read( value ); return value; }
/// Attempts reading at most 'count' records sized 'size'. Returns
/// the number of records it managed to read, up to 'count'.
- size_t readRecords( void * buf, qint64 size, size_t count ) THROW_SPEC( exWriteError );
+ size_t readRecords( void * buf, qint64 size, size_t count ) ;
/// Writes the number of bytes from the buffer, throws an error if it
/// failed to write the whole buffer (short write, i/o error etc).
@@ -72,10 +71,10 @@ public:
/// end up on disk immediately, or a short write may occur later
/// than it really did. If you don't want write buffering, use
/// writeRecords() function instead.
- void write( void const * buf, qint64 size ) THROW_SPEC( exWriteError, exAllocation );
+ void write( void const * buf, qint64 size ) ;
template< typename T >
- void write( T const & value ) THROW_SPEC( exWriteError )
+ void write( T const & value )
{ write( &value, sizeof( value ) ); }
/// Attempts writing at most 'count' records sized 'size'. Returns
@@ -83,46 +82,46 @@ public:
/// This function does not employ buffering, but flushes the buffer if it
/// was used before.
size_t writeRecords( void const * buf, qint64 size, size_t count )
- THROW_SPEC( exWriteError );
+ ;
/// Reads a string from the file. Unlike the normal fgets(), this one
/// can strip the trailing newline character, if this was requested.
/// Returns either s or 0 if no characters were read.
- char * gets( char * s, int size, bool stripNl = false ) THROW_SPEC( exWriteError );
+ char * gets( char * s, int size, bool stripNl = false ) ;
/// Like the above, but uses its own local internal buffer (1024 bytes
/// currently), and strips newlines by default.
- std::string gets( bool stripNl = true ) THROW_SPEC( exReadError, exWriteError );
+ std::string gets( bool stripNl = true ) ;
/// Seeks in the file, relative to its beginning.
- void seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError );
+ void seek( qint64 offset ) ;
/// Seeks in the file, relative to the current position.
- void seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError );
+ void seekCur( qint64 offset ) ;
/// Seeks in the file, relative to the end of file.
- void seekEnd( qint64 offset = 0 ) THROW_SPEC( exSeekError, exWriteError );
+ void seekEnd( qint64 offset = 0 ) ;
/// Seeks to the beginning of file
- void rewind() THROW_SPEC( exSeekError, exWriteError );
+ void rewind() ;
/// Tells the current position within the file, relative to its beginning.
- qint64 tell() THROW_SPEC( exSeekError );
+ qint64 tell() ;
/// Returns true if end-of-file condition is set.
- bool eof() THROW_SPEC( exWriteError );
+ bool eof() ;
/// Returns the underlying FILE * record, so other operations can be
/// performed on it.
- QFile & file() THROW_SPEC( exWriteError );
+ QFile & file() ;
/// Closes the file. No further operations are valid.
- void close() THROW_SPEC( exWriteError );
+ void close() ;
~Class() throw();
private:
- void flushWriteBuffer() THROW_SPEC( exWriteError );
- void releaseWriteBuffer() THROW_SPEC( exWriteError );
+ void flushWriteBuffer() ;
+ void releaseWriteBuffer() ;
};
}
diff --git a/flags/folder.png b/flags/folder.png
index fc6f17e9..1c5f38d5 100644
Binary files a/flags/folder.png and b/flags/folder.png differ
diff --git a/folding.cc b/folding.cc
index 2efab88c..6136b817 100644
--- a/folding.cc
+++ b/folding.cc
@@ -622,6 +622,8 @@ wstring trimWhitespaceOrPunct( wstring const & in )
wstring trimWhitespace( wstring const & in )
{
+ if( in.empty() )
+ return in;
wchar const * wordBegin = in.c_str();
wstring::size_type wordSize = in.size();
diff --git a/forvo.cc b/forvo.cc
index 2014f93c..3488a085 100644
--- a/forvo.cc
+++ b/forvo.cc
@@ -55,7 +55,7 @@ public:
{ return 0; }
virtual sptr< WordSearchRequest > prefixMatch( wstring const & /*word*/,
- unsigned long /*maxResults*/ ) THROW_SPEC( std::exception )
+ unsigned long /*maxResults*/ )
{
sptr< WordSearchRequestInstant > sr = new WordSearchRequestInstant;
@@ -66,7 +66,7 @@ public:
virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts,
wstring const &, bool )
- THROW_SPEC( std::exception );
+ ;
protected:
@@ -77,7 +77,7 @@ protected:
sptr< DataRequest > ForvoDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &, bool )
- THROW_SPEC( std::exception )
+
{
if ( word.size() > 80 )
{
@@ -347,7 +347,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
Dictionary::Initializing &,
Config::Forvo const & forvo,
QNetworkAccessManager & mgr )
- THROW_SPEC( std::exception )
+
{
vector< sptr< Dictionary::Class > > result;
diff --git a/forvo.hh b/forvo.hh
index c9588ed6..0607ba79 100644
--- a/forvo.hh
+++ b/forvo.hh
@@ -21,7 +21,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
Dictionary::Initializing &,
Config::Forvo const &,
QNetworkAccessManager & )
- THROW_SPEC( std::exception );
+ ;
/// Exposed here for moc
class ForvoArticleRequest: public Dictionary::DataRequest
diff --git a/ftshelpers.cc b/ftshelpers.cc
index d3920b64..0d775282 100644
--- a/ftshelpers.cc
+++ b/ftshelpers.cc
@@ -71,10 +71,10 @@ bool parseSearchString( QString const & str, QStringList & indexWords,
{
searchWords.clear();
indexWords.clear();
- QRegExp spacesRegExp( "\\W+" );
- QRegExp wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}" );
- QRegExp setsRegExp( "\\[[^\\]]+\\]", Qt::CaseInsensitive, QRegExp::RegExp2 );
- QRegExp regexRegExp( "\\\\[afnrtvdDwWsSbB]|\\\\x([0-9A-Fa-f]{4})|\\\\0([0-7]{3})", Qt::CaseSensitive, QRegExp::RegExp2 );
+ QRegularExpression spacesRegExp( "\\W+" );
+ QRegularExpression wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}" );
+ QRegularExpression setsRegExp( "\\[[^\\]]+\\]", QRegularExpression::CaseInsensitiveOption );
+ QRegularExpression regexRegExp( "\\\\[afnrtvdDwWsSbB]|\\\\x([0-9A-Fa-f]{4})|\\\\0([0-7]{3})", QRegularExpression::CaseInsensitiveOption);
hasCJK = false;
for( int x = 0; x < str.size(); x++ )
diff --git a/ftshelpers.hh b/ftshelpers.hh
index 0c3530aa..f8392d09 100644
--- a/ftshelpers.hh
+++ b/ftshelpers.hh
@@ -2,7 +2,11 @@
#define __FTSHELPERS_HH_INCLUDED__
#include
+#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#else
#include
+#endif
#include
#include
#include
diff --git a/fulltextsearch.cc b/fulltextsearch.cc
index a7ad4595..02b24dce 100644
--- a/fulltextsearch.cc
+++ b/fulltextsearch.cc
@@ -17,6 +17,7 @@
#include "initializing.hh"
#include
#include
+#include
#endif
@@ -248,8 +249,7 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,
oldBarStyle = 0;
- if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA
- && ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based )
+ if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7
&& !IsThemeActive() )
{
QStyle * barStyle = WindowsStyle::instance().getStyle();
@@ -649,7 +649,7 @@ Q_UNUSED( parent );
for( int x = 0; x < hws.length(); x++ )
{
- QList< FtsHeadword >::iterator it = qBinaryFind( headwords.begin(), headwords.end(), hws.at( x ) );
+ QList< FtsHeadword >::iterator it = std::lower_bound( headwords.begin(), headwords.end(), hws.at( x ) );
if( it != headwords.end() )
{
it->dictIDs.push_back( hws.at( x ).dictIDs.front() );
diff --git a/fulltextsearch.hh b/fulltextsearch.hh
index 75586cf3..e588b3ae 100644
--- a/fulltextsearch.hh
+++ b/fulltextsearch.hh
@@ -3,7 +3,11 @@
#include
#include
+#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#else
#include
+#endif
#include
#include
#include
diff --git a/gddebug.cc b/gddebug.cc
index 57cd7ab1..df57aa5d 100644
--- a/gddebug.cc
+++ b/gddebug.cc
@@ -1,9 +1,13 @@
/* This file is (c) 2013 Abs62
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
-#include
#include
#include "gddebug.hh"
+#if(QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#else
+#include
+#endif
QFile * logFilePtr;
static QTextCodec * utf8Codec;
@@ -23,7 +27,7 @@ QTextCodec *localeCodec = 0;
QTextCodec::setCodecForLocale( utf8Codec );
}
- qWarning( "%s", QString().vsprintf( msg, ap ).toUtf8().data() );
+ qWarning( "%s", QString().vasprintf( msg, ap ).toUtf8().data() );
if( logFilePtr && logFilePtr->isOpen() )
{
@@ -48,7 +52,7 @@ QTextCodec *localeCodec = 0;
QTextCodec::setCodecForLocale( utf8Codec );
}
- qDebug( "%s", QString().vsprintf( msg, ap ).toUtf8().data() );
+ qDebug( "%s", QString().vasprintf( msg, ap ).toUtf8().data() );
if( logFilePtr && logFilePtr->isOpen() )
{
diff --git a/generators/Makefile b/generators/Makefile
deleted file mode 100644
index 635ab062..00000000
--- a/generators/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-
-.PHONY: all clean
-
-all: ../inc_case_folding.hh ../inc_diacritic_folding.hh
-
-generate: generate.cc
- c++ -W -Wall $< -o $@
-
-../inc_case_folding.hh ../inc_diacritic_folding.hh: CaseFolding.txt DiacriticFolding.txt generate
- ./generate
-
-clean:
- rm -f generate
diff --git a/german.cc b/german.cc
index 402896c3..7caaadaf 100644
--- a/german.cc
+++ b/german.cc
@@ -40,7 +40,7 @@ GermanTable::GermanTable()
}
-sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception )
+sptr< Dictionary::Class > makeDictionary()
{
static GermanTable t;
diff --git a/german.hh b/german.hh
index d4c82d32..38afbe71 100644
--- a/german.hh
+++ b/german.hh
@@ -9,7 +9,7 @@
// Support for German transliteration
namespace GermanTranslit {
-sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception );
+sptr< Dictionary::Class > makeDictionary() ;
}
diff --git a/gls.cc b/gls.cc
index d1fc2c13..3bc28fc1 100644
--- a/gls.cc
+++ b/gls.cc
@@ -32,7 +32,11 @@
#include
#include
-
+#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
+#include
+#else
+#include
+#endif
#include
#include
#include