summaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-11-16 14:04:06 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-16 18:34:47 +0000
commit7c5c38b154baeeb05d2c70a3c248cda41349133a (patch)
tree4084a8661d50e536f96eb9e98e327ee25a1bcc27 /qt-ui/simplewidgets.cpp
parent7967d2bec1f90f230800ada64c7fe69b3f2009cd (diff)
downloadsubsurface-7c5c38b154baeeb05d2c70a3c248cda41349133a.tar.gz
Addded a min / max layout for the filter, and a filter count
But the filter count seems to be broken for some reason and I really don't know why. It seems to work for tags, but not for everything else. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp54
1 files changed, 25 insertions, 29 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 192682774..1020e0ec3 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -17,6 +17,7 @@
#include "display.h"
#include "mainwindow.h"
#include "helpers.h"
+#include "ui_filterwidget.h"
class MinMaxAvgWidgetPrivate {
public:
@@ -560,55 +561,50 @@ void SuitFilter::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
-MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent)
+MultiFilter::MultiFilter(QWidget *parent) : QWidget(parent)
{
+ ui = new Ui::FilterWidget2();
+ ui->setupUi(this);
+
QWidget *expandedWidget = new QWidget();
QHBoxLayout *l = new QHBoxLayout();
-
TagFilter *tagFilter = new TagFilter();
int minimumHeight = tagFilter->ui.filterInternalList->height() +
- tagFilter->ui.verticalLayout->spacing() * tagFilter->ui.verticalLayout->count();
+ tagFilter->ui.verticalLayout->spacing() * tagFilter->ui.verticalLayout->count();
QListView *dummyList = new QListView();
QStringListModel *dummy = new QStringListModel(QStringList() << "Dummy Text");
dummyList->setModel(dummy);
- // Buttons to Clear/Minimize/Close
- QToolBar *tb = new QToolBar();
- QToolButton *clearBtn = new QToolButton();
- clearBtn->setToolTip(tr("Reset the filters"));
- clearBtn->setIcon(QIcon(":/trash"));
- clearBtn->setAutoRaise(true);
- QToolButton *closeBtn = new QToolButton();
- closeBtn->setToolTip(tr("Close this window and reset the filters"));
- closeBtn->setIcon(QIcon(":/close"));
- closeBtn->setAutoRaise(true);
- QToolButton *minimize = new QToolButton();
- minimize->setToolTip(tr("Minimize this window"));
- minimize->setIcon(QIcon(":/arrow_up"));
- minimize->setAutoRaise(true);
-
- tb->setOrientation(Qt::Vertical);
- tb->addWidget(clearBtn);
- tb->addWidget(minimize);
- tb->addWidget(closeBtn);
-
- connect(closeBtn, SIGNAL(clicked(bool)), this, SLOT(closeFilter()));
- connect(clearBtn, SIGNAL(clicked(bool)), MultiFilterSortModel::instance(), SLOT(clearFilter()));
- l->addWidget(tb);
+ 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);
- setWidget(expandedWidget);
+
+ ui->scrollArea->setWidget(expandedWidget);
expandedWidget->resize(expandedWidget->width(), minimumHeight + dummyList->sizeHintForRow(0) * 5 );
+ ui->scrollArea->setMinimumHeight(expandedWidget->height() + 5);
- setMinimumHeight(expandedWidget->height() + 5);
+ connect(MultiFilterSortModel::instance(), SIGNAL(filterFinished()), this, SLOT(filterFinished()));
+}
+
+void MultiFilter::filterFinished()
+{
+ ui->filterText->setText(tr("Dives filtered out: ") + QString::number(MultiFilterSortModel::instance()->divesFilteredOut)
+ + tr("Dives being shown: ") + QString::number(MultiFilterSortModel::instance()->divesDisplayed));
+}
+
+void MultiFilter::adjustHeight()
+{
+ ui->scrollArea->setVisible(!ui->scrollArea->isVisible());
}
void MultiFilter::closeFilter()