2017-04-27 18:25:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-08-13 13:30:22 +00:00
|
|
|
#ifndef COMPLETIONMODELS_H
|
|
|
|
#define COMPLETIONMODELS_H
|
|
|
|
|
2020-11-14 16:42:59 +00:00
|
|
|
#include "core/subsurface-qt/divelistnotifier.h"
|
2013-08-13 13:30:22 +00:00
|
|
|
#include <QStringListModel>
|
|
|
|
|
2020-11-14 16:42:59 +00:00
|
|
|
struct dive;
|
|
|
|
|
|
|
|
class CompletionModelBase : public QStringListModel {
|
2013-08-13 13:30:22 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-11-14 16:42:59 +00:00
|
|
|
CompletionModelBase();
|
|
|
|
private slots:
|
2013-08-13 13:30:22 +00:00
|
|
|
void updateModel();
|
2020-11-14 16:42:59 +00:00
|
|
|
void divesChanged(const QVector<dive *> &dives, DiveField field);
|
|
|
|
protected:
|
|
|
|
virtual QStringList getStrings() = 0;
|
|
|
|
virtual bool relevantDiveField(const DiveField &f) = 0;
|
2013-08-13 13:30:22 +00:00
|
|
|
};
|
|
|
|
|
2020-11-14 16:42:59 +00:00
|
|
|
class BuddyCompletionModel final : public CompletionModelBase {
|
2013-08-13 13:30:22 +00:00
|
|
|
Q_OBJECT
|
2020-11-14 16:42:59 +00:00
|
|
|
private:
|
|
|
|
QStringList getStrings() override;
|
|
|
|
bool relevantDiveField(const DiveField &f) override;
|
2013-08-13 13:30:22 +00:00
|
|
|
};
|
|
|
|
|
2022-02-12 13:03:18 +00:00
|
|
|
class DiveGuideCompletionModel final : public CompletionModelBase {
|
2013-08-13 13:30:22 +00:00
|
|
|
Q_OBJECT
|
2020-11-14 16:42:59 +00:00
|
|
|
private:
|
|
|
|
QStringList getStrings() override;
|
|
|
|
bool relevantDiveField(const DiveField &f) override;
|
2013-08-13 13:30:22 +00:00
|
|
|
};
|
|
|
|
|
2020-11-14 16:42:59 +00:00
|
|
|
class SuitCompletionModel final : public CompletionModelBase {
|
2013-11-02 01:20:02 +00:00
|
|
|
Q_OBJECT
|
2020-11-14 16:42:59 +00:00
|
|
|
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;
|
2013-11-02 01:20:02 +00:00
|
|
|
};
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // COMPLETIONMODELS_H
|