mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Start to implement a simplified version of the filter widget
The idea of this new widget is to be able to filter more types of data, while keeping it simple and extending the feature set to something that was impossible with the old implementation. While the old implementation had 4 panels that you could use to filter specific tags / people / types of dives the new one will let you filter by visibility, temperature people, name, equipment, etc, in a more natural way than the old one. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
c64c9c923b
commit
19f6e8810c
8 changed files with 363 additions and 15 deletions
|
@ -34,6 +34,7 @@ set (SUBSURFACE_UI
|
|||
diveshareexportdialog.ui
|
||||
downloadfromdivecomputer.ui
|
||||
filterwidget.ui
|
||||
filterwidget2.ui
|
||||
findmovedimagesdialog.ui
|
||||
listfilter.ui
|
||||
locationInformation.ui
|
||||
|
@ -90,6 +91,7 @@ set(SUBSURFACE_INTERFACE
|
|||
command_divelist.cpp
|
||||
locationinformation.cpp
|
||||
qtwaitingspinner.cpp
|
||||
filterwidget2.cpp
|
||||
tab-widgets/TabDiveStatistics.cpp
|
||||
tab-widgets/TabDiveInformation.cpp
|
||||
tab-widgets/TabDivePhotos.cpp
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterWidget2</class>
|
||||
<widget class="QWidget" name="FilterWidget2">
|
||||
<class>FilterWidget</class>
|
||||
<widget class="QWidget" name="FilterWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string></string>
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
|
@ -70,10 +70,10 @@
|
|||
<item>
|
||||
<widget class="QToolButton" name="clear">
|
||||
<property name="toolTip">
|
||||
<string>Reset filters</string>
|
||||
<string>Reset filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:edit-clear-icon</normaloff>:edit-clear-icon</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
|
@ -84,10 +84,10 @@
|
|||
<item>
|
||||
<widget class="QToolButton" name="maximize">
|
||||
<property name="toolTip">
|
||||
<string>Show/hide filters</string>
|
||||
<string>Show/hide filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:hide-icon</normaloff>:hide-icon</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
|
@ -101,7 +101,7 @@
|
|||
<string>Close and reset filters</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<iconset>
|
||||
<normaloff>:filter-close</normaloff>:filter-close</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
|
@ -125,7 +125,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>594</width>
|
||||
<height>337</height>
|
||||
<height>332</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
59
desktop-widgets/filterwidget2.cpp
Normal file
59
desktop-widgets/filterwidget2.cpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include "desktop-widgets/filterwidget2.h"
|
||||
#include "desktop-widgets/simplewidgets.h"
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
FilterWidget2::FilterWidget2(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::FilterWidget2())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->minRating->setCurrentStars(0);
|
||||
ui->maxRating->setCurrentStars(5);
|
||||
ui->minVisibility->setCurrentStars(0);
|
||||
ui->maxVisibility->setCurrentStars(5);
|
||||
|
||||
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, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->minAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->maxWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->minWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->from, &QDateTimeEdit::dateTimeChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->to, &QDateTimeEdit::dateTimeChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->tags, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->people, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
|
||||
connect(ui->location, &QLineEdit::textChanged,
|
||||
this, &FilterWidget2::updateFilter);
|
||||
}
|
||||
|
||||
void FilterWidget2::updateFilter()
|
||||
{
|
||||
|
||||
}
|
27
desktop-widgets/filterwidget2.h
Normal file
27
desktop-widgets/filterwidget2.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef FILTERWIDGET_2_H
|
||||
#define FILTERWIDGET_2_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ui_filterwidget2.h"
|
||||
|
||||
namespace Ui {
|
||||
class FilterWidget2;
|
||||
}
|
||||
|
||||
class FilterWidget2 : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FilterWidget2(QWidget *parent = 0);
|
||||
void updateFilter();
|
||||
|
||||
signals:
|
||||
void filterUpdated();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::FilterWidget2> ui;
|
||||
};
|
||||
|
||||
#endif
|
260
desktop-widgets/filterwidget2.ui
Normal file
260
desktop-widgets/filterwidget2.ui
Normal file
|
@ -0,0 +1,260 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterWidget2</class>
|
||||
<widget class="QWidget" name="FilterWidget2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>510</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="StarWidget" name="maxVisibility" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="minWaterTemp"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="StarWidget" name="minVisibility" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Tags</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string> Rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="StarWidget" name="minRating" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>People</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="tags"/>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="4">
|
||||
<widget class="QCheckBox" name="invertFilter">
|
||||
<property name="toolTip">
|
||||
<string>Display dives that will not match the search, only applies to tags, people, location and equipment</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert filter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="4">
|
||||
<widget class="QDateTimeEdit" name="from"/>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="people"/>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="StarWidget" name="maxRating" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<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="QDoubleSpinBox" name="maxWaterTemp"/>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Equipment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="location"/>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="4">
|
||||
<widget class="QDateTimeEdit" name="to"/>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="equipment"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Visibility</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Water Temp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Air Temp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QDoubleSpinBox" name="minAirTemp"/>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QDoubleSpinBox" name="maxAirTemp"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StarWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">desktop-widgets/starwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>minRating</tabstop>
|
||||
<tabstop>maxRating</tabstop>
|
||||
<tabstop>minVisibility</tabstop>
|
||||
<tabstop>maxVisibility</tabstop>
|
||||
<tabstop>from</tabstop>
|
||||
<tabstop>to</tabstop>
|
||||
<tabstop>tags</tabstop>
|
||||
<tabstop>people</tabstop>
|
||||
<tabstop>location</tabstop>
|
||||
<tabstop>equipment</tabstop>
|
||||
<tabstop>invertFilter</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterWidget</class>
|
||||
<widget class="QWidget" name="FilterWidget">
|
||||
<class>ListFilter</class>
|
||||
<widget class="QWidget" name="ListFilter">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
|
|
@ -200,7 +200,7 @@ void SetpointDialog::setpointData(struct divecomputer *divecomputer, int second)
|
|||
void SetpointDialog::buttonClicked(QAbstractButton *button)
|
||||
{
|
||||
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole && dc) {
|
||||
add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()),
|
||||
add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()),
|
||||
QT_TRANSLATE_NOOP("gettextFromC", "SP change"));
|
||||
invalidate_dive_cache(current_dive);
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ private:
|
|||
};
|
||||
|
||||
namespace Ui{
|
||||
class FilterWidget2;
|
||||
class FilterWidget;
|
||||
};
|
||||
|
||||
class MultiFilter : public QWidget {
|
||||
|
@ -164,7 +164,7 @@ slots:
|
|||
|
||||
public:
|
||||
MultiFilter(QWidget *parent);
|
||||
Ui::FilterWidget2 ui;
|
||||
Ui::FilterWidget ui;
|
||||
};
|
||||
|
||||
class FilterBase : public QWidget {
|
||||
|
@ -173,7 +173,7 @@ class FilterBase : public QWidget {
|
|||
protected:
|
||||
FilterBase(FilterModelBase *model, QWidget *parent = 0);
|
||||
FilterModelBase *model;
|
||||
Ui::FilterWidget ui;
|
||||
Ui::ListFilter ui;
|
||||
void showEvent(QShowEvent *) override;
|
||||
void hideEvent(QHideEvent *) override;
|
||||
friend class MultiFilter;
|
||||
|
|
Loading…
Add table
Reference in a new issue