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,
|
void loadDictionaries( QWidget * parent,
|
||||||
bool showInitially,
|
|
||||||
Config::Class const & cfg,
|
Config::Class const & cfg,
|
||||||
std::vector< sptr< Dictionary::Class > > & dictionaries,
|
std::vector< sptr< Dictionary::Class > > & dictionaries,
|
||||||
QNetworkAccessManager & dictNetMgr,
|
QNetworkAccessManager & dictNetMgr,
|
||||||
|
@ -206,7 +205,7 @@ void loadDictionaries( QWidget * parent,
|
||||||
{
|
{
|
||||||
dictionaries.clear();
|
dictionaries.clear();
|
||||||
|
|
||||||
::Initializing init( parent, showInitially );
|
::Initializing init( parent );
|
||||||
|
|
||||||
// Start a thread to load all the dictionaries
|
// Start a thread to load all the dictionaries
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ signals:
|
||||||
/// If doDeferredInit is true (default), doDeferredInit() is done on all
|
/// If doDeferredInit is true (default), doDeferredInit() is done on all
|
||||||
/// dictionaries at the end.
|
/// dictionaries at the end.
|
||||||
void loadDictionaries( QWidget * parent,
|
void loadDictionaries( QWidget * parent,
|
||||||
bool showInitially,
|
|
||||||
Config::Class const & cfg,
|
Config::Class const & cfg,
|
||||||
std::vector< sptr< Dictionary::Class > > &,
|
std::vector< sptr< Dictionary::Class > > &,
|
||||||
QNetworkAccessManager & dictNetMgr,
|
QNetworkAccessManager & dictNetMgr,
|
||||||
|
|
|
@ -5,19 +5,17 @@
|
||||||
#include "initializing.hh"
|
#include "initializing.hh"
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
|
||||||
Initializing::Initializing( QWidget * parent, bool showOnStartup ):
|
Initializing::Initializing( QWidget * parent ):
|
||||||
QDialog( parent )
|
QDialog( parent )
|
||||||
{
|
{
|
||||||
ui.setupUi( this );
|
ui.setupUi( this );
|
||||||
|
|
||||||
setWindowFlags( Qt::Dialog | Qt::FramelessWindowHint );
|
setWindowFlags( Qt::Dialog | Qt::FramelessWindowHint );
|
||||||
|
|
||||||
setWindowIcon( QIcon( ":/icons/programicon.png" ) );
|
setWindowIcon( QIcon( ":/icons/programicon.png" ) );
|
||||||
|
|
||||||
if ( showOnStartup ) {
|
if ( parent->isVisible() ) {
|
||||||
ui.operation->setText( tr( "Please wait..." ) );
|
ui.operation->setText( tr( "Please wait..." ) );
|
||||||
ui.dictionary->hide();
|
ui.dictionary->setText( "" );
|
||||||
ui.progressBar->hide();
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,9 +24,6 @@ void Initializing::indexing( QString const & dictionaryName )
|
||||||
{
|
{
|
||||||
ui.operation->setText( tr( "Indexing..." ) );
|
ui.operation->setText( tr( "Indexing..." ) );
|
||||||
ui.dictionary->setText( dictionaryName );
|
ui.dictionary->setText( dictionaryName );
|
||||||
ui.dictionary->show();
|
|
||||||
ui.progressBar->show();
|
|
||||||
adjustSize();
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +31,6 @@ void Initializing::loading( QString const & dictionaryName )
|
||||||
{
|
{
|
||||||
ui.operation->setText( tr( "Loading..." ) );
|
ui.operation->setText( tr( "Loading..." ) );
|
||||||
ui.dictionary->setText( dictionaryName );
|
ui.dictionary->setText( dictionaryName );
|
||||||
ui.dictionary->show();
|
|
||||||
ui.progressBar->show();
|
|
||||||
adjustSize();
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Initializing: public QDialog
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Initializing( QWidget * parent, bool showOnStartup );
|
Initializing( QWidget * parent );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
|
||||||
groups.clear();
|
groups.clear();
|
||||||
orderAndProps.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
|
// If no changes to groups were made, update the original data
|
||||||
const bool noGroupEdits = ( origCfg.groups == savedGroups );
|
const bool noGroupEdits = ( origCfg.groups == savedGroups );
|
||||||
|
|
|
@ -1585,7 +1585,7 @@ void MainWindow::makeDictionaries()
|
||||||
ftsIndexing.stopIndexing();
|
ftsIndexing.stopIndexing();
|
||||||
ftsIndexing.clearDictionaries();
|
ftsIndexing.clearDictionaries();
|
||||||
|
|
||||||
loadDictionaries( this, isVisible(), cfg, dictionaries, dictNetMgr, false );
|
loadDictionaries( this, cfg, dictionaries, dictNetMgr, false );
|
||||||
|
|
||||||
//create map
|
//create map
|
||||||
dictMap = Dictionary::dictToMap( dictionaries );
|
dictMap = Dictionary::dictToMap( dictionaries );
|
||||||
|
@ -3478,7 +3478,7 @@ void MainWindow::on_rescanFiles_triggered()
|
||||||
dictionariesUnmuted.clear();
|
dictionariesUnmuted.clear();
|
||||||
dictionaryBar.setDictionaries( dictionaries );
|
dictionaryBar.setDictionaries( dictionaries );
|
||||||
|
|
||||||
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
loadDictionaries( this, cfg, dictionaries, dictNetMgr );
|
||||||
dictMap = Dictionary::dictToMap( dictionaries );
|
dictMap = Dictionary::dictToMap( dictionaries );
|
||||||
|
|
||||||
for ( const auto & dictionarie : dictionaries ) {
|
for ( const auto & dictionarie : dictionaries ) {
|
||||||
|
|
Loading…
Reference in a new issue