diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2018-10-13 11:52:08 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-12-14 01:05:18 +0800 |
commit | 19f6e8810cdaedcbecd87aa762c75e59bebe26c9 (patch) | |
tree | cae987dfcd04090530375d5ec9bb98d174d1b128 /desktop-widgets | |
parent | c64c9c923b1f2a4758f3ff639c28790f99c9ce84 (diff) | |
download | subsurface-19f6e8810cdaedcbecd87aa762c75e59bebe26c9.tar.gz |
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/CMakeLists.txt | 2 | ||||
-rw-r--r-- | desktop-widgets/filterwidget.ui | 18 | ||||
-rw-r--r-- | desktop-widgets/filterwidget2.cpp | 59 | ||||
-rw-r--r-- | desktop-widgets/filterwidget2.h | 27 | ||||
-rw-r--r-- | desktop-widgets/filterwidget2.ui | 260 | ||||
-rw-r--r-- | desktop-widgets/listfilter.ui | 4 | ||||
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/simplewidgets.h | 6 |
8 files changed, 363 insertions, 15 deletions
diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index 519061ac0..149ba32c0 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -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 diff --git a/desktop-widgets/filterwidget.ui b/desktop-widgets/filterwidget.ui index 7f548a931..6a8b8e863 100644 --- a/desktop-widgets/filterwidget.ui +++ b/desktop-widgets/filterwidget.ui @@ -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> diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp new file mode 100644 index 000000000..9bf526a88 --- /dev/null +++ b/desktop-widgets/filterwidget2.cpp @@ -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() +{ + +} diff --git a/desktop-widgets/filterwidget2.h b/desktop-widgets/filterwidget2.h new file mode 100644 index 000000000..70313c5d2 --- /dev/null +++ b/desktop-widgets/filterwidget2.h @@ -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 diff --git a/desktop-widgets/filterwidget2.ui b/desktop-widgets/filterwidget2.ui new file mode 100644 index 000000000..bf6d6a8ed --- /dev/null +++ b/desktop-widgets/filterwidget2.ui @@ -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> diff --git a/desktop-widgets/listfilter.ui b/desktop-widgets/listfilter.ui index 06f1889a8..91d430617 100644 --- a/desktop-widgets/listfilter.ui +++ b/desktop-widgets/listfilter.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> diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 42747cd3e..8cfb63100 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -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); } diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h index 48e5e7e3d..040754a98 100644 --- a/desktop-widgets/simplewidgets.h +++ b/desktop-widgets/simplewidgets.h @@ -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; |