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