@ -1,218 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<teacherGuide> |
||||
<gradeLevels> |
||||
<gradeLevel label="" baseLevel="Maternelle"/> |
||||
<gradeLevel label="Petite Section (3-4 ans)" baseLevel="Maternelle"/> |
||||
<gradeLevel label="Moyenne Section (4-5 ans)" baseLevel="Maternelle"/> |
||||
<gradeLevel label="Grande Section (5-6 ans)" baseLevel="Maternelle"/> |
||||
<gradeLevel label="CP (6-7 ans)" baseLevel="Elémentaire"/> |
||||
<gradeLevel label="CE1 (7-8 ans)" baseLevel="Elémentaire"/> |
||||
<gradeLevel label="CE2 (8-9 ans)" baseLevel="Elémentaire"/> |
||||
<gradeLevel label="CM1 (9-10ans)" baseLevel="Elémentaire"/> |
||||
<gradeLevel label="CM2 (10-11 ans)" baseLevel="Elémentaire"/> |
||||
<gradeLevel label="6ème (11-12 ans)" baseLevel="Collège"/> |
||||
<gradeLevel label="5ème (12-13 ans)" baseLevel="Collège"/> |
||||
<gradeLevel label="4ème (13-14 ans)" baseLevel="Collège"/> |
||||
<gradeLevel label="3ème (14-15 ans)" baseLevel="Collège"/> |
||||
<gradeLevel label="2nde dont CAP/BEP (15-16 ans)" baseLevel="Lycée"/> |
||||
<gradeLevel label="1ère dont CAP/BEP (16-17 ans)" baseLevel="Lycée"/> |
||||
<gradeLevel label="Terminale dont Bac Pro (17-18 ans)" baseLevel="Lycée"/> |
||||
<gradeLevel label="Bac+2 professionnel" baseLevel="Enseignement Professionnel" /> |
||||
<gradeLevel label="Niveau universitaire" baseLevel="Enseignement Professionnel" /> |
||||
<gradeLevel label="Formation continue Professionnelle" baseLevel="Enseignement Professionnel" /> |
||||
<gradeLevel label="Education Spécialisée" baseLevel="Enseignement Professionnel" /> |
||||
</gradeLevels> |
||||
<subjects baseLevel="Maternelle"> |
||||
<subject label="" /> |
||||
<subject label="Percevoir, sentir, imaginer, créer" /> |
||||
<subject label="Découvrir l'écrit" /> |
||||
<subject label="S'approprier le langage" /> |
||||
<subject label="Agir et s'exprimer avec son corps" /> |
||||
<subject label="Découvrir le monde" /> |
||||
</subjects> |
||||
<subjects baseLevel="Elémentaire"> |
||||
<subject label="" /> |
||||
<subject label="Pratiques artistiques" /> |
||||
<subject label="Pratiques artistiques - arts visuels" /> |
||||
<subject label="Pratiques artistiques - éducation musicale" /> |
||||
<subject label="Histoire des arts" /> |
||||
<subject label="Langues vivantes étrangères" /> |
||||
<subject label="Langue nationale français" /> |
||||
<subject label="Langue nationale français - lecture" /> |
||||
<subject label="Langue nationale français - écriture" /> |
||||
<subject label="Langue nationale français - langage oral" /> |
||||
<subject label="Langue nationale français - grammaire" /> |
||||
<subject label="Langue nationale français - orthographe" /> |
||||
<subject label="Langue nationale français - vocabulaire" /> |
||||
<subject label="Mathématiques - informatique" /> |
||||
<subject label="EPS (éducation physique et sportive)" /> |
||||
<subject label="Découverte du monde" /> |
||||
<subject label="Sciences expérimentales et technologie" /> |
||||
<subject label="Instruction civique et morale" /> |
||||
<subject label="Histoire et géographie" /> |
||||
<subject label="TUIC" /> |
||||
</subjects> |
||||
<subjects baseLevel="Collège"> |
||||
<subject label="" /> |
||||
<subject label="Pratiques artistiques" /> |
||||
<subject label="Pratiques artistiques - arts visuels" /> |
||||
<subject label="Pratiques artistiques - éducation musicale" /> |
||||
<subject label="Histoire des arts" /> |
||||
<subject label="Langues vivantes étrangères" /> |
||||
<subject label="Langues vivantes étrangères - anglais" /> |
||||
<subject label="Langues vivantes étrangères - allemand" /> |
||||
<subject label="Langues vivantes étrangères - espagnol" /> |
||||
<subject label="Langues vivantes étrangères - italien" /> |
||||
<subject label="Langues vivantes étrangères - néerlandais" /> |
||||
<subject label="Langues vivantes étrangères - chinois" /> |
||||
<subject label="Langues vivantes étrangères - portugais" /> |
||||
<subject label="Langues vivantes étrangères - russe" /> |
||||
<subject label="Langues vivantes étrangères - arabe" /> |
||||
<subject label="Langues et cultures de l'Antiquité (latin,grec ancien)" /> |
||||
<subject label="Langue nationale français" /> |
||||
<subject label="Mathématiques - informatique" /> |
||||
<subject label="EPS (éducation physique et sportive)" /> |
||||
<subject label="Education à la sécurité" /> |
||||
<subject label="Education à la santé" /> |
||||
<subject label="SVT (sciences de la vie et de la Terre)" /> |
||||
<subject label="Sciences physiques et chimiques" /> |
||||
<subject label="Technologie" /> |
||||
<subject label="Culture scientifique et technique" /> |
||||
<subject label="Histoire - éducation civique" /> |
||||
<subject label="Géographie" /> |
||||
<subject label="EDD (éducation au développement durable)" /> |
||||
<subject label="Education aux médias" /> |
||||
</subjects> |
||||
<subjects baseLevel="Lycée"> |
||||
<subject label="" /> |
||||
<subject label="Enseignements artistiques" /> |
||||
<subject label="Agriculture" /> |
||||
<subject label="Arts" /> |
||||
<subject label="Banque - Assurances - Immobilier" /> |
||||
<subject label="Commerce" /> |
||||
<subject label="Défense publique - Sécurité" /> |
||||
<subject label="Economie - Droit - Sciences politiques" /> |
||||
<subject label="Electricité - Electronique" /> |
||||
<subject label="Environnement - Energies - Aménagement - Propreté" /> |
||||
<subject label="Fonction production - Transport" /> |
||||
<subject label="Formation générale - Lettres et langues - Enseignement" /> |
||||
<subject label="Génie civil - Construction - Architecture" /> |
||||
<subject label="Gestion des entreprises" /> |
||||
<subject label="Hôtellerie - Restauration - Tourisme" /> |
||||
<subject label="Information - Communication" /> |
||||
<subject label="Informatique" /> |
||||
<subject label="Mécanique" /> |
||||
<subject label="Santé - Social - Sport" /> |
||||
<subject label="Sciences" /> |
||||
<subject label="Sciences humaines et sociales" /> |
||||
<subject label="Transformation" /> |
||||
<subject label="Langues et cultures de l'Antiquité (latin,grec ancien)" /> |
||||
<subject label="Langues vivantes étrangères" /> |
||||
<subject label="Langues vivantes étrangères - anglais" /> |
||||
<subject label="Langues vivantes étrangères - allemand" /> |
||||
<subject label="Langues vivantes étrangères - espagnol" /> |
||||
<subject label="Langues vivantes étrangères - italien" /> |
||||
<subject label="Langues vivantes étrangères - néerlandais" /> |
||||
<subject label="Langues vivantes étrangères - chinois" /> |
||||
<subject label="Langues vivantes étrangères - portugais" /> |
||||
<subject label="Langues vivantes étrangères - russe" /> |
||||
<subject label="Langues vivantes étrangères - arabe" /> |
||||
<subject label="Langue nationale français" /> |
||||
<subject label="Mathématiques - informatique" /> |
||||
<subject label="EPS" /> |
||||
<subject label="Physique-chimie" /> |
||||
<subject label="SVT (sciences de la vie et de la Terre)" /> |
||||
<subject label="Histoire-géographie et éducation civique" /> |
||||
<subject label="SES (sciences économiques et sociales)" /> |
||||
<subject label="Economie" /> |
||||
<subject label="Droit" /> |
||||
<subject label="Langues et cultures de l'Antiquité" /> |
||||
<subject label="Philosophie" /> |
||||
</subjects> |
||||
<subjects baseLevel="Enseignement Professionnel"> |
||||
<subject label="" /> |
||||
<subject label="Enseignements artistiques" /> |
||||
<subject label="Agriculture" /> |
||||
<subject label="Arts" /> |
||||
<subject label="Banque - Assurances - Immobilier" /> |
||||
<subject label="Commerce" /> |
||||
<subject label="Défense publique - Sécurité" /> |
||||
<subject label="Economie - Droit - Sciences politiques" /> |
||||
<subject label="Electricité - Electronique" /> |
||||
<subject label="Environnement - Energies - Aménagement - Propreté" /> |
||||
<subject label="Fonction production - Transport" /> |
||||
<subject label="Formation générale - Lettres et langues - Enseignement" /> |
||||
<subject label="Génie civil - Construction - Architecture" /> |
||||
<subject label="Gestion des entreprises" /> |
||||
<subject label="Hôtellerie - Restauration - Tourisme" /> |
||||
<subject label="Information - Communication" /> |
||||
<subject label="Informatique" /> |
||||
<subject label="Mécanique" /> |
||||
<subject label="Santé - Social - Sport" /> |
||||
<subject label="Sciences" /> |
||||
<subject label="Sciences humaines et sociales" /> |
||||
<subject label="Transformation" /> |
||||
<subject label="Langues vivantes étrangères" /> |
||||
<subject label="Langues vivantes étrangères - anglais" /> |
||||
<subject label="Langues vivantes étrangères - allemand" /> |
||||
<subject label="Langues vivantes étrangères - espagnol" /> |
||||
<subject label="Langues vivantes étrangères - italien" /> |
||||
<subject label="Langues vivantes étrangères - néerlandais" /> |
||||
<subject label="Langues vivantes étrangères - chinois" /> |
||||
<subject label="Langues vivantes étrangères - portugais" /> |
||||
<subject label="Langues vivantes étrangères - russe" /> |
||||
<subject label="Langues vivantes étrangères - arabe" /> |
||||
<subject label="Langue nationale français" /> |
||||
<subject label="Mathématiques - informatique" /> |
||||
<subject label="EPS" /> |
||||
<subject label="Physique-chimie" /> |
||||
<subject label="SVT (sciences de la vie et de la Terre)" /> |
||||
<subject label="Histoire-géographie et éducation civique" /> |
||||
<subject label="SES (sciences économiques et sociales)" /> |
||||
<subject label="Economie" /> |
||||
<subject label="Droit" /> |
||||
<subject label="Langues et cultures de l'Antiquité" /> |
||||
<subject label="Philosophie" /> |
||||
</subjects> |
||||
<types> |
||||
<type label="" /> |
||||
<type label="Activité : Evaluation/Travail à la maison" /> |
||||
<type label="Activité : Exercice" /> |
||||
<type label="Activité : Travaux Pratiques" /> |
||||
<type label="Activité : Jeux" /> |
||||
<type label="Activité : Grapheur/Tableur" /> |
||||
<type label="Activité : Collection de sujets" /> |
||||
<type label="Activité : WebQuest" /> |
||||
<type label="Composant : Animation/Simulation" /> |
||||
<type label="Composant : Article" /> |
||||
<type label="Composant : Audio" /> |
||||
<type label="Composant : Diagramme/illustration" /> |
||||
<type label="Composant : Glossaire / Liste de vocabulaire" /> |
||||
<type label="Composant : Table des Matières" /> |
||||
<type label="Composant : Photographie" /> |
||||
<type label="Composant : Référence" /> |
||||
<type label="Composant : Scénario" /> |
||||
<type label="Composant : Etude/Données/Recherche" /> |
||||
<type label="Composant : Graphique/Diagramme" /> |
||||
<type label="Composant : Modèle de Document" /> |
||||
<type label="Composant : Video/Présentation/Diapo" /> |
||||
<type label="Composant : Webcast/Podcast" /> |
||||
<type label="Livre : Fiction" /> |
||||
<type label="Livre : Documentaire" /> |
||||
<type label="Livre : Notes de lecture" /> |
||||
<type label="Livre : Manuel scolaire" /> |
||||
<type label="Parcours : Réponse" /> |
||||
<type label="Parcours : Evaluation/Test" /> |
||||
<type label="Parcours : Cours complet" /> |
||||
<type label="Parcours : Plan de cours" /> |
||||
<type label="Parcours : Rubrique" /> |
||||
<type label="Parcours : Séquence" /> |
||||
<type label="Parcours : Standard ou programme" /> |
||||
<type label="Parcours : Polycopié / notes de cours" /> |
||||
<type label="Parcours : Programme" /> |
||||
<type label="Parcours : Tutoriel" /> |
||||
<type label="Parcours : Unité pédagogique" /> |
||||
<type label="Parcours : Cahier d'activité" /> |
||||
<type label="Autres" /> |
||||
</types> |
||||
</teacherGuide> |
Before Width: | Height: | Size: 795 B |
Before Width: | Height: | Size: 909 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 7.7 KiB |
@ -1,59 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) |
||||
* |
||||
* This file is part of Open-Sankoré. |
||||
* |
||||
* Open-Sankoré is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, |
||||
* with a specific linking exception for the OpenSSL project's |
||||
* "OpenSSL" library (or with modified versions of it that use the |
||||
* same license as the "OpenSSL" library). |
||||
* |
||||
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
|
||||
|
||||
#include "core/UBApplication.h" |
||||
#include "globals/UBGlobals.h" |
||||
|
||||
#include "UBDockTeacherGuideWidget.h" |
||||
#include "UBTeacherGuideWidget.h" |
||||
|
||||
#include "core/memcheck.h" |
||||
|
||||
|
||||
UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char* name): |
||||
UBDockPaletteWidget(parent,name) |
||||
, mpTeacherGuideWidget(NULL) |
||||
{ |
||||
mName = "TeacherGuide"; |
||||
mVisibleState = true; |
||||
SET_STYLE_SHEET(); |
||||
|
||||
mIconToLeft = QPixmap(":images/teacher_open.png"); |
||||
mIconToRight = QPixmap(":images/teacher_close.png"); |
||||
|
||||
mpLayout = new QVBoxLayout(this); |
||||
setLayout(mpLayout); |
||||
mpTeacherGuideWidget = new UBTeacherGuideWidget(this); |
||||
mpLayout->addWidget(mpTeacherGuideWidget); |
||||
} |
||||
|
||||
UBDockTeacherGuideWidget::~UBDockTeacherGuideWidget() |
||||
{ |
||||
DELETEPTR(mpTeacherGuideWidget); |
||||
DELETEPTR(mpLayout); |
||||
} |
||||
|
||||
UBTeacherGuideWidget* UBDockTeacherGuideWidget::teacherGuideWidget() |
||||
{ |
||||
return mpTeacherGuideWidget; |
||||
} |
@ -1,49 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) |
||||
* |
||||
* This file is part of Open-Sankoré. |
||||
* |
||||
* Open-Sankoré is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, |
||||
* with a specific linking exception for the OpenSSL project's |
||||
* "OpenSSL" library (or with modified versions of it that use the |
||||
* same license as the "OpenSSL" library). |
||||
* |
||||
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
|
||||
|
||||
#ifndef UBDOCKTEACHERGUIDEWIDGET_H |
||||
#define UBDOCKTEACHERGUIDEWIDGET_H |
||||
|
||||
class QVBoxLayout; |
||||
class UBTeacherGuideWidget; |
||||
|
||||
#include "UBDockPaletteWidget.h" |
||||
|
||||
|
||||
class UBDockTeacherGuideWidget : public UBDockPaletteWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBDockTeacherGuideWidget(QWidget* parent=0, const char* name="UBDockTeacherGuideWidget"); |
||||
~UBDockTeacherGuideWidget(); |
||||
|
||||
bool visibleInMode(eUBDockPaletteWidgetMode mode){ return mode == eUBDockPaletteWidget_BOARD; } |
||||
|
||||
UBTeacherGuideWidget* teacherGuideWidget(); |
||||
|
||||
private: |
||||
QVBoxLayout* mpLayout; |
||||
UBTeacherGuideWidget* mpTeacherGuideWidget; |
||||
}; |
||||
|
||||
#endif // UBDOCKTEACHERGUIDEWIDGET_H
|
@ -1,252 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) |
||||
* |
||||
* This file is part of Open-Sankoré. |
||||
* |
||||
* Open-Sankoré is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, |
||||
* with a specific linking exception for the OpenSSL project's |
||||
* "OpenSSL" library (or with modified versions of it that use the |
||||
* same license as the "OpenSSL" library). |
||||
* |
||||
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
|
||||
|
||||
#ifndef UBTEACHERGUIDEWIDGET_H |
||||
#define UBTEACHERGUIDEWIDGET_H |
||||
|
||||
class QTreeWidget; |
||||
class QHeaderView; |
||||
class QLabel; |
||||
class QVBoxLayout; |
||||
class QPushButton; |
||||
class UBDocumentProxy; |
||||
class UBGraphicsTextItem; |
||||
class QScrollArea; |
||||
|
||||
#include "UBTeacherGuideWidgetsTools.h" |
||||
|
||||
#include "interfaces/IDataStorage.h" |
||||
|
||||
typedef enum |
||||
{ |
||||
tUBTGZeroPageMode_EDITION, |
||||
tUBTGZeroPageMode_PRESENTATION |
||||
}tUBTGZeroPageMode; |
||||
|
||||
#define LOWER_RESIZE_WIDTH 50 |
||||
|
||||
/***************************************************************************
|
||||
* class UBTeacherGuideEditionWidget * |
||||
***************************************************************************/ |
||||
class UBTeacherGuideEditionWidget : public QWidget , public IDataStorage |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit UBTeacherGuideEditionWidget(QWidget* parent = 0, const char* name="UBTeacherGuideEditionWidget"); |
||||
~UBTeacherGuideEditionWidget(); |
||||
void cleanData(); |
||||
QVector<tUBGEElementNode*> getData(); |
||||
|
||||
void load(QString element); |
||||
QVector<tIDataStorage*> save(int pageIndex); |
||||
|
||||
bool isModified(); |
||||
|
||||
public slots: |
||||
void onAddItemClicked(QTreeWidgetItem* widget, int column, QDomElement* element = 0); |
||||
void onActiveSceneChanged(); |
||||
void showEvent(QShowEvent* event); |
||||
|
||||
private: |
||||
QList<QTreeWidgetItem*> getChildrenList(QTreeWidgetItem* widgetItem); |
||||
QVector<tUBGEElementNode*> getPageAndCommentData(); |
||||
|
||||
QVBoxLayout* mpLayout; |
||||
QLabel* mpDocumentTitle; |
||||
QLabel* mpPageNumberLabel; |
||||
UBTGAdaptableText* mpPageTitle; |
||||
UBTGAdaptableText* mpComment; |
||||
QFrame* mpSeparator; |
||||
QTreeWidget* mpTreeWidget; |
||||
QTreeWidgetItem* mpRootWidgetItem; |
||||
UBAddItem* mpAddAnActionItem; |
||||
UBAddItem* mpAddAMediaItem; |
||||
UBAddItem* mpAddALinkItem; |
||||
|
||||
private slots: |
||||
void onActiveDocumentChanged(); |
||||
#ifdef Q_WS_MACX |
||||
void onSliderMoved(int size); |
||||
#endif |
||||
}; |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* class UBTeacherGuidePresentationWidget * |
||||
***************************************************************************/ |
||||
class UBTeacherGuidePresentationWidget : public QWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit UBTeacherGuidePresentationWidget(QWidget* parent, const char* name = "UBTeacherGuidePresentationName"); |
||||
~UBTeacherGuidePresentationWidget(); |
||||
void showData(QVector<tUBGEElementNode*>data); |
||||
void cleanData(); |
||||
|
||||
public slots: |
||||
void onAddItemClicked(QTreeWidgetItem* widget, int column); |
||||
void onActiveSceneChanged(); |
||||
|
||||
private: |
||||
bool eventFilter(QObject* object, QEvent* event); |
||||
|
||||
void createMediaButtonItem(); |
||||
|
||||
UBTGAdaptableText* mpPageTitle; |
||||
UBTGAdaptableText* mpComment; |
||||
QVBoxLayout* mpLayout; |
||||
QHBoxLayout* mpButtonTitleLayout; |
||||
QLabel* mpDocumentTitle; |
||||
QLabel* mpPageNumberLabel; |
||||
QFrame* mpSeparator; |
||||
QPushButton* mpModePushButton; |
||||
UBTGDraggableTreeItem* mpTreeWidget; |
||||
QTreeWidgetItem* mpRootWidgetItem; |
||||
QTreeWidgetItem* mpMediaSwitchItem; |
||||
|
||||
|
||||
#ifdef Q_WS_MACX |
||||
private slots: |
||||
void onSliderMoved(int size); |
||||
#endif |
||||
|
||||
}; |
||||
|
||||
/***************************************************************************
|
||||
* class UBTeacherGuidePageZeroWidget * |
||||
***************************************************************************/ |
||||
class UBTeacherGuidePageZeroWidget : public QWidget |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit UBTeacherGuidePageZeroWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget"); |
||||
~UBTeacherGuidePageZeroWidget(); |
||||
|
||||
QVector<tUBGEElementNode*> getData(); |
||||
bool isModified(); |
||||
|
||||
signals: |
||||
void resized(); |
||||
|
||||
public slots: |
||||
void onActiveSceneChanged(); |
||||
void switchToMode(tUBTGZeroPageMode mode = tUBTGZeroPageMode_EDITION); |
||||
|
||||
protected: |
||||
void resizeEvent(QResizeEvent* ev); |
||||
|
||||
private: |
||||
void fillComboBoxes(); |
||||
void loadData(); |
||||
void hideEvent(QHideEvent* event); |
||||
bool eventFilter(QObject* object, QEvent* event); |
||||
void updateSceneTitle(); |
||||
|
||||
QVBoxLayout* mpLayout; |
||||
QHBoxLayout* mpButtonTitleLayout; |
||||
QVBoxLayout* mpContainerWidgetLayout; |
||||
QPushButton* mpModePushButton; |
||||
QLabel* mpPageNumberLabel; |
||||
|
||||
QScrollArea* mpScrollArea; |
||||
QWidget* mpContainerWidget; |
||||
|
||||
UBTGAdaptableText* mpSessionTitle; |
||||
QFrame* mpSeparatorSessionTitle; |
||||
|
||||
QLabel* mpAuthorsLabel; |
||||
UBTGAdaptableText* mpAuthors; |
||||
QFrame* mpSeparatorAuthors; |
||||
|
||||
QLabel* mpCreationLabel; |
||||
QLabel* mpLastModifiedLabel; |
||||
QLabel* mpObjectivesLabel; |
||||
UBTGAdaptableText* mpObjectives; |
||||
QFrame* mpSeparatorObjectives; |
||||
|
||||
QLabel* mpIndexLabel; |
||||
QLabel* mpKeywordsLabel; |
||||
UBTGAdaptableText* mpKeywords; |
||||
|
||||
QLabel* mpSchoolLevelItemLabel; |
||||
QComboBox* mpSchoolLevelBox; |
||||
QLabel* mpSchoolLevelValueLabel; |
||||
|
||||
QLabel* mpSchoolSubjectsItemLabel; |
||||
QComboBox* mpSchoolSubjectsBox; |
||||
QLabel* mpSchoolSubjectsValueLabel; |
||||
|
||||
QLabel* mpSchoolTypeItemLabel; |
||||
QComboBox* mpSchoolTypeBox; |
||||
QLabel* mpSchoolTypeValueLabel; |
||||
QFrame* mpSeparatorIndex; |
||||
|
||||
QLabel* mpLicenceLabel; |
||||
QComboBox* mpLicenceBox; |
||||
QLabel* mpLicenceValueLabel; |
||||
QLabel* mpLicenceIcon; |
||||
QHBoxLayout* mpLicenceLayout; |
||||
|
||||
UBGraphicsTextItem* mpSceneItemSessionTitle; |
||||
|
||||
QMap<QString,QString> mGradeLevelsMap; |
||||
QMap<QString,QStringList> mSubjects; |
||||
|
||||
private slots: |
||||
void onSchoolLevelChanged(QString schoolLevel); |
||||
void persistData(); |
||||
}; |
||||
|
||||
/***************************************************************************
|
||||
* class UBTeacherGuideWidget * |
||||
***************************************************************************/ |
||||
|
||||
class UBTeacherGuideWidget : public QStackedWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit UBTeacherGuideWidget(QWidget* parent = 0, const char* name="UBTeacherGuideWidget"); |
||||
~UBTeacherGuideWidget(); |
||||
|
||||
bool isModified(); |
||||
|
||||
public slots: |
||||
void changeMode(); |
||||
void showPresentationMode(); |
||||
void connectToStylusPalette(); |
||||
void onActiveSceneChanged(); |
||||
|
||||
private: |
||||
UBTeacherGuidePageZeroWidget* mpPageZeroWidget; |
||||
UBTeacherGuideEditionWidget* mpEditionWidget; |
||||
UBTeacherGuidePresentationWidget* mpPresentationWidget; |
||||
QVector<tUBGEElementNode*>mCurrentData; |
||||
bool mKeyboardActionFired; |
||||
|
||||
private slots: |
||||
void onTriggeredAction(bool checked); |
||||
void onTriggeredKeyboardAction(bool checked); |
||||
}; |
||||
|
||||
#endif // UBTEACHERGUIDEWIDGET_H
|
@ -1,724 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) |
||||
* |
||||
* This file is part of Open-Sankoré. |
||||
* |
||||
* Open-Sankoré is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, |
||||
* with a specific linking exception for the OpenSSL project's |
||||
* "OpenSSL" library (or with modified versions of it that use the |
||||
* same license as the "OpenSSL" library). |
||||
* |
||||
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
|
||||
|
||||
#include <QTreeWidget> |
||||
#include <QVBoxLayout> |
||||
#include <QComboBox> |
||||
#include <QColor> |
||||
#include <QLabel> |
||||
#include <QDebug> |
||||
#include <QUrl> |
||||
#include <QWebSettings> |
||||
#include <QApplication> |
||||
#include <QDomElement> |
||||
#include <QWebFrame> |
||||
#include <QTextDocument> |
||||
#include <QTextBlock> |
||||
#include <QTextCursor> |
||||
|
||||
#include "UBTeacherGuideWidgetsTools.h" |
||||
|
||||
#include "core/UBPersistenceManager.h" |
||||
#include "core/UBApplication.h" |
||||
|
||||
#include "board/UBBoardController.h" |
||||
|
||||
#include "domain/UBGraphicsWidgetItem.h" |
||||
|
||||
#include "globals/UBGlobals.h" |
||||
|
||||
#include "frameworks/UBFileSystemUtils.h" |
||||
|
||||
#include "customWidgets/UBMediaWidget.h" |
||||
|
||||
#include "core/memcheck.h" |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* class UBAddItem * |
||||
***************************************************************************/ |
||||
UBAddItem::UBAddItem(const QString &string, int addSubItemWidgetType, QTreeWidget* parent): QTreeWidgetItem(parent) |
||||
{ |
||||
setIcon(0,QIcon(":images/increase.svg")); |
||||
setText(0,string); |
||||
setData(0,Qt::UserRole,QVariant(addSubItemWidgetType)); |
||||
setData(1,Qt::UserRole,QVariant(addSubItemWidgetType)); |
||||
setData(0,Qt::BackgroundRole,QVariant(QColor(200,200,200))); |
||||
setData(1,Qt::BackgroundRole,QVariant(QColor(200,200,200))); |
||||
setData(0,Qt::FontRole,QVariant(QFont(QApplication::font().family(),12))); |
||||
} |
||||
|
||||
UBAddItem::~UBAddItem() |
||||
{ |
||||
//NOOP
|
||||
} |
||||
|
||||
/***************************************************************************
|
||||
* class UBTGActionWidget * |
||||
***************************************************************************/ |
||||
UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, const char* name) : QWidget(parent) |
||||
, mpLayout(NULL) |
||||
, mpOwner(NULL) |
||||
, mpTask(NULL) |
||||
{ |
||||
setObjectName(name); |
||||
SET_STYLE_SHEET(); |
||||
mpLayout = new QVBoxLayout(this); |
||||
mpOwner = new QComboBox(this); |
||||
mpOwner->setObjectName("DockPaletteWidgetComboBox"); |
||||
mpOwner->setMinimumHeight(22); |
||||
QStringList qslOwner; |
||||
qslOwner << tr("Teacher") << tr("Student"); |
||||
mpOwner->insertItems(0,qslOwner); |
||||
mpOwner->setCurrentIndex(0); |
||||
mpTask = new UBTGAdaptableText(widget,this); |
||||
mpTask->setPlaceHolderText(tr("Type task here ...")); |
||||
mpTask->setAcceptRichText(true); |
||||
mpTask->setObjectName("ActionWidgetTaskTextEdit"); |
||||
mpLayout->addWidget(mpOwner); |
||||
mpLayout->addWidget(mpTask); |
||||
} |
||||
|
||||
UBTGActionWidget::~UBTGActionWidget() |
||||
{ |
||||
DELETEPTR(mpOwner); |
||||
DELETEPTR(mpTask); |
||||
DELETEPTR(mpLayout); |
||||
} |
||||
|
||||
void UBTGActionWidget::initializeWithDom(QDomElement element) |
||||
{ |
||||
mpOwner->setCurrentIndex(element.attribute("owner").toInt()); |
||||
mpTask->setInitialText(element.attribute("task")); |
||||
} |
||||
|
||||
tUBGEElementNode* UBTGActionWidget::saveData() |
||||
{ |
||||
tUBGEElementNode* result = new tUBGEElementNode(); |
||||
result->name = "action"; |
||||
result->attributes.insert("owner",QString("%0").arg(mpOwner->currentIndex())); |
||||
result->attributes.insert("task",mpTask->text()); |
||||
return result; |
||||
} |
||||
|
||||
/***************************************************************************
|
||||
* class UBTGAdaptableText * |
||||
***************************************************************************/ |
||||
UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, const char* name):QTextEdit(parent) |
||||
, mBottomMargin(5) |
||||
, mpTreeWidgetItem(widget) |
||||
, mMinimumHeight(0) |
||||
, mHasPlaceHolder(false) |
||||
, mIsUpdatingSize(false) |
||||
, mMaximumLength(0) |
||||
{ |
||||
setObjectName(name); |
||||
connect(this,SIGNAL(textChanged()),this,SLOT(onTextChanged())); |
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
||||
|
||||
mMinimumHeight = document()->size().height() + mBottomMargin; |
||||
setMinimumHeight(mMinimumHeight); |
||||
|
||||
} |
||||
|
||||
void UBTGAdaptableText::setMaximumLength(int length) |
||||
{ |
||||
mMaximumLength = length; |
||||
} |
||||
|
||||
void UBTGAdaptableText::setPlaceHolderText(QString text) |
||||
{ |
||||
mHasPlaceHolder = true; |
||||
|
||||
// the space addition is to make this string unique and check against it to know
|
||||
// if we are talking about a typed string or the placeholder string
|
||||
mPlaceHolderText = text + " "; |
||||
setPlainText(mPlaceHolderText); |
||||
} |
||||
|
||||
void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e) |
||||
{ |
||||
QTextEdit::keyReleaseEvent(e); |
||||
|
||||
if(mMaximumLength && toPlainText().length()>mMaximumLength){ |
||||
setPlainText(toPlainText().left(mMaximumLength)); |
||||
QTextCursor tc(document()); |
||||
tc.setPosition(mMaximumLength); |
||||
setTextCursor(tc); |
||||
} |
||||
} |
||||
|
||||
void UBTGAdaptableText::showEvent(QShowEvent* e) |
||||
{ |
||||
Q_UNUSED(e); |
||||
if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){ |
||||
setTextColor(QColor(Qt::lightGray)); |
||||
setPlainText(mPlaceHolderText); |
||||
} |
||||
else |
||||
// If the teacherguide is collapsed, don't updated the size. Or set the size as the expanded size
|
||||
onTextChanged(); |
||||
} |
||||
|
||||
QString UBTGAdaptableText::text() |
||||
{ |
||||
QString result = toPlainText(); |
||||
if(mHasPlaceHolder && result == mPlaceHolderText) |
||||
return ""; |
||||
|
||||
return result; |
||||
} |
||||
|
||||
void UBTGAdaptableText::onTextChanged() |
||||
{ |
||||
qreal documentSize = document()->size().height(); |
||||
if(height() == documentSize + mBottomMargin){ |
||||
return; |
||||
} |
||||
mIsUpdatingSize = true; |
||||
|
||||
|
||||
if(documentSize < mMinimumHeight){ |
||||
setFixedHeight(mMinimumHeight); |
||||
} |
||||
else{ |
||||
setFixedHeight(documentSize+mBottomMargin); |
||||
} |
||||
|
||||
updateGeometry(); |
||||
//to trig a resize on the tree widget item
|
||||
if(mpTreeWidgetItem){ |
||||
mpTreeWidgetItem->setDisabled(true); |
||||
mpTreeWidgetItem->setExpanded(true); |
||||
mpTreeWidgetItem->setDisabled(false); |
||||
setFocus(); |
||||
} |
||||
mIsUpdatingSize = false; |
||||
} |
||||
|
||||
void UBTGAdaptableText::setInitialText(const QString& text) |
||||
{ |
||||
setText(text); |
||||
setReadOnly(false); |
||||
onTextChanged(); |
||||
} |
||||
|
||||
void UBTGAdaptableText::resetText() |
||||
{ |
||||
if(mHasPlaceHolder && !mPlaceHolderText.isEmpty()){ |
||||
setTextColor(QColor(Qt::lightGray)); |
||||
setText(mPlaceHolderText); |
||||
} |
||||
else{ |
||||
setText(""); |
||||
setTextColor(QColor(Qt::black)); |
||||
} |
||||
onTextChanged(); |
||||
} |
||||
|
||||
void UBTGAdaptableText::showText(const QString & text) |
||||
{ |
||||
setText(text); |
||||
setReadOnly(true); |
||||
onTextChanged(); |
||||
} |
||||
|
||||
void UBTGAdaptableText::bottomMargin(int newValue) |
||||
{ |
||||
mBottomMargin = newValue; |
||||
onTextChanged(); |
||||
} |
||||
|
||||
void UBTGAdaptableText::focusInEvent(QFocusEvent* e) |
||||
{ |
||||
if(isReadOnly()){ |
||||
e->ignore(); |
||||
} |
||||
managePlaceholder(true); |
||||
QTextEdit::focusInEvent(e); |
||||
} |
||||
|
||||
void UBTGAdaptableText::focusOutEvent(QFocusEvent* e) |
||||
{ |
||||
managePlaceholder(false); |
||||
QTextEdit::focusOutEvent(e); |
||||
} |
||||
|
||||
void UBTGAdaptableText::insertFromMimeData(const QMimeData *source) |
||||
{ |
||||
QMimeData editedMimeData; |
||||
QTextDocument textDoc; |
||||
QString plainText; |
||||
|
||||
if (source->hasHtml()) |
||||
{ |
||||
textDoc.setHtml(source->html()); |
||||
plainText += textDoc.toPlainText(); |
||||
} |
||||
if (source->hasText()) |
||||
if (textDoc.toPlainText() != source->text()) |
||||
plainText += source->text(); |
||||
if (source->hasUrls()) |
||||
{ |
||||
foreach(QUrl url, source->urls()) |
||||
{ |
||||
plainText += url.toString(); |
||||
} |
||||
} |
||||
|
||||
editedMimeData.setText(plainText); |
||||
QTextEdit::insertFromMimeData(&editedMimeData); |
||||
} |
||||
|
||||
void UBTGAdaptableText::managePlaceholder(bool focus) |
||||
{ |
||||
if(focus){ |
||||
if(toPlainText() == mPlaceHolderText){ |
||||
setTextColor(QColor(Qt::black)); |
||||
setPlainText(""); |
||||
setCursorToTheEnd(); |
||||
} |
||||
} |
||||
else{ |
||||
if(toPlainText().isEmpty()){ |
||||
setTextColor(QColor(Qt::lightGray)); |
||||
setPlainText(mPlaceHolderText); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void UBTGAdaptableText::setCursorToTheEnd() |
||||
{ |
||||
QTextDocument* doc = document(); |
||||
if(NULL != doc){ |
||||
QTextBlock block = doc->lastBlock(); |
||||
QTextCursor cursor(doc); |
||||
cursor.setPosition(block.position() + block.length() - 1); |
||||
setTextCursor(cursor); |
||||
} |
||||
} |
||||
|
||||
/***************************************************************************
|
||||
* class UBTGDraggableWeb * |
||||
***************************************************************************/ |
||||
UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView(parent) |
||||
, mDragStartPosition(QPoint(-1,-1)) |
||||
, mDragStarted(false) |
||||
|
||||
{ |
||||
if(!relativePath.startsWith("file://")) |
||||
mRelativePath = QUrl::fromLocalFile(relativePath).toString(); |
||||
else |
||||
mRelativePath = relativePath; |
||||
//NOOP
|
||||
} |
||||
|
||||
void UBDraggableWeb::mousePressEvent(QMouseEvent* event) |
||||
{ |
||||
mDragStartPosition = event->pos(); |
||||
mDragStarted = true; |
||||
QWebView::mousePressEvent(event); |
||||
} |
||||
|
||||
void UBDraggableWeb::mouseReleaseEvent(QMouseEvent* event) |
||||
{ |
||||
mDragStarted = false; |
||||
QWebView::mouseReleaseEvent(event); |
||||
} |
||||
|
||||
void UBDraggableWeb::mouseMoveEvent(QMouseEvent* event) |
||||
{ |
||||
if(mDragStarted && (event->pos() - mDragStartPosition).manhattanLength() > QApplication::startDragDistance()){ |
||||
QDrag *drag = new QDrag(this); |
||||
QMimeData *mimeData = new QMimeData; |
||||
QList<QUrl> urlList; |
||||
urlList << QUrl(mRelativePath); |
||||
mimeData->setUrls(urlList); |
||||
drag->setMimeData(mimeData); |
||||
|
||||
drag->exec(); |
||||
event->accept(); |
||||
mDragStarted = false; |
||||
} |
||||
else |
||||
QWebView::mouseMoveEvent(event); |
||||
|
||||
} |
||||
|
||||
/***************************************************************************
|
||||
* class UBTGMediaWidget * |
||||
***************************************************************************/ |
||||
UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) |
||||
, mpTreeWidgetItem(widget) |
||||
, mpDropMeWidget(NULL) |
||||
, mpWorkWidget(NULL) |
||||
, mpLayout(NULL) |
||||
, mpMediaLayout(NULL) |
||||
, mpTitle(NULL) |
||||
, mpMediaLabelWidget(NULL) |
||||
, mpMediaWidget(NULL) |
||||
, mpWebView(NULL) |
||||
, mMediaPath(QString("")) |
||||
, mIsPresentationMode(false) |
||||
, mIsInitializationMode(false) |
||||
, mMediaWidgetHeight(150) |
||||
{ |
||||
setObjectName(name); |
||||
mpDropMeWidget = new QLabel(); |
||||
mpDropMeWidget->setObjectName("UBTGMediaDropMeLabel"); |
||||
mpDropMeWidget->setText(tr("drop media here ...")); |
||||
mpDropMeWidget->setAlignment(Qt::AlignCenter); |
||||
setAcceptDrops(true); |
||||
addWidget(mpDropMeWidget); |
||||
|
||||
setMinimumHeight(250); |
||||
} |
||||
|
||||
UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWidget* parent,bool forceFlashMediaType,const char* name): QStackedWidget(parent) |
||||
, mpTreeWidgetItem(widget) |
||||
, mpDropMeWidget(NULL) |
||||
, mpWorkWidget(NULL) |
||||
, mpLayout(NULL) |
||||
, mpMediaLayout(NULL) |
||||
, mpTitle(NULL) |
||||
, mpMediaLabelWidget(NULL) |
||||
, mpMediaWidget(NULL) |
||||
, mpWebView(NULL) |
||||
, mIsPresentationMode(true) |
||||
, mMediaType("") |
||||
, mIsInitializationMode(false) |
||||
, mMediaWidgetHeight(150) |
||||
{ |
||||
setObjectName(name); |
||||
mMediaPath = UBApplication::boardController->selectedDocument()->persistencePath()+ "/" + mediaPath; |
||||
setAcceptDrops(false); |
||||
createWorkWidget(forceFlashMediaType); |
||||
setFixedHeight(200); |
||||
} |
||||
|
||||
UBTGMediaWidget::~UBTGMediaWidget() |
||||
{ |
||||
DELETEPTR(mpTitle); |
||||
DELETEPTR(mpMediaLabelWidget); |
||||
DELETEPTR(mpMediaWidget); |
||||
DELETEPTR(mpWebView); |
||||
DELETEPTR(mpMediaLayout); |
||||
DELETEPTR(mpLayout); |
||||
|
||||
removeWidget(mpDropMeWidget); |
||||
DELETEPTR(mpDropMeWidget); |
||||
removeWidget(mpWorkWidget); |
||||
DELETEPTR(mpWorkWidget); |
||||
} |
||||
|
||||
void UBTGMediaWidget::initializeWithDom(QDomElement element) |
||||
{ |
||||
mIsInitializationMode = true; |
||||
setAcceptDrops(false); |
||||
mMediaPath = UBApplication::boardController->selectedDocument()->persistencePath() + "/" + element.attribute("relativePath"); |
||||
createWorkWidget(element.attribute("mediaType").contains("flash")); |
||||
setFixedHeight(200); |
||||
mpTitle->setInitialText(element.attribute("title")); |
||||
mIsInitializationMode = false; |
||||
} |
||||
|
||||
void UBTGMediaWidget::removeSource() |
||||
{ |
||||
QFileInfo fileInfo(mMediaPath); |
||||
if(fileInfo.isFile()) |
||||
QFile(mMediaPath).remove(); |
||||
else |
||||
UBFileSystemUtils::deleteDir(mMediaPath); |
||||
} |
||||
|
||||
void UBTGMediaWidget::hideEvent(QHideEvent* event) |
||||
{ |
||||
if(mpWebView) |
||||
mpWebView->page()->mainFrame()->setContent(UBGraphicsW3CWidgetItem::freezedWidgetPage().toAscii()); |
||||
QWidget::hideEvent(event); |
||||
} |
||||
|
||||
void UBTGMediaWidget::showEvent(QShowEvent* event) |
||||
{ |
||||
QWidget::showEvent(event); |
||||
if(mpWebView){ |
||||
QString indexPath = mMediaPath+"/index.htm"; |
||||
if(!QFile::exists(indexPath)) |
||||
indexPath += "l"; |
||||
mpWebView->load(QUrl::fromLocalFile(indexPath)); |
||||
} |
||||
} |
||||
|
||||
tUBGEElementNode* UBTGMediaWidget::saveData() |
||||
{ |
||||
if(!mpTitle) |
||||
return 0; |
||||
tUBGEElementNode* result = new tUBGEElementNode(); |
||||
QString relativePath = mMediaPath; |
||||
relativePath = relativePath.replace(UBApplication::boardController->selectedDocument()->persistencePath()+"/",""); |
||||
result->name = "media"; |
||||
result->attributes.insert("title",mpTitle->text()); |
||||
result->attributes.insert("relativePath",relativePath); |
||||
result->attributes.insert("mediaType",mMediaType); |
||||
return result; |
||||
} |
||||
|
||||
void UBTGMediaWidget::dragEnterEvent(QDragEnterEvent *event) |
||||
{ |
||||
event->accept(); |
||||
} |
||||
|
||||
void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType) |
||||
{ |
||||
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mMediaPath); |
||||
bool setMedia = true; |
||||
UBDocumentProxy* proxyDocument = UBApplication::boardController->selectedDocument(); |
||||
if(mimeType.contains("audio") || mimeType.contains("video")){ |
||||
mMediaType = mimeType.contains("audio")? "audio":"movie"; |
||||
mpMediaWidget = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); |
||||
if(mIsPresentationMode || mIsInitializationMode){ |
||||
mpMediaWidget->setFile(mMediaPath); |
||||
} |
||||
else{ |
||||
mMediaPath = UBPersistenceManager::persistenceManager()->addObjectToTeacherGuideDirectory(proxyDocument, mMediaPath); |
||||
mpMediaWidget->setFile(mMediaPath); |
||||
} |
||||
} |
||||
else if(mimeType.contains("image")){ |
||||
mMediaType = "image"; |
||||
if(!(mIsPresentationMode || mIsInitializationMode)) |
||||
mMediaPath = UBPersistenceManager::persistenceManager()->addObjectToTeacherGuideDirectory(proxyDocument, mMediaPath); |
||||
|
||||
mpMediaLabelWidget = new QLabel(); |
||||
QPixmap pixmap = QPixmap(mMediaPath); |
||||
pixmap = pixmap.scaledToHeight(mMediaWidgetHeight); |
||||
mpMediaLabelWidget->setPixmap(pixmap); |
||||
} |
||||
else if(mimeType.contains("widget") && !forceFlashMediaType){ |
||||
mMediaType = "w3c"; |
||||
if(!(mIsPresentationMode || mIsInitializationMode)){ |
||||
mMediaPath = UBPersistenceManager::persistenceManager()->addWidgetToTeacherGuideDirectory(proxyDocument, mMediaPath); |
||||
} |
||||
mpWebView = new UBDraggableWeb(mMediaPath); |
||||
mpWebView->setAcceptDrops(false); |
||||
mpWebView->settings()->setAttribute(QWebSettings::JavaEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); |
||||
QString indexPath = mMediaPath+"/index.htm"; |
||||
if(!QFile::exists(indexPath)) |
||||
indexPath += "l"; |
||||
mpWebView->load(QUrl::fromLocalFile(indexPath)); |
||||
} |
||||
else if(mimeType.contains("x-shockwave-flash") || forceFlashMediaType){ |
||||
mMediaType = "flash"; |
||||
if(!(mIsPresentationMode || mIsInitializationMode)){ |
||||
QDir baseW3CDirectory(UBPersistenceManager::persistenceManager()->teacherGuideAbsoluteObjectPath(proxyDocument)); |
||||
mMediaPath = UBGraphicsW3CWidgetItem::createNPAPIWrapperInDir(mMediaPath,baseW3CDirectory,mimeType,QSize(100,100),QUuid::createUuid()); |
||||
} |
||||
qDebug() << mMediaPath; |
||||
mpWebView = new UBDraggableWeb(mMediaPath); |
||||
mpWebView->setAcceptDrops(false); |
||||
mpWebView->settings()->setAttribute(QWebSettings::JavaEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); |
||||
mpWebView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); |
||||
QString indexPath = mMediaPath+"/index.htm"; |
||||
if(!QFile::exists(indexPath)) |
||||
indexPath += "l"; |
||||
mpWebView->load(QUrl::fromLocalFile(indexPath)); |
||||
} |
||||
else{ |
||||
qDebug() << "createWorkWidget mime type not handled" << mimeType; |
||||
setMedia=false; |
||||
} |
||||
|
||||
if(setMedia){ |
||||
setAcceptDrops(false); |
||||
mpWorkWidget = new QWidget(this); |
||||
if(!mIsPresentationMode){ |
||||
mpLayout = new QVBoxLayout(mpWorkWidget); |
||||
mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget); |
||||
mpTitle->setPlaceHolderText(tr("Type title here...")); |
||||
mpLayout->addWidget(mpTitle); |
||||
mpMediaLayout = new QHBoxLayout; |
||||
mpLayout->addLayout(mpMediaLayout); |
||||
mpWorkWidget->setLayout(mpLayout); |
||||
} |
||||
else{ |
||||
mpMediaLayout = new QHBoxLayout(mpWorkWidget); |
||||
mpWorkWidget->setLayout(mpMediaLayout); |
||||
} |
||||
|
||||
mpMediaLayout->addStretch(1); |
||||
|
||||
if(mpMediaLabelWidget){ |
||||
mpMediaLabelWidget->setFixedHeight(mMediaWidgetHeight); |
||||
mpMediaLabelWidget->setParent(mpWorkWidget); |
||||
mpMediaLayout->addWidget(mpMediaLabelWidget); |
||||
} |
||||
else if (mpMediaWidget){ |
||||
mpMediaWidget->setFixedHeight(mMediaWidgetHeight); |
||||
mpMediaWidget->setParent(mpWorkWidget); |
||||
mpMediaLayout->addWidget(mpMediaWidget); |
||||
} |
||||
else if (mpWebView){ |
||||
mpWebView->setFixedHeight(mMediaWidgetHeight); |
||||
mpWebView->setParent(mpWorkWidget); |
||||
mpMediaLayout->addWidget(mpWebView); |
||||
mpWebView->show(); |
||||
} |
||||
mpMediaLayout->addStretch(1); |
||||
addWidget(mpWorkWidget); |
||||
setCurrentWidget(mpWorkWidget); |
||||
mpWorkWidget->show(); |
||||
|
||||
} |
||||
} |
||||
|
||||
void UBTGMediaWidget::parseMimeData(const QMimeData* pMimeData) |
||||
{ |
||||
if(pMimeData){ |
||||
if(pMimeData->hasText()){ |
||||
mMediaPath = QUrl::fromLocalFile(pMimeData->text()).toString(); |
||||
} |
||||
else if(pMimeData->hasUrls()){ |
||||
mMediaPath = pMimeData->urls().at(0).toString(); |
||||
} |
||||
else if(pMimeData->hasImage()){ |
||||
qDebug() << "Not yet implemented"; |
||||
} |
||||
} |
||||
else |
||||
qDebug() << "No mime data present"; |
||||
|
||||
createWorkWidget(); |
||||
} |
||||
|
||||
void UBTGMediaWidget::dropEvent(QDropEvent* event) |
||||
{ |
||||
parseMimeData(event->mimeData()); |
||||
event->accept(); |
||||
} |
||||
|
||||
void UBTGMediaWidget::mousePressEvent(QMouseEvent *event) |
||||
{ |
||||
if (!mIsPresentationMode) |
||||
event->ignore(); |
||||
else{ |
||||
QDrag *drag = new QDrag(this); |
||||
QMimeData *mimeData = new QMimeData(); |
||||
QList<QUrl> urlList; |
||||
#ifdef Q_WS_WIN |
||||
urlList << QUrl::fromLocalFile(mMediaPath); |
||||
#else |
||||
urlList << QUrl(mMediaPath); |
||||
#endif |
||||
mimeData->setUrls(urlList); |
||||
drag->setMimeData(mimeData); |
||||
|
||||
drag->exec(); |
||||
event->accept(); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* class UBTGUrlWidget * |
||||
***************************************************************************/ |
||||
UBTGUrlWidget::UBTGUrlWidget(QWidget* parent, const char* name ):QWidget(parent) |
||||
, mpLayout(NULL) |
||||
, mpTitle(NULL) |
||||
, mpUrl(NULL) |
||||
{ |
||||
setObjectName(name); |
||||
SET_STYLE_SHEET(); |
||||
mpLayout = new QVBoxLayout(this); |
||||
setLayout(mpLayout); |
||||
mpTitle = new QLineEdit(this); |
||||
mpTitle->setObjectName("UBTGLineEdit"); |
||||
mpTitle->setPlaceholderText(tr("Insert link title here...")); |
||||
mpUrl = new QLineEdit(this); |
||||
connect(mpUrl,SIGNAL(editingFinished()),this,SLOT(onUrlEditionFinished())); |
||||
mpUrl->setObjectName("UBTGLineEdit"); |
||||
mpUrl->setPlaceholderText("http://"); |
||||
mpLayout->addWidget(mpTitle); |
||||
mpLayout->addWidget(mpUrl); |
||||
} |
||||
|
||||
UBTGUrlWidget::~UBTGUrlWidget() |
||||
{ |
||||
DELETEPTR(mpTitle); |
||||
DELETEPTR(mpUrl); |
||||
DELETEPTR(mpLayout); |
||||
} |
||||
|
||||
void UBTGUrlWidget::onUrlEditionFinished() |
||||
{ |
||||
QString url = mpUrl->text(); |
||||
if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){ |
||||
mpUrl->setText("http://" + mpUrl->text()); |
||||
setFocus(); |
||||
} |
||||
} |
||||
|
||||
void UBTGUrlWidget::initializeWithDom(QDomElement element) |
||||
{ |
||||
mpTitle->setText(element.attribute("title")); |
||||
mpUrl->setText(element.attribute("url")); |
||||
} |
||||
|
||||
tUBGEElementNode* UBTGUrlWidget::saveData() |
||||
{ |
||||
tUBGEElementNode* result = new tUBGEElementNode(); |
||||
result->name = "link"; |
||||
result->attributes.insert("title",mpTitle->text()); |
||||
result->attributes.insert("url",mpUrl->text()); |
||||
return result; |
||||
} |
||||
|
||||
|
||||
/***************************************************************************
|
||||
* class UBTGDraggableTreeItem * |
||||
***************************************************************************/ |
||||
UBTGDraggableTreeItem::UBTGDraggableTreeItem(QWidget* parent, const char* name) : QTreeWidget(parent) |
||||
{ |
||||
setObjectName(name); |
||||
} |
||||
|
||||
QMimeData* UBTGDraggableTreeItem::mimeData(const QList<QTreeWidgetItem *> items) const |
||||
{ |
||||
QMimeData* result = new QMimeData(); |
||||
QList<QUrl> urls; |
||||
urls << QUrl(items.at(0)->data(0,TG_USER_ROLE_MIME_TYPE).toString()); |
||||
result->setUrls(urls); |
||||
return result; |
||||
} |
@ -1,220 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) |
||||
* |
||||
* This file is part of Open-Sankoré. |
||||
* |
||||
* Open-Sankoré is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, |
||||
* with a specific linking exception for the OpenSSL project's |
||||
* "OpenSSL" library (or with modified versions of it that use the |
||||
* same license as the "OpenSSL" library). |
||||
* |
||||
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
|
||||
|
||||
#ifndef UBTEACHERGUIDEWIDGETSTOOLS_H |
||||
#define UBTEACHERGUIDEWIDGETSTOOLS_H |
||||
|
||||
#include <QObject> |
||||
#include <QTreeWidgetItem> |
||||
#include <QTextEdit> |
||||
#include <QLabel> |
||||
#include <QDragEnterEvent> |
||||
#include <QDropEvent> |
||||
#include <QLineEdit> |
||||
#include <QMimeData> |
||||
#include <QStackedWidget> |
||||
#include <QWebView> |
||||
#include <QFocusEvent> |
||||
#include <QMouseEvent> |
||||
|
||||
#include "customWidgets/UBMediaWidget.h" |
||||
|
||||
#define TG_USER_ROLE_MIME_TYPE (Qt::UserRole+50) |
||||
|
||||
|
||||
class QTreeWidget; |
||||
class QVBoxLayout; |
||||
class QComboBox; |
||||
class QTextEdit; |
||||
class QWidget; |
||||
class UBTGAdaptableText; |
||||
class QDomElement; |
||||
class UBMediaWidget; |
||||
|
||||
typedef struct |
||||
{ |
||||
QString name; |
||||
QMap<QString,QString> attributes; |
||||
}tUBGEElementNode; |
||||
|
||||
|
||||
class iUBTGSaveData |
||||
{ |
||||
public: |
||||
virtual tUBGEElementNode* saveData() = 0; |
||||
}; |
||||
|
||||
|
||||
class UBAddItem : public QTreeWidgetItem |
||||
{ |
||||
public: |
||||
explicit UBAddItem(const QString &strings, int addSubItemWidgetType, QTreeWidget* parent = 0); |
||||
~UBAddItem(); |
||||
|
||||
signals: |
||||
|
||||
public slots: |
||||
}; |
||||
|
||||
class UBTGActionWidget : public QWidget, public iUBTGSaveData |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent = 0,const char* name = "UBTGActionWidget"); |
||||
~UBTGActionWidget(); |
||||
void update(); |
||||
tUBGEElementNode* saveData(); |
||||
void initializeWithDom(QDomElement element); |
||||
|
||||
private: |
||||
QVBoxLayout* mpLayout; |
||||
QComboBox* mpOwner; |
||||
UBTGAdaptableText* mpTask; |
||||
|
||||
protected: |
||||
QTreeWidgetItem* mpTreeWidgetItem; |
||||
}; |
||||
|
||||
|
||||
class UBTGAdaptableText : public QTextEdit |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit UBTGAdaptableText(QTreeWidgetItem* widget = 0, QWidget *parent = 0, const char* name = "UBTGAdaptableText"); |
||||
void showText(const QString & text); |
||||
void resetText(); |
||||
void bottomMargin(int newValue); |
||||
void setPlaceHolderText(QString text); |
||||
QString text(); |
||||
void setInitialText(const QString& text); |
||||
void setMaximumLength(int length); |
||||
void managePlaceholder(bool focus); |
||||
|
||||
public slots: |
||||
void onTextChanged(); |
||||
|
||||
protected: |
||||
void keyReleaseEvent(QKeyEvent* e); |
||||
void showEvent(QShowEvent* e); |
||||
void focusInEvent(QFocusEvent* e); |
||||
void focusOutEvent(QFocusEvent* e); |
||||
virtual void insertFromMimeData(const QMimeData *source); |
||||
|
||||
private: |
||||
void setCursorToTheEnd(); |
||||
int mBottomMargin; |
||||
QTreeWidgetItem* mpTreeWidgetItem; |
||||
int mMinimumHeight; |
||||
bool mHasPlaceHolder; |
||||
QString mPlaceHolderText; |
||||
bool mIsUpdatingSize; |
||||
int mMaximumLength; |
||||
}; |
||||
|
||||
|
||||
class UBDraggableWeb : public QWebView |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit UBDraggableWeb(QString& relativePath, QWidget* parent = 0); |
||||
|
||||
private: |
||||
void mousePressEvent(QMouseEvent* event); |
||||
void mouseMoveEvent(QMouseEvent* event); |
||||
void mouseReleaseEvent(QMouseEvent* event); |
||||
|
||||
QString mRelativePath; |
||||
QPoint mDragStartPosition; |
||||
bool mDragStarted; |
||||
}; |
||||
|
||||
class UBTGMediaWidget : public QStackedWidget , public iUBTGSaveData |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBTGMediaWidget(QTreeWidgetItem* widget = 0, QWidget* parent = 0, const char* name = "UBTGMediaWidget"); |
||||
UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget = 0, QWidget* parent = 0, bool forceFlashMediaType = false, const char *name = "UBTGMediaWidget"); |
||||
~UBTGMediaWidget(); |
||||
tUBGEElementNode* saveData(); |
||||
void initializeWithDom(QDomElement element); |
||||
void removeSource(); |
||||
|
||||
protected: |
||||
void dragEnterEvent(QDragEnterEvent* event); |
||||
void dropEvent(QDropEvent* event); |
||||
void mousePressEvent(QMouseEvent* event); |
||||
void hideEvent(QHideEvent* event); |
||||
void showEvent(QShowEvent* event); |
||||
|
||||
private: |
||||
void parseMimeData(const QMimeData* pMimeData); |
||||
void createWorkWidget(bool forceFlashMediaType = false); |
||||
void updateSize(); |
||||
|
||||
QTreeWidgetItem* mpTreeWidgetItem; |
||||
QLabel* mpDropMeWidget; |
||||
QWidget* mpWorkWidget; |
||||
QVBoxLayout* mpLayout; |
||||
QHBoxLayout* mpMediaLayout; |
||||
UBTGAdaptableText* mpTitle; |
||||
QLabel* mpMediaLabelWidget; |
||||
UBMediaWidget* mpMediaWidget; |
||||
UBDraggableWeb* mpWebView; |
||||
QString mMediaPath; |
||||
bool mIsPresentationMode; |
||||
QString mMediaType; |
||||
bool mIsInitializationMode; |
||||
int mMediaWidgetHeight; |
||||
}; |
||||
|
||||
|
||||
class UBTGUrlWidget : public QWidget , public iUBTGSaveData |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBTGUrlWidget(QWidget* parent = 0, const char* name = "UBTGUrlWidget"); |
||||
~UBTGUrlWidget(); |
||||
tUBGEElementNode* saveData(); |
||||
void initializeWithDom(QDomElement element); |
||||
|
||||
public slots: |
||||
void onUrlEditionFinished(); |
||||
|
||||
private: |
||||
QVBoxLayout* mpLayout; |
||||
QLineEdit* mpTitle; |
||||
QLineEdit* mpUrl; |
||||
}; |
||||
|
||||
class UBTGDraggableTreeItem : public QTreeWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBTGDraggableTreeItem(QWidget* parent = 0, const char* name = "UBTGDraggableTreeItem"); |
||||
|
||||
private: |
||||
QMimeData* mimeData(const QList<QTreeWidgetItem *> items) const; |
||||
}; |
||||
|
||||
#endif // UBTEACHERGUIDEWIDGETSTOOLS_H
|
@ -1,50 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) |
||||
* |
||||
* This file is part of Open-Sankoré. |
||||
* |
||||
* Open-Sankoré is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, version 3 of the License, |
||||
* with a specific linking exception for the OpenSSL project's |
||||
* "OpenSSL" library (or with modified versions of it that use the |
||||
* same license as the "OpenSSL" library). |
||||
* |
||||
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
|
||||
|
||||
|
||||
#ifndef IDATASTORAGE_H |
||||
#define IDATASTORAGE_H |
||||
|
||||
#include <QString> |
||||
#include <QMap> |
||||
|
||||
typedef enum |
||||
{ |
||||
eElementType_START, |
||||
eElementType_END, |
||||
eElementType_UNIQUE |
||||
}eElementType; |
||||
|
||||
typedef struct |
||||
{ |
||||
QString name; |
||||
QMap<QString,QString> attributes; |
||||
eElementType type; |
||||
}tIDataStorage; |
||||
|
||||
class IDataStorage |
||||
{ |
||||
public: |
||||
//virtual void load(QString element) = 0;
|
||||
virtual QVector<tIDataStorage*>save(int pageIndex) = 0 ; |
||||
}; |
||||
#endif // IDATASTORAGE_H
|
@ -1,2 +0,0 @@ |
||||
HEADERS += \ |
||||
src/interfaces/IDataStorage.h |