From 4885bfcef4d89cf0cb391e00af617b9fd19c9cbb Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Tue, 21 Oct 2014 22:48:33 -0400 Subject: Imported Upstream version 2.5 --- src/frontend/btbookshelfdockwidget.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/frontend/btbookshelfdockwidget.cpp') diff --git a/src/frontend/btbookshelfdockwidget.cpp b/src/frontend/btbookshelfdockwidget.cpp index bedebcb..880c939 100644 --- a/src/frontend/btbookshelfdockwidget.cpp +++ b/src/frontend/btbookshelfdockwidget.cpp @@ -26,8 +26,7 @@ #include #include "backend/bookshelfmodel/btbookshelfmodel.h" #include "backend/bookshelfmodel/btbookshelftreemodel.h" -#include "backend/bookshelfmodel/btmodulehiddenfilterproxymodel.h" -#include "backend/bookshelfmodel/btmodulenamefilterproxymodel.h" +#include "backend/bookshelfmodel/btbookshelffiltermodel.h" #include "backend/config/cbtconfig.h" #include "backend/drivers/cswordmoduleinfo.h" #include "backend/managers/cswordbackend.h" @@ -59,10 +58,8 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f) m_bookshelfTreeModel->setDefaultChecked(BtBookshelfTreeModel::MODULE_HIDDEN); m_bookshelfTreeModel->setSourceModel(CPointers::backend()->model()); - m_filterProxyModel = new BtModuleHiddenFilterProxyModel(this); + m_filterProxyModel = new BtBookshelfFilterModel(this); m_filterProxyModel->setSourceModel(m_bookshelfTreeModel); - m_nameFilterProxyModel = new BtModuleNameFilterProxyModel(this); - m_nameFilterProxyModel->setSourceModel(m_filterProxyModel); // Setup actions and menus: initMenus(); @@ -73,7 +70,7 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f) layout->setContentsMargins(0, 0, 0, 0); QHBoxLayout *toolBar(new QHBoxLayout); // Add a small margin between the edge of the window and the label (looks better) - toolBar->setContentsMargins(3,0,0,0); + toolBar->setContentsMargins(3, 0, 0, 0); m_nameFilterLabel = new QLabel(this); toolBar->addWidget(m_nameFilterLabel); @@ -96,13 +93,13 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f) layout->addLayout(toolBar); m_view = new BtBookshelfView(this); - m_view->setModel(m_nameFilterProxyModel); + m_view->setModel(m_filterProxyModel); layout->addWidget(m_view); m_widget->setLayout(layout); setWidget(m_widget); connect(m_nameFilterEdit, SIGNAL(textEdited(QString)), - m_nameFilterProxyModel, SLOT(setFilterFixedString(QString))); + m_filterProxyModel, SLOT(setNameFilterFixedString(QString))); connect(m_view, SIGNAL(contextMenuActivated(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_view, @@ -110,10 +107,10 @@ BtBookshelfDockWidget::BtBookshelfDockWidget(QWidget *parent, Qt::WindowFlags f) this, SLOT(showItemContextMenu(CSwordModuleInfo*, QPoint))); connect(m_view, SIGNAL(moduleActivated(CSwordModuleInfo*)), this, SIGNAL(moduleOpenTriggered(CSwordModuleInfo*))); - connect(m_bookshelfTreeModel, SIGNAL(moduleChecked(CSwordModuleInfo*,bool)), - this, SLOT(moduleChecked(CSwordModuleInfo*,bool))); + connect(m_bookshelfTreeModel, SIGNAL(moduleChecked(CSwordModuleInfo*, bool)), + this, SLOT(moduleChecked(CSwordModuleInfo*, bool))); - retranslateInterface(); + retranslateUi(); } bool BtBookshelfDockWidget::eventFilter(QObject *object, QEvent *event) { @@ -173,7 +170,7 @@ void BtBookshelfDockWidget::initMenus() { m_groupingMenu->addAction(m_groupingNoneAction); m_showHideAction = new QAction(this); - m_showHideAction->setIcon(DU::getIcon(RM::search::icon)); + m_showHideAction->setIcon(DU::getIcon("layer-visible-on.svg")); m_showHideAction->setCheckable(true); connect(m_showHideAction, SIGNAL(toggled(bool)), this, SLOT(showHideEnabled(bool))); @@ -217,7 +214,7 @@ void BtBookshelfDockWidget::initMenus() { m_itemContextMenu->addAction(m_itemAboutAction); } -void BtBookshelfDockWidget::retranslateInterface() { +void BtBookshelfDockWidget::retranslateUi() { setWindowTitle(tr("Bookshelf")); m_nameFilterLabel->setText(tr("Fi<er:")); @@ -276,10 +273,10 @@ void BtBookshelfDockWidget::groupingActionTriggered(QAction *action) { void BtBookshelfDockWidget::showHideEnabled(bool enable) { if (enable) { m_bookshelfTreeModel->setCheckable(true); - m_filterProxyModel->setEnabled(false); + m_filterProxyModel->setShowHidden(true); } else { - m_filterProxyModel->setEnabled(true); + m_filterProxyModel->setShowHidden(false); m_bookshelfTreeModel->setCheckable(false); } } -- cgit v1.2.3