From 581d55d5048064455694d6b14c365e864b264791 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Mon, 30 Jun 2014 17:58:39 +0400 Subject: [PATCH] Dictionaries dialog: Show dictionaries number --- orderandprops.cc | 21 +++++++---- orderandprops.hh | 1 + orderandprops.ui | 96 ++---------------------------------------------- 3 files changed, 18 insertions(+), 100 deletions(-) diff --git a/orderandprops.cc b/orderandprops.cc index 29106f67..6cef5332 100644 --- a/orderandprops.cc +++ b/orderandprops.cc @@ -89,13 +89,6 @@ OrderAndProps::OrderAndProps( QWidget * parent, { ui.setupUi( this ); - // For now we don't support arrows, so remove them until we get to that - delete ui.moveActiveUp; - delete ui.moveActiveDown; - - delete ui.moveToActive; - delete ui.moveToInactive; - Instances::Group order( dictionaryOrder, allDictionaries ); Instances::Group inactive( inactiveDictionaries, allDictionaries ); @@ -125,6 +118,13 @@ OrderAndProps::OrderAndProps( QWidget * parent, connect (ui.searchLine, SIGNAL( filterChanged( QString const & ) ), this, SLOT( filterChanged( QString const &) ) ); + + connect( ui.dictionaryOrder->getModel(), SIGNAL( contentChanged() ), + this, SLOT( showDictNumbers() ) ); + connect( ui.inactiveDictionaries->getModel(), SIGNAL( contentChanged() ), + this, SLOT( showDictNumbers() ) ); + + showDictNumbers(); } Config::Group OrderAndProps::getCurrentDictionaryOrder() const @@ -279,3 +279,10 @@ void OrderAndProps::contextMenuRequested( const QPoint & pos ) emit showDictionaryHeadwords( QString::fromUtf8( dict->getId().c_str() ) ); } } + +void OrderAndProps::showDictNumbers() +{ + ui.dictionariesNumber->setText( tr( "Dictionaries active: %1, inactive: %2" ) + .arg( QString::number( ui.dictionaryOrder->getModel()->rowCount( QModelIndex() ) ) ) + .arg( QString::number( ui.inactiveDictionaries->getModel()->rowCount( QModelIndex() ) ) ) ); +} diff --git a/orderandprops.hh b/orderandprops.hh index 6c48606c..79c49877 100644 --- a/orderandprops.hh +++ b/orderandprops.hh @@ -29,6 +29,7 @@ private slots: void filterChanged( QString const & filterText ); void dictListFocused(); void inactiveDictListFocused(); + void showDictNumbers(); private: diff --git a/orderandprops.ui b/orderandprops.ui index 95d7f04e..93c6143e 100644 --- a/orderandprops.ui +++ b/orderandprops.ui @@ -23,51 +23,12 @@ - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + - ... - - - Qt::UpArrow + - - - - ... - - - Qt::DownArrow - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -81,54 +42,7 @@ - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - ... - - - Qt::UpArrow - - - - - - - ... - - - Qt::DownArrow - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + @@ -431,10 +345,6 @@ dictionaryOrder - moveActiveUp - moveActiveDown - moveToActive - moveToInactive inactiveDictionaries dictionaryDescription dictionaryFileList