Merge branch 'staged' into dev

This commit is contained in:
Xiao YiFang 2022-06-17 21:47:32 +08:00
commit 815a7d7fa3
4 changed files with 18 additions and 14 deletions

View file

@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
qt_ver: [6.2.4,6.3.1]
qt_ver: [6.3.1]
qt_arch: [gcc_64]
env:
version: 22.5.22
@ -65,21 +65,18 @@ jobs:
qmake CONFIG+=release PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support
make INSTALL_ROOT=appdir -j`nproc` install; find appdir/
ls -al appdir
#copy missing shared dll to appdir.
mkdir -p appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep gobject ) appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep libpango ) appdir/usr/lib
# mkdir -p appdir/usr/lib
# cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep gobject ) appdir/usr/lib
# cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep libpango ) appdir/usr/lib
- name: Build AppImage
run: |
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod a+x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/org.goldendict.GoldenDict.desktop
# - uses: actions/upload-artifact@v2
# with:
# name: AppImage
# path: './*.AppImage*'
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x appimagetool-*.AppImage
./appimagetool-*.AppImage -s deploy appdir/usr/share/applications/*.desktop # Bundle EVERYTHING
# ./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/org.goldendict.GoldenDict.desktop
- name: Generate changelog
if: ${{!env.prerelease}}
id: changelog1

View file

@ -139,6 +139,8 @@ char * Reader::getBlock( uint32_t address, vector< char > & chunk )
// file.seek( offsets[ chunkIdx ] );
Mutex::Lock _( file.lock );
auto bytes = file.map( offsets[ chunkIdx ], 8 );
if( bytes == nullptr )
throw mapFailed();
auto qBytes = QByteArray::fromRawData( reinterpret_cast< char * >(bytes), 8 );
QDataStream in( qBytes );
in.setByteOrder( QDataStream::LittleEndian );
@ -153,7 +155,8 @@ char * Reader::getBlock( uint32_t address, vector< char > & chunk )
// vector< unsigned char > compressedData( compressedSize );
auto chunkDataBytes = file.map( offsets[ chunkIdx ] + 8, compressedSize );
if( chunkDataBytes == nullptr )
throw mapFailed();
// file.read( &compressedData.front(), compressedData.size() );
auto autoUnmap = qScopeGuard(
[ & ] {

View file

@ -25,6 +25,7 @@ DEF_EX( Ex, "Chunked storage exception", std::exception )
DEF_EX( exFailedToCompressChunk, "Failed to compress a chunk", Ex )
DEF_EX( exAddressOutOfRange, "The given chunked address is out of range", Ex )
DEF_EX( exFailedToDecompressChunk, "Failed to decompress a chunk", Ex )
DEF_EX( mapFailed, "Failed to map/unmap the file", Ex )
/// This class writes data blocks in chunks.
class Writer

View file

@ -458,7 +458,10 @@ void FTSResultsRequest::checkArticles( QVector< uint32_t > const & offsets,
for( auto & address : offsets )
{
if( Utils::AtomicInt::loadAcquire( isCancelled ) )
{
synchronizer.setCancelOnWait(true);
return;
}
sem.acquire();
QFuture< void > f = QtConcurrent::run(
[ & ]()