diff --git a/.github/workflows/macos-arm-homebrew.yml b/.github/workflows/macos-arm-homebrew.yml index 04778e527..fd76c2bd6 100644 --- a/.github/workflows/macos-arm-homebrew.yml +++ b/.github/workflows/macos-arm-homebrew.yml @@ -47,7 +47,7 @@ jobs: brew install autoconf brew install libtool brew install opencc - brew install automake git lame libass libtool shtool texi2html theora wget xvid nasm + brew install automake libtool brew install libiconv brew install lzo bzip2 diff --git a/.github/workflows/macos-homebrew.yml b/.github/workflows/macos-homebrew.yml index 3e0686e03..ab55bb707 100644 --- a/.github/workflows/macos-homebrew.yml +++ b/.github/workflows/macos-homebrew.yml @@ -47,7 +47,7 @@ jobs: brew install autoconf brew install libtool brew install opencc - brew install automake git lame libass libtool shtool texi2html theora wget xvid nasm + brew install automake libtool brew install libiconv brew install lzo bzip2 diff --git a/src/config.cc b/src/config.cc index 1e25c3f87..d81627808 100644 --- a/src/config.cc +++ b/src/config.cc @@ -632,6 +632,11 @@ Class load() Path( nl.item( x ).toElement().text(), nl.item( x ).toElement().attribute( "recursive" ) == "1" ) ); } + if ( Config::isPortableVersion() && c.paths.empty() ) { + // For portable version, hardcode some settings + c.paths.push_back( Config::Path( Config::getPortableVersionDictionaryDir(), true ) ); + } + QDomNode soundDirs = root.namedItem( "sounddirs" ); if ( !soundDirs.isNull() ) { diff --git a/src/dict/sounddir.cc b/src/dict/sounddir.cc index f0f3b9147..a61852cd8 100644 --- a/src/dict/sounddir.cc +++ b/src/dict/sounddir.cc @@ -17,6 +17,7 @@ #include #include #include +#include namespace SoundDir { @@ -438,7 +439,24 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::SoundDirs const & string indexFile = indicesDir + dictId; - if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( indexFile ) ) { + // Check if the soundDir and its subdirs' modification date changed, that means the user modified the sound files inside + + bool soundDirModified = false; + { + QDateTime indexFileModifyTime = QFileInfo( QString::fromStdString( indexFile ) ).lastModified(); + QDirIterator it( dir.path(), + QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks, + QDirIterator::Subdirectories ); + while ( it.hasNext() ) { + it.next(); + if ( it.fileInfo().lastModified() > indexFileModifyTime ) { + soundDirModified = true; + break; + } + } + } + + if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( indexFile ) || soundDirModified ) { // Building the index qDebug() << "Sounds: Building the index for directory: " << soundDir.path; diff --git a/src/dict/sources.cc b/src/dict/sources.cc index d42baf5b2..87a1d7bb3 100644 --- a/src/dict/sources.cc +++ b/src/dict/sources.cc @@ -1115,13 +1115,6 @@ Qt::ItemFlags PathsModel::flags( QModelIndex const & index ) const { Qt::ItemFlags result = QAbstractItemModel::flags( index ); - if ( Config::isPortableVersion() ) { - if ( index.isValid() && index.row() == 0 ) { - result &= ~Qt::ItemIsSelectable; - result &= ~Qt::ItemIsEnabled; - } - } - if ( index.isValid() && index.column() == 1 ) result |= Qt::ItemIsUserCheckable;