File indexing completed on 2022-11-29 13:00:35

0001 /*
0002     SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef LESSONVIEW_H
0007 #define LESSONVIEW_H
0008 
0009 #include "containerview.h"
0010 #include "lessonmodel.h"
0011 
0012 namespace Editor
0013 {
0014 class EditorWindow;
0015 
0016 /**
0017  * View for the lesson list.
0018  * @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
0019  */
0020 class LessonView : public ContainerView
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit LessonView(EditorWindow *parent);
0026 
0027     /** Set the model for the view.
0028      * @param model the model */
0029     virtual void setModel(LessonModel *model);
0030 
0031 Q_SIGNALS:
0032     /** A lesson was selected */
0033     void selectedLessonChanged(KEduVocLesson *lesson);
0034 
0035     /** Emitted when a new container is selected. Indicates the selected container. */
0036     void signalShowContainer(KEduVocContainer *selected);
0037 
0038     /** Emitted when any of the checkboxes for the query change. */
0039     void lessonsInPracticeChanged();
0040 
0041 public Q_SLOTS:
0042     /** Append a lesson to the model and automatically set an edit up so the user can change "New unit" into something meaningful.*/
0043     void slotCreateNewLesson();
0044 
0045     /** Remove a lesson. Ask if it's not empty. */
0046     void slotDeleteLesson();
0047 
0048     /** Creates many small lessons with the contents of the original lesson.
0049      * @todo Let the user select if entries are taken by random or order.
0050      */
0051     void slotSplitLesson();
0052 
0053     /**
0054      * Moves the selected vocabs to a new lession
0055      */
0056     void moveToNewLesson();
0057 
0058     /** Remove the grades for the selected lesson.  */
0059     void slotRemoveGradesLesson();
0060 
0061     /** Remove the grades for the selected lesson and its children.  */
0062     void slotRemoveGradesLessonChildren();
0063 
0064     /**
0065      * get notified of new columns only to hide them (grades not shown by default).
0066      */
0067     void columnsInserted();
0068 
0069     void setTranslation(KEduVocExpression *entry, int translationId);
0070 
0071     /** Expand all the lessons and its corresponding sub-lessons **/
0072     void expandAllLesson();
0073 
0074     /** Collapse all the lessons and its corresponding sub-lessons **/
0075     void collapseAllLesson();
0076 
0077 protected Q_SLOTS:
0078     void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
0079     void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
0080 
0081 private:
0082     void setModel(ContainerModel *model) override
0083     {
0084         Q_UNUSED(model)
0085     }
0086     void setModel(QAbstractItemModel *model) override
0087     {
0088         Q_UNUSED(model)
0089     }
0090 
0091     LessonModel *m_model{nullptr};
0092     EditorWindow *m_editorWindow{nullptr};
0093 };
0094 }
0095 
0096 #endif