summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-11-13 17:32:17 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-13 12:09:58 -0800
commitdee20906e377508831a70b74aec0001f22511f5c (patch)
treee35c16f84a5be3a7fbbd8fbb91d7e5f24c50a00d /qt-ui
parentb7da2a9c444ef3995a23881d3f847c2e18a48cd3 (diff)
downloadsubsurface-dee20906e377508831a70b74aec0001f22511f5c.tar.gz
Suits Widget created and working.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/mainwindow.cpp1
-rw-r--r--qt-ui/simplewidgets.cpp26
-rw-r--r--qt-ui/simplewidgets.h11
3 files changed, 38 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 934191697..66ebb61b4 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -185,6 +185,7 @@ void MainWindow::recreateDiveList()
TagFilterModel::instance()->repopulate();
BuddyFilterModel::instance()->repopulate();
LocationFilterModel::instance()->repopulate();
+ SuitsFilterModel::instance()->repopulate();
}
void MainWindow::current_dive_changed(int divenr)
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index fb9b9043b..161f4f14a 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -535,6 +535,31 @@ void LocationFilter::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
+SuitFilter::SuitFilter(QWidget *parent) : QWidget(parent)
+{
+ ui.setupUi(this);
+ ui.label->setText(tr("Suits: "));
+#if QT_VERSION >= 0x050000
+ ui.filterInternalList->setClearButtonEnabled(true);
+#endif
+ QSortFilterProxyModel *filter = new QSortFilterProxyModel();
+ filter->setSourceModel(SuitsFilterModel::instance());
+ connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString)));
+ ui.filterList->setModel(filter);
+}
+
+void SuitFilter::showEvent(QShowEvent *event)
+{
+ MultiFilterSortModel::instance()->addFilterModel(SuitsFilterModel::instance());
+ QWidget::showEvent(event);
+}
+
+void SuitFilter::hideEvent(QHideEvent *event)
+{
+ MultiFilterSortModel::instance()->removeFilterModel(SuitsFilterModel::instance());
+ QWidget::hideEvent(event);
+}
+
MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent)
{
QWidget *expandedWidget = new QWidget();
@@ -575,6 +600,7 @@ MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent)
l->addWidget(tagFilter);
l->addWidget(new BuddyFilter());
l->addWidget(new LocationFilter());
+ l->addWidget(new SuitFilter());
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index 385ce0812..25ef654a6 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -161,6 +161,17 @@ private:
Ui::FilterWidget ui;
};
+class SuitFilter : public QWidget {
+ Q_OBJECT
+public:
+ SuitFilter(QWidget *parent = 0);
+ virtual void showEvent(QShowEvent *);
+ virtual void hideEvent(QHideEvent *);
+
+private:
+ Ui::FilterWidget ui;
+};
+
class LocationFilter : public QWidget {
Q_OBJECT
public: