Refactor show dictionary info in "Groups" tab

This commit is contained in:
Abs62 2013-07-07 12:09:46 +04:00
parent 5ca8279045
commit 7e7adaf7c0
3 changed files with 6 additions and 15 deletions

View file

@ -48,7 +48,7 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
connect( &sources, SIGNAL( rescan() ), this, SLOT( rescanSources() ) );
connect( groups.get(), SIGNAL( showDictionaryInfo( QString const & ) ),
this, SLOT( showDictionaryInfo(QString const & ) ) );
this, SIGNAL( showDictionaryInfo(QString const & ) ) );
}
void EditDictionaries::editGroup( unsigned id )
@ -236,17 +236,3 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups )
origCfg.inactiveDictionaries = orderAndProps->getCurrentInactiveDictionaries();
}
}
void EditDictionaries::showDictionaryInfo( QString const & dictId )
{
unsigned n;
for( n = 0; n < dictionaries.size(); n++ )
if( dictId.compare( QString::fromUtf8( dictionaries[ n ]->getId().c_str() ) ) == 0 )
break;
if( n < dictionaries.size() )
{
DictInfo infoMsg( cfg, this );
infoMsg.showInfo( dictionaries[ n ] );
infoMsg.exec();
}
}

View file

@ -47,6 +47,8 @@ private slots:
void rescanSources();
signals:
void showDictionaryInfo( QString const & dictId );
private:

View file

@ -1707,6 +1707,9 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup )
Config::Class newCfg = cfg;
EditDictionaries dicts( this, newCfg, dictionaries, groupInstances, dictNetMgr );
connect( &dicts, SIGNAL( showDictionaryInfo( QString const & ) ),
this, SLOT( showDictionaryInfo( QString const & ) ) );
if ( editDictionaryGroup != Instances::Group::NoGroupId )
dicts.editGroup( editDictionaryGroup );