mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
filter: connect new filtercode to filterwidget2
Replace the static filterwidget with a list of filterconstraints. The first attempt of using a table widget failed, because Qt's table delegates are dysfunctional. It's not that they are bad, they just don't work at all. Therefore, this code "simulates" a table in that on addition / deletion of constraints it keeps track of the rows of all constraints so that each constraint-widget can be associated with a row of the constraint model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c0af74ba88
commit
6c443ba841
5 changed files with 240 additions and 1061 deletions
|
@ -1,9 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include "divefilter.h"
|
||||
#include "divelist.h"
|
||||
#include "gettextfromc.h"
|
||||
#include "tag.h"
|
||||
#include "divelist.h" // for filter_dive
|
||||
#include "qthelper.h"
|
||||
#include "subsurface-qt/divelistnotifier.h"
|
||||
|
||||
static void updateDiveStatus(dive *d, bool newStatus, ShownChange &change)
|
||||
|
@ -16,6 +15,9 @@ static void updateDiveStatus(dive *d, bool newStatus, ShownChange &change)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
|
||||
#include "tag.h"
|
||||
static QStringList getTagList(const dive *d)
|
||||
{
|
||||
QStringList res;
|
||||
|
@ -25,8 +27,6 @@ static QStringList getTagList(const dive *d)
|
|||
return res;
|
||||
}
|
||||
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
|
||||
// Check if a string-list contains at least one string that starts with the second argument.
|
||||
// Comparison is non case sensitive and removes white space.
|
||||
static bool listContainsSuperstring(const QStringList &list, const QString &s)
|
||||
|
@ -140,10 +140,13 @@ void DiveFilter::setFilter(const FilterData &data)
|
|||
#include "desktop-widgets/mapwidget.h"
|
||||
#include "desktop-widgets/mainwindow.h"
|
||||
#include "desktop-widgets/divelistview.h"
|
||||
#include "core/trip.h"
|
||||
#include "core/divesite.h"
|
||||
#include "qt-models/filtermodels.h"
|
||||
|
||||
bool FilterData::validFilter() const
|
||||
{
|
||||
return fullText.doit() || !constraints.empty();
|
||||
}
|
||||
|
||||
ShownChange DiveFilter::update(const QVector<dive *> &dives) const
|
||||
{
|
||||
dive *old_current = current_dive;
|
||||
|
@ -191,96 +194,6 @@ ShownChange DiveFilter::updateAll() const
|
|||
return res;
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Pointer to function that takes two strings and returns whether
|
||||
// the first matches the second according to a criterion (substring, starts-with, exact).
|
||||
using StrCheck = bool (*) (const QString &s1, const QString &s2);
|
||||
|
||||
// Check if a string-list contains at least one string containing the second argument.
|
||||
// Comparison is non case sensitive and removes white space.
|
||||
bool listContainsSuperstring(const QStringList &list, const QString &s, StrCheck strchk)
|
||||
{
|
||||
return std::any_of(list.begin(), list.end(), [&s,strchk](const QString &s2)
|
||||
{ return strchk(s2, s); } );
|
||||
}
|
||||
|
||||
// Check whether either all, any or none of the items of the first list is
|
||||
// in the second list as a super string.
|
||||
// The mode is controlled by the second argument
|
||||
bool check(const QStringList &items, const QStringList &list, FilterData::Mode mode, StringFilterMode stringMode)
|
||||
{
|
||||
bool negate = mode == FilterData::Mode::NONE_OF;
|
||||
bool any_of = mode == FilterData::Mode::ANY_OF;
|
||||
StrCheck strchk =
|
||||
stringMode == StringFilterMode::SUBSTRING ?
|
||||
[](const QString &s1, const QString &s2) { return s1.contains(s2, Qt::CaseInsensitive); } :
|
||||
stringMode == StringFilterMode::STARTSWITH ?
|
||||
[](const QString &s1, const QString &s2) { return s1.startsWith(s2, Qt::CaseInsensitive); } :
|
||||
/* StringFilterMode::EXACT */
|
||||
[](const QString &s1, const QString &s2) { return s1.compare(s2, Qt::CaseInsensitive) == 0; };
|
||||
auto fun = [&list, negate, strchk](const QString &item)
|
||||
{ return listContainsSuperstring(list, item, strchk) != negate; };
|
||||
return any_of ? std::any_of(items.begin(), items.end(), fun)
|
||||
: std::all_of(items.begin(), items.end(), fun);
|
||||
}
|
||||
|
||||
bool hasTags(const QStringList &tags, const struct dive *d, FilterData::Mode mode, StringFilterMode stringMode)
|
||||
{
|
||||
if (tags.isEmpty())
|
||||
return true;
|
||||
return check(tags, getTagList(d), mode, stringMode);
|
||||
}
|
||||
|
||||
bool hasPersons(const QStringList &people, const struct dive *d, FilterData::Mode mode, StringFilterMode stringMode)
|
||||
{
|
||||
if (people.isEmpty())
|
||||
return true;
|
||||
QStringList dive_people = QString(d->buddy).split(",", QString::SkipEmptyParts)
|
||||
+ QString(d->divemaster).split(",", QString::SkipEmptyParts);
|
||||
return check(people, dive_people, mode, stringMode);
|
||||
}
|
||||
|
||||
bool hasLocations(const QStringList &locations, const struct dive *d, FilterData::Mode mode, StringFilterMode stringMode)
|
||||
{
|
||||
if (locations.isEmpty())
|
||||
return true;
|
||||
QStringList diveLocations;
|
||||
if (d->divetrip)
|
||||
diveLocations.push_back(QString(d->divetrip->location));
|
||||
|
||||
if (d->dive_site)
|
||||
diveLocations.push_back(QString(d->dive_site->name));
|
||||
|
||||
return check(locations, diveLocations, mode, stringMode);
|
||||
}
|
||||
|
||||
// TODO: Finish this implementation.
|
||||
bool hasEquipment(const QStringList &, const struct dive *, FilterData::Mode, StringFilterMode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasSuits(const QStringList &suits, const struct dive *d, FilterData::Mode mode, StringFilterMode stringMode)
|
||||
{
|
||||
if (suits.isEmpty())
|
||||
return true;
|
||||
QStringList diveSuits;
|
||||
if (d->suit)
|
||||
diveSuits.push_back(QString(d->suit));
|
||||
return check(suits, diveSuits, mode, stringMode);
|
||||
}
|
||||
|
||||
bool hasNotes(const QStringList &dnotes, const struct dive *d, FilterData::Mode mode, StringFilterMode stringMode)
|
||||
{
|
||||
if (dnotes.isEmpty())
|
||||
return true;
|
||||
QStringList diveNotes;
|
||||
if (d->notes)
|
||||
diveNotes.push_back(QString(d->notes));
|
||||
return check(dnotes, diveNotes, mode, stringMode);
|
||||
}
|
||||
}
|
||||
|
||||
DiveFilter *DiveFilter::instance()
|
||||
{
|
||||
static DiveFilter self;
|
||||
|
@ -296,70 +209,11 @@ bool DiveFilter::showDive(const struct dive *d) const
|
|||
if (d->invalid && !prefs.display_invalid_dives)
|
||||
return false;
|
||||
|
||||
if (!filterData.validFilter)
|
||||
if (!filterData.validFilter())
|
||||
return true;
|
||||
|
||||
if (d->visibility < filterData.minVisibility || d->visibility > filterData.maxVisibility)
|
||||
return false;
|
||||
|
||||
if (d->rating < filterData.minRating || d->rating > filterData.maxRating)
|
||||
return false;
|
||||
|
||||
auto temp_comp = prefs.units.temperature == units::CELSIUS ? C_to_mkelvin : F_to_mkelvin;
|
||||
if (d->watertemp.mkelvin &&
|
||||
(d->watertemp.mkelvin < (*temp_comp)(filterData.minWaterTemp) || d->watertemp.mkelvin > (*temp_comp)(filterData.maxWaterTemp)))
|
||||
return false;
|
||||
|
||||
if (d->airtemp.mkelvin &&
|
||||
(d->airtemp.mkelvin < (*temp_comp)(filterData.minAirTemp) || d->airtemp.mkelvin > (*temp_comp)(filterData.maxAirTemp)))
|
||||
return false;
|
||||
|
||||
QDateTime t = filterData.fromDate;
|
||||
t.setTime(filterData.fromTime);
|
||||
if (filterData.fromDate.isValid() && filterData.fromTime.isValid() &&
|
||||
d->when < t.toMSecsSinceEpoch()/1000 + t.offsetFromUtc())
|
||||
return false;
|
||||
|
||||
t = filterData.toDate;
|
||||
t.setTime(filterData.toTime);
|
||||
if (filterData.toDate.isValid() && filterData.toTime.isValid() &&
|
||||
d->when > t.toMSecsSinceEpoch()/1000 + t.offsetFromUtc())
|
||||
return false;
|
||||
|
||||
// tags.
|
||||
if (!hasTags(filterData.tags, d, filterData.tagsMode, filterData.tagsStringMode))
|
||||
return false;
|
||||
|
||||
// people
|
||||
if (!hasPersons(filterData.people, d, filterData.peopleMode, filterData.peopleStringMode))
|
||||
return false;
|
||||
|
||||
// Location
|
||||
if (!hasLocations(filterData.location, d, filterData.locationMode, filterData.locationStringMode))
|
||||
return false;
|
||||
|
||||
// Suit
|
||||
if (!hasSuits(filterData.suit, d, filterData.suitMode, filterData.suitStringMode))
|
||||
return false;
|
||||
|
||||
// Notes
|
||||
if (!hasNotes(filterData.dnotes, d, filterData.dnotesMode, filterData.dnotesStringMode))
|
||||
return false;
|
||||
|
||||
if (!hasEquipment(filterData.equipment, d, filterData.equipmentMode, filterData.equipmentStringMode))
|
||||
return false;
|
||||
|
||||
// Planned/Logged
|
||||
if (!filterData.logged && !has_planned(d, true))
|
||||
return false;
|
||||
if (!filterData.planned && !has_planned(d, false))
|
||||
return false;
|
||||
|
||||
// Dive mode
|
||||
if (filterData.diveMode >= 0 && d->dc.divemode != (divemode_t)filterData.diveMode)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return std::all_of(filterData.constraints.begin(), filterData.constraints.end(),
|
||||
[d] (const filter_constraint &c) { return filter_constraint_match_dive(c, d); });
|
||||
}
|
||||
|
||||
void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
#ifndef DIVE_FILTER_H
|
||||
#define DIVE_FILTER_H
|
||||
|
||||
#include "fulltext.h"
|
||||
#include "filterconstraint.h"
|
||||
#include <vector>
|
||||
#include <QVector>
|
||||
#include <QStringList>
|
||||
#include "fulltext.h"
|
||||
|
||||
struct dive;
|
||||
|
||||
|
@ -50,8 +52,6 @@ private:
|
|||
|
||||
#else
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
struct dive_trip;
|
||||
struct dive_site;
|
||||
|
||||
|
@ -63,45 +63,10 @@ struct FilterData {
|
|||
NONE_OF = 2
|
||||
};
|
||||
|
||||
bool validFilter = false;
|
||||
int minVisibility = 0;
|
||||
int maxVisibility = 5;
|
||||
int minRating = 0;
|
||||
int maxRating = 5;
|
||||
// The default minimum and maximum temperatures are set such that all
|
||||
// physically reasonable dives are shown. Note that these values should
|
||||
// work for both Celsius and Fahrenheit scales.
|
||||
double minWaterTemp = -10;
|
||||
double maxWaterTemp = 200;
|
||||
double minAirTemp = -50;
|
||||
double maxAirTemp = 200;
|
||||
QDateTime fromDate = QDateTime(QDate(1980,1,1));
|
||||
QTime fromTime = QTime(0,0);
|
||||
QDateTime toDate = QDateTime::currentDateTime().addDays(7);
|
||||
QTime toTime = QTime::currentTime();
|
||||
QStringList tags;
|
||||
QStringList people;
|
||||
QStringList location;
|
||||
QStringList suit;
|
||||
QStringList dnotes;
|
||||
QStringList equipment;
|
||||
FullTextQuery fullText;
|
||||
Mode tagsMode = Mode::ALL_OF;
|
||||
Mode peopleMode = Mode::ALL_OF;
|
||||
Mode locationMode = Mode::ANY_OF;
|
||||
Mode dnotesMode = Mode::ALL_OF;
|
||||
Mode suitMode = Mode::ANY_OF;
|
||||
Mode equipmentMode = Mode::ALL_OF;
|
||||
StringFilterMode fulltextStringMode = StringFilterMode::STARTSWITH;
|
||||
StringFilterMode tagsStringMode = StringFilterMode::SUBSTRING;
|
||||
StringFilterMode peopleStringMode = StringFilterMode::SUBSTRING;
|
||||
StringFilterMode locationStringMode = StringFilterMode::SUBSTRING;
|
||||
StringFilterMode dnotesStringMode = StringFilterMode::SUBSTRING;
|
||||
StringFilterMode suitStringMode = StringFilterMode::SUBSTRING;
|
||||
StringFilterMode equipmentStringMode = StringFilterMode::SUBSTRING;
|
||||
bool logged = true;
|
||||
bool planned = true;
|
||||
int diveMode = -1; // -1: don't filter, >= 0: corresponds to divemode_t
|
||||
std::vector<filter_constraint> constraints;
|
||||
bool validFilter() const;
|
||||
};
|
||||
|
||||
class DiveFilter {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "desktop-widgets/filterwidget2.h"
|
||||
#include "desktop-widgets/filterconstraintwidget.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
#include "desktop-widgets/mainwindow.h"
|
||||
#include "core/qthelper.h"
|
||||
|
@ -9,195 +10,89 @@
|
|||
|
||||
FilterWidget2::FilterWidget2(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ignoreSignal(false)
|
||||
ignoreSignal(false),
|
||||
validFilter(false)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
FilterData data;
|
||||
QMenu *newConstraintMenu = new QMenu(this);
|
||||
QStringList constraintTypes = filter_constraint_type_list_translated();
|
||||
for (int i = 0; i < constraintTypes.size(); ++i) {
|
||||
filter_constraint_type type = filter_constraint_type_from_index(i);
|
||||
newConstraintMenu->addAction(constraintTypes[i], [this, type]() { addConstraint(type); });
|
||||
}
|
||||
ui.addConstraintButton->setMenu(newConstraintMenu);
|
||||
ui.addConstraintButton->setPopupMode(QToolButton::InstantPopup);
|
||||
ui.constraintTable->setColumnStretch(4, 1); // The fifth column is were the actual constraint resides - stretch that.
|
||||
|
||||
// Use default values to set minimum and maximum air and water temperature.
|
||||
ui.minAirTemp->setRange(data.minAirTemp, data.maxAirTemp);
|
||||
ui.maxAirTemp->setRange(data.minAirTemp, data.maxAirTemp);
|
||||
ui.minWaterTemp->setRange(data.minWaterTemp, data.maxWaterTemp);
|
||||
ui.maxWaterTemp->setRange(data.minWaterTemp, data.maxWaterTemp);
|
||||
connect(ui.clear, &QToolButton::clicked, this, &FilterWidget2::clearFilter);
|
||||
connect(ui.close, &QToolButton::clicked, this, &FilterWidget2::closeFilter);
|
||||
connect(ui.fullText, &QLineEdit::textChanged, this, &FilterWidget2::updateFilter);
|
||||
connect(ui.fulltextStringMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FilterWidget2::updateFilter);
|
||||
|
||||
// This needs to be the same order as enum dive_comp_type in dive.h!
|
||||
QStringList types;
|
||||
types.append(""); // Empty means don't filter on dive mode
|
||||
for (int i = 0; i < NUM_DIVEMODE; i++)
|
||||
types.append(gettextFromC::tr(divemode_text_ui[i]));
|
||||
ui.diveMode->insertItems(0, types);
|
||||
connect(&constraintModel, &FilterConstraintModel::rowsInserted, this, &FilterWidget2::constraintAdded);
|
||||
connect(&constraintModel, &FilterConstraintModel::rowsRemoved, this, &FilterWidget2::constraintRemoved);
|
||||
connect(&constraintModel, &FilterConstraintModel::dataChanged, this, &FilterWidget2::constraintChanged);
|
||||
connect(&constraintModel, &FilterConstraintModel::modelReset, this, &FilterWidget2::constraintsReset);
|
||||
|
||||
// TODO: unhide this when we discover how to search for equipment.
|
||||
ui.equipment->hide();
|
||||
ui.equipmentMode->hide();
|
||||
ui.equipmentStringMode->hide();
|
||||
ui.labelEquipment->hide();
|
||||
|
||||
ui.fromDate->setDisplayFormat(prefs.date_format);
|
||||
ui.fromTime->setDisplayFormat(prefs.time_format);
|
||||
|
||||
ui.toDate->setDisplayFormat(prefs.date_format);
|
||||
ui.toTime->setDisplayFormat(prefs.time_format);
|
||||
|
||||
// Initialize temperature fields to display correct unit.
|
||||
temperatureChanged();
|
||||
|
||||
connect(ui.clear, &QToolButton::clicked,
|
||||
this, &FilterWidget2::clearFilter);
|
||||
|
||||
connect(ui.close, &QToolButton::clicked,
|
||||
this, &FilterWidget2::closeFilter);
|
||||
|
||||
connect(ui.maxRating, &StarWidget::valueChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.minRating, &StarWidget::valueChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.maxVisibility, &StarWidget::valueChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.minVisibility, &StarWidget::valueChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.maxAirTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.minAirTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.maxWaterTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.minWaterTemp, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.fromDate, &QDateTimeEdit::dateChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.fromTime, &QDateTimeEdit::timeChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.toDate, &QDateTimeEdit::dateChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.toTime, &QDateTimeEdit::timeChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.fullText, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.fulltextStringMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.tags, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.tagsMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.tagsStringMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.people, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.peopleMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.peopleStringMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.location, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.locationMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.locationStringMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.suit, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.suitMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.suitStringMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.dnotes, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.dnotesMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.dnotesStringMode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui.logged, &QCheckBox::stateChanged,
|
||||
this, &FilterWidget2::updateLogged);
|
||||
|
||||
connect(ui.planned, &QCheckBox::stateChanged,
|
||||
this, &FilterWidget2::updatePlanned);
|
||||
|
||||
connect(ui.diveMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
// Update temperature fields if user changes temperature-units in preferences.
|
||||
connect(qPrefUnits::instance(), &qPrefUnits::temperatureChanged,
|
||||
this, &FilterWidget2::temperatureChanged);
|
||||
|
||||
connect(qPrefUnits::instance(), &qPrefUnits::unit_systemChanged,
|
||||
this, &FilterWidget2::temperatureChanged);
|
||||
|
||||
// Reset all fields.
|
||||
clearFilter();
|
||||
}
|
||||
|
||||
FilterWidget2::~FilterWidget2()
|
||||
{
|
||||
}
|
||||
|
||||
void FilterWidget2::constraintAdded(const QModelIndex &parent, int first, int last)
|
||||
{
|
||||
if (parent.isValid() || last < first)
|
||||
return; // We only support one level
|
||||
constraintWidgets.reserve(constraintWidgets.size() + 1 + last - first);
|
||||
for (int i = last + 1; i < (int)constraintWidgets.size(); ++i)
|
||||
constraintWidgets[i]->moveToRow(i);
|
||||
for (int i = first; i <= last; ++i) {
|
||||
QModelIndex idx = constraintModel.index(i, 0);
|
||||
constraintWidgets.emplace(constraintWidgets.begin() + i, new FilterConstraintWidget(&constraintModel, idx, ui.constraintTable));
|
||||
}
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::constraintRemoved(const QModelIndex &parent, int first, int last)
|
||||
{
|
||||
if (parent.isValid() || last < first)
|
||||
return; // We only support one level
|
||||
constraintWidgets.erase(constraintWidgets.begin() + first, constraintWidgets.begin() + last + 1);
|
||||
for (int i = first; i < (int)constraintWidgets.size(); ++i)
|
||||
constraintWidgets[i]->moveToRow(i);
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::constraintChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
||||
{
|
||||
// Note: this may appear strange, but we don't update the widget if we get
|
||||
// a constraint-changed signal from the model. The reason being that the user
|
||||
// is currently editing the constraint and we don't want to bother them by
|
||||
// overwriting strings with canonicalized data.
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::constraintsReset()
|
||||
{
|
||||
constraintWidgets.clear();
|
||||
int count = constraintModel.rowCount(QModelIndex());
|
||||
for (int i = 0; i < count; ++i) {
|
||||
QModelIndex idx = constraintModel.index(i, 0);
|
||||
constraintWidgets.emplace_back(new FilterConstraintWidget(&constraintModel, idx, ui.constraintTable));
|
||||
}
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::clearFilter()
|
||||
{
|
||||
ignoreSignal = true; // Prevent signals to force filter recalculation
|
||||
filterData = FilterData();
|
||||
ui.minRating->setCurrentStars(filterData.minRating);
|
||||
ui.maxRating->setCurrentStars(filterData.maxRating);
|
||||
ui.minVisibility->setCurrentStars(filterData.minVisibility);
|
||||
ui.maxVisibility->setCurrentStars(filterData.maxVisibility);
|
||||
ui.minAirTemp->setValue(filterData.minAirTemp);
|
||||
ui.maxAirTemp->setValue(filterData.maxAirTemp);
|
||||
ui.minWaterTemp->setValue(filterData.minWaterTemp);
|
||||
ui.maxWaterTemp->setValue(filterData.maxWaterTemp);
|
||||
ui.planned->setChecked(filterData.logged);
|
||||
ui.planned->setChecked(filterData.planned);
|
||||
ui.people->clear();
|
||||
ui.location->clear();
|
||||
ui.suit->clear();
|
||||
ui.dnotes->clear();
|
||||
ui.equipment->clear();
|
||||
ui.tags->clear();
|
||||
ui.fromDate->setDate(filterData.fromDate.date());
|
||||
ui.fromTime->setTime(filterData.fromTime);
|
||||
ui.toDate->setDate(filterData.toDate.date());
|
||||
ui.toTime->setTime(filterData.toTime);
|
||||
ui.tagsMode->setCurrentIndex((int)filterData.tagsMode);
|
||||
ui.peopleMode->setCurrentIndex((int)filterData.peopleMode);
|
||||
ui.locationMode->setCurrentIndex((int)filterData.locationMode);
|
||||
ui.suitMode->setCurrentIndex((int)filterData.suitMode);
|
||||
ui.dnotesMode->setCurrentIndex((int)filterData.dnotesMode);
|
||||
ui.equipmentMode->setCurrentIndex((int)filterData.equipmentMode);
|
||||
ui.fulltextStringMode->setCurrentIndex((int)filterData.fulltextStringMode);
|
||||
ui.tagsStringMode->setCurrentIndex((int)filterData.tagsStringMode);
|
||||
ui.peopleStringMode->setCurrentIndex((int)filterData.peopleStringMode);
|
||||
ui.locationStringMode->setCurrentIndex((int)filterData.locationStringMode);
|
||||
ui.suitStringMode->setCurrentIndex((int)filterData.suitStringMode);
|
||||
ui.dnotesStringMode->setCurrentIndex((int)filterData.dnotesStringMode);
|
||||
ui.equipmentStringMode->setCurrentIndex((int)filterData.equipmentStringMode);
|
||||
ui.diveMode->setCurrentIndex(filterData.diveMode + 1); // -1 means don't filter, transform that into index 0
|
||||
|
||||
ignoreSignal = true; // Prevent signals to force filter recalculation (TODO: check if necessary)
|
||||
ui.fulltextStringMode->setCurrentIndex((int)StringFilterMode::STARTSWITH);
|
||||
ui.fullText->clear();
|
||||
ignoreSignal = false;
|
||||
|
||||
filterDataChanged(filterData);
|
||||
constraintModel.reload({}); // Causes a filter reload
|
||||
}
|
||||
|
||||
void FilterWidget2::closeFilter()
|
||||
|
@ -205,79 +100,24 @@ void FilterWidget2::closeFilter()
|
|||
MainWindow::instance()->setApplicationState(ApplicationState::Default);
|
||||
}
|
||||
|
||||
void FilterWidget2::temperatureChanged()
|
||||
{
|
||||
QString temp = get_temp_unit();
|
||||
ui.minAirTemp->setSuffix(temp);
|
||||
ui.maxAirTemp->setSuffix(temp);
|
||||
ui.minWaterTemp->setSuffix(temp);
|
||||
ui.maxWaterTemp->setSuffix(temp);
|
||||
}
|
||||
|
||||
void FilterWidget2::updateFilter()
|
||||
{
|
||||
if (ignoreSignal)
|
||||
return;
|
||||
|
||||
filterData.validFilter = true;
|
||||
filterData.minVisibility = ui.minVisibility->currentStars();
|
||||
filterData.maxVisibility = ui.maxVisibility->currentStars();
|
||||
filterData.minRating = ui.minRating->currentStars();
|
||||
filterData.maxRating = ui.maxRating->currentStars();
|
||||
filterData.minWaterTemp = ui.minWaterTemp->value();
|
||||
filterData.maxWaterTemp = ui.maxWaterTemp->value();
|
||||
filterData.minAirTemp = ui.minAirTemp->value();
|
||||
filterData.maxWaterTemp = ui.maxWaterTemp->value();
|
||||
filterData.fromDate = ui.fromDate->dateTime();
|
||||
filterData.fromTime = ui.fromTime->time();
|
||||
filterData.toDate = ui.toDate->dateTime();
|
||||
filterData.toTime = ui.toTime->time();
|
||||
filterData.fullText = ui.fullText->text();
|
||||
filterData.tags = ui.tags->text().split(",", QString::SkipEmptyParts);
|
||||
filterData.people = ui.people->text().split(",", QString::SkipEmptyParts);
|
||||
filterData.location = ui.location->text().split(",", QString::SkipEmptyParts);
|
||||
filterData.suit = ui.suit->text().split(",", QString::SkipEmptyParts);
|
||||
filterData.dnotes = ui.dnotes->text().split(",", QString::SkipEmptyParts);
|
||||
filterData.equipment = ui.equipment->text().split(",", QString::SkipEmptyParts);
|
||||
filterData.tagsMode = (FilterData::Mode)ui.tagsMode->currentIndex();
|
||||
filterData.peopleMode = (FilterData::Mode)ui.peopleMode->currentIndex();
|
||||
filterData.locationMode = (FilterData::Mode)ui.locationMode->currentIndex();
|
||||
filterData.suitMode = (FilterData::Mode)ui.suitMode->currentIndex();
|
||||
filterData.dnotesMode = (FilterData::Mode)ui.dnotesMode->currentIndex();
|
||||
filterData.equipmentMode = (FilterData::Mode)ui.equipmentMode->currentIndex();
|
||||
FilterData filterData;
|
||||
filterData.fulltextStringMode = (StringFilterMode)ui.fulltextStringMode->currentIndex();
|
||||
filterData.tagsStringMode = (StringFilterMode)ui.tagsStringMode->currentIndex();
|
||||
filterData.peopleStringMode = (StringFilterMode)ui.peopleStringMode->currentIndex();
|
||||
filterData.locationStringMode = (StringFilterMode)ui.locationStringMode->currentIndex();
|
||||
filterData.suitStringMode = (StringFilterMode)ui.suitStringMode->currentIndex();
|
||||
filterData.dnotesStringMode = (StringFilterMode)ui.dnotesStringMode->currentIndex();
|
||||
filterData.equipmentStringMode = (StringFilterMode)ui.equipmentStringMode->currentIndex();
|
||||
filterData.logged = ui.logged->isChecked();
|
||||
filterData.planned = ui.planned->isChecked();
|
||||
filterData.diveMode = ui.diveMode->currentIndex() - 1; // The first entry means don't filter, transform that to -1.
|
||||
|
||||
filterDataChanged(filterData);
|
||||
}
|
||||
|
||||
void FilterWidget2::updateLogged(int value)
|
||||
{
|
||||
if (value == Qt::Unchecked)
|
||||
ui.planned->setChecked(true);
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::updatePlanned(int value)
|
||||
{
|
||||
if (value == Qt::Unchecked)
|
||||
ui.logged->setChecked(true);
|
||||
updateFilter();
|
||||
filterData.fullText = ui.fullText->text();
|
||||
filterData.constraints = constraintModel.getConstraints();
|
||||
validFilter = filterData.validFilter();
|
||||
DiveFilter::instance()->setFilter(filterData);
|
||||
}
|
||||
|
||||
void FilterWidget2::showEvent(QShowEvent *event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
ui.fullText->setFocus();
|
||||
filterDataChanged(filterData);
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
void FilterWidget2::hideEvent(QHideEvent *event)
|
||||
|
@ -285,20 +125,15 @@ void FilterWidget2::hideEvent(QHideEvent *event)
|
|||
QWidget::hideEvent(event);
|
||||
}
|
||||
|
||||
void FilterWidget2::filterDataChanged(const FilterData &data)
|
||||
void FilterWidget2::addConstraint(filter_constraint_type type)
|
||||
{
|
||||
DiveFilter::instance()->setFilter(data);
|
||||
constraintModel.addConstraint(type);
|
||||
}
|
||||
|
||||
QString FilterWidget2::shownText()
|
||||
{
|
||||
if (isActive())
|
||||
if (validFilter)
|
||||
return tr("%L1/%L2 shown").arg(shown_dives).arg(dive_table.nr);
|
||||
else
|
||||
return tr("%L1 dives").arg(dive_table.nr);
|
||||
}
|
||||
|
||||
bool FilterWidget2::isActive() const
|
||||
{
|
||||
return filterData.validFilter;
|
||||
}
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
#ifndef FILTERWIDGET_2_H
|
||||
#define FILTERWIDGET_2_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHideEvent>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "ui_filterwidget2.h"
|
||||
#include "core/divefilter.h"
|
||||
#include "qt-models/filterconstraintmodel.h"
|
||||
|
||||
namespace Ui {
|
||||
class FilterWidget2;
|
||||
}
|
||||
class FilterConstraintWidget;
|
||||
|
||||
class FilterWidget2 : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilterWidget2(QWidget *parent = 0);
|
||||
void updateFilter();
|
||||
~FilterWidget2();
|
||||
QString shownText();
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
public slots:
|
||||
void updatePlanned(int value);
|
||||
void updateLogged(int value);
|
||||
private slots:
|
||||
void clearFilter();
|
||||
void closeFilter();
|
||||
void temperatureChanged();
|
||||
void updateFilter();
|
||||
void constraintAdded(const QModelIndex &parent, int first, int last);
|
||||
void constraintRemoved(const QModelIndex &parent, int first, int last);
|
||||
void constraintChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
||||
void constraintsReset();
|
||||
|
||||
private:
|
||||
bool ignoreSignal;
|
||||
bool isActive() const;
|
||||
Ui::FilterWidget2 ui;
|
||||
void filterDataChanged(const FilterData &data);
|
||||
FilterData filterData;
|
||||
FilterConstraintModel constraintModel;
|
||||
bool validFilter;
|
||||
void addConstraint(filter_constraint_type type);
|
||||
std::vector<std::unique_ptr<FilterConstraintWidget>> constraintWidgets;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
<height>349</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
|
@ -34,207 +40,133 @@
|
|||
<height>487</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="13" column="2">
|
||||
<widget class="QComboBox" name="suitStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="constraintTable">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Filter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
<item row="0" column="2" colspan="3">
|
||||
<layout class="QHBoxLayout" name="titleLineLayout">
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="clear">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:edit-clear-icon</normaloff>:edit-clear-icon</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="close">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:filter-close</normaloff>:filter-close</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QToolButton" name="addConstraintButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add constraint</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="titleLineSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exact</string>
|
||||
</property>
|
||||
<item row="1" column="0" colspan="2" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="fullTextLabel">
|
||||
<property name="text">
|
||||
<string>Fulltext</string>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="QTimeEdit" name="fromTime"/>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Suit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="StarWidget" name="maxRating" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="QTimeEdit" name="toTime"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Air Temp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="labelEquipment">
|
||||
<property name="text">
|
||||
<string>Equipment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="StarWidget" name="minRating" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QComboBox" name="locationStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
<item row="1" column="2" colspan="3" alignment="Qt::AlignLeft">
|
||||
<layout class="QHBoxLayout" name="fulltextLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="fulltextStringMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Full word</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="fullText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exact</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="StarWidget" name="maxVisibility" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Tags</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Water Temp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QComboBox" name="equipmentMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None of</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>People</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QDoubleSpinBox" name="maxAirTemp"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QDoubleSpinBox" name="minAirTemp"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -247,423 +179,15 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="16" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="equipment"/>
|
||||
</item>
|
||||
<item row="8" column="4">
|
||||
<widget class="QCheckBox" name="planned">
|
||||
<property name="text">
|
||||
<string>Planned</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QComboBox" name="dnotesMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None of</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="tags"/>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Notes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Visibility</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="suit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="StarWidget" name="minVisibility" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="2">
|
||||
<widget class="QComboBox" name="dnotesStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exact</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="location"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="filterButtonExplanation">
|
||||
<property name="text">
|
||||
<string>Reset / close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="dnotes"/>
|
||||
</item>
|
||||
<item row="11" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="people"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<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 row="11" column="2">
|
||||
<widget class="QComboBox" name="peopleStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exact</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QDoubleSpinBox" name="minWaterTemp"/>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QDateTimeEdit" name="fromDate">
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QComboBox" name="suitMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None of</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="5">
|
||||
<widget class="QDoubleSpinBox" name="maxWaterTemp"/>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QComboBox" name="tagsStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exact</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="2">
|
||||
<widget class="QComboBox" name="equipmentStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exact</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QComboBox" name="locationMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None of</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="logged">
|
||||
<property name="text">
|
||||
<string>Logged</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QDateTimeEdit" name="toDate">
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="peopleMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None of</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="tagsMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any of</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None of</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="close">
|
||||
<property name="toolTip">
|
||||
<string>Close filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:filter-close</normaloff>:filter-close</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Fulltext</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="fulltextStringMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Substring</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Starts with</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Full word</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="fullText"/>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Dive mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QComboBox" name="diveMode">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StarWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>desktop-widgets/starwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>fulltextStringMode</tabstop>
|
||||
<tabstop>fullText</tabstop>
|
||||
<tabstop>minRating</tabstop>
|
||||
<tabstop>maxRating</tabstop>
|
||||
<tabstop>minVisibility</tabstop>
|
||||
<tabstop>maxVisibility</tabstop>
|
||||
<tabstop>minWaterTemp</tabstop>
|
||||
<tabstop>maxWaterTemp</tabstop>
|
||||
<tabstop>minAirTemp</tabstop>
|
||||
<tabstop>maxAirTemp</tabstop>
|
||||
<tabstop>fromDate</tabstop>
|
||||
<tabstop>fromTime</tabstop>
|
||||
<tabstop>toDate</tabstop>
|
||||
<tabstop>toTime</tabstop>
|
||||
<tabstop>logged</tabstop>
|
||||
<tabstop>planned</tabstop>
|
||||
<tabstop>tagsMode</tabstop>
|
||||
<tabstop>tagsStringMode</tabstop>
|
||||
<tabstop>tags</tabstop>
|
||||
<tabstop>peopleMode</tabstop>
|
||||
<tabstop>peopleStringMode</tabstop>
|
||||
<tabstop>people</tabstop>
|
||||
<tabstop>locationMode</tabstop>
|
||||
<tabstop>locationStringMode</tabstop>
|
||||
<tabstop>location</tabstop>
|
||||
<tabstop>suitMode</tabstop>
|
||||
<tabstop>suitStringMode</tabstop>
|
||||
<tabstop>suit</tabstop>
|
||||
<tabstop>dnotesMode</tabstop>
|
||||
<tabstop>dnotesStringMode</tabstop>
|
||||
<tabstop>dnotes</tabstop>
|
||||
<tabstop>diveMode</tabstop>
|
||||
<tabstop>equipmentMode</tabstop>
|
||||
<tabstop>equipmentStringMode</tabstop>
|
||||
<tabstop>equipment</tabstop>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>clear</tabstop>
|
||||
<tabstop>close</tabstop>
|
||||
</tabstops>
|
||||
|
|
Loading…
Add table
Reference in a new issue