@ -23,8 +23,11 @@
# include "UBTeacherGuideWidget.h"
# include "UBTeacherGuideWidget.h"
# include "adaptors/UBSvgSubsetAdaptor.h"
# include "core/UBApplication.h"
# include "core/UBApplication.h"
# include "core/UBPersistenceManager.h"
# include "core/UBPersistenceManager.h"
# include "core/UBSettings.h"
# include "globals/UBGlobals.h"
# include "globals/UBGlobals.h"
@ -40,10 +43,21 @@
# include "document/UBDocumentProxy.h"
# include "document/UBDocumentProxy.h"
# include "document/UBDocumentController.h"
# include "document/UBDocumentController.h"
# include "domain/UBGraphicsTextItem.h"
# include "core/memcheck.h"
# include "core/memcheck.h"
# define UBTG_SEPARATOR_FIXED_HEIGHT 3
# define UBTG_SEPARATOR_FIXED_HEIGHT 3
typedef enum
{
eUBTGAddSubItemWidgetType_None ,
eUBTGAddSubItemWidgetType_Action ,
eUBTGAddSubItemWidgetType_Media ,
eUBTGAddSubItemWidgetType_Url
} eUBTGAddSubItemWidgetType ;
/***************************************************************************
/***************************************************************************
* class UBTeacherGuideEditionWidget *
* class UBTeacherGuideEditionWidget *
@ -62,20 +76,21 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
, mpAddAnActionItem ( NULL )
, mpAddAnActionItem ( NULL )
, mpAddAMediaItem ( NULL )
, mpAddAMediaItem ( NULL )
, mpAddALinkItem ( NULL )
, mpAddALinkItem ( NULL )
, mpTreeDelegate ( NULL )
{
{
setObjectName ( name ) ;
setObjectName ( name ) ;
mpLayout = new QVBoxLayout ( this ) ;
mpLayout = new QVBoxLayout ( this ) ;
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setObjectName ( " UBTGEdition PageNumberLabel " ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPageNumberLabel " ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
// tree basic configuration
// tree basic configuration
if ( UBSettings : : settings ( ) - > teacherGuidePageZeroActivated - > get ( ) . toBool ( ) ) {
mpDocumentTitle = new QLabel ( this ) ;
mpDocumentTitle = new QLabel ( this ) ;
mpDocumentTitle - > setText ( " Document title " ) ;
mpDocumentTitle - > setObjectName ( " UBTGPresentationDocumentTitle " ) ;
mpDocumentTitle - > setObjectName ( " UBTGEditionDocumentTitle " ) ;
mpLayout - > addWidget ( mpDocumentTitle ) ;
mpLayout - > addWidget ( mpDocumentTitle ) ;
}
mpPageTitle = new UBTGAdaptableText ( 0 , this ) ;
mpPageTitle = new UBTGAdaptableText ( 0 , this ) ;
mpPageTitle - > setObjectName ( " UBTGEditionPageTitle " ) ;
mpPageTitle - > setObjectName ( " UBTGEditionPageTitle " ) ;
@ -95,10 +110,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpTreeWidget = new QTreeWidget ( this ) ;
mpTreeWidget = new QTreeWidget ( this ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpTreeDelegate = new UBTGWidgetTreeDelegate ( ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
//mpTreeWidget->setItemDelegate(mpTreeDelegate);
mpTreeWidget - > setRootIsDecorated ( false ) ;
mpTreeWidget - > setRootIsDecorated ( false ) ;
mpTreeWidget - > setIndentation ( 0 ) ;
mpTreeWidget - > setIndentation ( 0 ) ;
mpTreeWidget - > setDropIndicatorShown ( false ) ;
mpTreeWidget - > setDropIndicatorShown ( false ) ;
@ -120,6 +132,11 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpRootWidgetItem - > addChild ( mpAddAnActionItem ) ;
mpRootWidgetItem - > addChild ( mpAddAnActionItem ) ;
mpRootWidgetItem - > addChild ( mpAddAMediaItem ) ;
mpRootWidgetItem - > addChild ( mpAddAMediaItem ) ;
mpRootWidgetItem - > addChild ( mpAddALinkItem ) ;
mpRootWidgetItem - > addChild ( mpAddALinkItem ) ;
if ( UBSettings : : settings ( ) - > teacherGuideLessonPagesActivated - > get ( ) . toBool ( ) ) {
UBSvgSubsetAdaptor : : addElementToBeStored ( QString ( " teacherGuide " ) , this ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeDocumentChanged ( ) ) , this , SLOT ( onActiveDocumentChanged ( ) ) ) ;
}
}
}
UBTeacherGuideEditionWidget : : ~ UBTeacherGuideEditionWidget ( )
UBTeacherGuideEditionWidget : : ~ UBTeacherGuideEditionWidget ( )
@ -132,23 +149,103 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget()
DELETEPTR ( mpAddAnActionItem ) ;
DELETEPTR ( mpAddAnActionItem ) ;
DELETEPTR ( mpAddAMediaItem ) ;
DELETEPTR ( mpAddAMediaItem ) ;
DELETEPTR ( mpAddALinkItem ) ;
DELETEPTR ( mpAddALinkItem ) ;
DELETEPTR ( mpTreeDelegate ) ;
DELETEPTR ( mpTreeWidget )
DELETEPTR ( mpTreeWidget )
DELETEPTR ( mpLayout ) ;
DELETEPTR ( mpLayout ) ;
}
}
void UBTeacherGuideEditionWidget : : showEvent ( QShowEvent * event )
void UBTeacherGuideEditionWidget : : showEvent ( QShowEvent * event )
{
{
mpPageTitle - > setFocus ( ) ;
mpComment - > setFocus ( ) ;
setFocus ( ) ;
setFocus ( ) ;
QWidget : : showEvent ( event ) ;
QWidget : : showEvent ( event ) ;
}
}
void UBTeacherGuideEditionWidget : : onActiveDocumentChanged ( )
{
int activeSceneIndex = UBApplication : : boardController - > activeSceneIndex ( ) ;
if ( UBApplication : : boardController - > pageFromSceneIndex ( activeSceneIndex ) ! = 0 )
load ( UBSvgSubsetAdaptor : : readTeacherGuideNode ( activeSceneIndex ) ) ;
}
void UBTeacherGuideEditionWidget : : load ( QString element )
{
cleanData ( ) ;
QDomDocument doc ( " TeacherGuide " ) ;
doc . setContent ( element ) ;
for ( QDomElement element = doc . documentElement ( ) . firstChildElement ( ) ; ! element . isNull ( ) ; element = element . nextSiblingElement ( ) ) {
QString tagName = element . tagName ( ) ;
if ( tagName = = " title " )
mpPageTitle - > setInitialText ( element . attribute ( " value " ) ) ;
else if ( tagName = = " comment " )
mpComment - > setInitialText ( element . attribute ( " value " ) ) ;
else if ( tagName = = " media " )
onAddItemClicked ( mpAddAMediaItem , 0 , & element ) ;
else if ( tagName = = " link " )
onAddItemClicked ( mpAddALinkItem , 0 , & element ) ;
else if ( tagName = = " action " )
onAddItemClicked ( mpAddAnActionItem , 0 , & element ) ;
}
}
QVector < tIDataStorage * > UBTeacherGuideEditionWidget : : save ( int pageIndex )
{
QVector < tIDataStorage * > result ;
if ( pageIndex ! = UBApplication : : boardController - > currentPage ( ) )
return result ;
tIDataStorage * data = new tIDataStorage ( ) ;
data - > name = " teacherGuide " ;
data - > type = eElementType_START ;
data - > attributes . insert ( " version " , " 1.50 " ) ;
result < < data ;
data = new tIDataStorage ( ) ;
data - > name = " title " ;
data - > type = eElementType_UNIQUE ;
data - > attributes . insert ( " value " , mpPageTitle - > text ( ) ) ;
result < < data ;
data = new tIDataStorage ( ) ;
data - > name = " comment " ;
data - > type = eElementType_UNIQUE ;
data - > attributes . insert ( " value " , mpComment - > text ( ) ) ;
result < < data ;
QList < QTreeWidgetItem * > children = getChildrenList ( mpAddAnActionItem ) ;
children < < getChildrenList ( mpAddAMediaItem ) ;
children < < getChildrenList ( mpAddALinkItem ) ;
foreach ( QTreeWidgetItem * widgetItem , children ) {
tUBGEElementNode * node = dynamic_cast < iUBTGSaveData * > ( mpTreeWidget - > itemWidget ( widgetItem , 0 ) ) - > saveData ( ) ;
if ( node ) {
data = new tIDataStorage ( ) ;
data - > name = node - > name ;
data - > type = eElementType_UNIQUE ;
foreach ( QString currentKey , node - > attributes . keys ( ) )
data - > attributes . insert ( currentKey , node - > attributes . value ( currentKey ) ) ;
result < < data ;
}
}
data = new tIDataStorage ( ) ;
data - > name = " teacherGuide " ;
data - > type = eElementType_END ;
result < < data ;
return result ;
}
void UBTeacherGuideEditionWidget : : onActiveSceneChanged ( )
void UBTeacherGuideEditionWidget : : onActiveSceneChanged ( )
{
{
int currentPage = UBApplication : : boardController - > currentPage ( ) ;
if ( currentPage > 0 ) {
cleanData ( ) ;
cleanData ( ) ;
mpPageNumberLabel - > setText ( tr ( " Page: %0 " ) . arg ( UBApplication : : boardController - > activeSceneIndex ( ) + 1 ) ) ;
load ( UBSvgSubsetAdaptor : : readTeacherGuideNode ( UBApplication : : boardController - > activeSceneIndex ( ) ) ) ;
mpPageNumberLabel - > setText ( tr ( " Page: %0 " ) . arg ( currentPage ) ) ;
UBDocumentProxy * documentProxy = UBApplication : : boardController - > activeDocument ( ) ;
if ( mpDocumentTitle )
mpDocumentTitle - > setText ( documentProxy - > metaData ( UBSettings : : sessionTitle ) . toString ( ) ) ;
}
}
}
void UBTeacherGuideEditionWidget : : cleanData ( )
void UBTeacherGuideEditionWidget : : cleanData ( )
@ -162,7 +259,6 @@ void UBTeacherGuideEditionWidget::cleanData()
foreach ( QTreeWidgetItem * item , children ) {
foreach ( QTreeWidgetItem * item , children ) {
DELETEPTR ( item ) ;
DELETEPTR ( item ) ;
}
}
}
}
QList < QTreeWidgetItem * > UBTeacherGuideEditionWidget : : getChildrenList ( QTreeWidgetItem * widgetItem )
QList < QTreeWidgetItem * > UBTeacherGuideEditionWidget : : getChildrenList ( QTreeWidgetItem * widgetItem )
@ -177,12 +273,12 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getPageAndCommentData()
{
{
QVector < tUBGEElementNode * > result ;
QVector < tUBGEElementNode * > result ;
tUBGEElementNode * pageTitle = new tUBGEElementNode ( ) ;
tUBGEElementNode * pageTitle = new tUBGEElementNode ( ) ;
pageTitle - > typ e = " pageTitle " ;
pageTitle - > nam e = " pageTitle " ;
pageTitle - > attributes . insert ( " value " , mpPageTitle - > text ( ) ) ;
pageTitle - > attributes . insert ( " value " , mpPageTitle - > text ( ) ) ;
result < < pageTitle ;
result < < pageTitle ;
tUBGEElementNode * comment = new tUBGEElementNode ( ) ;
tUBGEElementNode * comment = new tUBGEElementNode ( ) ;
comment - > typ e = " comment " ;
comment - > nam e = " comment " ;
comment - > attributes . insert ( " value " , mpComment - > text ( ) ) ;
comment - > attributes . insert ( " value " , mpComment - > text ( ) ) ;
result < < comment ;
result < < comment ;
return result ;
return result ;
@ -196,32 +292,42 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getData()
children < < getChildrenList ( mpAddALinkItem ) ;
children < < getChildrenList ( mpAddALinkItem ) ;
result < < getPageAndCommentData ( ) ;
result < < getPageAndCommentData ( ) ;
foreach ( QTreeWidgetItem * widgetItem , children ) {
foreach ( QTreeWidgetItem * widgetItem , children ) {
tUBGEElementNode * node = dynamic_cast < iUBTGSavabl eData * > ( mpTreeWidget - > itemWidget ( widgetItem , 0 ) ) - > saveData ( ) ;
tUBGEElementNode * node = dynamic_cast < iUBTGSaveData * > ( mpTreeWidget - > itemWidget ( widgetItem , 0 ) ) - > saveData ( ) ;
if ( node )
if ( node )
result < < node ;
result < < node ;
}
}
return result ;
return result ;
}
}
void UBTeacherGuideEditionWidget : : onAddItemClicked ( QTreeWidgetItem * widget , int column )
void UBTeacherGuideEditionWidget : : onAddItemClicked ( QTreeWidgetItem * widget , int column , QDomElement * element )
{
{
int addSubItemWidgetType = widget - > data ( column , Qt : : UserRole ) . toInt ( ) ;
int addSubItemWidgetType = widget - > data ( column , Qt : : UserRole ) . toInt ( ) ;
if ( column = = 0 & & addSubItemWidgetType ! = eUBTGAddSubItemWidgetType_None ) {
if ( addSubItemWidgetType ! = eUBTGAddSubItemWidgetType_None ) {
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( widget ) ;
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( widget ) ;
newWidgetItem - > setData ( column , Qt : : UserRole , eUBTGAddSubItemWidgetType_None ) ;
newWidgetItem - > setData ( column , Qt : : UserRole , eUBTGAddSubItemWidgetType_None ) ;
newWidgetItem - > setData ( 1 , Qt : : UserRole , eUBTGAddSubItemWidgetType_None ) ;
newWidgetItem - > setData ( 1 , Qt : : UserRole , eUBTGAddSubItemWidgetType_None ) ;
newWidgetItem - > setIcon ( 1 , QIcon ( " :images/close.svg " ) ) ;
newWidgetItem - > setIcon ( 1 , QIcon ( " :images/close.svg " ) ) ;
switch ( addSubItemWidgetType )
switch ( addSubItemWidgetType )
{
{
case eUBTGAddSubItemWidgetType_Action :
case eUBTGAddSubItemWidgetType_Action : {
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , new UBTGActionWidget ( widget ) ) ;
UBTGActionWidget * actionWidget = new UBTGActionWidget ( widget ) ;
if ( element ) actionWidget - > initializeWithDom ( * element ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , actionWidget ) ;
break ;
break ;
case eUBTGAddSubItemWidgetType_Media :
}
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , new UBTGMediaWidget ( widget ) ) ;
case eUBTGAddSubItemWidgetType_Media : {
UBTGMediaWidget * mediaWidget = new UBTGMediaWidget ( widget ) ;
if ( element ) mediaWidget - > initializeWithDom ( * element ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , mediaWidget ) ;
break ;
break ;
case eUBTGAddSubItemWidgetType_Url :
}
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , new UBTGUrlWidget ( ) ) ;
case eUBTGAddSubItemWidgetType_Url : {
UBTGUrlWidget * urlWidget = new UBTGUrlWidget ( ) ;
if ( element ) urlWidget - > initializeWithDom ( * element ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , urlWidget ) ;
break ;
break ;
}
default :
default :
delete newWidgetItem ;
delete newWidgetItem ;
qCritical ( ) < < " onAddItemClicked no action set " ;
qCritical ( ) < < " onAddItemClicked no action set " ;
@ -237,6 +343,8 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int
}
}
}
}
else if ( column = = 1 & & addSubItemWidgetType = = eUBTGAddSubItemWidgetType_None ) {
else if ( column = = 1 & & addSubItemWidgetType = = eUBTGAddSubItemWidgetType_None ) {
UBTGMediaWidget * media = dynamic_cast < UBTGMediaWidget * > ( mpTreeWidget - > itemWidget ( widget , 0 ) ) ;
if ( media ) media - > removeSource ( ) ;
int index = mpTreeWidget - > currentIndex ( ) . row ( ) ;
int index = mpTreeWidget - > currentIndex ( ) . row ( ) ;
QTreeWidgetItem * toBeDeletedWidgetItem = widget - > parent ( ) - > takeChild ( index ) ;
QTreeWidgetItem * toBeDeletedWidgetItem = widget - > parent ( ) - > takeChild ( index ) ;
delete toBeDeletedWidgetItem ;
delete toBeDeletedWidgetItem ;
@ -280,7 +388,7 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPresentationP ageNumberLabel " ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPageNumberLabel " ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
@ -289,15 +397,16 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpModePushButton = new QPushButton ( this ) ;
mpModePushButton = new QPushButton ( this ) ;
mpModePushButton - > setIcon ( QIcon ( " :images/pencil.svg " ) ) ;
mpModePushButton - > setIcon ( QIcon ( " :images/pencil.svg " ) ) ;
mpModePushButton - > setMaximumWidth ( 32 ) ;
mpModePushButton - > setMaximumWidth ( 32 ) ;
mpModePushButton - > installEventFilter ( this ) ;
connect ( mpModePushButton , SIGNAL ( clicked ( ) ) , parentWidget ( ) , SLOT ( changeMode ( ) ) ) ;
connect ( mpModePushButton , SIGNAL ( clicked ( ) ) , parentWidget ( ) , SLOT ( changeMode ( ) ) ) ;
mpButtonTitleLayout - > addWidget ( mpModePushButton ) ;
if ( UBSettings : : settings ( ) - > teacherGuidePageZeroActivated - > get ( ) . toBool ( ) ) {
mpDocumentTitle = new QLabel ( this ) ;
mpDocumentTitle = new QLabel ( this ) ;
mpDocumentTitle - > setObjectName ( " UBTGPresentationDocumentTitle " ) ;
mpDocumentTitle - > setObjectName ( " UBTGPresentationDocumentTitle " ) ;
mpDocumentTitle - > setText ( tr ( " Document title " ) ) ;
mpButtonTitleLayout - > addWidget ( mpModePushButton ) ;
mpButtonTitleLayout - > addWidget ( mpDocumentTitle ) ;
mpButtonTitleLayout - > addWidget ( mpDocumentTitle ) ;
}
mpLayout - > addLayout ( mpButtonTitleLayout ) ;
mpLayout - > addLayout ( mpButtonTitleLayout ) ;
@ -318,10 +427,11 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpSeparator - > setObjectName ( " UBTGSepartor " ) ;
mpSeparator - > setObjectName ( " UBTGSepartor " ) ;
mpLayout - > addWidget ( mpSeparator ) ;
mpLayout - > addWidget ( mpSeparator ) ;
mpTreeWidget = new QTreeWidget ( this ) ;
mpTreeWidget = new UBTGDraggableTreeItem ( this ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
mpTreeWidget - > setDragEnabled ( true ) ;
mpTreeWidget - > setRootIsDecorated ( false ) ;
mpTreeWidget - > setRootIsDecorated ( false ) ;
mpTreeWidget - > setIndentation ( 0 ) ;
mpTreeWidget - > setIndentation ( 0 ) ;
mpTreeWidget - > setDropIndicatorShown ( false ) ;
mpTreeWidget - > setDropIndicatorShown ( false ) ;
@ -345,6 +455,14 @@ UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget()
DELETEPTR ( mpLayout ) ;
DELETEPTR ( mpLayout ) ;
}
}
bool UBTeacherGuidePresentationWidget : : eventFilter ( QObject * object , QEvent * event )
{
Q_UNUSED ( object ) ;
if ( event - > type ( ) = = QEvent : : HoverEnter | | event - > type ( ) = = QEvent : : HoverMove | | event - > type ( ) = = QEvent : : HoverLeave )
return true ;
return false ;
}
void UBTeacherGuidePresentationWidget : : cleanData ( )
void UBTeacherGuidePresentationWidget : : cleanData ( )
{
{
mpPageTitle - > showText ( " " ) ;
mpPageTitle - > showText ( " " ) ;
@ -361,15 +479,16 @@ void UBTeacherGuidePresentationWidget::cleanData()
void UBTeacherGuidePresentationWidget : : onActiveSceneChanged ( )
void UBTeacherGuidePresentationWidget : : onActiveSceneChanged ( )
{
{
cleanData ( ) ;
cleanData ( ) ;
mpPageNumberLabel - > setText ( tr ( " Page: %0 " ) . arg ( UBApplication : : boardController - > activeSceneIndex ( ) + 1 ) ) ;
mpPageNumberLabel - > setText ( tr ( " Page: %0 " ) . arg ( UBApplication : : boardController - > currentPage ( ) ) ) ;
UBDocumentProxy * documentProxy = UBApplication : : boardController - > activeDocument ( ) ;
if ( mpDocumentTitle )
mpDocumentTitle - > setText ( documentProxy - > metaData ( UBSettings : : sessionTitle ) . toString ( ) ) ;
}
}
void UBTeacherGuidePresentationWidget : : createMediaButtonItem ( )
void UBTeacherGuidePresentationWidget : : createMediaButtonItem ( )
{
{
if ( ! mpMediaSwitchItem ) {
if ( ! mpMediaSwitchItem ) {
//create the media button
mpMediaSwitchItem = new QTreeWidgetItem ( mpRootWidgetItem ) ;
mpMediaSwitchItem = new QTreeWidgetItem ( mpRootWidgetItem ) ;
//mpMediaSwitchItem->setIcon(0,QIcon(":images/plus.svg"));
mpMediaSwitchItem - > setText ( 0 , " + " ) ;
mpMediaSwitchItem - > setText ( 0 , " + " ) ;
mpMediaSwitchItem - > setExpanded ( false ) ;
mpMediaSwitchItem - > setExpanded ( false ) ;
mpMediaSwitchItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnAction , tUBTGActionAssociateOnClickItem_EXPAND ) ;
mpMediaSwitchItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnAction , tUBTGActionAssociateOnClickItem_EXPAND ) ;
@ -386,13 +505,14 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
cleanData ( ) ;
cleanData ( ) ;
foreach ( tUBGEElementNode * element , data ) {
foreach ( tUBGEElementNode * element , data ) {
if ( element - > typ e = = " pageTitle " )
if ( element - > nam e = = " pageTitle " )
mpPageTitle - > showText ( element - > attributes . value ( " value " ) ) ;
mpPageTitle - > showText ( element - > attributes . value ( " value " ) ) ;
else if ( element - > typ e = = " comment " )
else if ( element - > nam e = = " comment " )
mpComment - > showText ( element - > attributes . value ( " value " ) ) ;
mpComment - > showText ( element - > attributes . value ( " value " ) ) ;
else if ( element - > typ e = = " action " ) {
else if ( element - > nam e = = " action " ) {
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( mpRootWidgetItem ) ;
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( mpRootWidgetItem ) ;
newWidgetItem - > setText ( 0 , element - > attributes . value ( " task " ) ) ;
newWidgetItem - > setText ( 0 , element - > attributes . value ( " task " ) ) ;
newWidgetItem - > setFlags ( Qt : : ItemIsEnabled | Qt : : ItemIsSelectable ) ;
QString colorString = element - > attributes . value ( " owner " ) . toInt ( ) = = 0 ? " red " : " green " ;
QString colorString = element - > attributes . value ( " owner " ) . toInt ( ) = = 0 ? " red " : " green " ;
UBTGAdaptableText * textWidget = new UBTGAdaptableText ( newWidgetItem , 0 ) ;
UBTGAdaptableText * textWidget = new UBTGAdaptableText ( newWidgetItem , 0 ) ;
textWidget - > bottomMargin ( 14 ) ;
textWidget - > bottomMargin ( 14 ) ;
@ -403,13 +523,15 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
mpRootWidgetItem - > addChild ( newWidgetItem ) ;
mpRootWidgetItem - > addChild ( newWidgetItem ) ;
}
}
else if ( element - > typ e = = " media " ) {
else if ( element - > nam e = = " media " ) {
createMediaButtonItem ( ) ;
createMediaButtonItem ( ) ;
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( mpMediaSwitchItem ) ;
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( mpMediaSwitchItem ) ;
newWidgetItem - > setIcon ( 0 , QIcon ( " :images/teacherGuide/ " + element - > attributes . value ( " mediaType " ) + " .png " ) ) ;
newWidgetItem - > setIcon ( 0 , QIcon ( " :images/teacherGuide/ " + element - > attributes . value ( " mediaType " ) + " .png " ) ) ;
newWidgetItem - > setText ( 0 , element - > attributes . value ( " title " ) ) ;
newWidgetItem - > setText ( 0 , element - > attributes . value ( " title " ) ) ;
newWidgetItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnAction , tUBTGActionAssociateOnClickItem_MEDIA ) ;
newWidgetItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnAction , tUBTGActionAssociateOnClickItem_MEDIA ) ;
newWidgetItem - > setData ( 0 , Qt : : FontRole , QVariant ( QFont ( QApplication : : font ( ) . family ( ) , 11 ) ) ) ;
newWidgetItem - > setData ( 0 , Qt : : FontRole , QVariant ( QFont ( QApplication : : font ( ) . family ( ) , 11 ) ) ) ;
newWidgetItem - > setData ( 0 , TG_USER_ROLE_MIME_TYPE , UBApplication : : boardController - > activeDocument ( ) - > persistencePath ( ) + " / " + element - > attributes . value ( " relativePath " ) ) ;
newWidgetItem - > setFlags ( Qt : : ItemIsDragEnabled | Qt : : ItemIsEnabled | Qt : : ItemIsSelectable ) ;
mpRootWidgetItem - > addChild ( newWidgetItem ) ;
mpRootWidgetItem - > addChild ( newWidgetItem ) ;
QTreeWidgetItem * mediaItem = new QTreeWidgetItem ( newWidgetItem ) ;
QTreeWidgetItem * mediaItem = new QTreeWidgetItem ( newWidgetItem ) ;
@ -418,7 +540,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem - > setExpanded ( false ) ;
newWidgetItem - > setExpanded ( false ) ;
mpTreeWidget - > setItemWidget ( mediaItem , 0 , mediaWidget ) ;
mpTreeWidget - > setItemWidget ( mediaItem , 0 , mediaWidget ) ;
}
}
else if ( element - > typ e = = " link " ) {
else if ( element - > nam e = = " link " ) {
createMediaButtonItem ( ) ;
createMediaButtonItem ( ) ;
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( mpMediaSwitchItem ) ;
QTreeWidgetItem * newWidgetItem = new QTreeWidgetItem ( mpMediaSwitchItem ) ;
newWidgetItem - > setIcon ( 0 , QIcon ( " :images/teacherGuide/link.png " ) ) ;
newWidgetItem - > setIcon ( 0 , QIcon ( " :images/teacherGuide/link.png " ) ) ;
@ -426,6 +548,7 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnAction , tUBTGActionAssociateOnClickItem_URL ) ;
newWidgetItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnAction , tUBTGActionAssociateOnClickItem_URL ) ;
newWidgetItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnUrl , QVariant ( element - > attributes . value ( " url " ) ) ) ;
newWidgetItem - > setData ( 0 , tUBTGTreeWidgetItemRole_HasAnUrl , QVariant ( element - > attributes . value ( " url " ) ) ) ;
newWidgetItem - > setData ( 0 , Qt : : FontRole , QVariant ( QFont ( QApplication : : font ( ) . family ( ) , 11 ) ) ) ;
newWidgetItem - > setData ( 0 , Qt : : FontRole , QVariant ( QFont ( QApplication : : font ( ) . family ( ) , 11 ) ) ) ;
newWidgetItem - > setFlags ( Qt : : ItemIsEnabled | Qt : : ItemIsSelectable ) ;
mpRootWidgetItem - > addChild ( newWidgetItem ) ;
mpRootWidgetItem - > addChild ( newWidgetItem ) ;
}
}
}
}
@ -461,7 +584,7 @@ void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget,
/***************************************************************************
/***************************************************************************
* class UBTeacherGuidePageZeroEditionWidget *
* class UBTeacherGuidePageZeroEditionWidget *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
UBTeacherGuidePageZeroEdition Widget : : UBTeacherGuidePageZeroEdition Widget ( QWidget * parent , const char * name ) : QWidget ( parent )
UBTeacherGuidePageZeroWidget : : UBTeacherGuidePageZeroWidget ( QWidget * parent , const char * name ) : QWidget ( parent )
, mpLayout ( NULL )
, mpLayout ( NULL )
, mpButtonTitleLayout ( NULL )
, mpButtonTitleLayout ( NULL )
, mpModePushButton ( NULL )
, mpModePushButton ( NULL )
@ -473,18 +596,18 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
, mpSeparatorAuthors ( NULL )
, mpSeparatorAuthors ( NULL )
, mpCreationLabel ( NULL )
, mpCreationLabel ( NULL )
, mpLastModifiedLabel ( NULL )
, mpLastModifiedLabel ( NULL )
, mpGoal sLabel ( NULL )
, mpObjective sLabel ( NULL )
, mpGoal s ( NULL )
, mpObjective s ( NULL )
, mpSeparatorGoal s ( NULL )
, mpSeparatorObjective s ( NULL )
, mpIndexLabel ( NULL )
, mpIndexLabel ( NULL )
, mpKeywordsLabel ( NULL )
, mpKeywordsLabel ( NULL )
, mpKeywords ( NULL )
, mpKeywords ( NULL )
, mpSchoolLevelItemLabel ( NULL )
, mpSchoolLevelItemLabel ( NULL )
, mpSchoolLevelBox ( NULL )
, mpSchoolLevelBox ( NULL )
, mpSchoolLevelValueLabel ( NULL )
, mpSchoolLevelValueLabel ( NULL )
, mpSchoolBranch ItemLabel ( NULL )
, mpSchoolSubjects ItemLabel ( NULL )
, mpSchoolBranch Box ( NULL )
, mpSchoolSubjects Box ( NULL )
, mpSchoolBranch ValueLabel ( NULL )
, mpSchoolSubjects ValueLabel ( NULL )
, mpSchoolTypeItemLabel ( NULL )
, mpSchoolTypeItemLabel ( NULL )
, mpSchoolTypeBox ( NULL )
, mpSchoolTypeBox ( NULL )
, mpSchoolTypeValueLabel ( NULL )
, mpSchoolTypeValueLabel ( NULL )
@ -493,13 +616,15 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
, mpLicenceBox ( NULL )
, mpLicenceBox ( NULL )
, mpLicenceIcon ( NULL )
, mpLicenceIcon ( NULL )
, mpLicenceLayout ( NULL )
, mpLicenceLayout ( NULL )
, mpSceneItemSessionTitle ( NULL )
{
{
setObjectName ( name ) ;
setObjectName ( name ) ;
QString chapterStyle ( " QLabel {font-size:16px; font-weight:bold;} " ) ;
mpLayout = new QVBoxLayout ( this ) ;
mpLayout = new QVBoxLayout ( 0 ) ;
setLayout ( mpLayout ) ;
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPresentationP ageNumberLabel " ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPageNumberLabel " ) ;
mpPageNumberLabel - > setText ( tr ( " Page 0 " ) ) ;
mpPageNumberLabel - > setText ( tr ( " Page 0 " ) ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
@ -508,12 +633,12 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
mpModePushButton = new QPushButton ( this ) ;
mpModePushButton = new QPushButton ( this ) ;
mpModePushButton - > setIcon ( QIcon ( " :images/pencil.svg " ) ) ;
mpModePushButton - > setIcon ( QIcon ( " :images/pencil.svg " ) ) ;
mpModePushButton - > setMaximumWidth ( 32 ) ;
mpModePushButton - > setMaximumWidth ( 32 ) ;
mpModePushButton - > installEventFilter ( this ) ;
mpButtonTitleLayout - > addWidget ( mpModePushButton ) ;
mpButtonTitleLayout - > addWidget ( mpModePushButton ) ;
connect ( mpModePushButton , SIGNAL ( clicked ( ) ) , this , SLOT ( switchToMode ( ) ) ) ;
connect ( mpModePushButton , SIGNAL ( clicked ( ) ) , this , SLOT ( switchToMode ( ) ) ) ;
mpSessionTitle = new UBTGAdaptableText ( 0 , this ) ;
mpSessionTitle = new UBTGAdaptableText ( 0 , this , " UBTGSessionTitle " ) ;
mpSessionTitle - > setPlaceHolderText ( tr ( " Type session title here ... " ) ) ;
mpSessionTitle - > setPlaceHolderText ( tr ( " Type session title here ... " ) ) ;
mpSessionTitle - > setObjectName ( " UBTGEditionModeSessionTitle " ) ;
mpButtonTitleLayout - > addWidget ( mpSessionTitle ) ;
mpButtonTitleLayout - > addWidget ( mpSessionTitle ) ;
mpLayout - > addLayout ( mpButtonTitleLayout ) ;
mpLayout - > addLayout ( mpButtonTitleLayout ) ;
@ -526,6 +651,7 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
mpAuthorsLabel = new QLabel ( this ) ;
mpAuthorsLabel = new QLabel ( this ) ;
mpAuthorsLabel - > setObjectName ( " UBTGZeroPageEditionModeTitle " ) ;
mpAuthorsLabel - > setObjectName ( " UBTGZeroPageEditionModeTitle " ) ;
mpAuthorsLabel - > setText ( tr ( " Author(s) " ) ) ;
mpAuthorsLabel - > setText ( tr ( " Author(s) " ) ) ;
mpAuthorsLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpAuthorsLabel ) ;
mpLayout - > addWidget ( mpAuthorsLabel ) ;
mpAuthors = new UBTGAdaptableText ( 0 , this ) ;
mpAuthors = new UBTGAdaptableText ( 0 , this ) ;
@ -546,29 +672,32 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
mpSeparatorAuthors - > setObjectName ( " UBTGSeparator " ) ;
mpSeparatorAuthors - > setObjectName ( " UBTGSeparator " ) ;
mpLayout - > addWidget ( mpSeparatorAuthors ) ;
mpLayout - > addWidget ( mpSeparatorAuthors ) ;
mpGoalsLabel = new QLabel ( this ) ;
mpObjectivesLabel = new QLabel ( this ) ;
mpGoalsLabel - > setObjectName ( " UBTGZeroPageEditionModeTitle " ) ;
mpObjectivesLabel - > setObjectName ( " UBTGZeroPageEditionModeTitle " ) ;
mpGoalsLabel - > setText ( tr ( " Goal(s) " ) ) ;
mpObjectivesLabel - > setText ( tr ( " Objective(s) " ) ) ;
mpLayout - > addWidget ( mpGoalsLabel ) ;
mpObjectivesLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpObjectivesLabel ) ;
mpGoal s = new UBTGAdaptableText ( 0 , this ) ;
mpObjective s = new UBTGAdaptableText ( 0 , this ) ;
mpGoal s - > setObjectName ( " UBTGZeroPageInputText " ) ;
mpObjective s - > setObjectName ( " UBTGZeroPageInputText " ) ;
mpGoal s - > setPlaceHolderText ( tr ( " Type goal s here... " ) ) ;
mpObjective s - > setPlaceHolderText ( tr ( " Type objective s here... " ) ) ;
mpLayout - > addWidget ( mpGoal s ) ;
mpLayout - > addWidget ( mpObjective s ) ;
mpSeparatorGoal s = new QFrame ( this ) ;
mpSeparatorObjective s = new QFrame ( this ) ;
mpSeparatorGoal s - > setFixedHeight ( UBTG_SEPARATOR_FIXED_HEIGHT ) ;
mpSeparatorObjective s - > setFixedHeight ( UBTG_SEPARATOR_FIXED_HEIGHT ) ;
mpSeparatorGoal s - > setObjectName ( " UBTGSeparator " ) ;
mpSeparatorObjective s - > setObjectName ( " UBTGSeparator " ) ;
mpLayout - > addWidget ( mpSeparatorGoal s ) ;
mpLayout - > addWidget ( mpSeparatorObjective s ) ;
mpIndexLabel = new QLabel ( this ) ;
mpIndexLabel = new QLabel ( this ) ;
mpIndexLabel - > setObjectName ( " UBTGZeroPageEditionModeTitle " ) ;
mpIndexLabel - > setObjectName ( " UBTGZeroPageEditionModeTitle " ) ;
mpIndexLabel - > setText ( tr ( " Resource indexing " ) ) ;
mpIndexLabel - > setText ( tr ( " Resource indexing " ) ) ;
mpIndexLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpIndexLabel ) ;
mpLayout - > addWidget ( mpIndexLabel ) ;
mpKeywordsLabel = new QLabel ( this ) ;
mpKeywordsLabel = new QLabel ( this ) ;
mpKeywordsLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpKeywordsLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpKeywordsLabel - > setText ( tr ( " Keywords: " ) ) ;
mpKeywordsLabel - > setText ( tr ( " Keywords: " ) ) ;
mpKeywordsLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpKeywordsLabel ) ;
mpLayout - > addWidget ( mpKeywordsLabel ) ;
mpKeywords = new UBTGAdaptableText ( 0 , this ) ;
mpKeywords = new UBTGAdaptableText ( 0 , this ) ;
mpKeywords - > setPlaceHolderText ( tr ( " Type keywords here ... " ) ) ;
mpKeywords - > setPlaceHolderText ( tr ( " Type keywords here ... " ) ) ;
@ -577,29 +706,35 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
mpSchoolLevelItemLabel = new QLabel ( this ) ;
mpSchoolLevelItemLabel = new QLabel ( this ) ;
mpSchoolLevelItemLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpSchoolLevelItemLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpSchoolLevelItemLabel - > setText ( tr ( " Level: " ) ) ;
mpSchoolLevelItemLabel - > setText ( tr ( " Level: " ) ) ;
mpSchoolLevelItemLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpSchoolLevelItemLabel ) ;
mpLayout - > addWidget ( mpSchoolLevelItemLabel ) ;
mpSchoolLevelBox = new QComboBox ( this ) ;
mpSchoolLevelBox = new QComboBox ( this ) ;
mpSchoolLevelBox - > setMinimumHeight ( 22 ) ;
mpSchoolLevelBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpSchoolLevelBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
connect ( mpSchoolLevelBox , SIGNAL ( currentIndexChanged ( QString ) ) , this , SLOT ( onSchoolLevelChanged ( QString ) ) ) ;
connect ( mpSchoolLevelBox , SIGNAL ( currentIndexChanged ( QString ) ) , this , SLOT ( onSchoolLevelChanged ( QString ) ) ) ;
mpLayout - > addWidget ( mpSchoolLevelBox ) ;
mpLayout - > addWidget ( mpSchoolLevelBox ) ;
mpSchoolLevelValueLabel = new QLabel ( this ) ;
mpSchoolLevelValueLabel = new QLabel ( this ) ;
mpLayout - > addWidget ( mpSchoolLevelValueLabel ) ;
mpLayout - > addWidget ( mpSchoolLevelValueLabel ) ;
mpSchoolBranchItemLabel = new QLabel ( this ) ;
mpSchoolSubjectsItemLabel = new QLabel ( this ) ;
mpSchoolBranchItemLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpSchoolSubjectsItemLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpSchoolBranchItemLabel - > setText ( tr ( " Branch: " ) ) ;
mpSchoolSubjectsItemLabel - > setText ( tr ( " Subjects: " ) ) ;
mpLayout - > addWidget ( mpSchoolBranchItemLabel ) ;
mpSchoolSubjectsItemLabel - > setStyleSheet ( chapterStyle ) ;
mpSchoolBranchBox = new QComboBox ( this ) ;
mpLayout - > addWidget ( mpSchoolSubjectsItemLabel ) ;
mpSchoolBranchBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpSchoolSubjectsBox = new QComboBox ( this ) ;
mpLayout - > addWidget ( mpSchoolBranchBox ) ;
mpSchoolSubjectsBox - > setMinimumHeight ( 22 ) ;
mpSchoolBranchValueLabel = new QLabel ( this ) ;
mpSchoolSubjectsBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpLayout - > addWidget ( mpSchoolBranchValueLabel ) ;
mpLayout - > addWidget ( mpSchoolSubjectsBox ) ;
mpSchoolSubjectsValueLabel = new QLabel ( this ) ;
mpLayout - > addWidget ( mpSchoolSubjectsValueLabel ) ;
mpSchoolTypeItemLabel = new QLabel ( this ) ;
mpSchoolTypeItemLabel = new QLabel ( this ) ;
mpSchoolTypeItemLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpSchoolTypeItemLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpSchoolTypeItemLabel - > setText ( tr ( " Type: " ) ) ;
mpSchoolTypeItemLabel - > setText ( tr ( " Type: " ) ) ;
mpSchoolTypeItemLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpSchoolTypeItemLabel ) ;
mpLayout - > addWidget ( mpSchoolTypeItemLabel ) ;
mpSchoolTypeBox = new QComboBox ( this ) ;
mpSchoolTypeBox = new QComboBox ( this ) ;
mpSchoolTypeBox - > setMinimumHeight ( 22 ) ;
mpSchoolTypeBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpSchoolTypeBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpLayout - > addWidget ( mpSchoolTypeBox ) ;
mpLayout - > addWidget ( mpSchoolTypeBox ) ;
mpSchoolTypeValueLabel = new QLabel ( this ) ;
mpSchoolTypeValueLabel = new QLabel ( this ) ;
@ -612,9 +747,11 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
mpLicenceLabel = new QLabel ( this ) ;
mpLicenceLabel = new QLabel ( this ) ;
mpLicenceLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpLicenceLabel - > setObjectName ( " UBTGZeroPageItemLabel " ) ;
mpLicenceLabel - > setText ( tr ( " Licence: " ) ) ;
mpLicenceLabel - > setText ( tr ( " Licence " ) ) ;
mpLicenceLabel - > setStyleSheet ( chapterStyle ) ;
mpLayout - > addWidget ( mpLicenceLabel ) ;
mpLayout - > addWidget ( mpLicenceLabel ) ;
mpLicenceBox = new QComboBox ( this ) ;
mpLicenceBox = new QComboBox ( this ) ;
mpLicenceBox - > setMinimumHeight ( 22 ) ;
mpLicenceBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpLicenceBox - > setObjectName ( " DockPaletteWidgetComboBox " ) ;
mpLayout - > addWidget ( mpLicenceBox ) ;
mpLayout - > addWidget ( mpLicenceBox ) ;
mpLicenceLayout = new QHBoxLayout ( 0 ) ;
mpLicenceLayout = new QHBoxLayout ( 0 ) ;
@ -624,11 +761,13 @@ UBTeacherGuidePageZeroEditionWidget::UBTeacherGuidePageZeroEditionWidget(QWidget
mpLicenceLayout - > addWidget ( mpLicenceValueLabel ) ;
mpLicenceLayout - > addWidget ( mpLicenceValueLabel ) ;
mpLayout - > addLayout ( mpLicenceLayout ) ;
mpLayout - > addLayout ( mpLicenceLayout ) ;
mpLayout - > addStretch ( 1 ) ;
mpLayout - > addStretch ( 1 ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
fillComboBoxes ( ) ;
fillComboBoxes ( ) ;
}
}
UBTeacherGuidePageZeroEdition Widget : : ~ UBTeacherGuidePageZeroEdition Widget ( )
UBTeacherGuidePageZeroWidget : : ~ UBTeacherGuidePageZeroWidget ( )
{
{
DELETEPTR ( mpPageNumberLabel ) ;
DELETEPTR ( mpPageNumberLabel ) ;
DELETEPTR ( mpSessionTitle ) ;
DELETEPTR ( mpSessionTitle ) ;
@ -638,16 +777,16 @@ UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget()
DELETEPTR ( mpSeparatorAuthors ) ;
DELETEPTR ( mpSeparatorAuthors ) ;
DELETEPTR ( mpCreationLabel ) ;
DELETEPTR ( mpCreationLabel ) ;
DELETEPTR ( mpLastModifiedLabel ) ;
DELETEPTR ( mpLastModifiedLabel ) ;
DELETEPTR ( mpGoal sLabel ) ;
DELETEPTR ( mpObjective sLabel ) ;
DELETEPTR ( mpGoal s ) ;
DELETEPTR ( mpObjective s ) ;
DELETEPTR ( mpSeparatorGoal s ) ;
DELETEPTR ( mpSeparatorObjective s ) ;
DELETEPTR ( mpIndexLabel ) ;
DELETEPTR ( mpIndexLabel ) ;
DELETEPTR ( mpKeywordsLabel ) ;
DELETEPTR ( mpKeywordsLabel ) ;
DELETEPTR ( mpKeywords ) ;
DELETEPTR ( mpKeywords ) ;
DELETEPTR ( mpSchoolLevelItemLabel ) ;
DELETEPTR ( mpSchoolLevelItemLabel ) ;
DELETEPTR ( mpSchoolLevelBox ) ;
DELETEPTR ( mpSchoolLevelBox ) ;
DELETEPTR ( mpSchoolBranch ItemLabel ) ;
DELETEPTR ( mpSchoolSubjects ItemLabel ) ;
DELETEPTR ( mpSchoolBranch Box ) ;
DELETEPTR ( mpSchoolSubjects Box ) ;
DELETEPTR ( mpSchoolTypeItemLabel ) ;
DELETEPTR ( mpSchoolTypeItemLabel ) ;
DELETEPTR ( mpSchoolTypeBox ) ;
DELETEPTR ( mpSchoolTypeBox ) ;
DELETEPTR ( mpSeparatorIndex ) ;
DELETEPTR ( mpSeparatorIndex ) ;
@ -661,7 +800,15 @@ UBTeacherGuidePageZeroEditionWidget::~UBTeacherGuidePageZeroEditionWidget()
DELETEPTR ( mpLayout ) ;
DELETEPTR ( mpLayout ) ;
}
}
void UBTeacherGuidePageZeroEditionWidget : : fillComboBoxes ( )
bool UBTeacherGuidePageZeroWidget : : eventFilter ( QObject * object , QEvent * event )
{
Q_UNUSED ( object ) ;
if ( event - > type ( ) = = QEvent : : HoverEnter | | event - > type ( ) = = QEvent : : HoverMove | | event - > type ( ) = = QEvent : : HoverLeave )
return true ;
return false ;
}
void UBTeacherGuidePageZeroWidget : : fillComboBoxes ( )
{
{
QString parametersConfigFilePath = UBSettings : : settings ( ) - > applicationCustomizationDirectory ( ) + " /teacherGuide/indexingParameters.xml " ;
QString parametersConfigFilePath = UBSettings : : settings ( ) - > applicationCustomizationDirectory ( ) + " /teacherGuide/indexingParameters.xml " ;
QFile parametersFile ( parametersConfigFilePath ) ;
QFile parametersFile ( parametersConfigFilePath ) ;
@ -702,49 +849,111 @@ void UBTeacherGuidePageZeroEditionWidget::fillComboBoxes()
QStringList licences ;
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 " ) ;
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 ) ;
mpLicenceBox - > addItems ( licences ) ;
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 " ;
for ( int i = 0 ; i < licenceIconList . count ( ) ; i + = 1 )
mpLicenceBox - > setItemData ( i , licenceIconList . at ( i ) ) ;
}
}
void UBTeacherGuidePageZeroEditionWidget : : onSchoolLevelChanged ( QString schoolLevel )
void UBTeacherGuidePageZeroWidget : : onSchoolLevelChanged ( QString schoolLevel )
{
{
QStringList subjects = mSubjects . value ( mGradeLevelsMap . value ( schoolLevel ) ) ;
QStringList subjects = mSubjects . value ( mGradeLevelsMap . value ( schoolLevel ) ) ;
mpSchoolBranch Box - > clear ( ) ;
mpSchoolSubjects Box - > clear ( ) ;
if ( subjects . count ( ) ) {
if ( subjects . count ( ) ) {
mpSchoolBranch ItemLabel - > setEnabled ( true ) ;
mpSchoolSubjects ItemLabel - > setEnabled ( true ) ;
mpSchoolBranch Box - > setEnabled ( true ) ;
mpSchoolSubjects Box - > setEnabled ( true ) ;
mpSchoolBranch Box - > addItems ( subjects ) ;
mpSchoolSubjects Box - > addItems ( subjects ) ;
}
}
else {
else {
mpSchoolBranch ItemLabel - > setDisabled ( true ) ;
mpSchoolSubjects ItemLabel - > setDisabled ( true ) ;
mpSchoolBranch Box - > setDisabled ( true ) ;
mpSchoolSubjects Box - > setDisabled ( true ) ;
}
}
}
}
void UBTeacherGuidePageZeroEditionWidget : : onActiveSceneChanged ( )
void UBTeacherGuidePageZeroWidget : : onActiveSceneChanged ( )
{
UBDocumentProxy * documentProxy = UBApplication : : boardController - > activeDocument ( ) ;
if ( documentProxy & & UBApplication : : boardController - > currentPage ( ) = = 0 ) {
QDateTime creationDate = documentProxy - > documentDate ( ) ;
mpCreationLabel - > setText ( tr ( " Created the: \n " ) + creationDate . toString ( Qt : : DefaultLocaleShortDate ) ) ;
QDateTime updatedDate = documentProxy - > lastUpdate ( ) ;
mpLastModifiedLabel - > setText ( tr ( " Updated the: \n " ) + updatedDate . toString ( Qt : : DefaultLocaleShortDate ) ) ;
loadData ( ) ;
updateSceneTitle ( ) ;
}
}
void UBTeacherGuidePageZeroWidget : : hideEvent ( QHideEvent * event )
{
persistData ( ) ;
QWidget : : hideEvent ( event ) ;
}
void UBTeacherGuidePageZeroWidget : : loadData ( )
{
{
UBDocumentProxy * documentProxy = UBApplication : : documentController ? UBApplication : : documentController - > getCurrentDocument ( ) : 0 ;
UBDocumentProxy * documentProxy = UBApplication : : boardController - > activeDocument ( ) ;
if ( UBApplication : : documentController & & UBApplication : : boardController - > activeSceneIndex ( ) = = 0 ) {
mpSessionTitle - > setText ( documentProxy - > metaData ( UBSettings : : sessionTitle ) . toString ( ) ) ;
// QDateTime creationDate = documentProxy->documentDate();
mpAuthors - > setText ( documentProxy - > metaData ( UBSettings : : sessionAuthors ) . toString ( ) ) ;
// mpCreationLabel->setText(tr("Created the:") + creationDate.toString(Qt::SystemLocaleShortDate));
mpObjectives - > setText ( documentProxy - > metaData ( UBSettings : : sessionObjectives ) . toString ( ) ) ;
// QDateTime updatedDate = documentProxy->lastUpdate();
mpKeywords - > setText ( documentProxy - > metaData ( UBSettings : : sessionKeywords ) . toString ( ) ) ;
// mpLastModifiedLabel->setText(tr("Updated the:") + updatedDate.toString(Qt::SystemLocaleShortDate));
int currentIndex = mpSchoolLevelBox - > findText ( documentProxy - > metaData ( UBSettings : : sessionGradeLevel ) . toString ( ) ) ;
mpSchoolLevelBox - > setCurrentIndex ( ( currentIndex ! = - 1 ) ? currentIndex : 0 ) ;
currentIndex = mpSchoolSubjectsBox - > findText ( documentProxy - > metaData ( UBSettings : : sessionSubjects ) . toString ( ) ) ;
mpSchoolSubjectsBox - > setCurrentIndex ( ( currentIndex ! = - 1 ) ? currentIndex : 0 ) ;
currentIndex = mpSchoolTypeBox - > findText ( documentProxy - > metaData ( UBSettings : : sessionType ) . toString ( ) ) ;
mpSchoolTypeBox - > setCurrentIndex ( ( currentIndex ! = - 1 ) ? currentIndex : 0 ) ;
currentIndex = mpLicenceBox - > findText ( documentProxy - > metaData ( UBSettings : : sessionLicence ) . toString ( ) ) ;
mpLicenceBox - > setCurrentIndex ( ( currentIndex ! = - 1 ) ? currentIndex : 0 ) ;
}
void UBTeacherGuidePageZeroWidget : : persistData ( )
{
// check necessary because at document closing hide event is send after boardcontroller set
// to NULL
if ( UBApplication : : boardController ) {
UBDocumentProxy * documentProxy = UBApplication : : boardController - > activeDocument ( ) ;
documentProxy - > setMetaData ( UBSettings : : sessionTitle , mpSessionTitle - > text ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionAuthors , mpAuthors - > text ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionObjectives , mpObjectives - > text ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionKeywords , mpKeywords - > text ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionGradeLevel , mpSchoolLevelBox - > currentText ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionSubjects , mpSchoolSubjectsBox - > currentText ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionType , mpSchoolTypeBox - > currentText ( ) ) ;
documentProxy - > setMetaData ( UBSettings : : sessionLicence , mpLicenceBox - > currentText ( ) ) ;
}
}
}
}
void UBTeacherGuidePageZeroWidget : : updateSceneTitle ( )
{
QString sessionTitle = mpSessionTitle - > text ( ) ;
if ( ! sessionTitle . isEmpty ( ) )
UBApplication : : boardController - > activeScene ( ) - > textForObjectName ( mpSessionTitle - > text ( ) ) ;
}
void UBTeacherGuidePageZeroEditionWidget : : switchToMode ( tUBTGZeroPageMode mode )
void UBTeacherGuidePageZeroWidget : : switchToMode ( tUBTGZeroPageMode mode )
{
{
if ( mode = = tUBTGZeroPageMode_EDITION ) {
if ( mode = = tUBTGZeroPageMode_EDITION ) {
QString inputStyleSheet ( " QTextEdit { background: white; border-radius: 10px; border: 2px;} " ) ;
mpModePushButton - > hide ( ) ;
mpModePushButton - > hide ( ) ;
mpSessionTitle - > setReadOnly ( false ) ;
mpSessionTitle - > setReadOnly ( false ) ;
mpSessionTitle - > setStyleSheet ( inputStyleSheet ) ;
QFont titleFont ( QApplication : : font ( ) . family ( ) , 11 , - 1 ) ;
mpSessionTitle - > document ( ) - > setDefaultFont ( titleFont ) ;
mpAuthors - > setReadOnly ( false ) ;
mpAuthors - > setReadOnly ( false ) ;
mpGoals - > setReadOnly ( false ) ;
mpAuthors - > setStyleSheet ( inputStyleSheet ) ;
mpObjectives - > setReadOnly ( false ) ;
mpObjectives - > setStyleSheet ( inputStyleSheet ) ;
mpKeywords - > setReadOnly ( false ) ;
mpKeywords - > setReadOnly ( false ) ;
mpKeywords - > setStyleSheet ( inputStyleSheet ) ;
mpSchoolLevelValueLabel - > hide ( ) ;
mpSchoolLevelValueLabel - > hide ( ) ;
mpSchoolLevelBox - > show ( ) ;
mpSchoolLevelBox - > show ( ) ;
mpSchoolBranchValueLabel - > hide ( ) ;
mpSchoolSubjects ValueLabel - > hide ( ) ;
mpSchoolBranchBox - > show ( ) ;
mpSchoolSubjects Box - > show ( ) ;
mpSchoolTypeValueLabel - > hide ( ) ;
mpSchoolTypeValueLabel - > hide ( ) ;
mpSchoolTypeBox - > show ( ) ;
mpSchoolTypeBox - > show ( ) ;
mpLicenceIcon - > hide ( ) ;
mpLicenceIcon - > hide ( ) ;
@ -752,84 +961,94 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode)
mpLicenceBox - > show ( ) ;
mpLicenceBox - > show ( ) ;
}
}
else {
else {
QString inputStyleSheet ( " QTextEdit { background: transparent; border: none;} " ) ;
mpModePushButton - > show ( ) ;
mpModePushButton - > show ( ) ;
mpSessionTitle - > setReadOnly ( true ) ;
mpSessionTitle - > showText ( mpSessionTitle - > text ( ) ) ;
mpAuthors - > setReadOnly ( true ) ;
mpSessionTitle - > setStyleSheet ( inputStyleSheet ) ;
mpGoals - > setReadOnly ( true ) ;
updateSceneTitle ( ) ;
mpKeywords - > setReadOnly ( true ) ;
QFont titleFont ( QApplication : : font ( ) . family ( ) , 14 , 1 ) ;
mpSessionTitle - > document ( ) - > setDefaultFont ( titleFont ) ;
mpAuthors - > setStyleSheet ( inputStyleSheet ) ;
mpAuthors - > setTextColor ( QColor ( Qt : : black ) ) ;
mpAuthors - > showText ( mpAuthors - > text ( ) ) ;
mpObjectives - > setStyleSheet ( inputStyleSheet ) ;
mpObjectives - > setTextColor ( QColor ( Qt : : black ) ) ;
mpObjectives - > showText ( mpObjectives - > text ( ) ) ;
mpKeywords - > setStyleSheet ( inputStyleSheet ) ;
mpKeywords - > setTextColor ( QColor ( Qt : : black ) ) ;
mpKeywords - > showText ( mpKeywords - > text ( ) ) ;
mpSchoolLevelValueLabel - > setText ( mpSchoolLevelBox - > currentText ( ) ) ;
mpSchoolLevelValueLabel - > setText ( mpSchoolLevelBox - > currentText ( ) ) ;
mpSchoolLevelValueLabel - > show ( ) ;
mpSchoolLevelValueLabel - > show ( ) ;
mpSchoolLevelBox - > hide ( ) ;
mpSchoolLevelBox - > hide ( ) ;
mpSchoolBranchValueLabel - > setText ( mpSchoolBranchBox - > currentText ( ) ) ;
mpSchoolSubjects ValueLabel - > setText ( mpSchoolSubjects Box - > currentText ( ) ) ;
mpSchoolBranchValueLabel - > show ( ) ;
mpSchoolSubjects ValueLabel - > show ( ) ;
mpSchoolBranchBox - > hide ( ) ;
mpSchoolSubjects Box - > hide ( ) ;
mpSchoolTypeValueLabel - > setText ( mpSchoolTypeBox - > currentText ( ) ) ;
mpSchoolTypeValueLabel - > setText ( mpSchoolTypeBox - > currentText ( ) ) ;
mpSchoolTypeValueLabel - > show ( ) ;
mpSchoolTypeValueLabel - > show ( ) ;
mpSchoolTypeBox - > hide ( ) ;
mpSchoolTypeBox - > hide ( ) ;
mpLicenceValueLabel - > setText ( mpLicenceBox - > currentText ( ) ) ;
mpLicenceValueLabel - > setText ( mpLicenceBox - > currentText ( ) ) ;
QStringList licenceIconList ;
QString licenceIconPath = mpLicenceBox - > itemData ( mpLicenceBox - > currentIndex ( ) ) . toString ( ) ;
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 ( ! licenceIconPath . isEmpty ( ) ) {
int licenceBoxCurrentIndex = mpLicenceBox - > currentIndex ( ) ;
mpLicenceIcon - > setPixmap ( QPixmap ( licenceIconPath ) ) ;
// -1 is return if there is no values on the box
if ( licenceBoxCurrentIndex > 0 & & licenceBoxCurrentIndex < licenceIconList . count ( ) ) {
mpLicenceIcon - > setPixmap ( licenceIconList . at ( licenceBoxCurrentIndex ) ) ;
mpLicenceIcon - > show ( ) ;
mpLicenceIcon - > show ( ) ;
}
}
mpLicenceValueLabel - > show ( ) ;
mpLicenceValueLabel - > show ( ) ;
mpLicenceBox - > hide ( ) ;
mpLicenceBox - > hide ( ) ;
persistData ( ) ;
}
}
update ( ) ;
}
}
QVector < tUBGEElementNode * > UBTeacherGuidePageZeroEdition Widget : : getData ( )
QVector < tUBGEElementNode * > UBTeacherGuidePageZeroWidget : : getData ( )
{
{
QVector < tUBGEElementNode * > result ;
QVector < tUBGEElementNode * > result ;
tUBGEElementNode * elementNode = new tUBGEElementNode ( ) ;
tUBGEElementNode * elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " sessionTitle " ;
elementNode - > nam e = " sessionTitle " ;
elementNode - > attributes . insert ( " value " , mpSessionTitle - > text ( ) ) ;
elementNode - > attributes . insert ( " value " , mpSessionTitle - > text ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " authors " ;
elementNode - > nam e = " authors " ;
elementNode - > attributes . insert ( " value " , mpAuthors - > text ( ) ) ;
elementNode - > attributes . insert ( " value " , mpAuthors - > text ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " creationDate " ;
elementNode - > nam e = " creationDate " ;
elementNode - > attributes . insert ( " value " , mpCreationLabel - > text ( ) ) ;
elementNode - > attributes . insert ( " value " , mpCreationLabel - > text ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " lastModifiedDate " ;
elementNode - > nam e = " lastModifiedDate " ;
elementNode - > attributes . insert ( " value " , mpLastModifiedLabel - > text ( ) ) ;
elementNode - > attributes . insert ( " value " , mpLastModifiedLabel - > text ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " goals " ;
elementNode - > nam e = " goals " ;
elementNode - > attributes . insert ( " value " , mpGoal s - > text ( ) ) ;
elementNode - > attributes . insert ( " value " , mpObjective s - > text ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " keywords " ;
elementNode - > nam e = " keywords " ;
elementNode - > attributes . insert ( " value " , mpKeywords - > text ( ) ) ;
elementNode - > attributes . insert ( " value " , mpKeywords - > text ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " schoolLevel " ;
elementNode - > nam e = " schoolLevel " ;
elementNode - > attributes . insert ( " value " , mpSchoolLevelBox - > currentText ( ) ) ;
elementNode - > attributes . insert ( " value " , mpSchoolLevelBox - > currentText ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " schoolBranch " ;
elementNode - > nam e = " schoolBranch " ;
elementNode - > attributes . insert ( " value " , mpSchoolBranch Box - > currentText ( ) ) ;
elementNode - > attributes . insert ( " value " , mpSchoolSubjects Box - > currentText ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " schoolType " ;
elementNode - > nam e = " schoolType " ;
elementNode - > attributes . insert ( " value " , mpSchoolTypeBox - > currentText ( ) ) ;
elementNode - > attributes . insert ( " value " , mpSchoolTypeBox - > currentText ( ) ) ;
result < < elementNode ;
result < < elementNode ;
elementNode = new tUBGEElementNode ( ) ;
elementNode = new tUBGEElementNode ( ) ;
elementNode - > typ e = " licence " ;
elementNode - > nam e = " licence " ;
elementNode - > attributes . insert ( " value " , mpLicenceBox - > currentText ( ) ) ;
elementNode - > attributes . insert ( " value " , mpLicenceBox - > currentText ( ) ) ;
result < < elementNode ;
result < < elementNode ;
return result ;
return result ;
@ -839,46 +1058,59 @@ QVector<tUBGEElementNode*> UBTeacherGuidePageZeroEditionWidget::getData()
* class UBTeacherGuideWidget *
* class UBTeacherGuideWidget *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
UBTeacherGuideWidget : : UBTeacherGuideWidget ( QWidget * parent , const char * name ) : QStackedWidget ( parent )
UBTeacherGuideWidget : : UBTeacherGuideWidget ( QWidget * parent , const char * name ) : QStackedWidget ( parent )
, mpPageZeroEditon Widget ( NULL )
, mpPageZeroWidget ( NULL )
, mpEditionWidget ( NULL )
, mpEditionWidget ( NULL )
, mpPresentationWidget ( NULL )
, mpPresentationWidget ( NULL )
{
{
setObjectName ( name ) ;
setObjectName ( name ) ;
if ( UBSettings : : settings ( ) - > teacherGuidePageZeroActivated - > get ( ) . toBool ( ) ) {
mpPageZeroEditon Widget = new UBTeacherGuidePageZeroEdition Widget ( this ) ;
mpPageZeroWidget = new UBTeacherGuidePageZeroWidget ( this ) ;
addWidget ( mpPageZeroEditon Widget ) ;
addWidget ( mpPageZeroWidget ) ;
setCurrentWidget ( mpPageZeroEditonWidget ) ;
}
// mpEditionWidget = new UBTeacherGuideEditionWidget(this);
if ( UBSettings : : settings ( ) - > teacherGuideLessonPagesActivated - > get ( ) . toBool ( ) ) {
// addWidget(mpEditionWidget);
mpEditionWidget = new UBTeacherGuideEditionWidget ( this ) ;
// mpPresentationWidget = new UBTeacherGuidePresentationWidget(this);
addWidget ( mpEditionWidget ) ;
// addWidget(mpPresentationWidget);
mpPresentationWidget = new UBTeacherGuidePresentationWidget ( this ) ;
// setCurrentWidget(mpPresentationWidget);
addWidget ( mpPresentationWidget ) ;
}
connect ( UBApplication : : boardController - > controlView ( ) , SIGNAL ( clickOnBoard ( ) ) , this , SLOT ( showPresentationMode ( ) ) ) ;
connect ( UBApplication : : boardController - > controlView ( ) , SIGNAL ( clickOnBoard ( ) ) , this , SLOT ( showPresentationMode ( ) ) ) ;
connectToStylusPalette ( ) ;
connectToStylusPalette ( ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
}
}
UBTeacherGuideWidget : : ~ UBTeacherGuideWidget ( )
UBTeacherGuideWidget : : ~ UBTeacherGuideWidget ( )
{
{
DELETEPTR ( mpPageZeroWidget ) ;
DELETEPTR ( mpEditionWidget ) ;
DELETEPTR ( mpEditionWidget ) ;
DELETEPTR ( mpPresentationWidget ) ;
DELETEPTR ( mpPresentationWidget ) ;
}
}
void UBTeacherGuideWidget : : onActiveSceneChanged ( )
{
if ( UBApplication : : boardController - > currentPage ( ) = = 0 ) {
setCurrentWidget ( mpPageZeroWidget ) ;
mpPageZeroWidget - > switchToMode ( tUBTGZeroPageMode_EDITION ) ;
} else
setCurrentWidget ( mpEditionWidget ) ;
}
void UBTeacherGuideWidget : : connectToStylusPalette ( )
void UBTeacherGuideWidget : : connectToStylusPalette ( )
{
{
if ( UBApplication : : boardController - > paletteManager ( ) )
if ( UBApplication : : boardController - > paletteManager ( ) )
connect ( UBApplication : : boardController - > paletteManager ( ) - > stylusPalette ( ) , SIGNAL ( itemOnActionPaletteChanged ( ) ) , this , SLOT ( showPresentationMode ( ) ) ) ;
connect ( UBApplication : : boardController - > paletteManager ( ) - > stylusPalette ( ) , SIGNAL ( itemOnActionPaletteChanged ( ) ) , this , SLOT ( showPresentationMode ( ) ) ) ;
else
else
QTimer : : singleShot ( 500 , this , SLOT ( connectToStylusPalette ( ) ) ) ;
QTimer : : singleShot ( 1 00, this , SLOT ( connectToStylusPalette ( ) ) ) ;
}
}
void UBTeacherGuideWidget : : showPresentationMode ( )
void UBTeacherGuideWidget : : showPresentationMode ( )
{
{
if ( currentWidget ( ) = = mpPageZeroEditonWidget ) {
if ( currentWidget ( ) = = mpPageZeroWidget ) {
mCurrentData = mpPageZeroEditon Widget - > getData ( ) ;
mCurrentData = mpPageZeroWidget - > getData ( ) ;
mpPageZeroEditon Widget - > switchToMode ( tUBTGZeroPageMode_PRESENTATION ) ;
mpPageZeroWidget - > switchToMode ( tUBTGZeroPageMode_PRESENTATION ) ;
}
}
else if ( currentWidget ( ) = = mpEditionWidget ) {
else if ( currentWidget ( ) = = mpEditionWidget ) {
mCurrentData = mpEditionWidget - > getData ( ) ;
mCurrentData = mpEditionWidget - > getData ( ) ;