summaryrefslogtreecommitdiffstats
path: root/qt-models/completionmodels.h
blob: 6d271c348e059116e47a2145915c5769a5db7de0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: GPL-2.0
#ifndef COMPLETIONMODELS_H
#define COMPLETIONMODELS_H

#include "core/subsurface-qt/divelistnotifier.h"
#include <QStringListModel>

struct dive;

class CompletionModelBase : public QStringListModel {
	Q_OBJECT
public:
	CompletionModelBase();
private slots:
	void updateModel();
	void divesChanged(const QVector<dive *> &dives, DiveField field);
protected:
	virtual QStringList getStrings() = 0;
	virtual bool relevantDiveField(const DiveField &f) = 0;
};

class BuddyCompletionModel final : public CompletionModelBase {
	Q_OBJECT
private:
	QStringList getStrings() override;
	bool relevantDiveField(const DiveField &f) override;
};

class DiveMasterCompletionModel final : public CompletionModelBase {
	Q_OBJECT
private:
	QStringList getStrings() override;
	bool relevantDiveField(const DiveField &f) override;
};

class SuitCompletionModel final : public CompletionModelBase {
	Q_OBJECT
private:
	QStringList getStrings() override;
	bool relevantDiveField(const DiveField &f) override;
};

class TagCompletionModel final : public CompletionModelBase {
	Q_OBJECT
private:
	QStringList getStrings() override;
	bool relevantDiveField(const DiveField &f) override;
};

#endif // COMPLETIONMODELS_H