summaryrefslogtreecommitdiff
path: root/src/frontend/btbookshelfdockwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/btbookshelfdockwidget.cpp')
-rw-r--r--src/frontend/btbookshelfdockwidget.cpp27
1 files changed, 12 insertions, 15 deletions
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 <QVBoxLayout>
#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&lter:"));
@@ -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);
}
}