Compare commits

...

8 commits

Author SHA1 Message Date
xiaoyifang 78173e3c5d
New Crowdin updates (#1760)
Some checks failed
SonarCloud / Build and analyze (push) Waiting to run
deploy_website / deploy (push) Has been cancelled
* New translations Hungarian from Crowdin

* New translations French from Crowdin

* New translations Spanish from Crowdin

* New translations Belarusian from Crowdin

* New translations Bulgarian from Crowdin

* New translations Czech from Crowdin

* New translations German from Crowdin

* New translations Greek from Crowdin

* New translations Finnish from Crowdin

* New translations Hungarian from Crowdin

* New translations Italian from Crowdin

* New translations Japanese from Crowdin

* New translations Korean from Crowdin

* New translations Lithuanian from Crowdin

* New translations Macedonian from Crowdin

* New translations Dutch from Crowdin

* New translations Polish from Crowdin

* New translations Portuguese from Crowdin

* New translations Russian from Crowdin

* New translations Slovak from Crowdin

* New translations Albanian from Crowdin

* New translations Serbian (Cyrillic) from Crowdin

* New translations Swedish from Crowdin

* New translations Turkish from Crowdin

* New translations Ukrainian from Crowdin

* New translations Chinese Simplified from Crowdin

* New translations Chinese Traditional from Crowdin

* New translations Vietnamese from Crowdin

* New translations Portuguese, Brazilian from Crowdin

* New translations Persian from Crowdin

* New translations Spanish, Argentina from Crowdin

* New translations Hindi from Crowdin

* New translations Esperanto from Crowdin

* New translations Lojban from Crowdin

* New translations German, Switzerland from Crowdin

* New translations Spanish, Bolivia from Crowdin

* New translations Tajik from Crowdin

* New translations Quechua from Crowdin

* New translations Aymara from Crowdin

* New translations Arabic, Saudi Arabia from Crowdin

* New translations Turkmen from Crowdin

* New translations Interlingue from Crowdin
2024-09-10 13:42:55 +00:00
YiFang Xiao a36f218df2 [ts]update crowdin.ts and document 2024-09-10 21:33:06 +08:00
shenleban tongying b392c83e86
fix: ensure icu4c are copied to app bundle on macOS (#1762)
by explictly linking it
2024-09-10 05:52:23 -04:00
xiaoyifang 39836dc143
Let Crowdin format Hungarian translation (#1757) 2024-09-09 23:35:49 +00:00
shenleban tongying 9a73931d69 fix: add Hungarian to Preferences and minor fix ts file 2024-09-09 19:20:22 -04:00
lionkmp 11717fbf62
feat: Adds Hungarian translation via .ts file (#1752)
* Add original HU translation from orig goldendict

---------

Co-authored-by: shenleban tongying <shenlebantongying@gmail.com>
2024-09-09 22:02:48 +00:00
shenleban tongying 5e62b1c567
fix: consider devicePixelRatio when scaling icons (#1751) 2024-09-09 20:19:56 +00:00
Konstantin aaaeb585b6
feature: High-quality dictionary icons in toolbar (#1750)
* better procedure of image scaling and size choosing
* allow user to set toolbar icon size via qt style sheet

---------

Co-authored-by: shenleban tongying <shenlebantongying@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-09 14:48:33 -04:00
52 changed files with 86925 additions and 83065 deletions

View file

@ -239,7 +239,9 @@ else ()
endif ()
qt_add_translations(${GOLDENDICT} TS_FILES ${TRANS_FILES}
QM_FILES_OUTPUT_VARIABLE qm_files)
QM_FILES_OUTPUT_VARIABLE qm_files
LUPDATE_OPTIONS "-no-ui-lines -locations none -no-obsolete")
add_dependencies(${GOLDENDICT} "release_translations")
#### installation or assemble redistribution

View file

@ -83,6 +83,12 @@ endif ()
if (WITH_ZIM)
pkg_check_modules(ZIM REQUIRED IMPORTED_TARGET libzim)
target_link_libraries(${GOLDENDICT} PRIVATE PkgConfig::ZIM)
if (APPLE)
# For some reason, icu4c as transitive dependency of libzim may not be copied into app bundle,
# so we directly depends on it to help macdeployqt or whatever
pkg_check_modules(BREW_ICU_FOR_LIBZIM_FORCE_LINK REQUIRED IMPORTED_TARGET icu-i18n icu-uc)
target_link_libraries(${GOLDENDICT} PUBLIC PkgConfig::BREW_ICU_FOR_LIBZIM_FORCE_LINK)
endif ()
endif ()
if (USE_SYSTEM_FMT)

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

4287
locale/hu_HU.ts Normal file

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

@ -6,18 +6,15 @@
#include <cstdio>
#include "dictionary.hh"
#include <QCryptographicHash>
// For needToRebuildIndex(), read below
#include <QFileInfo>
#include <QDateTime>
#include "config.hh"
#include <QDir>
#include <QFileInfo>
#include <QCryptographicHash>
#include <QDateTime>
#include <QImage>
#include <QPixmap>
#include <QPainter>
#include <QRegularExpression>
#include "utils.hh"
@ -238,6 +235,11 @@ void Class::loadIcon() noexcept
dictionaryIconLoaded = true;
}
int Class::getOptimalIconSize()
{
return 64 * qGuiApp->devicePixelRatio();
}
bool Class::loadIconFromFile( QString const & _filename, bool isFullName )
{
QFileInfo info;
@ -266,33 +268,14 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName )
}
if ( info.isFile() ) {
QImage img( fileName );
auto iconSize = getOptimalIconSize();
QPixmap img( fileName );
if ( !img.isNull() ) {
// Load successful
//some icon is very large ,will crash the application.
img = img.scaledToWidth( 64 );
// Apply the color key
#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
img.setAlphaChannel( img.createMaskFromColor( QColor( 192, 192, 192 ).rgb(), Qt::MaskOutColor ) );
#endif
// Transform it to be square
int max = img.width() > img.height() ? img.width() : img.height();
QImage result( max, max, QImage::Format_ARGB32 );
result.fill( 0 ); // Black transparent
QPainter painter( &result );
painter.setRenderHint( QPainter::RenderHint::Antialiasing );
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
img.height() == max ? 0 : ( max - img.height() ) / 2 ),
img );
painter.end();
dictionaryIcon = QIcon( QPixmap::fromImage( result ) );
auto result = img.scaled( { iconSize, iconSize }, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation );
dictionaryIcon = QIcon( result );
return !dictionaryIcon.isNull();
}
@ -307,18 +290,12 @@ bool Class::loadIconFromText( QString iconUrl, QString const & text )
QImage img( iconUrl );
if ( !img.isNull() ) {
int iconSize = 64;
//some icon is very large ,will crash the application.
img = img.scaledToWidth( iconSize );
QImage result( iconSize, iconSize, QImage::Format_ARGB32 );
result.fill( 0 ); // Black transparent
int max = img.width() > img.height() ? img.width() : img.height();
auto iconSize = getOptimalIconSize();
QImage result = img.scaled( { iconSize, iconSize }, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation );
QPainter painter( &result );
painter.setRenderHint( QPainter::RenderHint::Antialiasing );
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
img.height() == max ? 0 : ( max - img.height() ) / 2 ),
img );
painter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
painter.setCompositionMode( QPainter::CompositionMode_SourceAtop );
QFont font = painter.font();

View file

@ -12,6 +12,7 @@
#include <QObject>
#include <QString>
#include <QWaitCondition>
#include <QGuiApplication>
#include "config.hh"
#include "ex.hh"
@ -316,11 +317,12 @@ protected:
bool synonymSearchEnabled;
string dictionaryName;
std::optional< bool > metadata_enable_fts = std::nullopt;
// Load user icon if it exist
// By default set icon to empty
virtual void loadIcon() noexcept;
static int getOptimalIconSize();
// Load icon from filename directly if isFullName == true
// else treat filename as name without extension
bool loadIconFromFile( QString const & filename, bool isFullName = false );

View file

@ -75,6 +75,7 @@ private:
{ "tk_TM", QT_TR_NOOP( "Turkmen" ) },
{ "ie_001", QT_TR_NOOP( "Interlingue" ) },
{ "jbo_EN", QT_TR_NOOP( "Lojban" ) },
{ "hu_HU", QT_TR_NOOP( "Hungarian" ) },
{ "en_US", QT_TR_NOOP( "English" ) } };
Db();

View file

@ -4,6 +4,7 @@
#include <QMenu>
#include <QContextMenuEvent>
#include <QProcess>
#include <QStyle>
using std::vector;
@ -18,6 +19,8 @@ DictionaryBar::DictionaryBar( QWidget * parent,
editDictionaryCommand( _editDictionaryCommand ),
maxDictionaryRefsInContextMenu( maxDictionaryRefsInContextMenu_ )
{
normalIconSize = { this->iconSize().height(), this->iconSize().height() };
setObjectName( "dictionaryBar" );
maxDictionaryRefsAction =
@ -72,14 +75,24 @@ void DictionaryBar::setDictionaries( vector< sptr< Dictionary::Class > > const &
dictActions.append( action );
}
setDictionaryIconSize( 21 );
setUpdatesEnabled( true );
}
void DictionaryBar::setDictionaryIconSize( int extent )
void DictionaryBar::setDictionaryIconSize( IconSize size )
{
setIconSize( QSize( extent, extent ) );
switch ( size ) {
case IconSize::Small: {
auto smallSize = QApplication::style()->pixelMetric( QStyle::PM_SmallIconSize );
setIconSize( { smallSize, smallSize } );
break;
}
case IconSize::Normal: {
setIconSize( normalIconSize );
break;
}
}
}
void DictionaryBar::contextMenuEvent( QContextMenuEvent * event )
@ -87,6 +100,7 @@ void DictionaryBar::contextMenuEvent( QContextMenuEvent * event )
showContextMenu( event );
}
void DictionaryBar::showContextMenu( QContextMenuEvent * event, bool extended )
{
QMenu menu( this );

View file

@ -34,7 +34,14 @@ public:
{
return mutedDictionaries;
}
void setDictionaryIconSize( int extent );
enum class IconSize {
Small,
Normal,
// TODO: implement something to have an Large option
};
void setDictionaryIconSize( IconSize size );
signals:
@ -69,6 +76,8 @@ private:
QList< QAction * > dictActions;
QAction * maxDictionaryRefsAction;
QSize normalIconSize; // cache icon size set by stylesheet provided by user
protected:
void contextMenuEvent( QContextMenuEvent * event );

View file

@ -1655,11 +1655,8 @@ void MainWindow::updateDictionaryBar()
dictionaryBar.setDictionaries( grp->dictionaries );
int extent = useSmallIconsInToolbarsAction.isChecked() ?
QApplication::style()->pixelMetric( QStyle::PM_SmallIconSize ) :
QApplication::style()->pixelMetric( QStyle::PM_ToolBarIconSize );
dictionaryBar.setDictionaryIconSize( extent );
dictionaryBar.setDictionaryIconSize( useSmallIconsInToolbarsAction.isChecked() ? DictionaryBar::IconSize::Small :
DictionaryBar::IconSize::Normal );
}
}

View file

@ -1110,9 +1110,8 @@ void ScanPopup::on_goForwardButton_clicked() const
void ScanPopup::setDictionaryIconSize()
{
int extent = cfg.usingSmallIconsInToolbars ? QApplication::style()->pixelMetric( QStyle::PM_SmallIconSize ) :
QApplication::style()->pixelMetric( QStyle::PM_ToolBarIconSize );
dictionaryBar.setDictionaryIconSize( extent );
dictionaryBar.setDictionaryIconSize( cfg.usingSmallIconsInToolbars ? DictionaryBar::IconSize::Small :
DictionaryBar::IconSize::Normal );
}
void ScanPopup::setGroupByName( QString const & name ) const

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.