mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
clean: simplify loadDictionaries & Initializing dialog's showInitialy
parameter (#1833)
This commit is contained in:
parent
8b8b83ab04
commit
9f13188973
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class Initializing: public QDialog
|
|||
|
||||
public:
|
||||
|
||||
Initializing( QWidget * parent, bool showOnStartup );
|
||||
Initializing( QWidget * parent );
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue