mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Drop old filter code
Drop tons of now-unused-code. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
43178be1f2
commit
e0f473fcb4
16 changed files with 44 additions and 1045 deletions
|
|
@ -33,7 +33,6 @@ set (SUBSURFACE_UI
|
|||
diveplanner.ui
|
||||
diveshareexportdialog.ui
|
||||
downloadfromdivecomputer.ui
|
||||
filterwidget.ui
|
||||
filterwidget2.ui
|
||||
findmovedimagesdialog.ui
|
||||
listfilter.ui
|
||||
|
|
|
|||
|
|
@ -110,11 +110,6 @@ std::vector<DiveToAdd> DiveListBase::removeDives(std::vector<dive *> &divesToDel
|
|||
std::vector<DiveToAdd> res;
|
||||
res.reserve(divesToDelete.size());
|
||||
|
||||
// First, tell the filters that dives are removed. This could
|
||||
// be done later using the emitted signals, but we do this here
|
||||
// for symmetry with addDives()
|
||||
MultiFilterSortModel::instance()->divesDeleted(QVector<dive *>::fromStdVector(divesToDelete));
|
||||
|
||||
for (dive *d: divesToDelete)
|
||||
res.push_back(removeDive(d));
|
||||
divesToDelete.clear();
|
||||
|
|
@ -154,7 +149,6 @@ std::vector<dive *> DiveListBase::addDives(std::vector<DiveToAdd> &divesToAdd)
|
|||
QVector<dive *> divesForFilter;
|
||||
for (const DiveToAdd &entry: divesToAdd)
|
||||
divesForFilter.push_back(entry.dive.get());
|
||||
MultiFilterSortModel::instance()->divesAdded(divesForFilter);
|
||||
|
||||
// At the end of the function, to send the proper dives-added signals,
|
||||
// we the the list of added trips. Create this list now.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "qt-models/divepicturemodel.h"
|
||||
#include "core/metrics.h"
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
|
||||
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
|
||||
currentLayout(DiveTripModel::TREE), dontEmitDiveChangedSignal(false), selectionSaved(false),
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <QMimeData>
|
||||
#include <QRegExp>
|
||||
#include <QUndoStack>
|
||||
#include <QPainter>
|
||||
#include "core/qthelper.h"
|
||||
#include "core/import-csv.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,140 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterWidget</class>
|
||||
<widget class="QWidget" name="FilterWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>594</width>
|
||||
<height>362</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="filterText">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="clear">
|
||||
<property name="toolTip">
|
||||
<string>Reset filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:edit-clear-icon</normaloff>:edit-clear-icon</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="maximize">
|
||||
<property name="toolTip">
|
||||
<string>Show/hide filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:hide-icon</normaloff>:hide-icon</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="close">
|
||||
<property name="toolTip">
|
||||
<string>Close and reset filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:filter-close</normaloff>:filter-close</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>594</width>
|
||||
<height>332</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../subsurface.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -34,8 +34,6 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
|||
ui.diveSiteMessage->addAction(rejectAction);
|
||||
|
||||
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
||||
connect(this, SIGNAL(nameChanged(const QString &, const QString &)),
|
||||
LocationFilterModel::instance(), SLOT(changeName(const QString &, const QString &)));
|
||||
connect(ui.updateLocationButton, SIGNAL(clicked()), this, SLOT(updateLocationOnMap()));
|
||||
connect(ui.diveSiteCoordinates, SIGNAL(returnPressed()), this, SLOT(updateLocationOnMap()));
|
||||
ui.diveSiteCoordinates->installEventFilter(this);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#include "desktop-widgets/updatemanager.h"
|
||||
#include "desktop-widgets/usersurvey.h"
|
||||
#include "desktop-widgets/filterwidget2.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
|
||||
|
|
@ -205,8 +206,6 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
setStateProperties("FilterDive", enabledList, enabledList, enabledList, enabledList);
|
||||
setApplicationState("Default");
|
||||
|
||||
ui.multiFilter->hide();
|
||||
|
||||
setWindowIcon(QIcon(":subsurface-icon"));
|
||||
if (!QIcon::hasThemeIcon("window-close")) {
|
||||
QIcon::setThemeName("subsurface");
|
||||
|
|
@ -497,10 +496,6 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
|
|||
void MainWindow::recreateDiveList()
|
||||
{
|
||||
diveList->reload();
|
||||
TagFilterModel::instance()->repopulate();
|
||||
BuddyFilterModel::instance()->repopulate();
|
||||
LocationFilterModel::instance()->repopulate();
|
||||
SuitsFilterModel::instance()->repopulate();
|
||||
MultiFilterSortModel::instance()->myInvalidate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "ui_plannerDetails.h"
|
||||
#include "desktop-widgets/notificationwidget.h"
|
||||
#include "core/gpslocation.h"
|
||||
#include "core/dive.h"
|
||||
|
||||
#define NUM_RECENT_FILES 4
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,18 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="MultiFilter" name="multiFilter" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="mainSplitter">
|
||||
<property name="orientation">
|
||||
|
|
@ -53,7 +59,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>861</width>
|
||||
<height>23</height>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
@ -133,7 +139,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuShare_on">
|
||||
<property name="title">
|
||||
<string>Share on</string>
|
||||
<string>Share o&n</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
|
|
@ -438,7 +444,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:pp-o2-icon</normaloff>:pp-o2-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -450,7 +456,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:pp-n2-icon</normaloff>:pp-n2-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -462,7 +468,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:pp-he-icon</normaloff>:pp-he-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -474,7 +480,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:ceiling-dc-icon</normaloff>:ceiling-dc-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -486,7 +492,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:ceiling-calculated-icon</normaloff>:ceiling-calculated-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -498,7 +504,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:ceiling-tissues-icon</normaloff>:ceiling-tissues-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -510,7 +516,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:ceiling-increments-icon</normaloff>:ceiling-increments-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -522,7 +528,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:rate-heart-icon</normaloff>:rate-heart-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -534,7 +540,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:depth-mod-icon</normaloff>:depth-mod-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -546,7 +552,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:depth-ead-icon</normaloff>:depth-ead-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -558,7 +564,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:depth-ndl-icon</normaloff>:depth-ndl-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -570,7 +576,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:rate-sac-icon</normaloff>:rate-sac-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -582,7 +588,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:ruler-icon</normaloff>:ruler-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -594,7 +600,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:scale-graph-icon</normaloff>:scale-graph-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -606,7 +612,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:photo-icon</normaloff>:photo-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -618,7 +624,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:gaschange-icon</normaloff>:gaschange-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -641,7 +647,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:heatmap-icon</normaloff>:heatmap-icon</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -704,7 +710,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cloud storage online</string>
|
||||
<string>Cloud stora&ge online</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
|
@ -715,12 +721,6 @@
|
|||
<header>desktop-widgets/notificationwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>MultiFilter</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>desktop-widgets/simplewidgets.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../subsurface.qrc"/>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "desktop-widgets/modeldelegates.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include "core/gettextfromc.h"
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
#include "qt-models/divetripmodel.h"
|
||||
#include "qt-models/divelocationmodel.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QKeyEvent>
|
||||
|
|
@ -22,6 +24,9 @@
|
|||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QAbstractProxyModel>
|
||||
#include <QLineEdit>
|
||||
#include <QAbstractItemView>
|
||||
#include <QSpinBox>
|
||||
|
||||
QSize DiveListDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <QShortcut>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#define SETTINGS_GROUP "PrintDialog"
|
||||
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ class FilterModelBase;
|
|||
#include "ui_urldialog.h"
|
||||
#include "ui_divecomponentselection.h"
|
||||
#include "ui_listfilter.h"
|
||||
#include "ui_filterwidget.h"
|
||||
#include "core/exif.h"
|
||||
#include "core/dive.h"
|
||||
|
||||
|
|
@ -150,59 +149,6 @@ private:
|
|||
struct dive_components *what;
|
||||
};
|
||||
|
||||
namespace Ui{
|
||||
class FilterWidget;
|
||||
};
|
||||
|
||||
class MultiFilter : public QWidget {
|
||||
Q_OBJECT
|
||||
public
|
||||
slots:
|
||||
void closeFilter();
|
||||
void adjustHeight();
|
||||
void filterFinished();
|
||||
|
||||
public:
|
||||
MultiFilter(QWidget *parent);
|
||||
Ui::FilterWidget ui;
|
||||
};
|
||||
|
||||
class FilterBase : public QWidget {
|
||||
Q_OBJECT
|
||||
void addContextMenuEntry(const QString &s, void (FilterModelBase::*)());
|
||||
protected:
|
||||
FilterBase(FilterModelBase *model, QWidget *parent = 0);
|
||||
FilterModelBase *model;
|
||||
Ui::ListFilter ui;
|
||||
void showEvent(QShowEvent *) override;
|
||||
void hideEvent(QHideEvent *) override;
|
||||
friend class MultiFilter;
|
||||
};
|
||||
|
||||
class TagFilter : public FilterBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TagFilter(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class BuddyFilter : public FilterBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuddyFilter(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class SuitFilter : public FilterBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SuitFilter(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class LocationFilter : public FilterBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocationFilter(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class TextHyperlinkEventFilter : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "core/gettextfromc.h"
|
||||
#include "desktop-widgets/locationinformation.h"
|
||||
#include "desktop-widgets/command.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
|
||||
#include "TabDiveExtraInfo.h"
|
||||
#include "TabDiveInformation.h"
|
||||
|
|
@ -688,7 +689,6 @@ struct dive_site *MainTab::updateDiveSite(struct dive_site *pickedDs, dive *d)
|
|||
QString name = ui.location->text().isEmpty() ? tr("New dive site") : ui.location->text();
|
||||
pickedDs = create_dive_site(qPrintable(name), displayed_dive.when);
|
||||
createdNewDive = true;
|
||||
LocationFilterModel::instance()->addName(name);
|
||||
}
|
||||
|
||||
if (origDs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue