Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
shibakaneki 13 years ago
commit 22bd3e08df
  1. 56
      plugins/cffadaptor/src/UBCFFAdaptor.cpp
  2. 6
      release.linux.sh
  3. 211
      resources/customizations/teacherGuide/indexingParameters.xml
  4. 3
      resources/style.qss
  5. 2
      src/adaptors/UBCFFSubsetAdaptor.cpp
  6. 19
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  7. 4
      src/core/UBPersistenceManager.cpp
  8. 2
      src/core/UBPreferencesController.cpp
  9. 3
      src/document/UBDocumentController.cpp
  10. 3
      src/document/UBDocumentController.h
  11. 17
      src/document/UBDocumentProxy.cpp
  12. 4
      src/document/UBDocumentProxy.h
  13. 5
      src/frameworks/UBStringUtils.cpp
  14. 1
      src/frameworks/UBStringUtils.h
  15. 409
      src/gui/UBTeacherGuideWidget.cpp
  16. 74
      src/gui/UBTeacherGuideWidget.h

@ -443,7 +443,6 @@ bool UBCFFAdaptor::UBToCFFConverter::parseMetadata()
QSize tmpSize = getSVGDimentions(nextInElement.text()); QSize tmpSize = getSVGDimentions(nextInElement.text());
if (!tmpSize.isNull()) { if (!tmpSize.isNull()) {
mSVGSize = tmpSize; mSVGSize = tmpSize;
mViewbox.setRect(0,0, tmpSize.width(), tmpSize.height());
} else { } else {
qDebug() << "can't interpret svg section size"; qDebug() << "can't interpret svg section size";
errorStr = "InterpretSvgSizeError"; errorStr = "InterpretSvgSizeError";
@ -487,6 +486,11 @@ bool UBCFFAdaptor::UBToCFFConverter::parseContent() {
} }
if (QRect() == mViewbox)
{
mViewbox.setRect(0,0, mSVGSize.width(), mSVGSize.height());
}
svgDocumentSection.setAttribute(aIWBViewBox, rectToIWBAttr(mViewbox)); svgDocumentSection.setAttribute(aIWBViewBox, rectToIWBAttr(mViewbox));
svgDocumentSection.setAttribute(aWidth, QString("%1").arg(mViewbox.width())); svgDocumentSection.setAttribute(aWidth, QString("%1").arg(mViewbox.width()));
svgDocumentSection.setAttribute(aHeight, QString("%1").arg(mViewbox.height())); svgDocumentSection.setAttribute(aHeight, QString("%1").arg(mViewbox.height()));
@ -639,30 +643,29 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parseSvgPageSection(const QDomElemen
void UBCFFAdaptor::UBToCFFConverter::writeQDomElementToXML(const QDomNode &node) void UBCFFAdaptor::UBToCFFConverter::writeQDomElementToXML(const QDomNode &node)
{ {
if (!node.isNull()){ if (!node.isNull())
if (node.isText()) if (node.isText())
{
mIWBContentWriter->writeCharacters(node.nodeValue());
}
else
{
mIWBContentWriter->writeStartElement(node.namespaceURI(), node.toElement().tagName());
for (int i = 0; i < node.toElement().attributes().count(); i++)
{ {
mIWBContentWriter->writeCharacters(node.nodeValue()); QDomAttr attr = node.toElement().attributes().item(i).toAttr();
mIWBContentWriter->writeAttribute(attr.name(), attr.value());
} }
else QDomNode child = node.firstChild();
while(!child.isNull())
{ {
mIWBContentWriter->writeStartElement(node.namespaceURI(), node.toElement().tagName()); writeQDomElementToXML(child);
child = child.nextSibling();
for (int i = 0; i < node.toElement().attributes().count(); i++)
{
QDomAttr attr = node.toElement().attributes().item(i).toAttr();
mIWBContentWriter->writeAttribute(attr.name(), attr.value());
}
QDomNode child = node.firstChild();
while(!child.isNull())
{
writeQDomElementToXML(child);
child = child.nextSibling();
}
mIWBContentWriter->writeEndElement();
} }
}
mIWBContentWriter->writeEndElement();
}
} }
bool UBCFFAdaptor::UBToCFFConverter::writeExtendedIwbSection() bool UBCFFAdaptor::UBToCFFConverter::writeExtendedIwbSection()
@ -1025,8 +1028,6 @@ void UBCFFAdaptor::UBToCFFConverter::setCoordinatesFromUBZ(const QDomElement &ub
item.setRect(0,0, width, height); item.setRect(0,0, width, height);
item.setTransform(tr); item.setTransform(tr);
item.setTransformOriginPoint(item.boundingRect().center());
item.setRotation(-alpha); item.setRotation(-alpha);
QMatrix sceneMatrix = item.sceneMatrix(); QMatrix sceneMatrix = item.sceneMatrix();
@ -1107,6 +1108,9 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle
svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+fePng); svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+fePng);
} }
} }
}else
{
bRet = false;
} }
if (!bRet) if (!bRet)
@ -1142,7 +1146,6 @@ void UBCFFAdaptor::UBToCFFConverter::setCFFTextFromHTMLTextNode(const QDomElemen
QDomNode spanNode = htmlPNode.firstChild(); QDomNode spanNode = htmlPNode.firstChild();
while (!spanNode.isNull()) while (!spanNode.isNull())
{ {
if (spanNode.isText()) if (spanNode.isText())
@ -1153,7 +1156,10 @@ void UBCFFAdaptor::UBToCFFConverter::setCFFTextFromHTMLTextNode(const QDomElemen
else else
if (spanNode.isElement()) if (spanNode.isElement())
{ {
QDomElement pElementIwb;
QDomElement spanElement = textDoc.createElementNS(svgIWBNS,svgIWBNSPrefix + ":" + tIWBTspan); QDomElement spanElement = textDoc.createElementNS(svgIWBNS,svgIWBNSPrefix + ":" + tIWBTspan);
setCommonAttributesFromUBZ(htmlPNode.toElement(), pElementIwb, spanElement);
if (spanNode.hasAttributes()) if (spanNode.hasAttributes())
{ {
int attrCount = spanNode.attributes().count(); int attrCount = spanNode.attributes().count();
@ -1196,6 +1202,8 @@ QString UBCFFAdaptor::UBToCFFConverter::ubzAttrNameToCFFAttrName(QString cffAttr
QString sRet = cffAttrName; QString sRet = cffAttrName;
if (QString("color") == cffAttrName) if (QString("color") == cffAttrName)
sRet = QString("fill"); sRet = QString("fill");
if (QString("align") == cffAttrName)
sRet = QString("text-align");
return sRet; return sRet;
} }

@ -111,8 +111,8 @@ else
LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`" LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`"
if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then
echo creating a tag with the version $VERSION echo creating a tag with the version $VERSION
# git tag -a "v$VERSION" -m "Generating setup for v$VERSION" git tag -a "v$VERSION" -m "Generating setup for v$VERSION"
# git push origin --tags git push origin --tags
fi fi
fi fi
@ -353,4 +353,4 @@ cd $RELEASE_DIR
rm ../../../install/linux/Open-Sankore.tar.gz rm ../../../install/linux/Open-Sankore.tar.gz
tar cvzf ../../../install/linux/Open-Sankore.tar.gz Open-Sankore.$VERSION -C . tar cvzf ../../../install/linux/Open-Sankore.tar.gz Open-Sankore.$VERSION -C .
notify-send "Open-Sankore" "tar.gz Build done" notify-send "Open-Sankore" "tar.gz Build done"

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<teacherGuide>
<gradeLevels>
<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="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="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="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="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="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="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>

@ -254,8 +254,7 @@ UBTGAdaptableText#UBTGPresentationComment
border : none; border : none;
} }
QFrame#UBTGEditionSeparator, QFrame#UBTGSeparator
QFrame#UBTGPresentationSepartor
{ {
background-color: #cccccc; background-color: #cccccc;
} }

@ -41,8 +41,6 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "QFile" #include "QFile"
#include <QDomDocument>
#include "core/memcheck.h" #include "core/memcheck.h"
//#include "qtlogger.h" //#include "qtlogger.h"

@ -97,7 +97,7 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy)
xmlWriter.writeTextElement(nsDc, "title", proxy->metaData(UBSettings::documentName).toString()); xmlWriter.writeTextElement(nsDc, "title", proxy->metaData(UBSettings::documentName).toString());
xmlWriter.writeTextElement(nsDc, "type", proxy->metaData(UBSettings::documentGroupName).toString()); xmlWriter.writeTextElement(nsDc, "type", proxy->metaData(UBSettings::documentGroupName).toString());
xmlWriter.writeTextElement(nsDc, "date", QDate::currentDate().toString("yyyy-MM-dd")); xmlWriter.writeTextElement(nsDc, "date", proxy->metaData(UBSettings::documentDate).toString());
xmlWriter.writeTextElement(nsDc, "format", "image/svg+xml"); xmlWriter.writeTextElement(nsDc, "format", "image/svg+xml");
// introduced in UB 4.2 // introduced in UB 4.2
@ -108,8 +108,7 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy)
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "size", QString("%1x%2").arg(width).arg(height)); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "size", QString("%1x%2").arg(width).arg(height));
// introduced in UB 4.4 // introduced in UB 4.4
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "updated-at", proxy->metaData(UBSettings::documentUpdatedAt).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "updated-at", UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTimeUtc()));
// introduced in OpenSankore 1.40.00 // introduced in OpenSankore 1.40.00
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTitle,proxy->metaData(UBSettings::sessionTitle).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTitle,proxy->metaData(UBSettings::sessionTitle).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTarget,proxy->metaData(UBSettings::sessionTarget).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTarget,proxy->metaData(UBSettings::sessionTarget).toString());
@ -278,13 +277,21 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
metadata.insert(UBSettings::documentSize, QVariant(docSize)); metadata.insert(UBSettings::documentSize, QVariant(docSize));
} }
if (!updatedAtFound) // this is necessary to update the old files date
{ QString dateString = metadata.value(UBSettings::documentDate).toString();
metadata.insert(UBSettings::documentUpdatedAt, date + "T00:00:00Z"); if(dateString.length() < 10){
metadata.remove(UBSettings::documentDate);
metadata.insert(UBSettings::documentDate,dateString+"T00:00:00Z");
}
if (!updatedAtFound) {
metadata.insert(UBSettings::documentUpdatedAt, dateString);
} }
metadata.insert(UBSettings::documentDate, QVariant(date)); metadata.insert(UBSettings::documentDate, QVariant(date));
return metadata; return metadata;
} }

@ -239,7 +239,9 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
} }
doc->setMetaData(UBSettings::documentVersion, UBSettings::currentFileVersion); doc->setMetaData(UBSettings::documentVersion, UBSettings::currentFileVersion);
doc->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); QString currentDate = UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime());
doc->setMetaData(UBSettings::documentUpdatedAt,currentDate);
doc->setMetaData(UBSettings::documentDate,currentDate);
if (withEmptyPage) createDocumentSceneAt(doc, 0); if (withEmptyPage) createDocumentSceneAt(doc, 0);

@ -470,14 +470,12 @@ void UBPreferencesController::toolbarOrientationVertical(bool checked)
{ {
UBSettings* settings = UBSettings::settings(); UBSettings* settings = UBSettings::settings();
settings->appToolBarOrientationVertical->set(checked); settings->appToolBarOrientationVertical->set(checked);
//settings->appToolBarOrientationVertical->set(true);
} }
void UBPreferencesController::toolbarOrientationHorizontal(bool checked) void UBPreferencesController::toolbarOrientationHorizontal(bool checked)
{ {
UBSettings* settings = UBSettings::settings(); UBSettings* settings = UBSettings::settings();
settings->appToolBarOrientationVertical->set(!checked); settings->appToolBarOrientationVertical->set(!checked);
//settings->appToolBarOrientationVertical->set(false);
} }
UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors, UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,

@ -509,7 +509,6 @@ void UBDocumentController::openSelectedItem()
if (proxy && isOKToOpenDocument(proxy)) if (proxy && isOKToOpenDocument(proxy))
{ {
//mBoardController->setActiveDocumentScene(proxy, thumb->sceneIndex());
UBApplication::applicationController->showBoard(); UBApplication::applicationController->showBoard();
} }
} }
@ -1639,4 +1638,4 @@ int UBDocumentController::getSelectedItemIndex()
return thumb->sceneIndex(); return thumb->sceneIndex();
} }
else return -1; else return -1;
} }

@ -34,7 +34,6 @@ class UBDocumentGroupTreeItem;
class UBDocumentProxyTreeItem; class UBDocumentProxyTreeItem;
class UBMainWindow; class UBMainWindow;
class UBDocumentToolsPalette; class UBDocumentToolsPalette;
//class UBKeyboardPalette;
class UBDocumentController : public QObject class UBDocumentController : public QObject
{ {
@ -77,8 +76,6 @@ class UBDocumentController : public QObject
void paste(); void paste();
void focusChanged(QWidget *old, QWidget *current); void focusChanged(QWidget *old, QWidget *current);
// void showKeyboard(bool show);
protected: protected:
virtual void setupViews(); virtual void setupViews();
virtual void setupToolbar(); virtual void setupToolbar();

@ -295,13 +295,18 @@ QString UBDocumentProxy::sessionAuthors()
return QString(); return QString();
} }
QString UBDocumentProxy::documentDate() QDateTime UBDocumentProxy::documentDate()
{ {
if(mMetaDatas.contains(UBSettings::documentDate)){ if(mMetaDatas.contains(UBSettings::documentDate))
return metaData(UBSettings::documentDate).toString(); return UBStringUtils::fromUtcIsoDate(metaData(UBSettings::documentDate).toString());
}else{ return QDateTime::currentDateTime();
return QString(); }
}
QDateTime UBDocumentProxy::lastUpdate()
{
if(mMetaDatas.contains(UBSettings::documentUpdatedAt))
return UBStringUtils::fromUtcIsoDate(metaData(UBSettings::documentUpdatedAt).toString());
return QDateTime().currentDateTime();
} }
bool UBDocumentProxy::isModified() const bool UBDocumentProxy::isModified() const

@ -59,7 +59,9 @@ class UBDocumentProxy : public QObject
QString sessionTopic(); QString sessionTopic();
void setSessionAuthor(const QString& authors); void setSessionAuthor(const QString& authors);
QString sessionAuthors(); QString sessionAuthors();
QString documentDate(); QDateTime documentDate();
QDateTime lastUpdate();
QSize defaultDocumentSize() const; QSize defaultDocumentSize() const;

@ -105,6 +105,11 @@ QString UBStringUtils::toUtcIsoDateTime(const QDateTime& dateTime)
return dateTime.toUTC().toString(Qt::ISODate) + "Z"; return dateTime.toUTC().toString(Qt::ISODate) + "Z";
} }
QDateTime UBStringUtils::fromUtcIsoDate(const QString& dateString)
{
return QDateTime::fromString(dateString,Qt::ISODate).toLocalTime();
}

@ -33,6 +33,7 @@ class UBStringUtils
static QString toCanonicalUuid(const QUuid& uuid); static QString toCanonicalUuid(const QUuid& uuid);
static QString toUtcIsoDateTime(const QDateTime& dateTime); static QString toUtcIsoDateTime(const QDateTime& dateTime);
static QDateTime fromUtcIsoDate(const QString& dateString);
}; };

@ -19,10 +19,12 @@
#include <QHeaderView> #include <QHeaderView>
#include <QTreeWidget> #include <QTreeWidget>
#include <QPushButton> #include <QPushButton>
#include <QDomDocument>
#include "UBTeacherGuideWidget.h" #include "UBTeacherGuideWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
@ -35,6 +37,9 @@
#include "web/UBWebController.h" #include "web/UBWebController.h"
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#define UBTG_SEPARATOR_FIXED_HEIGHT 3 #define UBTG_SEPARATOR_FIXED_HEIGHT 3
@ -81,7 +86,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpLayout->addWidget(mpComment); mpLayout->addWidget(mpComment);
mpSeparator = new QFrame(this); mpSeparator = new QFrame(this);
mpSeparator->setObjectName("UBTGEditionSeparator"); mpSeparator->setObjectName("UBTGSeparator");
mpSeparator->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); mpSeparator->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
mpLayout->addWidget(mpSeparator); mpLayout->addWidget(mpSeparator);
@ -308,7 +313,7 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpSeparator = new QFrame(this); mpSeparator = new QFrame(this);
mpSeparator->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); mpSeparator->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
mpSeparator->setObjectName("UBTGPresentationSepartor"); mpSeparator->setObjectName("UBTGSepartor");
mpLayout->addWidget(mpSeparator); mpLayout->addWidget(mpSeparator);
mpTreeWidget = new QTreeWidget(this); mpTreeWidget = new QTreeWidget(this);
@ -406,7 +411,6 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
mpRootWidgetItem->addChild(newWidgetItem); mpRootWidgetItem->addChild(newWidgetItem);
QTreeWidgetItem* mediaItem = new QTreeWidgetItem(newWidgetItem); QTreeWidgetItem* mediaItem = new QTreeWidgetItem(newWidgetItem);
//mediaItem->setBackground(0,QBrush(QColor("#EEEEEF")));
mediaItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_NONE); mediaItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_NONE);
UBTGMediaWidget* mediaWidget = new UBTGMediaWidget(element->attributes.value("relativePath"),newWidgetItem); UBTGMediaWidget* mediaWidget = new UBTGMediaWidget(element->attributes.value("relativePath"),newWidgetItem);
newWidgetItem->setExpanded(false); newWidgetItem->setExpanded(false);
@ -451,21 +455,402 @@ void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget,
} }
} }
/***************************************************************************
* class UBTeacherGuidePageZeroEditionWidget *
***************************************************************************/
UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget* parent, const char* name): QWidget(parent)
, mpLayout(NULL)
, mpButtonTitleLayout(NULL)
, mpModePushButton(NULL)
, mpPageNumberLabel(NULL)
, mpSessionTitle(NULL)
, mpSeparatorSessionTitle(NULL)
, mpAuthorsLabel(NULL)
, mpAuthors(NULL)
, mpSeparatorAuthors(NULL)
, mpCreationLabel(NULL)
, mpLastModifiedLabel(NULL)
, mpGoalsLabel(NULL)
, mpGoals(NULL)
, mpSeparatorGoals(NULL)
, mpIndexLabel(NULL)
, mpKeywordsLabel(NULL)
, mpKeywords(NULL)
, mpSchoolLevelItemLabel(NULL)
, mpSchoolLevelBox(NULL)
, mpSchoolLevelValueLabel(NULL)
, mpSchoolBranchItemLabel(NULL)
, mpSchoolBranchBox(NULL)
, mpSchoolBranchValueLabel(NULL)
, mpSchoolTypeItemLabel(NULL)
, mpSchoolTypeBox(NULL)
, mpSchoolTypeValueLabel(NULL)
, mpSeparatorIndex(NULL)
, mpLicenceLabel(NULL)
, mpLicenceBox(NULL)
, mpLicenceIcon(NULL)
, mpLicenceLayout(NULL)
{
setObjectName(name);
mpLayout = new QVBoxLayout(this);
mpPageNumberLabel = new QLabel(this);
mpPageNumberLabel->setAlignment(Qt::AlignRight);
mpPageNumberLabel->setObjectName("UBTGPresentationPageNumberLabel");
mpPageNumberLabel->setText(tr("Page 0"));
mpLayout->addWidget(mpPageNumberLabel);
mpButtonTitleLayout = new QHBoxLayout(0);
mpModePushButton = new QPushButton(this);
mpModePushButton->setIcon(QIcon(":images/pencil.svg"));
mpModePushButton->setMaximumWidth(32);
mpButtonTitleLayout->addWidget(mpModePushButton);
connect(mpModePushButton,SIGNAL(clicked()),this,SLOT(switchToMode()));
mpSessionTitle = new UBTGAdaptableText(0,this);
mpSessionTitle->setPlaceHolderText(tr("Type session title here ..."));
mpSessionTitle->setObjectName("UBTGEditionModeSessionTitle");
mpButtonTitleLayout->addWidget(mpSessionTitle);
mpLayout->addLayout(mpButtonTitleLayout);
mpSeparatorSessionTitle = new QFrame(this);
mpSeparatorSessionTitle->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
mpSeparatorSessionTitle->setObjectName("UBTGSeparator");
mpLayout->addWidget(mpSeparatorSessionTitle);
mpAuthorsLabel = new QLabel(this);
mpAuthorsLabel->setObjectName("UBTGZeroPageEditionModeTitle");
mpAuthorsLabel->setText(tr("Author(s)"));
mpLayout->addWidget(mpAuthorsLabel);
mpAuthors = new UBTGAdaptableText(0,this);
mpAuthors->setObjectName("UBTGZeroPageInputText");
mpAuthors->setPlaceHolderText(tr("Type authors here ..."));
mpLayout->addWidget(mpAuthors);
mpCreationLabel = new QLabel(this);
mpCreationLabel->setObjectName("UBTGZeroPageDateLabel");
mpLayout->addWidget(mpCreationLabel);
mpLastModifiedLabel = new QLabel(this);
mpLastModifiedLabel->setObjectName("UBTGZeroPageDateLabel");
mpLayout->addWidget(mpLastModifiedLabel);
mpSeparatorAuthors = new QFrame(this);
mpSeparatorAuthors->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
mpSeparatorAuthors->setObjectName("UBTGSeparator");
mpLayout->addWidget(mpSeparatorAuthors);
mpGoalsLabel = new QLabel(this);
mpGoalsLabel->setObjectName("UBTGZeroPageEditionModeTitle");
mpGoalsLabel->setText(tr("Goal(s)"));
mpLayout->addWidget(mpGoalsLabel);
mpGoals = new UBTGAdaptableText(0,this);
mpGoals->setObjectName("UBTGZeroPageInputText");
mpGoals->setPlaceHolderText(tr("Type goals here..."));
mpLayout->addWidget(mpGoals);
mpSeparatorGoals = new QFrame(this);
mpSeparatorGoals->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
mpSeparatorGoals->setObjectName("UBTGSeparator");
mpLayout->addWidget(mpSeparatorGoals);
mpIndexLabel = new QLabel(this);
mpIndexLabel->setObjectName("UBTGZeroPageEditionModeTitle");
mpIndexLabel->setText(tr("Resource indexing"));
mpLayout->addWidget(mpIndexLabel);
mpKeywordsLabel = new QLabel(this);
mpKeywordsLabel->setObjectName("UBTGZeroPageItemLabel");
mpKeywordsLabel->setText(tr("Keywords:"));
mpLayout->addWidget(mpKeywordsLabel);
mpKeywords = new UBTGAdaptableText(0,this);
mpKeywords->setPlaceHolderText(tr("Type keywords here ..."));
mpLayout->addWidget(mpKeywords);
mpSchoolLevelItemLabel = new QLabel(this);
mpSchoolLevelItemLabel->setObjectName("UBTGZeroPageItemLabel");
mpSchoolLevelItemLabel->setText(tr("Level:"));
mpLayout->addWidget(mpSchoolLevelItemLabel);
mpSchoolLevelBox = new QComboBox(this);
mpSchoolLevelBox->setObjectName("DockPaletteWidgetComboBox");
connect(mpSchoolLevelBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(onSchoolLevelChanged(QString)));
mpLayout->addWidget(mpSchoolLevelBox);
mpSchoolLevelValueLabel = new QLabel(this);
mpLayout->addWidget(mpSchoolLevelValueLabel);
mpSchoolBranchItemLabel = new QLabel(this);
mpSchoolBranchItemLabel->setObjectName("UBTGZeroPageItemLabel");
mpSchoolBranchItemLabel->setText(tr("Branch:"));
mpLayout->addWidget(mpSchoolBranchItemLabel);
mpSchoolBranchBox = new QComboBox(this);
mpSchoolBranchBox->setObjectName("DockPaletteWidgetComboBox");
mpLayout->addWidget(mpSchoolBranchBox);
mpSchoolBranchValueLabel = new QLabel(this);
mpLayout->addWidget(mpSchoolBranchValueLabel);
mpSchoolTypeItemLabel = new QLabel(this);
mpSchoolTypeItemLabel->setObjectName("UBTGZeroPageItemLabel");
mpSchoolTypeItemLabel->setText(tr("Type:"));
mpLayout->addWidget(mpSchoolTypeItemLabel);
mpSchoolTypeBox = new QComboBox(this);
mpSchoolTypeBox->setObjectName("DockPaletteWidgetComboBox");
mpLayout->addWidget(mpSchoolTypeBox);
mpSchoolTypeValueLabel = new QLabel(this);
mpLayout->addWidget(mpSchoolTypeValueLabel);
mpSeparatorIndex = new QFrame(this);
mpSeparatorIndex->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT);
mpSeparatorIndex->setObjectName("UBTGSeparator");
mpLayout->addWidget(mpSeparatorIndex);
mpLicenceLabel = new QLabel(this);
mpLicenceLabel->setObjectName("UBTGZeroPageItemLabel");
mpLicenceLabel->setText(tr("Licence:"));
mpLayout->addWidget(mpLicenceLabel);
mpLicenceBox = new QComboBox(this);
mpLicenceBox->setObjectName("DockPaletteWidgetComboBox");
mpLayout->addWidget(mpLicenceBox);
mpLicenceLayout = new QHBoxLayout(0);
mpLicenceIcon = new QLabel(this);
mpLicenceLayout->addWidget(mpLicenceIcon);
mpLicenceValueLabel = new QLabel(this);
mpLicenceLayout->addWidget(mpLicenceValueLabel);
mpLayout->addLayout(mpLicenceLayout);
mpLayout->addStretch(1);
connect(UBApplication::boardController,SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged()));
fillComboBoxes();
}
UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget()
{
DELETEPTR(mpPageNumberLabel);
DELETEPTR(mpSessionTitle);
DELETEPTR(mpSeparatorSessionTitle);
DELETEPTR(mpAuthorsLabel);
DELETEPTR(mpAuthors);
DELETEPTR(mpSeparatorAuthors);
DELETEPTR(mpCreationLabel);
DELETEPTR(mpLastModifiedLabel);
DELETEPTR(mpGoalsLabel);
DELETEPTR(mpGoals);
DELETEPTR(mpSeparatorGoals);
DELETEPTR(mpIndexLabel);
DELETEPTR(mpKeywordsLabel);
DELETEPTR(mpKeywords);
DELETEPTR(mpSchoolLevelItemLabel);
DELETEPTR(mpSchoolLevelBox);
DELETEPTR(mpSchoolBranchItemLabel);
DELETEPTR(mpSchoolBranchBox);
DELETEPTR(mpSchoolTypeItemLabel);
DELETEPTR(mpSchoolTypeBox);
DELETEPTR(mpSeparatorIndex);
DELETEPTR(mpLicenceLabel);
DELETEPTR(mpLicenceBox);
DELETEPTR(mpLicenceValueLabel);
DELETEPTR(mpLicenceIcon);
DELETEPTR(mpModePushButton);
DELETEPTR(mpLicenceLayout);
DELETEPTR(mpButtonTitleLayout);
DELETEPTR(mpLayout);
}
void UBTeacherGuidePageZeroEditionWidget::fillComboBoxes()
{
QString parametersConfigFilePath = UBSettings::settings()->applicationCustomizationDirectory() + "/teacherGuide/indexingParameters.xml";
QFile parametersFile(parametersConfigFilePath);
if(!parametersFile.exists()){
qCritical() << "UBTeacherGuidePageZeroEditionWidget fillComboBoxes file not found " << parametersConfigFilePath;
return;
}
parametersFile.open(QFile::ReadOnly);
QDomDocument doc;
doc.setContent(parametersFile.readAll());
QDomElement rootElement = doc.elementsByTagName("teacherGuide").at(0).toElement();
QDomNodeList subjects = rootElement.elementsByTagName("subjects");
for(int baseLevelCounter = 0; baseLevelCounter < subjects.count(); baseLevelCounter += 1){
QDomNode subjectsForBaseLevel = subjects.at(baseLevelCounter);
QDomNodeList subjectsList = subjectsForBaseLevel.childNodes();
QStringList subjectsRelatedToBaseLevel;
for(int j = 0; j < subjectsList.count(); j += 1){
subjectsRelatedToBaseLevel.append(subjectsList.at(j).toElement().attribute("label"));
}
mSubjects.insert(subjectsForBaseLevel.toElement().attribute("baseLevel"),subjectsRelatedToBaseLevel);
}
QDomNodeList gradeLevels = rootElement.elementsByTagName("gradeLevels").at(0).childNodes();
for(int i=0; i<gradeLevels.count();i+=1){
mGradeLevelsMap.insert(gradeLevels.at(i).toElement().attribute("label"),gradeLevels.at(i).toElement().attribute("baseLevel"));
mpSchoolLevelBox->addItem(gradeLevels.at(i).toElement().attribute("label"));
}
QDomNodeList types = rootElement.elementsByTagName("types").at(0).childNodes();
for(int i=0; i<types.count();i+=1)
mpSchoolTypeBox->addItem(types.at(i).toElement().attribute("label"));
parametersFile.close();
QStringList licences;
licences << tr("Attribution CC BY") << tr("Attribution-NoDerivs CC BY-ND") << tr("Attribution-ShareAlike CC BY-SA") << tr("Attribution-NonCommercial CC BY-NC") << tr("Attribution-NonCommercial-NoDerivs CC BY-NC-ND") << tr("Attribution-NonCommercial-ShareAlike CC BY-NC-SA") << tr("Public domain") << tr("Copyright");
mpLicenceBox->addItems(licences);
}
void UBTeacherGuidePageZeroEditionWidget::onSchoolLevelChanged(QString schoolLevel)
{
QStringList subjects = mSubjects.value(mGradeLevelsMap.value(schoolLevel));
mpSchoolBranchBox->clear();
if(subjects.count()){
mpSchoolBranchItemLabel->setEnabled(true);
mpSchoolBranchBox->setEnabled(true);
mpSchoolBranchBox->addItems(subjects);
}
else{
mpSchoolBranchItemLabel->setDisabled(true);
mpSchoolBranchBox->setDisabled(true);
}
}
void UBTeacherGuidePageZeroEditionWidget::onActiveSceneChanged()
{
UBDocumentProxy* documentProxy = UBApplication::documentController ? UBApplication::documentController->getCurrentDocument() : 0;
if(UBApplication::documentController && UBApplication::boardController->activeSceneIndex() == 0){
QDateTime creationDate = documentProxy->documentDate();
mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate));
QDateTime updatedDate = documentProxy->lastUpdate();
mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate));
}
}
void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode)
{
if(mode == tUBTGZeroPageMode_EDITION){
mpModePushButton->hide();
mpSessionTitle->setReadOnly(false);
mpAuthors->setReadOnly(false);
mpGoals->setReadOnly(false);
mpKeywords->setReadOnly(false);
mpSchoolLevelValueLabel->hide();
mpSchoolLevelBox->show();
mpSchoolBranchValueLabel->hide();
mpSchoolBranchBox->show();
mpSchoolTypeValueLabel->hide();
mpSchoolTypeBox->show();
mpLicenceIcon->hide();
mpLicenceValueLabel->hide();
mpLicenceBox->show();
}
else{
mpModePushButton->show();
mpSessionTitle->setReadOnly(true);
mpAuthors->setReadOnly(true);
mpGoals->setReadOnly(true);
mpKeywords->setReadOnly(true);
mpSchoolLevelValueLabel->setText(mpSchoolLevelBox->currentText());
mpSchoolLevelValueLabel->show();
mpSchoolLevelBox->hide();
mpSchoolBranchValueLabel->setText(mpSchoolBranchBox->currentText());
mpSchoolBranchValueLabel->show();
mpSchoolBranchBox->hide();
mpSchoolTypeValueLabel->setText(mpSchoolTypeBox->currentText());
mpSchoolTypeValueLabel->show();
mpSchoolTypeBox->hide();
mpLicenceValueLabel->setText(mpLicenceBox->currentText());
QStringList licenceIconList;
licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png";
if(mpLicenceBox->currentIndex() < 6){
mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex()));
mpLicenceIcon->show();
}
mpLicenceValueLabel->show();
mpLicenceBox->hide();
}
}
QVector<tUBGEElementNode*> UBTeacherGuidePageZeroEditionWidget::getData()
{
QVector<tUBGEElementNode*>result;
tUBGEElementNode* elementNode = new tUBGEElementNode();
elementNode->type = "sessionTitle";
elementNode->attributes.insert("value",mpSessionTitle->text());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "authors";
elementNode->attributes.insert("value",mpAuthors->text());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "creationDate";
elementNode->attributes.insert("value",mpCreationLabel->text());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "lastModifiedDate";
elementNode->attributes.insert("value",mpLastModifiedLabel->text());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "goals";
elementNode->attributes.insert("value",mpGoals->text());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "keywords";
elementNode->attributes.insert("value",mpKeywords->text());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "schoolLevel";
elementNode->attributes.insert("value",mpSchoolLevelBox->currentText());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "schoolBranch";
elementNode->attributes.insert("value",mpSchoolBranchBox->currentText());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "schoolType";
elementNode->attributes.insert("value",mpSchoolTypeBox->currentText());
result << elementNode;
elementNode = new tUBGEElementNode();
elementNode->type = "licence";
elementNode->attributes.insert("value",mpLicenceBox->currentText());
result << elementNode;
return result;
}
/*************************************************************************** /***************************************************************************
* class UBTeacherGuideWidget * * class UBTeacherGuideWidget *
***************************************************************************/ ***************************************************************************/
UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget *parent, const char *name): QStackedWidget(parent) UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name): QStackedWidget(parent)
, mpPageZeroEditonWidget(NULL)
, mpEditionWidget(NULL) , mpEditionWidget(NULL)
, mpPresentationWidget(NULL) , mpPresentationWidget(NULL)
{ {
setObjectName(name); setObjectName(name);
mpEditionWidget = new UBTeacherGuideEditionWidget(this); mpPageZeroEditonWidget = new UBTeacherGuidePageZeroEditionWidget(this);
addWidget(mpEditionWidget); addWidget(mpPageZeroEditonWidget);
mpPresentationWidget = new UBTeacherGuidePresentationWidget(this); setCurrentWidget(mpPageZeroEditonWidget);
addWidget(mpPresentationWidget); // mpEditionWidget = new UBTeacherGuideEditionWidget(this);
// addWidget(mpEditionWidget);
// mpPresentationWidget = new UBTeacherGuidePresentationWidget(this);
// addWidget(mpPresentationWidget);
// setCurrentWidget(mpPresentationWidget);
setCurrentWidget(mpPresentationWidget);
connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode())); connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode()));
connectToStylusPalette(); connectToStylusPalette();
} }
@ -487,7 +872,11 @@ void UBTeacherGuideWidget::connectToStylusPalette()
void UBTeacherGuideWidget::showPresentationMode() void UBTeacherGuideWidget::showPresentationMode()
{ {
if(currentWidget()!=mpPresentationWidget){ if(currentWidget()==mpPageZeroEditonWidget){
mCurrentData = mpPageZeroEditonWidget->getData();
mpPageZeroEditonWidget->switchToMode(tUBTGZeroPageMode_PRESENTATION);
}
else if(currentWidget()==mpEditionWidget){
mCurrentData = mpEditionWidget->getData(); mCurrentData = mpEditionWidget->getData();
mpPresentationWidget->showData(mCurrentData); mpPresentationWidget->showData(mCurrentData);
setCurrentWidget(mpPresentationWidget); setCurrentWidget(mpPresentationWidget);

@ -21,10 +21,17 @@ class QHeaderView;
class QLabel; class QLabel;
class QVBoxLayout; class QVBoxLayout;
class QPushButton; class QPushButton;
class UBDocumentProxy;
#include "UBTeacherGuideWidgetsTools.h" #include "UBTeacherGuideWidgetsTools.h"
#include "UBTGWidgetTreeDelegate.h" #include "UBTGWidgetTreeDelegate.h"
typedef enum
{
tUBTGZeroPageMode_EDITION,
tUBTGZeroPageMode_PRESENTATION
}tUBTGZeroPageMode;
/*************************************************************************** /***************************************************************************
* class UBTeacherGuideEditionWidget * * class UBTeacherGuideEditionWidget *
***************************************************************************/ ***************************************************************************/
@ -95,7 +102,73 @@ private:
}; };
/***************************************************************************
* class UBTeacherGuidePageZeroPresentationWidget *
***************************************************************************/
class UBTeacherGuidePageZeroEditionWidget : public QWidget
{
Q_OBJECT
public:
explicit UBTeacherGuidePageZeroEditionWidget(QWidget* parent, const char* name = "UBTeacherGuidePageZeroEditionWidget");
~UBTeacherGuidePageZeroEditionWidget();
QVector<tUBGEElementNode*> getData();
public slots:
void onActiveSceneChanged();
void switchToMode(tUBTGZeroPageMode mode = tUBTGZeroPageMode_EDITION);
private:
void fillComboBoxes();
QVBoxLayout* mpLayout;
QHBoxLayout* mpButtonTitleLayout;
QPushButton* mpModePushButton;
QLabel* mpPageNumberLabel;
UBTGAdaptableText* mpSessionTitle;
QFrame* mpSeparatorSessionTitle;
QLabel* mpAuthorsLabel;
UBTGAdaptableText* mpAuthors;
QFrame* mpSeparatorAuthors;
QLabel* mpCreationLabel;
QLabel* mpLastModifiedLabel;
QLabel* mpGoalsLabel;
UBTGAdaptableText* mpGoals;
QFrame* mpSeparatorGoals;
QLabel* mpIndexLabel;
QLabel* mpKeywordsLabel;
UBTGAdaptableText* mpKeywords;
QLabel* mpSchoolLevelItemLabel;
QComboBox* mpSchoolLevelBox;
QLabel* mpSchoolLevelValueLabel;
QLabel* mpSchoolBranchItemLabel;
QComboBox* mpSchoolBranchBox;
QLabel* mpSchoolBranchValueLabel;
QLabel* mpSchoolTypeItemLabel;
QComboBox* mpSchoolTypeBox;
QLabel* mpSchoolTypeValueLabel;
QFrame* mpSeparatorIndex;
QLabel* mpLicenceLabel;
QComboBox* mpLicenceBox;
QLabel* mpLicenceValueLabel;
QLabel* mpLicenceIcon;
QHBoxLayout* mpLicenceLayout;
QMap<QString,QString> mGradeLevelsMap;
QMap<QString,QStringList> mSubjects;
private slots:
void onSchoolLevelChanged(QString schoolLevel);
};
/*************************************************************************** /***************************************************************************
* class UBTeacherGuideWidget * * class UBTeacherGuideWidget *
@ -114,6 +187,7 @@ public slots:
void connectToStylusPalette(); void connectToStylusPalette();
private: private:
UBTeacherGuidePageZeroEditionWidget* mpPageZeroEditonWidget;
UBTeacherGuideEditionWidget* mpEditionWidget; UBTeacherGuideEditionWidget* mpEditionWidget;
UBTeacherGuidePresentationWidget* mpPresentationWidget; UBTeacherGuidePresentationWidget* mpPresentationWidget;
QVector<tUBGEElementNode*>mCurrentData; QVector<tUBGEElementNode*>mCurrentData;

Loading…
Cancel
Save