mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Added Apply button to the Dictionaries configuration dialog.
This commit is contained in:
parent
f12a8e6761
commit
a30a13323b
|
@ -42,6 +42,9 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
|
|||
ui.tabs->addTab( orderAndProps.get(), QIcon(":/icons/book.png"), tr( "&Dictionaries" ) );
|
||||
ui.tabs->addTab( groups.get(), QIcon(":/icons/bookcase.png"), tr( "&Groups" ) );
|
||||
|
||||
connect( ui.buttons, SIGNAL( clicked( QAbstractButton * ) ),
|
||||
this, SLOT( buttonBoxClicked( QAbstractButton * ) ) );
|
||||
|
||||
connect( &sources, SIGNAL( rescan() ), this, SLOT( rescanSources() ) );
|
||||
}
|
||||
|
||||
|
@ -56,7 +59,7 @@ void EditDictionaries::editGroup( unsigned id )
|
|||
}
|
||||
}
|
||||
|
||||
void EditDictionaries::accept()
|
||||
void EditDictionaries::save()
|
||||
{
|
||||
Config::Groups newGroups = groups->getGroups();
|
||||
Config::Group newOrder = orderAndProps->getCurrentDictionaryOrder();
|
||||
|
@ -73,7 +76,11 @@ void EditDictionaries::accept()
|
|||
cfg.dictionaryOrder = newOrder;
|
||||
cfg.inactiveDictionaries = newInactive;
|
||||
}
|
||||
}
|
||||
|
||||
void EditDictionaries::accept()
|
||||
{
|
||||
save();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
@ -132,6 +139,16 @@ void EditDictionaries::rescanSources()
|
|||
acceptChangedSources( true );
|
||||
}
|
||||
|
||||
void EditDictionaries::buttonBoxClicked( QAbstractButton * button )
|
||||
{
|
||||
if (ui.buttons->buttonRole(button) == QDialogButtonBox::ApplyRole) {
|
||||
if ( isSourcesChanged() ) {
|
||||
acceptChangedSources( true );
|
||||
}
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
bool EditDictionaries::isSourcesChanged() const
|
||||
{
|
||||
return sources.getPaths() != cfg.paths ||
|
||||
|
|
|
@ -43,6 +43,8 @@ private slots:
|
|||
|
||||
void on_tabs_currentChanged( int index );
|
||||
|
||||
void buttonBoxClicked( QAbstractButton * button );
|
||||
|
||||
void rescanSources();
|
||||
|
||||
private:
|
||||
|
@ -50,6 +52,8 @@ private:
|
|||
bool isSourcesChanged() const;
|
||||
|
||||
void acceptChangedSources( bool rebuildGroups );
|
||||
|
||||
void save();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue