clean: simplify loadDictionaries & Initializing dialog's showInitialy parameter (#1833)

This commit is contained in:
shenleban tongying 2024-10-17 23:08:20 -04:00 committed by GitHub
parent 8b8b83ab04
commit 9f13188973
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 18 deletions

View file

@ -198,7 +198,6 @@ void LoadDictionaries::loadingDictionary( string const & dictionaryName ) noexce
void loadDictionaries( QWidget * parent,
bool showInitially,
Config::Class const & cfg,
std::vector< sptr< Dictionary::Class > > & dictionaries,
QNetworkAccessManager & dictNetMgr,
@ -206,7 +205,7 @@ void loadDictionaries( QWidget * parent,
{
dictionaries.clear();
::Initializing init( parent, showInitially );
::Initializing init( parent );
// Start a thread to load all the dictionaries

View file

@ -67,7 +67,6 @@ signals:
/// If doDeferredInit is true (default), doDeferredInit() is done on all
/// dictionaries at the end.
void loadDictionaries( QWidget * parent,
bool showInitially,
Config::Class const & cfg,
std::vector< sptr< Dictionary::Class > > &,
QNetworkAccessManager & dictNetMgr,

View file

@ -5,19 +5,17 @@
#include "initializing.hh"
#include <QCloseEvent>
Initializing::Initializing( QWidget * parent, bool showOnStartup ):
Initializing::Initializing( QWidget * parent ):
QDialog( parent )
{
ui.setupUi( this );
setWindowFlags( Qt::Dialog | Qt::FramelessWindowHint );
setWindowIcon( QIcon( ":/icons/programicon.png" ) );
if ( showOnStartup ) {
if ( parent->isVisible() ) {
ui.operation->setText( tr( "Please wait..." ) );
ui.dictionary->hide();
ui.progressBar->hide();
ui.dictionary->setText( "" );
show();
}
}
@ -26,9 +24,6 @@ void Initializing::indexing( QString const & dictionaryName )
{
ui.operation->setText( tr( "Indexing..." ) );
ui.dictionary->setText( dictionaryName );
ui.dictionary->show();
ui.progressBar->show();
adjustSize();
show();
}
@ -36,9 +31,6 @@ void Initializing::loading( QString const & dictionaryName )
{
ui.operation->setText( tr( "Loading..." ) );
ui.dictionary->setText( dictionaryName );
ui.dictionary->show();
ui.progressBar->show();
adjustSize();
show();
}

View file

@ -12,7 +12,7 @@ class Initializing: public QDialog
public:
Initializing( QWidget * parent, bool showOnStartup );
Initializing( QWidget * parent );
public slots:

View file

@ -208,7 +208,7 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
groups.clear();
orderAndProps.clear();
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
loadDictionaries( this, cfg, dictionaries, dictNetMgr );
// If no changes to groups were made, update the original data
const bool noGroupEdits = ( origCfg.groups == savedGroups );

View file

@ -1585,7 +1585,7 @@ void MainWindow::makeDictionaries()
ftsIndexing.stopIndexing();
ftsIndexing.clearDictionaries();
loadDictionaries( this, isVisible(), cfg, dictionaries, dictNetMgr, false );
loadDictionaries( this, cfg, dictionaries, dictNetMgr, false );
//create map
dictMap = Dictionary::dictToMap( dictionaries );
@ -3478,7 +3478,7 @@ void MainWindow::on_rescanFiles_triggered()
dictionariesUnmuted.clear();
dictionaryBar.setDictionaries( dictionaries );
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
loadDictionaries( this, cfg, dictionaries, dictNetMgr );
dictMap = Dictionary::dictToMap( dictionaries );
for ( const auto & dictionarie : dictionaries ) {