aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/mainwindow.cpp1
-rw-r--r--qt-ui/models.cpp1
-rw-r--r--qt-ui/simplewidgets.cpp27
-rw-r--r--qt-ui/simplewidgets.h10
4 files changed, 38 insertions, 1 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index c052867fe..1ad8f93b3 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -182,6 +182,7 @@ void MainWindow::recreateDiveList()
{
ui.ListWidget->reload(DiveTripModel::CURRENT);
TagFilterModel::instance()->repopulate();
+ BuddyFilterModel::instance()->repopulate();
}
void MainWindow::current_dive_changed(int divenr)
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 41087531c..be3a94a0e 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -2412,7 +2412,6 @@ Qt::ItemFlags BuddyFilterModel::flags(const QModelIndex &index) const
void BuddyFilterModel::repopulate()
{
-
QStringList list;
struct dive *dive;
int i = 0;
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index bacaad5c4..bfd8f1991 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -481,12 +481,39 @@ void TagFilter::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
+BuddyFilter::BuddyFilter(QWidget *parent) : QWidget(parent)
+{
+ ui.setupUi(this);
+ ui.label->setText(tr("Buddies: "));
+#if QT_VERSION >= 0x050000
+ ui.filterInternalList->setClearButtonEnabled(true);
+#endif
+ QSortFilterProxyModel *filter = new QSortFilterProxyModel();
+ filter->setSourceModel(BuddyFilterModel::instance());
+ connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString)));
+ ui.filterList->setModel(filter);
+}
+
+void BuddyFilter::showEvent(QShowEvent *event)
+{
+ MultiFilterSortModel::instance()->addFilterModel(BuddyFilterModel::instance());
+ QWidget::showEvent(event);
+}
+
+void BuddyFilter::hideEvent(QHideEvent *event)
+{
+ MultiFilterSortModel::instance()->removeFilterModel(BuddyFilterModel::instance());
+ QWidget::hideEvent(event);
+}
+
MultiFilter::MultiFilter(QWidget *parent): QScrollArea(parent)
{
QWidget *w = new QWidget();
QHBoxLayout *l = new QHBoxLayout();
l->addWidget(new TagFilter());
+ l->addWidget(new BuddyFilter());
+
l->setContentsMargins(0,0,0,0);
l->setSpacing(1);
w->setLayout(l);
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index f90e5478c..02467e201 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -140,6 +140,16 @@ private:
Ui::FilterWidget ui;
};
+class BuddyFilter : public QWidget {
+ Q_OBJECT
+public:
+ BuddyFilter(QWidget *parent = 0);
+ virtual void showEvent(QShowEvent *);
+ virtual void hideEvent(QHideEvent *);
+private:
+ Ui::FilterWidget ui;
+};
+
class MultiFilter : public QScrollArea {
Q_OBJECT
public: