File indexing completed on 2024-04-21 07:34:49

0001 /*
0002  * SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
0003  * SPDX-License-Identifier: GPL-2.0-or-later
0004  */
0005 
0006 #ifndef KEDUVOCLEITNERBOX_H
0007 #define KEDUVOCLEITNERBOX_H
0008 
0009 #include "keduvocdocument_export.h"
0010 
0011 #include "keduvoccontainer.h"
0012 
0013 #include <QList>
0014 #include <QString>
0015 
0016 class KEduVocExpression;
0017 class KEduVocTranslation;
0018 
0019 /**
0020  * Leitner Boxes are an alternative grading system.
0021  * Classically flash cards are kept in boxes and moved corresponding to the users knowledge level.
0022  */
0023 class KEDUVOCDOCUMENT_EXPORT KEduVocLeitnerBox : public KEduVocContainer
0024 {
0025 public:
0026     /** default constructor */
0027     explicit KEduVocLeitnerBox(const QString &name, KEduVocLeitnerBox *parent = nullptr);
0028 
0029     /** destructor */
0030     ~KEduVocLeitnerBox() override;
0031 
0032     /**
0033      * The leitner box class keeps track of individual translations, because for one entry, the translations can have different grades.
0034      * @param row
0035      * @return
0036      */
0037     KEduVocTranslation *translation(int row);
0038 
0039     /**
0040      * get a list of all entries in the box
0041      * @return
0042      */
0043     QList<KEduVocExpression *> entries(EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE;
0044 
0045     KEduVocExpression *entry(int row, EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE;
0046 
0047     /** get the number of entries in the lesson */
0048     int entryCount(EnumEntriesRecursive recursive = NotRecursive) Q_DECL_OVERRIDE;
0049 
0050 private:
0051     class Private;
0052     Private *const d;
0053 
0054     /** add an entry to the lesson
0055      * @param entryid id of the entry to add
0056      */
0057     void addTranslation(KEduVocTranslation *translation);
0058 
0059     /** remove an entry from the lesson
0060      * @param entryid id of the entry to remove
0061      */
0062     void removeTranslation(KEduVocTranslation *translation);
0063 
0064     friend class KEduVocTranslation;
0065 };
0066 
0067 #endif