UBTeacherGuideWidget.h 6.3 KB
Newer Older
1 2 3
/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
Claudio Valerio's avatar
Claudio Valerio committed
4
 * the Free Software Foundation, either version 2 of the License, or
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef UBTEACHERGUIDEWIDGET_H
#define UBTEACHERGUIDEWIDGET_H

class QTreeWidget;
class QHeaderView;
class QLabel;
class QVBoxLayout;
class QPushButton;
24
class UBDocumentProxy;
25
class UBGraphicsTextItem;
26

27

28 29
#include "UBTeacherGuideWidgetsTools.h"

30 31
#include "interfaces/IDataStorage.h"

32 33 34 35 36 37
typedef enum
{
    tUBTGZeroPageMode_EDITION,
    tUBTGZeroPageMode_PRESENTATION
}tUBTGZeroPageMode;

38 39 40
/***************************************************************************
 *               class    UBTeacherGuideEditionWidget                      *
 ***************************************************************************/
41
class UBTeacherGuideEditionWidget : public QWidget , public IDataStorage
42 43 44 45 46 47 48 49
{
    Q_OBJECT
public:
    explicit UBTeacherGuideEditionWidget(QWidget* parent = 0, const char* name="UBTeacherGuideEditionWidget");
    ~UBTeacherGuideEditionWidget();
    void cleanData();
    QVector<tUBGEElementNode*> getData();

50
    void load(QString element);
51
    QVector<tIDataStorage*> save(int pageIndex);
52

53
public slots:
54
    void onAddItemClicked(QTreeWidgetItem* widget, int column, QDomElement* element = 0);
55 56
    void onActiveSceneChanged();
    void showEvent(QShowEvent* event);
57 58 59 60 61 62 63

private:
    QList<QTreeWidgetItem*> getChildrenList(QTreeWidgetItem* widgetItem);
    QVector<tUBGEElementNode*> getPageAndCommentData();

    QVBoxLayout* mpLayout;
    QLabel* mpDocumentTitle;
64
    QLabel* mpPageNumberLabel;
65 66
    UBTGAdaptableText* mpPageTitle;
    UBTGAdaptableText* mpComment;
67
    QFrame* mpSeparator;
68 69 70 71 72 73
    QTreeWidget* mpTreeWidget;
    QTreeWidgetItem* mpRootWidgetItem;
    UBAddItem* mpAddAnActionItem;
    UBAddItem* mpAddAMediaItem;
    UBAddItem* mpAddALinkItem;

74 75 76
private slots:
    void onActiveDocumentChanged();

77 78 79 80 81 82 83 84 85 86 87 88 89
};


/***************************************************************************
 *           class    UBTeacherGuidePresentationWidget                     *
 ***************************************************************************/
class UBTeacherGuidePresentationWidget : public QWidget
{
    Q_OBJECT
public:
    explicit UBTeacherGuidePresentationWidget(QWidget* parent, const char* name = "UBTeacherGuidePresentationName");
    ~UBTeacherGuidePresentationWidget();
    void showData(QVector<tUBGEElementNode*>data);
90
    void cleanData();
91 92 93

public slots:
    void onAddItemClicked(QTreeWidgetItem* widget, int column);
94
    void onActiveSceneChanged();
95 96

private:
97 98
    bool eventFilter(QObject* object, QEvent* event);

99 100 101 102 103 104
    void createMediaButtonItem();

    UBTGAdaptableText* mpPageTitle;
    UBTGAdaptableText* mpComment;
    QVBoxLayout* mpLayout;
    QHBoxLayout* mpButtonTitleLayout;
105 106 107
    QLabel* mpDocumentTitle;
    QLabel* mpPageNumberLabel;
    QFrame* mpSeparator;
108
    QPushButton* mpModePushButton;
109
    UBTGDraggableTreeItem* mpTreeWidget;
110 111 112 113 114
    QTreeWidgetItem* mpRootWidgetItem;
    QTreeWidgetItem* mpMediaSwitchItem;

};

115
/***************************************************************************
116
 *                  class    UBTeacherGuidePageZeroWidget                  *
117
 ***************************************************************************/
118
class UBTeacherGuidePageZeroWidget : public QWidget
119 120 121 122
{
    Q_OBJECT

public:
123 124
    explicit UBTeacherGuidePageZeroWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget");
    ~UBTeacherGuidePageZeroWidget();
125 126 127

    QVector<tUBGEElementNode*> getData();

128

129 130 131 132 133 134
public slots:
    void onActiveSceneChanged();
    void switchToMode(tUBTGZeroPageMode mode = tUBTGZeroPageMode_EDITION);

private:
    void fillComboBoxes();
135 136
    void loadData();
    void hideEvent(QHideEvent* event);
137
    bool eventFilter(QObject* object, QEvent* event);
138
    void updateSceneTitle();
139 140 141 142 143 144 145 146 147 148 149 150 151 152

    QVBoxLayout* mpLayout;
    QHBoxLayout* mpButtonTitleLayout;
    QPushButton* mpModePushButton;
    QLabel* mpPageNumberLabel;
    UBTGAdaptableText* mpSessionTitle;
    QFrame* mpSeparatorSessionTitle;

    QLabel* mpAuthorsLabel;
    UBTGAdaptableText* mpAuthors;
    QFrame* mpSeparatorAuthors;

    QLabel* mpCreationLabel;
    QLabel* mpLastModifiedLabel;
153 154 155
    QLabel* mpObjectivesLabel;
    UBTGAdaptableText* mpObjectives;
    QFrame* mpSeparatorObjectives;
156 157 158 159 160 161 162 163 164

    QLabel* mpIndexLabel;
    QLabel* mpKeywordsLabel;
    UBTGAdaptableText* mpKeywords;

    QLabel* mpSchoolLevelItemLabel;
    QComboBox* mpSchoolLevelBox;
    QLabel* mpSchoolLevelValueLabel;

165 166 167
    QLabel* mpSchoolSubjectsItemLabel;
    QComboBox* mpSchoolSubjectsBox;
    QLabel* mpSchoolSubjectsValueLabel;
168 169 170 171 172 173 174 175 176 177 178 179

    QLabel* mpSchoolTypeItemLabel;
    QComboBox* mpSchoolTypeBox;
    QLabel* mpSchoolTypeValueLabel;
    QFrame* mpSeparatorIndex;

    QLabel* mpLicenceLabel;
    QComboBox* mpLicenceBox;
    QLabel* mpLicenceValueLabel;
    QLabel* mpLicenceIcon;
    QHBoxLayout* mpLicenceLayout;

180 181
    UBGraphicsTextItem* mpSceneItemSessionTitle;

182 183 184 185 186
    QMap<QString,QString> mGradeLevelsMap;
    QMap<QString,QStringList> mSubjects;

private slots:
    void onSchoolLevelChanged(QString schoolLevel);
187
    void persistData();
188
};
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204

/***************************************************************************
 *                    class    UBTeacherGuideWidget                        *
 ***************************************************************************/

class UBTeacherGuideWidget : public QStackedWidget
{
    Q_OBJECT
public:
    explicit UBTeacherGuideWidget(QWidget* parent = 0, const char* name="UBTeacherGuideWidget");
    ~UBTeacherGuideWidget();

public slots:
    void changeMode();
    void showPresentationMode();
    void connectToStylusPalette();
205
    void onActiveSceneChanged();
206 207

private:
208
    UBTeacherGuidePageZeroWidget* mpPageZeroWidget;
209 210
    UBTeacherGuideEditionWidget* mpEditionWidget;
    UBTeacherGuidePresentationWidget* mpPresentationWidget;
211
    QVector<tUBGEElementNode*>mCurrentData;
212 213 214
};

#endif // UBTEACHERGUIDEWIDGET_H