summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/simplewidgets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r--desktop-widgets/simplewidgets.cpp111
1 files changed, 0 insertions, 111 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index 8cfb63100..42569a270 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -493,117 +493,6 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
}
}
-void FilterBase::addContextMenuEntry(const QString &s, void (FilterModelBase::*fn)())
-{
- QAction *act = new QAction(s, this);
- connect(act, &QAction::triggered, model, fn);
- ui.filterList->addAction(act);
-}
-
-FilterBase::FilterBase(FilterModelBase *model_, QWidget *parent) : QWidget(parent),
- model(model_)
-{
- ui.setupUi(this);
-#if QT_VERSION >= 0x050200
- ui.filterInternalList->setClearButtonEnabled(true);
-#endif
- QSortFilterProxyModel *filter = new QSortFilterProxyModel();
- filter->setSourceModel(model);
- filter->setFilterCaseSensitivity(Qt::CaseInsensitive);
- connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString)));
- connect(ui.notButton, &QToolButton::toggled, model, &FilterModelBase::setNegate);
- ui.filterList->setModel(filter);
-
- addContextMenuEntry(tr("Select All"), &FilterModelBase::selectAll);
- addContextMenuEntry(tr("Unselect All"), &FilterModelBase::clearFilter);
- addContextMenuEntry(tr("Invert Selection"), &FilterModelBase::invertSelection);
- ui.filterList->setContextMenuPolicy(Qt::ActionsContextMenu);
-}
-
-void FilterBase::showEvent(QShowEvent *event)
-{
- MultiFilterSortModel::instance()->addFilterModel(model);
- QWidget::showEvent(event);
-}
-
-void FilterBase::hideEvent(QHideEvent *event)
-{
- MultiFilterSortModel::instance()->removeFilterModel(model);
- QWidget::hideEvent(event);
-}
-
-TagFilter::TagFilter(QWidget *parent) : FilterBase(TagFilterModel::instance(), parent)
-{
- ui.label->setText(tr("Tags") + QStringLiteral(": "));
-}
-
-BuddyFilter::BuddyFilter(QWidget *parent) : FilterBase(BuddyFilterModel::instance(), parent)
-{
- ui.label->setText(tr("Person") + QStringLiteral(": "));
- ui.label->setToolTip(tr("Searches for buddies and divemasters"));
-}
-
-LocationFilter::LocationFilter(QWidget *parent) : FilterBase(LocationFilterModel::instance(), parent)
-{
- ui.label->setText(tr("Location") + QStringLiteral(": "));
-}
-
-SuitFilter::SuitFilter(QWidget *parent) : FilterBase(SuitsFilterModel::instance(), parent)
-{
- ui.label->setText(tr("Suits") + QStringLiteral(": "));
-}
-
-MultiFilter::MultiFilter(QWidget *parent) : QWidget(parent)
-{
- ui.setupUi(this);
-
- QWidget *expandedWidget = new QWidget();
- QHBoxLayout *l = new QHBoxLayout();
-
- TagFilter *tagFilter = new TagFilter(this);
- int minimumHeight = tagFilter->ui.filterInternalList->height() +
- tagFilter->ui.verticalLayout->spacing() * tagFilter->ui.verticalLayout->count();
-
- QListView *dummyList = new QListView();
- QStringListModel *dummy = new QStringListModel(QStringList() << "Dummy Text");
- dummyList->setModel(dummy);
-
- connect(ui.close, SIGNAL(clicked(bool)), this, SLOT(closeFilter()));
- connect(ui.clear, SIGNAL(clicked(bool)), MultiFilterSortModel::instance(), SLOT(clearFilter()));
- connect(ui.maximize, SIGNAL(clicked(bool)), this, SLOT(adjustHeight()));
-
- l->addWidget(tagFilter);
- l->addWidget(new BuddyFilter());
- l->addWidget(new LocationFilter());
- l->addWidget(new SuitFilter());
- l->setContentsMargins(0, 0, 0, 0);
- l->setSpacing(0);
- expandedWidget->setLayout(l);
-
- ui.scrollArea->setWidget(expandedWidget);
- expandedWidget->resize(expandedWidget->width(), minimumHeight + dummyList->sizeHintForRow(0) * 5);
- ui.scrollArea->setMinimumHeight(expandedWidget->height() + 5);
-
- connect(MultiFilterSortModel::instance(), SIGNAL(filterFinished()), this, SLOT(filterFinished()));
-}
-
-void MultiFilter::filterFinished()
-{
- ui.filterText->setText(tr("Filter shows %1 (of %2) dives").arg(MultiFilterSortModel::instance()->divesDisplayed).arg(dive_table.nr));
-}
-
-void MultiFilter::adjustHeight()
-{
- ui.scrollArea->setVisible(!ui.scrollArea->isVisible());
-}
-
-void MultiFilter::closeFilter()
-{
- MultiFilterSortModel::instance()->clearFilter();
- hide();
- MainWindow::instance()->setCheckedActionFilterTags(false);
-}
-
TextHyperlinkEventFilter::TextHyperlinkEventFilter(QTextEdit *txtEdit) : QObject(txtEdit),
textEdit(txtEdit),
scrollView(textEdit->viewport())