Compare commits

...

9 commits

Author SHA1 Message Date
xiaoyifang 41c9a357ee
Merge 4a0db3f7ee into 9315dda365 2024-11-05 22:24:56 -05:00
xiaoyifang 9315dda365
Merge pull request #1905 from xiaoyifang/opt/custom-js-defer
opt: make custom javascript delay execution
2024-11-06 09:57:43 +08:00
xiaoyifang 1418f9ab9e opt: make custom javascript delay execution 2024-11-06 09:09:18 +08:00
shenleban tongying 6efdb09b1a clean: add override to satisfy clang's Winconsistent-missing-override
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
2024-11-05 17:27:15 -05:00
xiaoyifang d4cc838652
opt: move special GroupIDs to a seperate enum (#1900)
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
* opt: move groupid to a seperate namespace

* opt: move groupid to a seperate namespace

* Update src/config.hh

Co-authored-by: shenleban tongying <shenlebantongying@gmail.com>

---------

Co-authored-by: shenleban tongying <shenlebantongying@gmail.com>
2024-11-05 13:51:53 +08:00
xiaoyifang c8b6a6b6c5
Update topic_userstyle.md (#1899)
Some checks failed
SonarCloud / Build and analyze (push) Waiting to run
deploy_website / deploy (push) Has been cancelled
* Update topic_userstyle.md

* Update topic_userstyle.md

---------

Co-authored-by: shenleban tongying <shenlebantongying@gmail.com>
2024-11-04 21:11:01 +08:00
xiaoyifang 3f6819b049
Merge pull request #1898 from xiaoyifang/opt/compiler-version
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
opt: [win] update Windows compiler name
2024-11-04 17:05:28 +08:00
xiaoyifang a56cfb8d3a opt: [win] update Windows compiler name 2024-11-04 16:55:32 +08:00
xiaoyifang dd22c913e2
New Crowdin updates (#1884)
* New translations Kabyle from Crowdin

* New translations Kabyle from Crowdin
2024-11-04 13:58:01 +08:00
16 changed files with 133 additions and 130 deletions

View file

@ -86,7 +86,7 @@
</message>
<message>
<source>(untitled)</source>
<translation type="unfinished">(untitled)</translation>
<translation>(war azwel)</translation>
</message>
<message>
<source>(picture)</source>
@ -101,7 +101,7 @@
</message>
<message>
<source>From </source>
<translation type="unfinished">From </translation>
<translation>Seg </translation>
</message>
<message>
<source>Collapse article</source>
@ -156,7 +156,7 @@
</message>
<message>
<source>Audio</source>
<translation type="unfinished">Audio</translation>
<translation>Ameslaw</translation>
</message>
<message>
<source>TTS Voice</source>
@ -941,7 +941,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished">Cancel</translation>
<translation>Sefsex</translation>
</message>
<message>
<source>Help</source>
@ -1161,7 +1161,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Please wait...</source>
<translation type="unfinished">Please wait...</translation>
<translation>Txil rǧu</translation>
</message>
<message>
<source>Indexing...</source>
@ -1180,11 +1180,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Abkhazian</source>
<translation type="unfinished">Abkhazian</translation>
<translation>Tabxazit</translation>
</message>
<message>
<source>Avestan</source>
<translation type="unfinished">Avestan</translation>
<translation>Tavestant</translation>
</message>
<message>
<source>Afrikaans</source>
@ -1244,15 +1244,15 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Bambara</source>
<translation type="unfinished">Bambara</translation>
<translation>Tabambarat</translation>
</message>
<message>
<source>Bengali</source>
<translation type="unfinished">Bengali</translation>
<translation>Tabengalit</translation>
</message>
<message>
<source>Tibetan</source>
<translation type="unfinished">Tibetan</translation>
<translation>Tatibitant</translation>
</message>
<message>
<source>Breton</source>
@ -1312,11 +1312,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Dzongkha</source>
<translation type="unfinished">Dzongkha</translation>
<translation>Tadzungat</translation>
</message>
<message>
<source>Ewe</source>
<translation type="unfinished">Ewe</translation>
<translation>Tawit</translation>
</message>
<message>
<source>Greek</source>
@ -1344,11 +1344,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Persian</source>
<translation type="unfinished">Persian</translation>
<translation>Tafarsit</translation>
</message>
<message>
<source>Fulah</source>
<translation type="unfinished">Fulah</translation>
<translation>Tafulaht</translation>
</message>
<message>
<source>Finnish</source>
@ -1372,7 +1372,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Irish</source>
<translation type="unfinished">Irish</translation>
<translation>Tirlandit</translation>
</message>
<message>
<source>Scottish Gaelic</source>
@ -1404,15 +1404,15 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Hindi</source>
<translation type="unfinished">Hindi</translation>
<translation>Tahendit</translation>
</message>
<message>
<source>Hiri Motu</source>
<translation type="unfinished">Hiri Motu</translation>
<translation>Tahirimutut</translation>
</message>
<message>
<source>Croatian</source>
<translation type="unfinished">Croatian</translation>
<translation>Takrwasit</translation>
</message>
<message>
<source>Haitian</source>
@ -1420,23 +1420,23 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Hungarian</source>
<translation type="unfinished">Hungarian</translation>
<translation>Tahungarit</translation>
</message>
<message>
<source>Armenian</source>
<translation type="unfinished">Armenian</translation>
<translation>Taṛminit</translation>
</message>
<message>
<source>Herero</source>
<translation type="unfinished">Herero</translation>
<translation>Tahirirut</translation>
</message>
<message>
<source>Interlingua</source>
<translation type="unfinished">Interlingua</translation>
<translation>Tantirlingwat</translation>
</message>
<message>
<source>Indonesian</source>
<translation type="unfinished">Indonesian</translation>
<translation>Tandunizit</translation>
</message>
<message>
<source>Interlingue</source>
@ -1460,15 +1460,15 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Icelandic</source>
<translation type="unfinished">Icelandic</translation>
<translation>Taslandit</translation>
</message>
<message>
<source>Italian</source>
<translation type="unfinished">Italian</translation>
<translation>Taṭelyanit</translation>
</message>
<message>
<source>Inuktitut</source>
<translation type="unfinished">Inuktitut</translation>
<translation>Tinuktitut</translation>
</message>
<message>
<source>Japanese</source>
@ -1480,23 +1480,23 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Georgian</source>
<translation type="unfinished">Georgian</translation>
<translation>Tajyurjit</translation>
</message>
<message>
<source>Kongo</source>
<translation type="unfinished">Kongo</translation>
<translation>Takungut</translation>
</message>
<message>
<source>Kikuyu</source>
<translation type="unfinished">Kikuyu</translation>
<translation>Takikuyut</translation>
</message>
<message>
<source>Kwanyama</source>
<translation type="unfinished">Kwanyama</translation>
<translation>Takwanyamat</translation>
</message>
<message>
<source>Kazakh</source>
<translation type="unfinished">Kazakh</translation>
<translation>Takazaxt</translation>
</message>
<message>
<source>Kalaallisut</source>
@ -1512,27 +1512,27 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Korean</source>
<translation type="unfinished">Korean</translation>
<translation>Takurit</translation>
</message>
<message>
<source>Kanuri</source>
<translation type="unfinished">Kanuri</translation>
<translation>Takanurit</translation>
</message>
<message>
<source>Kashmiri</source>
<translation type="unfinished">Kashmiri</translation>
<translation>Takacmirit</translation>
</message>
<message>
<source>Kurdish</source>
<translation type="unfinished">Kurdish</translation>
<translation>Takurdit</translation>
</message>
<message>
<source>Komi</source>
<translation type="unfinished">Komi</translation>
<translation>Takumit</translation>
</message>
<message>
<source>Cornish</source>
<translation type="unfinished">Cornish</translation>
<translation>Takurnikt</translation>
</message>
<message>
<source>Kirghiz</source>
@ -1628,11 +1628,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Nepali</source>
<translation type="unfinished">Nepali</translation>
<translation>Tanipalit</translation>
</message>
<message>
<source>Ndonga</source>
<translation type="unfinished">Ndonga</translation>
<translation>Tandungat</translation>
</message>
<message>
<source>Dutch</source>
@ -1644,7 +1644,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Norwegian</source>
<translation type="unfinished">Norwegian</translation>
<translation>Tanurvijit</translation>
</message>
<message>
<source>South Ndebele</source>
@ -1696,11 +1696,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Portuguese</source>
<translation type="unfinished">Portuguese</translation>
<translation>Tapurtugit</translation>
</message>
<message>
<source>Quechua</source>
<translation type="unfinished">Quechua</translation>
<translation>Takicwat</translation>
</message>
<message>
<source>Raeto-Romance</source>
@ -1712,7 +1712,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Romanian</source>
<translation type="unfinished">Romanian</translation>
<translation>Tarumanit</translation>
</message>
<message>
<source>Russian</source>
@ -1752,35 +1752,35 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Slovak</source>
<translation type="unfinished">Slovak</translation>
<translation>Tasluvakt</translation>
</message>
<message>
<source>Slovenian</source>
<translation type="unfinished">Slovenian</translation>
<translation>Tasluvinit</translation>
</message>
<message>
<source>Samoan</source>
<translation type="unfinished">Samoan</translation>
<translation>Tasamwant</translation>
</message>
<message>
<source>Shona</source>
<translation type="unfinished">Shona</translation>
<translation>Tacunat</translation>
</message>
<message>
<source>Somali</source>
<translation type="unfinished">Somali</translation>
<translation>Tasumalit</translation>
</message>
<message>
<source>Albanian</source>
<translation type="unfinished">Albanian</translation>
<translation>Talbanit</translation>
</message>
<message>
<source>Serbian</source>
<translation type="unfinished">Serbian</translation>
<translation>Taṣirbit</translation>
</message>
<message>
<source>Swati</source>
<translation type="unfinished">Swati</translation>
<translation>Taswatit</translation>
</message>
<message>
<source>Southern Sotho</source>
@ -1792,27 +1792,27 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Swedish</source>
<translation type="unfinished">Swedish</translation>
<translation>Taswidit</translation>
</message>
<message>
<source>Swahili</source>
<translation type="unfinished">Swahili</translation>
<translation>Taswahilit</translation>
</message>
<message>
<source>Tamil</source>
<translation type="unfinished">Tamil</translation>
<translation>Taṭamilit</translation>
</message>
<message>
<source>Telugu</source>
<translation type="unfinished">Telugu</translation>
<translation>Tatilugut</translation>
</message>
<message>
<source>Tajik</source>
<translation type="unfinished">Tajik</translation>
<translation>Tatajikt</translation>
</message>
<message>
<source>Thai</source>
<translation type="unfinished">Thai</translation>
<translation>Taṭaylandit</translation>
</message>
<message>
<source>Tigrinya</source>
@ -1836,7 +1836,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Turkish</source>
<translation type="unfinished">Turkish</translation>
<translation>Taṭurkit</translation>
</message>
<message>
<source>Tsonga</source>
@ -1860,19 +1860,19 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Ukrainian</source>
<translation type="unfinished">Ukrainian</translation>
<translation>Tukranit</translation>
</message>
<message>
<source>Urdu</source>
<translation type="unfinished">Urdu</translation>
<translation>Turdut</translation>
</message>
<message>
<source>Uzbek</source>
<translation type="unfinished">Uzbek</translation>
<translation>Tuzbikt</translation>
</message>
<message>
<source>Venda</source>
<translation type="unfinished">Venda</translation>
<translation>Tavendat</translation>
</message>
<message>
<source>Vietnamese</source>
@ -1912,11 +1912,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Zulu</source>
<translation type="unfinished">Zulu</translation>
<translation>Tazulut</translation>
</message>
<message>
<source>Lojban</source>
<translation type="unfinished">Lojban</translation>
<translation>Talujbant</translation>
</message>
<message>
<source>Traditional Chinese</source>
@ -2027,11 +2027,11 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Lithuanian</source>
<translation type="unfinished">Lithuanian</translation>
<translation>Taliṭwanit</translation>
</message>
<message>
<source>Macedonian</source>
<translation type="unfinished">Macedonian</translation>
<translation>Tamasidunt</translation>
</message>
<message>
<source>Dutch</source>
@ -2039,7 +2039,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Polish</source>
<translation type="unfinished">Polish</translation>
<translation>Tapulandit</translation>
</message>
<message>
<source>Portuguese</source>
@ -2055,7 +2055,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Albanian</source>
<translation type="unfinished">Albanian</translation>
<translation>Talbanit</translation>
</message>
<message>
<source>Serbian (Cyrillic)</source>
@ -2091,7 +2091,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Persian</source>
<translation type="unfinished">Persian</translation>
<translation>Tafarsit</translation>
</message>
<message>
<source>Spanish, Argentina</source>
@ -2115,23 +2115,23 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>Tajik</source>
<translation type="unfinished">Tajik</translation>
<translation>Tatajikt</translation>
</message>
<message>
<source>Quechua</source>
<translation type="unfinished">Quechua</translation>
<translation>Takicwat</translation>
</message>
<message>
<source>Aymara</source>
<translation type="unfinished">Aymara</translation>
<translation>Taymarat</translation>
</message>
<message>
<source>Arabic, Saudi Arabia</source>
<translation type="unfinished">Arabic, Saudi Arabia</translation>
<translation>Taɛrabt, Suɛudiya Taɛrabt</translation>
</message>
<message>
<source>Turkmen</source>
<translation type="unfinished">Turkmen</translation>
<translation>Taturkmant</translation>
</message>
<message>
<source>Interlingue</source>
@ -2147,7 +2147,7 @@ between classic and school orthography in cyrillic)</translation>
</message>
<message>
<source>English</source>
<translation type="unfinished">English</translation>
<translation>Taglizit</translation>
</message>
</context>
<context>

View file

@ -209,7 +209,7 @@ body { background: #242525; }
// load the `article-style.js` in user's config folder
if ( auto userJsFile = Config::getUserJsFileName(); userJsFile.has_value() ) {
result += fmt::format( FMT_COMPILE( R"(<script src="file://{}"></script>)" ), userJsFile.value() );
result += fmt::format( FMT_COMPILE( R"(<script src="file://{}" defer></script>)" ), userJsFile.value() );
}
result += "</head><body>";
@ -315,7 +315,7 @@ sptr< Dictionary::DataRequest > ArticleMaker::makeDefinitionFor( QString const &
true );
}
if ( groupId == Instances::Group::HelpGroupId ) {
if ( groupId == GroupId::HelpGroupId ) {
if ( word == tr( "Welcome!" ) ) {
string welcome = makeWelcomeHtml();
sptr< Dictionary::DataRequestInstant > r = std::make_shared< Dictionary::DataRequestInstant >( true );

View file

@ -42,38 +42,38 @@ public:
delete baseReply;
}
void close()
void close() override
{
baseReply->close();
}
// QIODevice virtual functions
qint64 bytesAvailable() const;
qint64 bytesAvailable() const override;
bool atEnd() const override
{
return baseReply->atEnd();
}
qint64 bytesToWrite() const
qint64 bytesToWrite() const override
{
return baseReply->bytesToWrite();
}
bool canReadLine() const
bool canReadLine() const override
{
return baseReply->canReadLine();
}
bool isSequential() const
bool isSequential() const override
{
return baseReply->isSequential();
}
bool waitForReadyRead( int msecs )
bool waitForReadyRead( int msecs ) override
{
return baseReply->waitForReadyRead( msecs );
}
bool waitForBytesWritten( int msecs )
bool waitForBytesWritten( int msecs ) override
{
return baseReply->waitForBytesWritten( msecs );
}
bool reset()
bool reset() override
{
return baseReply->reset();
}
@ -82,37 +82,37 @@ public slots:
void applyError( QNetworkReply::NetworkError code );
// Redirect QNetworkReply slots
virtual void abort()
void abort() override
{
baseReply->abort();
}
virtual void ignoreSslErrors()
void ignoreSslErrors() override
{
baseReply->ignoreSslErrors();
}
protected:
// QNetworkReply virtual functions
void ignoreSslErrorsImplementation( const QList< QSslError > & errors )
void ignoreSslErrorsImplementation( const QList< QSslError > & errors ) override
{
baseReply->ignoreSslErrors( errors );
}
void setSslConfigurationImplementation( const QSslConfiguration & configuration )
void setSslConfigurationImplementation( const QSslConfiguration & configuration ) override
{
baseReply->setSslConfiguration( configuration );
}
void sslConfigurationImplementation( QSslConfiguration & configuration ) const
void sslConfigurationImplementation( QSslConfiguration & configuration ) const override
{
configuration = baseReply->sslConfiguration();
}
// QIODevice virtual functions
qint64 readData( char * data, qint64 maxSize );
qint64 readLineData( char * data, qint64 maxSize )
qint64 readData( char * data, qint64 maxSize ) override;
qint64 readLineData( char * data, qint64 maxSize ) override
{
return baseReply->readLine( data, maxSize );
}
qint64 writeData( const char * data, qint64 maxSize )
qint64 writeData( const char * data, qint64 maxSize ) override
{
return baseReply->write( data, maxSize );
}
@ -178,10 +178,10 @@ public:
protected:
virtual qint64 bytesAvailable() const;
virtual qint64 bytesAvailable() const override;
bool atEnd() const override;
virtual void abort() {}
virtual qint64 readData( char * data, qint64 maxSize );
virtual void abort() override {}
virtual qint64 readData( char * data, qint64 maxSize ) override;
// We use the hackery below to work around the fact that we need to emit
// ready/finish signals after we've been constructed.

View file

@ -18,6 +18,13 @@
#include <optional>
#include <QThread>
/// Special group IDs
enum GroupId : unsigned {
AllGroupId = UINT_MAX - 1, /// The 'All' group
HelpGroupId = UINT_MAX, /// The fictitious 'Help' group
NoGroupId = 0, /// Invalid value, used to specify that no group id is specified at all.
};
/// GoldenDict's configuration
namespace Config {

View file

@ -107,7 +107,7 @@ public:
string const & dictionaryId_,
QNetworkAccessManager & mgr );
virtual void cancel();
void cancel() override;
private:

View file

@ -47,7 +47,7 @@ public:
string const & dictionaryId_,
QNetworkAccessManager & mgr );
virtual void cancel();
void cancel() override;
private:

View file

@ -494,7 +494,7 @@ void FullTextSearchDialog::updateDictionaries()
Config::Group const * grp = cfg.getGroup( group );
Config::MutedDictionaries const * mutedDicts;
if ( group == Instances::Group::AllGroupId ) {
if ( group == GroupId::AllGroupId ) {
mutedDicts = &cfg.mutedDictionaries;
}
else {

View file

@ -45,17 +45,6 @@ struct Group
/// Remove id's if not presented in group dictionaries
void checkMutedDictionaries( Config::MutedDictionaries * mutedDictionaries ) const;
// Some constants
/// The id of the 'All' group
static const unsigned AllGroupId = UINT_MAX - 1;
/// The id of the fictious 'Help' group
static const unsigned HelpGroupId = UINT_MAX;
/// Invalid value, used to specify that no group id is specified at all.
static const unsigned NoGroupId = 0;
};
struct Groups: public vector< Group >

View file

@ -798,7 +798,7 @@ QStringList ArticleView::getMutedDictionaries( unsigned group )
// Find muted dictionaries for current group
Config::Group const * grp = cfg.getGroup( group );
Config::MutedDictionaries const * mutedDictionaries;
if ( group == Instances::Group::AllGroupId ) {
if ( group == GroupId::AllGroupId ) {
mutedDictionaries = popupView ? &cfg.popupMutedDictionaries : &cfg.mutedDictionaries;
}
else {
@ -1766,7 +1766,7 @@ void ArticleView::pasteTriggered()
if ( !word.isEmpty() ) {
unsigned groupId = getGroup( webview->url() );
if ( groupId == 0 || groupId == Instances::Group::HelpGroupId ) {
if ( groupId == 0 || groupId == GroupId::HelpGroupId ) {
// We couldn't figure out the group out of the URL,
// so let's try the currently selected group.
groupId = currentGroupId;
@ -1918,7 +1918,7 @@ void ArticleView::doubleClicked( QPoint pos )
QUrl const & ref = webview->url();
auto groupId = getGroup( ref );
if ( groupId == 0 || groupId == Instances::Group::HelpGroupId ) {
if ( groupId == 0 || groupId == GroupId::HelpGroupId ) {
groupId = currentGroupId;
}
if ( Utils::Url::hasQueryItem( ref, "dictionaries" ) ) {
@ -2062,7 +2062,7 @@ void ArticleView::setActiveDictIds( const ActiveDictIds & ad )
{
auto groupId = ad.groupId;
if ( groupId == 0 ) {
groupId = Instances::Group::AllGroupId;
groupId = GroupId::AllGroupId;
}
if ( ( ad.word == currentWord && groupId == getCurrentGroup() ) || historyMode ) {
// ignore all other signals.
@ -2077,7 +2077,7 @@ void ArticleView::dictionaryClear( const ActiveDictIds & ad )
{
auto groupId = ad.groupId;
if ( groupId == 0 ) {
groupId = Instances::Group::AllGroupId;
groupId = GroupId::AllGroupId;
}
// ignore all other signals.
if ( ad.word == currentWord && groupId == getCurrentGroup() ) {

View file

@ -104,7 +104,7 @@ public:
void setAudioLink( QString audioLink );
QString getAudioLink() const;
virtual QSize minimumSizeHint() const;
QSize minimumSizeHint() const override;
void clearContent();
~ArticleView();

View file

@ -74,7 +74,7 @@ void EditDictionaries::editGroup( unsigned id )
{
ui.tabs->setTabVisible( 0, false );
if ( id == Instances::Group::AllGroupId ) {
if ( id == GroupId::AllGroupId ) {
ui.tabs->setCurrentIndex( 1 );
}
else {

View file

@ -553,7 +553,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
// Dictionary bar
Instances::Group const * igrp = groupInstances.findGroup( cfg.lastMainGroupId );
if ( cfg.lastMainGroupId == Instances::Group::AllGroupId ) {
if ( cfg.lastMainGroupId == GroupId::AllGroupId ) {
if ( igrp ) {
igrp->checkMutedDictionaries( &cfg.mutedDictionaries );
}
@ -776,7 +776,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
addNewTab();
ArticleView * view = getCurrentArticleView();
history.enableAdd( false );
view->showDefinition( tr( "Welcome!" ), Instances::Group::HelpGroupId );
view->showDefinition( tr( "Welcome!" ), GroupId::HelpGroupId );
history.enableAdd( cfg.preferences.storeHistory );
// restore should be called after all UI initialized but not necessarily after show()
@ -1640,7 +1640,7 @@ void MainWindow::updateGroupList( bool reload )
dictionaries );
g.name = tr( "All" );
g.id = Instances::Group::AllGroupId;
g.id = GroupId::AllGroupId;
g.icon = "folder.png";
groupInstances.push_back( g );
@ -1685,7 +1685,7 @@ void MainWindow::updateDictionaryBar()
dictionaryBar.setMutedDictionaries( nullptr );
if ( grp ) { // Should always be !0, but check as a safeguard
if ( currentId == Instances::Group::AllGroupId ) {
if ( currentId == GroupId::AllGroupId ) {
dictionaryBar.setMutedDictionaries( &cfg.mutedDictionaries );
}
else {
@ -2205,7 +2205,7 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
connect( &dicts, &EditDictionaries::showDictionaryHeadwords, this, &MainWindow::showDictionaryHeadwords );
if ( editDictionaryGroup != Instances::Group::NoGroupId ) {
if ( editDictionaryGroup != GroupId::NoGroupId ) {
dicts.editGroup( editDictionaryGroup );
}
@ -2219,7 +2219,7 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
// Set muted dictionaries from old groups
for ( auto & group : newCfg.groups ) {
unsigned id = group.id;
if ( id != Instances::Group::NoGroupId ) {
if ( id != GroupId::NoGroupId ) {
Config::Group const * grp = cfg.getGroup( id );
if ( grp ) {
group.mutedDictionaries = grp->mutedDictionaries;
@ -2373,7 +2373,7 @@ void MainWindow::currentGroupChanged( int )
unsigned grg_id = groupList->getCurrentGroup();
cfg.lastMainGroupId = grg_id;
Instances::Group const * igrp = groupInstances.findGroup( grg_id );
if ( grg_id == Instances::Group::AllGroupId ) {
if ( grg_id == GroupId::AllGroupId ) {
if ( igrp ) {
igrp->checkMutedDictionaries( &cfg.mutedDictionaries );
}

View file

@ -345,7 +345,7 @@ private slots:
/// If editDictionaryGroup is specified, the dialog positions on that group
/// initially.
void editDictionaries( unsigned editDictionaryGroup = Instances::Group::NoGroupId );
void editDictionaries( unsigned editDictionaryGroup = GroupId::NoGroupId );
/// Edits current group when triggered from the dictionary bar.
void editCurrentGroup();
void editPreferences();

View file

@ -140,7 +140,7 @@ ScanPopup::ScanPopup( QWidget * parent,
dictionaryBar.setFloatable( false );
Instances::Group const * igrp = groups.findGroup( cfg.lastPopupGroupId );
if ( cfg.lastPopupGroupId == Instances::Group::AllGroupId ) {
if ( cfg.lastPopupGroupId == GroupId::AllGroupId ) {
if ( igrp ) {
igrp->checkMutedDictionaries( &cfg.popupMutedDictionaries );
}
@ -591,7 +591,7 @@ void ScanPopup::currentGroupChanged( int )
{
cfg.lastPopupGroupId = ui.groupList->getCurrentGroup();
Instances::Group const * igrp = groups.findGroup( cfg.lastPopupGroupId );
if ( cfg.lastPopupGroupId == Instances::Group::AllGroupId ) {
if ( cfg.lastPopupGroupId == GroupId::AllGroupId ) {
if ( igrp ) {
igrp->checkMutedDictionaries( &cfg.popupMutedDictionaries );
}
@ -1086,7 +1086,7 @@ void ScanPopup::updateDictionaryBar()
dictionaryBar.setDictionaries( grp->dictionaries );
}
if ( currentId == Instances::Group::AllGroupId ) {
if ( currentId == GroupId::AllGroupId ) {
dictionaryBar.setMutedDictionaries( &cfg.popupMutedDictionaries );
}
else {

View file

@ -27,7 +27,7 @@ const QLatin1String flags = QLatin1String(
const QLatin1String compiler = QLatin1String(
#if defined( Q_CC_MSVC )
"Visual C++ Compiler " QT_STRINGIFY( _MSC_FULL_VER )
"MSVC " QT_STRINGIFY( _MSC_FULL_VER )
#elif defined( Q_CC_CLANG )
"Clang " __clang_version__
#elif defined( Q_CC_GNU )

View file

@ -1,5 +1,13 @@
By creating `article-style.css` or `article-script.js` in GoldenDict's configuration folder (beside the `config` file), you can change dictionaries' presentation or inject javascript to dictionaries.
```
. <- GD's configuration folder
├── config
├── article-style.css
├── article-script.js
└── qt-style.css
```
The `article-style.css` is just standard HTML [Style Sheets](https://developer.mozilla.org/docs/Web/CSS). To know class or id names used in article, you can open inspector by right click article's body and click `Inspect (F12)`. The inspector's documentation can be found at [Chrome DevTools](https://developer.chrome.com/docs/devtools/)
You can adjust dark reader mode's parameter by add those lines to `article-script.js`
@ -17,7 +25,6 @@ Also, you can tune GoldenDict's interface by creating `qt-style.css` style sheet
Samples of `article-style.css` and `qt-style.css` files can found in GoldenDict's source code at [/src/stylesheets](https://github.com/xiaoyifang/goldendict-ng/tree/staged/src/stylesheets)
## "Addon" Styles
Under GoldenDict's configuration folder, you can create a "styles" folder for "Addon" styles, so that you can switch between multiple `article-style.css` and `qt-style.css`.