mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
+ Add a 'Rescan now' button in Sources.
This commit is contained in:
parent
3c390523d8
commit
743258b438
|
@ -27,12 +27,15 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
|
|||
|
||||
ui.tabs->addTab( &sources, QIcon(":/icons/book.png"), tr( "&Sources" ) );
|
||||
ui.tabs->addTab( groups.get(), QIcon(":/icons/bookcase.png"), tr( "&Groups" ) );
|
||||
|
||||
connect( &sources, SIGNAL( rescan() ), this, SLOT( rescanSources() ) );
|
||||
}
|
||||
|
||||
|
||||
void EditDictionaries::accept()
|
||||
{
|
||||
acceptChangedSources();
|
||||
if ( isSourcesChanged() )
|
||||
acceptChangedSources();
|
||||
|
||||
Config::Groups newGroups = groups->getGroups();
|
||||
|
||||
|
@ -99,6 +102,11 @@ void EditDictionaries::on_tabs_currentChanged( int index )
|
|||
lastCurrentTab = index;
|
||||
}
|
||||
|
||||
void EditDictionaries::rescanSources()
|
||||
{
|
||||
acceptChangedSources();
|
||||
}
|
||||
|
||||
bool EditDictionaries::isSourcesChanged() const
|
||||
{
|
||||
return sources.getPaths() != cfg.paths ||
|
||||
|
@ -109,15 +117,12 @@ bool EditDictionaries::isSourcesChanged() const
|
|||
|
||||
void EditDictionaries::acceptChangedSources()
|
||||
{
|
||||
if ( isSourcesChanged() )
|
||||
{
|
||||
dictionariesChanged = true;
|
||||
dictionariesChanged = true;
|
||||
|
||||
cfg.paths = sources.getPaths();
|
||||
cfg.soundDirs = sources.getSoundDirs();
|
||||
cfg.hunspell = sources.getHunspell();
|
||||
cfg.mediawikis = sources.getMediaWikis();
|
||||
cfg.paths = sources.getPaths();
|
||||
cfg.soundDirs = sources.getSoundDirs();
|
||||
cfg.hunspell = sources.getHunspell();
|
||||
cfg.mediawikis = sources.getMediaWikis();
|
||||
|
||||
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
||||
}
|
||||
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ private slots:
|
|||
|
||||
void on_tabs_currentChanged( int index );
|
||||
|
||||
void rescanSources();
|
||||
|
||||
private:
|
||||
|
||||
bool isSourcesChanged() const;
|
||||
|
|
|
@ -648,3 +648,9 @@ bool HunspellDictsModel::setData( QModelIndex const & index, const QVariant & /*
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Sources::on_rescan_clicked()
|
||||
{
|
||||
emit rescan();
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,11 @@ public:
|
|||
|
||||
Config::Hunspell getHunspell() const;
|
||||
|
||||
signals:
|
||||
|
||||
/// Emitted when a 'Rescan' button is clicked.
|
||||
void rescan();
|
||||
|
||||
private:
|
||||
Ui::Sources ui;
|
||||
MediaWikisModel mediawikisModel;
|
||||
|
@ -174,6 +179,8 @@ private slots:
|
|||
|
||||
void on_addMediaWiki_clicked();
|
||||
void on_removeMediaWiki_clicked();
|
||||
|
||||
void on_rescan_clicked();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -75,6 +75,13 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rescan">
|
||||
<property name="text">
|
||||
<string>Re&scan now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue