Merge pull request #1791 from xiaoyifang/staged
Some checks failed
Release AutoTag / Build (push) Has been cancelled
Release macOS / Build (macos-12, clang_64, 6.6.3) (push) Has been cancelled
Release macOS / Build (macos-12, clang_64, 6.7.3) (push) Has been cancelled
Release macOS / Build (macos-14, clang_64, 6.6.3) (push) Has been cancelled
Release macOS / Build (macos-14, clang_64, 6.7.3) (push) Has been cancelled
Release Windows CMake / Build (windows-2022, win64_msvc2019_64, 6.6.3) (push) Has been cancelled
Release Windows CMake / Build (windows-2022, win64_msvc2019_64, 6.7.3) (push) Has been cancelled

dev: make new test build
This commit is contained in:
shenleban tongying 2024-09-30 00:37:24 -04:00 committed by GitHub
commit c0c164c439
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
94 changed files with 84773 additions and 85209 deletions

View file

@ -86,7 +86,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 6.7.2
version: 6.7.3
arch: win64_msvc2019_64
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
setup-python: 'false'

View file

@ -22,8 +22,8 @@ jobs:
runs-on: ubuntu-latest
env:
version: 24.05.13
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'NextNameHere' }}
version: 24.11.0
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:

View file

@ -23,12 +23,12 @@ jobs:
strategy:
matrix:
os: [macos-12,macos-14]
qt_ver: [ 6.7.2,6.6.3 ]
qt_ver: [ 6.7.3,6.6.3 ]
qt_arch: [clang_64]
env:
targetName: GoldenDict
version: 24.05.13
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'NextNameHere' }}
version: 24.11.0
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:
- uses: actions/checkout@v4

View file

@ -21,11 +21,11 @@ jobs:
strategy:
matrix:
os: [windows-2022]
qt_ver: [ 6.7.2, 6.6.3 ]
qt_ver: [ 6.7.3, 6.6.3 ]
qt_arch: [win64_msvc2019_64]
env:
version: 24.05.13
versionSuffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'NextNameHere' }}
version: 24.11.0
versionSuffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:
- name: Install Qt

View file

@ -47,7 +47,7 @@ endif ()
include(FeatureSummary)
project(goldendict-ng
VERSION 24.05.13
VERSION 24.11.0
LANGUAGES CXX C)
set(GOLDENDICT "goldendict") # binary/executable name
@ -167,6 +167,7 @@ target_include_directories(${GOLDENDICT} PRIVATE
${PROJECT_SOURCE_DIR}/src/
${PROJECT_SOURCE_DIR}/src/common
${PROJECT_SOURCE_DIR}/src/dict
${PROJECT_SOURCE_DIR}/src/dict/utils
${PROJECT_SOURCE_DIR}/src/ui
)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,52 +1,17 @@
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef __WSTRING_HH_INCLUDED__
#define __WSTRING_HH_INCLUDED__
#pragma once
#include <string>
/// While most systems feature a 4-byte wchar_t and an UCS-4 Unicode
/// characters representation for it, Windows uses 2-byte wchar_t and an UTF-16
/// encoding. The use of UTF-16 on Windows is most probably a homeage to an
/// ancient history dating back to when there was nothing but a BMP, and
/// all Unicode chars were 2 bytes long. After the Unicode got expanded past
/// two-byte representation, the guys at Microsoft had probably decided that
/// the least painful way to go is to just switch to UTF-16. Or so's the theory.
///
/// Now, the UTF family is an encoding, made for transit purposes -- is not a
/// representation. While it's good for passthrough, it's not directly
/// applicable for manipulation on Unicode symbols. It must be decoded first to
/// a normal UCS. Think like this: UTF to UCS is something like Base64 to ASCII.
/// Aliases for legacy reasons.
///
/// The distinction between Microsoft platform and all other ones is that while
/// the latters are stuck in an 8-bit era and use UTF-8 to pass unicode around
/// through its venerable interfaces, the former one is stuck in a 16-bit era,
/// and uses UTF-16 instead. Neither solution allows for direct processing of
/// the symbols in those strings without decoding them first. And the 16-bit
/// solution is even more ugly than the 8-bit one, because it doesn't have a
/// benefit of ASCII compatibility, having a much more useless UCS-2
/// compatibility instead. It's stuck in the middle of nowhere, really.
/// For new code, just use the standardized std::u32string for UTF-32 strings instead.
///
/// The question is, what are we going to do with all this? When we do Unicode
/// processing in GoldenDict, we want to use real Unicode characters, not some
/// UTF-16 encoded ones. To that end, we have two options under Windows: first,
/// use QString, and second, use basic_string< unsigned int >.
/// While we use QStrings for the GUI and other non-critical code, there is a
/// serious doubt on the efficiency of QStrings for bulk text processing. And
/// since a lot of code uses wstring already, it would be much easier to convert
/// it to use basic_string< unsigned int > instead, since it shares the same
/// template, and therefore the interface too, with wstring. That's why we
/// introduce our own gd::wstring and gd::wchar types here. On all systems but
/// Windows, they are equivalent to std::wstring and wchar_t. On Windows, they
/// are basic_string< unsigned int > and unsigned int.
///
///
/// Now we have a better built-in type as char32_t and std::u32string
namespace gd {
typedef char32_t wchar;
typedef std::u32string wstring;
} // namespace gd
#endif

View file

@ -1157,7 +1157,8 @@ Class load()
c.showingDictBarNames = ( root.namedItem( "showingDictBarNames" ).toElement().text() == "1" );
c.usingSmallIconsInToolbars = ( root.namedItem( "usingSmallIconsInToolbars" ).toElement().text() == "1" );
c.usingToolbarsIconSize =
( static_cast< ToolbarsIconSize >( root.namedItem( "usingToolbarsIconSize" ).toElement().text().toInt() ) );
if ( !root.namedItem( "historyExportPath" ).isNull() )
c.historyExportPath = root.namedItem( "historyExportPath" ).toElement().text();
@ -2151,8 +2152,8 @@ void save( Class const & c )
opt.appendChild( dd.createTextNode( c.showingDictBarNames ? "1" : "0" ) );
root.appendChild( opt );
opt = dd.createElement( "usingSmallIconsInToolbars" );
opt.appendChild( dd.createTextNode( c.usingSmallIconsInToolbars ? "1" : "0" ) );
opt = dd.createElement( "usingToolbarsIconSize" );
opt.appendChild( dd.createTextNode( QString::number( static_cast< int >( c.usingToolbarsIconSize ) ) ) );
root.appendChild( opt );
if ( !c.historyExportPath.isEmpty() ) {

View file

@ -820,6 +820,13 @@ struct HeadwordsDialog
}
};
// TODO: arbitrary sizing
enum class ToolbarsIconSize : std::uint8_t {
Small = 0,
Normal = 1,
Large = 2,
};
struct Class
{
Paths paths;
@ -868,7 +875,7 @@ struct Class
bool showingDictBarNames;
bool usingSmallIconsInToolbars;
ToolbarsIconSize usingToolbarsIconSize = ToolbarsIconSize::Normal;
/// Maximum size for the headwords.
/// Bigger headwords won't be indexed. For now, only in DSL.
@ -885,7 +892,6 @@ struct Class
lastPopupGroupId( 0 ),
pinPopupWindow( false ),
showingDictBarNames( false ),
usingSmallIconsInToolbars( false ),
maxHeadwordSize( 256U ),
maxHeadwordsToExpand( 0 )
{

View file

@ -67,31 +67,23 @@ struct AAR_header
char indexItemFormat[ 4 ];
char keyLengthFormat[ 2 ];
char articleLengthFormat[ 2 ];
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( AAR_header ) == 1 );
struct IndexElement
{
quint32 wordOffset;
quint32 articleOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IndexElement ) == 1 );
struct IndexElement64
{
quint32 wordOffset;
quint64 articleOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IndexElement64 ) == 1 );
enum {
Signature = 0x58524141, // AARX on little-endian, XRAA on big-endian
@ -109,12 +101,8 @@ struct IdxHeader
quint32 articleCount;
quint32 langFrom; // Source language
quint32 langTo; // Target language
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )

View file

@ -5,7 +5,7 @@
#include "bgl_babylon.hh"
#include "btreeidx.hh"
#include "chunkedstorage.hh"
#include "file.hh"
#include "dictfile.hh"
#include "folding.hh"
#include "ftshelpers.hh"
#include "gddebug.hh"
@ -53,6 +53,8 @@ enum {
CurrentFormatVersion = 19 + BtreeIndexing::FormatVersion
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, BGLX
@ -77,11 +79,9 @@ struct IdxHeader
uint32_t iconSize; // Size of the icon in the chunks' storage, 0 = no icon
uint32_t descriptionAddress; // Address of the dictionary description in the chunks' storage
uint32_t descriptionSize; // Size of the description in the chunks' storage, 0 = no description
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -5,7 +5,7 @@
#define __BTREEIDX_HH_INCLUDED__
#include "dict/dictionary.hh"
#include "file.hh"
#include "dictfile.hh"
#include <algorithm>
#include <map>

View file

@ -5,7 +5,7 @@
#define __CHUNKEDSTORAGE_HH_INCLUDED__
#include "ex.hh"
#include "file.hh"
#include "dictfile.hh"
#include <vector>
#include <stdint.h>

View file

@ -55,6 +55,8 @@ enum {
CurrentFormatVersion = 5 + BtreeIndexing::FormatVersion + Folding::Version
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, DCDX
@ -65,11 +67,10 @@ struct IdxHeader
uint32_t indexRootOffset;
uint32_t langFrom; // Source language
uint32_t langTo; // Target language
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -86,6 +86,8 @@ enum {
CurrentFtsIndexVersion = 7
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, DSLX
@ -93,7 +95,7 @@ struct IdxHeader
uint32_t zipSupportVersion; // Zip support version -- narrows down reindexing
// when it changes only for dictionaries with the
// zip files
int dslEncoding; // Which encoding is used for the file indexed
uint32_t dslEncoding; // Which encoding is used for the file indexed
uint32_t chunksOffset; // The offset to chunks' storage
uint32_t hasAbrv; // Non-zero means file has abrvs at abrvAddress
uint32_t abrvAddress; // Address of abrv map in the chunked storage
@ -109,11 +111,10 @@ struct IdxHeader
uint32_t zipIndexBtreeMaxElements; // Two fields from IndexInfo of the zip
// resource index.
uint32_t zipIndexRootOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
struct InsidedCard
{

View file

@ -60,13 +60,9 @@ struct IdxHeader
quint32 nameSize;
quint32 langFrom; // Source language
quint32 langTo; // Target language
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
#pragma pack( pop )
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -304,6 +304,8 @@ enum {
CurrentFtsIndexVersion = 1
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, GLSX
@ -311,7 +313,7 @@ struct IdxHeader
uint32_t zipSupportVersion; // Zip support version -- narrows down reindexing
// when it changes only for dictionaries with the
// zip files
int glsEncoding; // Which encoding is used for the file indexed
uint32_t glsEncoding; // Which encoding is used for the file indexed
uint32_t chunksOffset; // The offset to chunks' storage
uint32_t indexBtreeMaxElements; // Two fields from IndexInfo
uint32_t indexRootOffset;
@ -324,11 +326,9 @@ struct IdxHeader
uint32_t zipIndexBtreeMaxElements; // Two fields from IndexInfo of the zip
// resource index.
uint32_t zipIndexRootOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile, bool hasZipFile )
{

View file

@ -2,7 +2,7 @@
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "lsa.hh"
#include "file.hh"
#include "dictfile.hh"
#include "iconv.hh"
#include "folding.hh"
#include "utf8.hh"
@ -49,6 +49,8 @@ enum {
CurrentFormatVersion = 5
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, BGLX
@ -57,11 +59,9 @@ struct IdxHeader
uint32_t vorbisOffset; // Offset of the vorbis file which contains all snds
uint32_t indexBtreeMaxElements; // Two fields from IndexInfo
uint32_t indexRootOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -5,7 +5,7 @@
#include "btreeidx.hh"
#include "folding.hh"
#include "utf8.hh"
#include "file.hh"
#include "dictfile.hh"
#include "wstring.hh"
#include "wstring_qt.hh"
#include "chunkedstorage.hh"
@ -62,6 +62,8 @@ enum {
DEF_EX( exCorruptDictionary, "dictionary file was tampered or corrupted", std::exception )
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, MDIC
@ -92,11 +94,9 @@ struct IdxHeader
uint32_t mddIndexInfosOffset; // address of IndexInfos for resource files (.mdd)
uint32_t mddIndexInfosCount; // count of IndexInfos for resource files
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
// A helper method to read resources from .mdd file
class IndexedMdd: public BtreeIndexing::BtreeIndex

View file

@ -68,22 +68,16 @@ struct DCT_header
uint32_t shortIndexOffset;
uint32_t fullIndexOffset;
uint32_t articlesOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( DCT_header ) == 1 );
struct IndexElement
{
uint16_t nextWord;
uint16_t previousWord;
uint32_t articleOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IndexElement ) == 1 );
enum {
Signature = 0x43494453, // SDIC on little-endian, CIDS on big-endian
@ -102,12 +96,8 @@ struct IdxHeader
uint32_t compressionType; // Data compression in file. 0 - no compression, 1 - zip, 2 - bzip2
uint32_t langFrom; // Source language
uint32_t langTo; // Target language
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )

View file

@ -62,13 +62,13 @@ DEF_EX_STR( exNoCodecFound, "No text codec found", Dictionary::Ex )
DEF_EX( exUserAbort, "User abort", Dictionary::Ex )
DEF_EX( exNoResource, "No resource found", Dictionary::Ex )
#pragma pack( push, 1 )
enum {
Signature = 0x58424C53, // SLBX on little-endian, XBLS on big-endian
CurrentFormatVersion = 2 + BtreeIndexing::FormatVersion + Folding::Version
};
#pragma pack( push, 1 )
struct IdxHeader
{
quint32 signature; // First comes the signature, SLBX
@ -81,13 +81,9 @@ struct IdxHeader
quint32 articleCount;
quint32 langFrom; // Source language
quint32 langTo; // Target language
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
#pragma pack( pop )
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
const char SLOB_MAGIC[ 8 ] = { 0x21, 0x2d, 0x31, 0x53, 0x4c, 0x4f, 0x42, 0x1f };

View file

@ -2,7 +2,6 @@
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "sounddir.hh"
#include "file.hh"
#include "folding.hh"
#include "utf8.hh"
#include "btreeidx.hh"
@ -37,6 +36,7 @@ enum {
CurrentFormatVersion = 1 + BtreeIndexing::FormatVersion + Folding::Version
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, SDRX
@ -45,11 +45,9 @@ struct IdxHeader
uint32_t chunksOffset; // The offset to chunks' storage
uint32_t indexBtreeMaxElements; // Two fields from IndexInfo
uint32_t indexRootOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -93,6 +93,7 @@ enum {
CurrentFormatVersion = 9 + BtreeIndexing::FormatVersion + Folding::Version
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, SIDX
@ -110,10 +111,10 @@ struct IdxHeader
uint32_t zipIndexBtreeMaxElements; // Two fields from IndexInfo of the zip
// resource index.
uint32_t zipIndexRootOffset;
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
;
bool indexIsOldOrBad( string const & indexFile )

View file

@ -1,7 +1,7 @@
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "file.hh"
#include "dictfile.hh"
#include "zipfile.hh"

View file

@ -1,4 +1,4 @@
/* Made up from data.c and other supplementary files of dictd-1.0.11 for the
/* Made up from data.c and other supplementary files of dictd-1.11.0 for the
* GoldenDict program.
*/

View file

@ -1,6 +1,9 @@
#ifndef UFILE_HH_INCLUDED
#define UFILE_HH_INCLUDED
// Don't use this thing.
// Use QFile instead.
#ifdef __WIN32
#include "zlib.h"

View file

@ -94,6 +94,7 @@ enum ArticleFormat {
Logical = 2
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, XDXF
@ -118,11 +119,9 @@ struct IdxHeader
// resource index.
uint32_t zipIndexRootOffset;
uint32_t revisionNumber; // Format revision
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -9,7 +9,7 @@
#include "folding.hh"
#include "audiolink.hh"
#include "file.hh"
#include "dictfile.hh"
#include "filetype.hh"
#include "htmlescape.hh"
#include "utils.hh"

View file

@ -11,7 +11,7 @@
#include "utf8.hh"
#include "langcoder.hh"
#include "filetype.hh"
#include "file.hh"
#include "dictfile.hh"
#include "utils.hh"
#include "tiff.hh"
#include "ftshelpers.hh"
@ -66,13 +66,12 @@ DEF_EX( exUserAbort, "User abort", Dictionary::Ex )
using ZimFile = zim::Archive;
#pragma pack( push, 1 )
enum {
Signature = 0x584D495A, // ZIMX on little-endian, XMIZ on big-endian
CurrentFormatVersion = 4 + BtreeIndexing::FormatVersion + Folding::Version
};
#pragma pack( push, 1 )
struct IdxHeader
{
quint32 signature; // First comes the signature, ZIMX
@ -87,12 +86,8 @@ struct IdxHeader
quint32 descriptionPtr;
quint32 langFrom; // Source language
quint32 langTo; // Target language
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
// Some supporting functions

View file

@ -2,7 +2,7 @@
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "zipsounds.hh"
#include "file.hh"
#include "dictfile.hh"
#include "folding.hh"
#include "utf8.hh"
#include "btreeidx.hh"
@ -45,6 +45,7 @@ enum {
CurrentFormatVersion = 6 + BtreeIndexing::FormatVersion
};
#pragma pack( push, 1 )
struct IdxHeader
{
uint32_t signature; // First comes the signature, ZIPS
@ -53,11 +54,9 @@ struct IdxHeader
uint32_t indexBtreeMaxElements; // Two fields from IndexInfo
uint32_t indexRootOffset;
uint32_t chunksOffset; // The offset to chunks' storage
}
#ifndef _MSC_VER
__attribute__( ( packed ) )
#endif
;
};
static_assert( alignof( IdxHeader ) == 1 );
#pragma pack( pop )
bool indexIsOldOrBad( string const & indexFile )
{

View file

@ -6,7 +6,7 @@
#include "fulltextsearch.hh"
#include "ftshelpers.hh"
#include "wstring_qt.hh"
#include "file.hh"
#include "dictfile.hh"
#include "gddebug.hh"
#include "folding.hh"
#include "utils.hh"

View file

@ -92,6 +92,12 @@ void DictionaryBar::setDictionaryIconSize( IconSize size )
setIconSize( normalIconSize );
break;
}
case IconSize::Large: {
auto largeSize = QApplication::style()->pixelMetric( QStyle::PM_LargeIconSize );
setIconSize( { largeSize + 10, largeSize + 10 } ); // the value isn't large enough, so we add 10
break;
}
}
}

View file

@ -38,7 +38,7 @@ public:
enum class IconSize {
Small,
Normal,
// TODO: implement something to have an Large option
Large,
};
void setDictionaryIconSize( IconSize size );

View file

@ -145,6 +145,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
switchToPrevTabAction( this ),
showDictBarNamesAction( tr( "Show Names in Dictionary &Bar" ), this ),
useSmallIconsInToolbarsAction( tr( "Show Small Icons in &Toolbars" ), this ),
useLargeIconsInToolbarsAction( tr( "Show Large Icons in &Toolbars" ), this ),
toggleMenuBarAction( tr( "&Menubar" ), this ),
focusHeadwordsDlgAction( this ),
focusArticleViewAction( this ),
@ -507,10 +508,17 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
// Use small icons in toolbars
useSmallIconsInToolbarsAction.setCheckable( true );
useSmallIconsInToolbarsAction.setChecked( cfg.usingSmallIconsInToolbars );
useSmallIconsInToolbarsAction.setChecked( cfg.usingToolbarsIconSize == Config::ToolbarsIconSize::Small );
connect( &useSmallIconsInToolbarsAction, &QAction::triggered, this, &MainWindow::useSmallIconsInToolbarsTriggered );
// Use large icons in toolbars
useLargeIconsInToolbarsAction.setCheckable( true );
useLargeIconsInToolbarsAction.setChecked( cfg.usingToolbarsIconSize == Config::ToolbarsIconSize::Large );
connect( &useLargeIconsInToolbarsAction, &QAction::triggered, this, &MainWindow::useLargeIconsInToolbarsTriggered );
// Toggle Menubar
toggleMenuBarAction.setCheckable( true );
toggleMenuBarAction.setChecked( !cfg.preferences.hideMenubar );
@ -535,6 +543,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
ui.menuView->addSeparator();
ui.menuView->addAction( &showDictBarNamesAction );
ui.menuView->addAction( &useSmallIconsInToolbarsAction );
ui.menuView->addAction( &useLargeIconsInToolbarsAction );
ui.menuView->addSeparator();
ui.alwaysOnTop->setChecked( cfg.preferences.alwaysOnTop );
ui.menuView->addAction( ui.alwaysOnTop );
@ -905,6 +914,8 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
#endif
useSmallIconsInToolbarsTriggered();
useLargeIconsInToolbarsTriggered();
if ( cfg.preferences.checkForNewReleases ) {
QTimer::singleShot( 0, this, &MainWindow::checkNewRelease );
@ -1655,8 +1666,15 @@ void MainWindow::updateDictionaryBar()
dictionaryBar.setDictionaries( grp->dictionaries );
dictionaryBar.setDictionaryIconSize( useSmallIconsInToolbarsAction.isChecked() ? DictionaryBar::IconSize::Small :
DictionaryBar::IconSize::Normal );
if ( useSmallIconsInToolbarsAction.isChecked() ) {
dictionaryBar.setDictionaryIconSize( DictionaryBar::IconSize::Small );
}
else if ( useLargeIconsInToolbarsAction.isChecked() ) {
dictionaryBar.setDictionaryIconSize( DictionaryBar::IconSize::Large );
}
else {
dictionaryBar.setDictionaryIconSize( DictionaryBar::IconSize::Normal );
}
}
}
@ -1971,7 +1989,7 @@ void MainWindow::updateWindowTitle()
if ( view ) {
QString str = view->getTitle();
if ( !str.isEmpty() ) {
setWindowTitle( tr( "%1 - %2" ).arg( str, "GoldenDict-ng" ) );
setWindowTitle( QString( "%1 - %2" ).arg( str, "GoldenDict-ng" ) );
}
}
}
@ -3010,6 +3028,13 @@ void MainWindow::showDictBarNamesTriggered()
void MainWindow::useSmallIconsInToolbarsTriggered()
{
bool useSmallIcons = useSmallIconsInToolbarsAction.isChecked();
if ( useSmallIcons ) {
cfg.usingToolbarsIconSize = Config::ToolbarsIconSize::Small;
useLargeIconsInToolbarsAction.setChecked( false );
}
else if ( !useLargeIconsInToolbarsAction.isChecked() ) {
cfg.usingToolbarsIconSize = Config::ToolbarsIconSize::Normal;
}
int extent = useSmallIcons ? QApplication::style()->pixelMetric( QStyle::PM_SmallIconSize ) :
QApplication::style()->pixelMetric( QStyle::PM_ToolBarIconSize );
@ -3021,7 +3046,30 @@ void MainWindow::useSmallIconsInToolbarsTriggered()
updateDictionaryBar();
cfg.usingSmallIconsInToolbars = useSmallIcons;
scanPopup->setDictionaryIconSize();
}
void MainWindow::useLargeIconsInToolbarsTriggered()
{
bool useLargeIcons = useLargeIconsInToolbarsAction.isChecked();
if ( useLargeIcons ) {
cfg.usingToolbarsIconSize = Config::ToolbarsIconSize::Large;
useSmallIconsInToolbarsAction.setChecked( false );
}
else if ( !useSmallIconsInToolbarsAction.isChecked() ) {
cfg.usingToolbarsIconSize = Config::ToolbarsIconSize::Normal;
}
int extent = useLargeIcons ? QApplication::style()->pixelMetric( QStyle::PM_LargeIconSize ) :
QApplication::style()->pixelMetric( QStyle::PM_ToolBarIconSize );
navToolbar->setIconSize( QSize( extent, extent ) );
menuButton->setIconSize( QSize( extent, extent ) );
updateDictionaryBar();
scanPopup->setDictionaryIconSize();
}

View file

@ -107,8 +107,8 @@ private:
QAction escAction, focusTranslateLineAction, addTabAction, closeCurrentTabAction, closeAllTabAction,
closeRestTabAction, switchToNextTabAction, switchToPrevTabAction, showDictBarNamesAction,
useSmallIconsInToolbarsAction, toggleMenuBarAction, focusHeadwordsDlgAction, focusArticleViewAction,
addAllTabToFavoritesAction;
useSmallIconsInToolbarsAction, useLargeIconsInToolbarsAction, toggleMenuBarAction, focusHeadwordsDlgAction,
focusArticleViewAction, addAllTabToFavoritesAction;
QAction stopAudioAction;
QToolBar * navToolbar;
@ -408,6 +408,7 @@ private slots:
void showDictBarNamesTriggered();
void useSmallIconsInToolbarsTriggered();
void useLargeIconsInToolbarsTriggered();
void toggleMenuBarTriggered( bool announce = true );
void on_clearHistory_triggered();

View file

@ -553,7 +553,7 @@ void ScanPopup::engagePopup( bool forcePopup, bool giveFocus )
}
if ( ui.pinButton->isChecked() )
setWindowTitle( tr( "%1 - GoldenDict-ng" ).arg( elideInputWord() ) );
setWindowTitle( QString( "%1 - GoldenDict-ng" ).arg( elideInputWord() ) );
/// Too large strings make window expand which is probably not what user
/// wants
@ -916,7 +916,7 @@ void ScanPopup::pinButtonClicked( bool checked )
setAttribute( Qt::WA_MacAlwaysShowToolWindow );
#endif
setWindowTitle( tr( "%1 - GoldenDict-ng" ).arg( elideInputWord() ) );
setWindowTitle( QString( "%1 - GoldenDict-ng" ).arg( elideInputWord() ) );
dictionaryBar.setMovable( true );
hideTimer.stop();
}
@ -1110,10 +1110,18 @@ void ScanPopup::on_goForwardButton_clicked() const
void ScanPopup::setDictionaryIconSize()
{
dictionaryBar.setDictionaryIconSize( cfg.usingSmallIconsInToolbars ? DictionaryBar::IconSize::Small :
DictionaryBar::IconSize::Normal );
if ( cfg.usingToolbarsIconSize == Config::ToolbarsIconSize::Small ) {
dictionaryBar.setDictionaryIconSize( DictionaryBar::IconSize::Small );
}
else if ( cfg.usingToolbarsIconSize == Config::ToolbarsIconSize::Normal ) {
dictionaryBar.setDictionaryIconSize( DictionaryBar::IconSize::Normal );
}
else if ( cfg.usingToolbarsIconSize == Config::ToolbarsIconSize::Large ) {
dictionaryBar.setDictionaryIconSize( DictionaryBar::IconSize::Large );
}
}
void ScanPopup::setGroupByName( QString const & name ) const
{
int i;

View file

@ -41,10 +41,15 @@ Basically, you need those commands:
```shell
cd goldendict-ng && mkdir build_dir
# config step
cmake -S . -B build_dir -G Ninja
cmake -S . -B build_dir
-G "Ninja"/"Unix Makefiles"/"Xcode"... (Optional)
--install-prefix=/usr/local/ (Optional)
-DCMAKE_BUILD_TYPE=Release (Optional)
# actual build
cmake --build build_dir
--parallel 7 (Optional if Ninja was chosen)
cmake --install ./build_dir/
```

View file

@ -3,7 +3,7 @@ This project uses crowdin to organize all the transactions.When some new transac
# how to update the crowdin.ts file
```
lupdate-pro.exe -no-obsolete -no-ui-lines -locations none goldendict.pro -ts locale\crowdin.ts
lupdate.exe -no-obsolete -no-ui-lines -locations none .\src\ -ts .\locale\crowdin.ts
```
the option `-no-obsolete` will remove obsolete items from crowdin.ts file.