@ -49,16 +49,13 @@
# define UBTG_SEPARATOR_FIXED_HEIGHT 3
# define UBTG_SEPARATOR_FIXED_HEIGHT 3
typedef enum
typedef enum {
{
eUBTGAddSubItemWidgetType_None ,
eUBTGAddSubItemWidgetType_None ,
eUBTGAddSubItemWidgetType_Action ,
eUBTGAddSubItemWidgetType_Action ,
eUBTGAddSubItemWidgetType_Media ,
eUBTGAddSubItemWidgetType_Media ,
eUBTGAddSubItemWidgetType_Url
eUBTGAddSubItemWidgetType_Url
} eUBTGAddSubItemWidgetType ;
} eUBTGAddSubItemWidgetType ;
/***************************************************************************
/***************************************************************************
* class UBTeacherGuideEditionWidget *
* class UBTeacherGuideEditionWidget *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@ -108,6 +105,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpLayout - > addWidget ( mpSeparator ) ;
mpLayout - > addWidget ( mpSeparator ) ;
mpTreeWidget = new QTreeWidget ( this ) ;
mpTreeWidget = new QTreeWidget ( this ) ;
mpTreeWidget - > setStyleSheet ( " selection-background-color:transparent; padding-bottom:5px; padding-top:5px; " ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
@ -121,6 +119,7 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpTreeWidget - > header ( ) - > setResizeMode ( 0 , QHeaderView : : Stretch ) ;
mpTreeWidget - > header ( ) - > setResizeMode ( 0 , QHeaderView : : Stretch ) ;
mpTreeWidget - > header ( ) - > setResizeMode ( 1 , QHeaderView : : Fixed ) ;
mpTreeWidget - > header ( ) - > setResizeMode ( 1 , QHeaderView : : Fixed ) ;
mpTreeWidget - > header ( ) - > setDefaultSectionSize ( 18 ) ;
mpTreeWidget - > header ( ) - > setDefaultSectionSize ( 18 ) ;
mpTreeWidget - > setSelectionMode ( QAbstractItemView : : NoSelection ) ;
connect ( mpTreeWidget , SIGNAL ( itemClicked ( QTreeWidgetItem * , int ) ) , this , SLOT ( onAddItemClicked ( QTreeWidgetItem * , int ) ) ) ;
connect ( mpTreeWidget , SIGNAL ( itemClicked ( QTreeWidgetItem * , int ) ) , this , SLOT ( onAddItemClicked ( QTreeWidgetItem * , int ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
@ -135,7 +134,6 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
if ( UBSettings : : settings ( ) - > teacherGuideLessonPagesActivated - > get ( ) . toBool ( ) ) {
if ( UBSettings : : settings ( ) - > teacherGuideLessonPagesActivated - > get ( ) . toBool ( ) ) {
UBSvgSubsetAdaptor : : addElementToBeStored ( QString ( " teacherGuide " ) , this ) ;
UBSvgSubsetAdaptor : : addElementToBeStored ( QString ( " teacherGuide " ) , this ) ;
//connect(UBApplication::boardController,SIGNAL(activeDocumentChanged()),this,SLOT(onActiveDocumentChanged()));
connect ( UBApplication : : boardController , SIGNAL ( documentSet ( UBDocumentProxy * ) ) , this , SLOT ( onActiveDocumentChanged ( ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( documentSet ( UBDocumentProxy * ) ) , this , SLOT ( onActiveDocumentChanged ( ) ) ) ;
}
}
}
}
@ -150,7 +148,7 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget()
DELETEPTR ( mpAddAnActionItem ) ;
DELETEPTR ( mpAddAnActionItem ) ;
DELETEPTR ( mpAddAMediaItem ) ;
DELETEPTR ( mpAddAMediaItem ) ;
DELETEPTR ( mpAddALinkItem ) ;
DELETEPTR ( mpAddALinkItem ) ;
DELETEPTR ( mpTreeWidget )
DELETEPTR ( mpTreeWidget ) ;
DELETEPTR ( mpLayout ) ;
DELETEPTR ( mpLayout ) ;
}
}
@ -173,7 +171,8 @@ void UBTeacherGuideEditionWidget::load(QString element)
QDomDocument doc ( " TeacherGuide " ) ;
QDomDocument doc ( " TeacherGuide " ) ;
doc . setContent ( element ) ;
doc . setContent ( element ) ;
for ( QDomElement element = doc . documentElement ( ) . firstChildElement ( ) ; ! element . isNull ( ) ; element = element . nextSiblingElement ( ) ) {
for ( QDomElement element = doc . documentElement ( ) . firstChildElement ( ) ;
! element . isNull ( ) ; element = element . nextSiblingElement ( ) ) {
QString tagName = element . tagName ( ) ;
QString tagName = element . tagName ( ) ;
if ( tagName = = " title " )
if ( tagName = = " title " )
mpPageTitle - > setInitialText ( element . attribute ( " value " ) ) ;
mpPageTitle - > setInitialText ( element . attribute ( " value " ) ) ;
@ -188,8 +187,6 @@ void UBTeacherGuideEditionWidget::load(QString element)
}
}
}
}
QVector < tIDataStorage * > UBTeacherGuideEditionWidget : : save ( int pageIndex )
QVector < tIDataStorage * > UBTeacherGuideEditionWidget : : save ( int pageIndex )
{
{
QVector < tIDataStorage * > result ;
QVector < tIDataStorage * > result ;
@ -198,16 +195,15 @@ QVector<tIDataStorage*> UBTeacherGuideEditionWidget::save(int pageIndex)
tIDataStorage * data = new tIDataStorage ( ) ;
tIDataStorage * data = new tIDataStorage ( ) ;
data - > name = " teacherGuide " ;
data - > name = " teacherGuide " ;
data - > type = eElementType_START ;
data - > type = eElementType_START ;
data - > attributes . insert ( " version " , " 1.5 0" ) ;
data - > attributes . insert ( " version " , " 2.0 0" ) ;
result < < data ;
result < < data ;
data = new tIDataStorage ( ) ;
data = new tIDataStorage ( ) ;
data - > name = " title " ;
data - > name = " title " ;
data - > type = eElementType_UNIQUE ;
data - > type = eElementType_UNIQUE ;
data - > attributes . insert ( " value " , mpPageTitle - > text ( ) ) ;
data - > attributes . insert ( " value " , mpPageTitle - > text ( ) ) ;
if ( mpPageTitle - > text ( ) . length ( ) ) {
if ( mpPageTitle - > text ( ) . length ( ) )
result < < data ;
result < < data ;
}
data = new tIDataStorage ( ) ;
data = new tIDataStorage ( ) ;
data - > name = " comment " ;
data - > name = " comment " ;
@ -312,23 +308,25 @@ void UBTeacherGuideEditionWidget::onAddItemClicked(QTreeWidgetItem* widget, int
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 : {
UBTGActionWidget * actionWidget = new UBTGActionWidget ( widget ) ;
UBTGActionWidget * actionWidget = new UBTGActionWidget ( widget ) ;
if ( element ) actionWidget - > initializeWithDom ( * element ) ;
if ( element )
actionWidget - > initializeWithDom ( * element ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , actionWidget ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , actionWidget ) ;
break ;
break ;
}
}
case eUBTGAddSubItemWidgetType_Media : {
case eUBTGAddSubItemWidgetType_Media : {
UBTGMediaWidget * mediaWidget = new UBTGMediaWidget ( widget ) ;
UBTGMediaWidget * mediaWidget = new UBTGMediaWidget ( widget ) ;
if ( element ) mediaWidget - > initializeWithDom ( * element ) ;
if ( element )
mediaWidget - > initializeWithDom ( * element ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , mediaWidget ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , mediaWidget ) ;
break ;
break ;
}
}
case eUBTGAddSubItemWidgetType_Url : {
case eUBTGAddSubItemWidgetType_Url : {
UBTGUrlWidget * urlWidget = new UBTGUrlWidget ( ) ;
UBTGUrlWidget * urlWidget = new UBTGUrlWidget ( ) ;
if ( element ) urlWidget - > initializeWithDom ( * element ) ;
if ( element )
urlWidget - > initializeWithDom ( * element ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , urlWidget ) ;
mpTreeWidget - > setItemWidget ( newWidgetItem , 0 , urlWidget ) ;
break ;
break ;
}
}
@ -348,32 +346,42 @@ 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 ) ) ;
UBTGMediaWidget * media = dynamic_cast < UBTGMediaWidget * > ( mpTreeWidget - > itemWidget ( widget , 0 ) ) ;
if ( media ) media - > removeSource ( ) ;
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 ;
}
}
}
}
bool UBTeacherGuideEditionWidget : : isModified ( )
{
bool result = false ;
result | = mpPageTitle - > text ( ) . length ( ) > 0 ;
result | = mpComment - > text ( ) . length ( ) > 0 ;
result | = mpAddAnActionItem - > childCount ( ) > 0 ;
result | = mpAddAMediaItem - > childCount ( ) > 0 ;
result | = mpAddALinkItem - > childCount ( ) > 0 ;
return result ;
}
/***************************************************************************
/***************************************************************************
* class UBTeacherGuidePresentationWidget *
* class UBTeacherGuidePresentationWidget *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
typedef enum
typedef enum {
{
tUBTGActionAssociateOnClickItem_NONE ,
tUBTGActionAssociateOnClickItem_NONE ,
tUBTGActionAssociateOnClickItem_URL ,
tUBTGActionAssociateOnClickItem_URL ,
tUBTGActionAssociateOnClickItem_MEDIA ,
tUBTGActionAssociateOnClickItem_MEDIA ,
tUBTGActionAssociateOnClickItem_EXPAND
tUBTGActionAssociateOnClickItem_EXPAND
} tUBTGActionAssociateOnClickItem ;
} tUBTGActionAssociateOnClickItem ;
typedef enum
typedef enum {
{
tUBTGTreeWidgetItemRole_HasAnAction = Qt : : UserRole ,
tUBTGTreeWidgetItemRole_HasAnAction = Qt : : UserRole ,
tUBTGTreeWidgetItemRole_HasAnUrl
tUBTGTreeWidgetItemRole_HasAnUrl
} tUBTGTreeWidgetItemRole ;
} tUBTGTreeWidgetItemRole ;
UBTeacherGuidePresentationWidget : : UBTeacherGuidePresentationWidget ( QWidget * parent , const char * name ) :
UBTeacherGuidePresentationWidget : : UBTeacherGuidePresentationWidget ( QWidget * parent , const char * name ) : QWidget ( parent )
QWidget ( parent )
, mpPageTitle ( NULL )
, mpPageTitle ( NULL )
, mpComment ( NULL )
, mpComment ( NULL )
, mpLayout ( NULL )
, mpLayout ( NULL )
@ -435,12 +443,14 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare
mpLayout - > addWidget ( mpTreeWidget ) ;
mpLayout - > addWidget ( mpTreeWidget ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
mpRootWidgetItem = mpTreeWidget - > invisibleRootItem ( ) ;
mpTreeWidget - > setSelectionMode ( QAbstractItemView : : NoSelection ) ;
mpTreeWidget - > setDragEnabled ( true ) ;
mpTreeWidget - > setDragEnabled ( true ) ;
mpTreeWidget - > setRootIsDecorated ( false ) ;
mpTreeWidget - > setRootIsDecorated ( false ) ;
mpTreeWidget - > setIndentation ( 0 ) ;
mpTreeWidget - > setIndentation ( 0 ) ;
mpTreeWidget - > setDropIndicatorShown ( false ) ;
mpTreeWidget - > setDropIndicatorShown ( false ) ;
mpTreeWidget - > header ( ) - > close ( ) ;
mpTreeWidget - > header ( ) - > close ( ) ;
mpTreeWidget - > setHorizontalScrollBarPolicy ( Qt : : ScrollBarAlwaysOff ) ;
mpTreeWidget - > setHorizontalScrollBarPolicy ( Qt : : ScrollBarAlwaysOff ) ;
mpTreeWidget - > setStyleSheet ( " selection-background-color:transparent; padding-bottom:5px; padding-top:5px; " ) ;
connect ( mpTreeWidget , SIGNAL ( itemClicked ( QTreeWidgetItem * , int ) ) , this , SLOT ( onAddItemClicked ( QTreeWidgetItem * , int ) ) ) ;
connect ( mpTreeWidget , SIGNAL ( itemClicked ( QTreeWidgetItem * , int ) ) , this , SLOT ( onAddItemClicked ( QTreeWidgetItem * , int ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this , SLOT ( onActiveSceneChanged ( ) ) ) ;
}
}
@ -503,7 +513,6 @@ void UBTeacherGuidePresentationWidget::createMediaButtonItem()
}
}
}
}
void UBTeacherGuidePresentationWidget : : showData ( QVector < tUBGEElementNode * > data )
void UBTeacherGuidePresentationWidget : : showData ( QVector < tUBGEElementNode * > data )
{
{
cleanData ( ) ;
cleanData ( ) ;
@ -566,10 +575,10 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
void UBTeacherGuidePresentationWidget : : onAddItemClicked ( QTreeWidgetItem * widget , int column )
void UBTeacherGuidePresentationWidget : : onAddItemClicked ( QTreeWidgetItem * widget , int column )
{
{
int associateAction = widget - > data ( column , tUBTGTreeWidgetItemRole_HasAnAction ) . toInt ( ) ;
int associateAction = widget - > data ( column ,
tUBTGTreeWidgetItemRole_HasAnAction ) . toInt ( ) ;
if ( column = = 0 & & associateAction ! = tUBTGActionAssociateOnClickItem_NONE ) {
if ( column = = 0 & & associateAction ! = tUBTGActionAssociateOnClickItem_NONE ) {
switch ( associateAction )
switch ( associateAction ) {
{
case tUBTGActionAssociateOnClickItem_EXPAND :
case tUBTGActionAssociateOnClickItem_EXPAND :
widget - > setExpanded ( ! widget - > isExpanded ( ) ) ;
widget - > setExpanded ( ! widget - > isExpanded ( ) ) ;
if ( widget - > isExpanded ( ) )
if ( widget - > isExpanded ( ) )
@ -590,11 +599,11 @@ void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget,
}
}
}
}
/***************************************************************************
/***************************************************************************
* class UBTeacherGuidePageZeroEdition Widget *
* class UBTeacherGuidePageZeroWidget *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
UBTeacherGuidePageZeroWidget : : UBTeacherGuidePageZeroWidget ( 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 )
@ -635,7 +644,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel = new QLabel ( this ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setAlignment ( Qt : : AlignRight ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPageNumberLabel " ) ;
mpPageNumberLabel - > setObjectName ( " UBTGPageNumberLabel " ) ;
mpPageNumberLabel - > setText ( tr ( " Page 0 " ) ) ;
mpPageNumberLabel - > setText ( tr ( " Title page " ) ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
mpLayout - > addWidget ( mpPageNumberLabel ) ;
mpButtonTitleLayout = new QHBoxLayout ( 0 ) ;
mpButtonTitleLayout = new QHBoxLayout ( 0 ) ;
@ -772,7 +781,6 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons
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 ( ) ;
}
}
@ -850,7 +858,6 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes()
mpSchoolLevelBox - > addItem ( gradeLevels . at ( i ) . toElement ( ) . attribute ( " label " ) ) ;
mpSchoolLevelBox - > addItem ( gradeLevels . at ( i ) . toElement ( ) . attribute ( " label " ) ) ;
}
}
QDomNodeList types = rootElement . elementsByTagName ( " types " ) . at ( 0 ) . childNodes ( ) ;
QDomNodeList types = rootElement . elementsByTagName ( " types " ) . at ( 0 ) . childNodes ( ) ;
for ( int i = 0 ; i < types . count ( ) ; i + = 1 )
for ( int i = 0 ; i < types . count ( ) ; i + = 1 )
mpSchoolTypeBox - > addItem ( types . at ( i ) . toElement ( ) . attribute ( " label " ) ) ;
mpSchoolTypeBox - > addItem ( types . at ( i ) . toElement ( ) . attribute ( " label " ) ) ;
@ -858,10 +865,18 @@ void UBTeacherGuidePageZeroWidget::fillComboBoxes()
parametersFile . close ( ) ;
parametersFile . close ( ) ;
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 ;
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 " ;
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 )
for ( int i = 0 ; i < licenceIconList . count ( ) ; i + = 1 )
mpLicenceBox - > setItemData ( i , licenceIconList . at ( i ) ) ;
mpLicenceBox - > setItemData ( i , licenceIconList . at ( i ) ) ;
}
}
@ -874,8 +889,7 @@ void UBTeacherGuidePageZeroWidget::onSchoolLevelChanged(QString schoolLevel)
mpSchoolSubjectsItemLabel - > setEnabled ( true ) ;
mpSchoolSubjectsItemLabel - > setEnabled ( true ) ;
mpSchoolSubjectsBox - > setEnabled ( true ) ;
mpSchoolSubjectsBox - > setEnabled ( true ) ;
mpSchoolSubjectsBox - > addItems ( subjects ) ;
mpSchoolSubjectsBox - > addItems ( subjects ) ;
}
} else {
else {
mpSchoolSubjectsItemLabel - > setDisabled ( true ) ;
mpSchoolSubjectsItemLabel - > setDisabled ( true ) ;
mpSchoolSubjectsBox - > setDisabled ( true ) ;
mpSchoolSubjectsBox - > setDisabled ( true ) ;
}
}
@ -1064,10 +1078,25 @@ QVector<tUBGEElementNode*> UBTeacherGuidePageZeroWidget::getData()
return result ;
return result ;
}
}
bool UBTeacherGuidePageZeroWidget : : isModified ( )
{
bool result = false ;
result | = mpSessionTitle - > text ( ) . length ( ) > 0 ;
result | = mpAuthors - > text ( ) . length ( ) > 0 ;
result | = mpObjectives - > text ( ) . length ( ) > 0 ;
result | = mpKeywords - > text ( ) . length ( ) > 0 ;
result | = mpSchoolLevelBox - > currentIndex ( ) > 0 ;
result | = mpSchoolSubjectsBox - > currentIndex ( ) > 0 ;
result | = mpSchoolTypeBox - > currentIndex ( ) > 0 ;
result | = mpLicenceBox - > currentIndex ( ) > 0 ;
return result ;
}
/***************************************************************************
/***************************************************************************
* class UBTeacherGuideWidget *
* class UBTeacherGuideWidget *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
UBTeacherGuideWidget : : UBTeacherGuideWidget ( QWidget * parent , const char * name ) : QStackedWidget ( parent )
UBTeacherGuideWidget : : UBTeacherGuideWidget ( QWidget * parent , const char * name ) :
QStackedWidget ( parent )
, mpPageZeroWidget ( NULL )
, mpPageZeroWidget ( NULL )
, mpEditionWidget ( NULL )
, mpEditionWidget ( NULL )
, mpPresentationWidget ( NULL )
, mpPresentationWidget ( NULL )
@ -1084,12 +1113,13 @@ UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget* parent, const char* name): Q
addWidget ( 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 ( ) ) ) ;
connect ( UBApplication : : boardController , SIGNAL ( activeSceneChanged ( ) ) , this ,
SLOT ( onActiveSceneChanged ( ) ) ) ;
}
}
UBTeacherGuideWidget : : ~ UBTeacherGuideWidget ( )
UBTeacherGuideWidget : : ~ UBTeacherGuideWidget ( )
{
{
DELETEPTR ( mpPageZeroWidget ) ;
DELETEPTR ( mpPageZeroWidget ) ;
@ -1097,13 +1127,13 @@ UBTeacherGuideWidget::~UBTeacherGuideWidget()
DELETEPTR ( mpPresentationWidget ) ;
DELETEPTR ( mpPresentationWidget ) ;
}
}
void UBTeacherGuideWidget : : onActiveSceneChanged ( )
void UBTeacherGuideWidget : : onActiveSceneChanged ( )
{
{
if ( UBApplication : : boardController - > currentPage ( ) = = 0 ) {
if ( UBApplication : : boardController - > currentPage ( ) = = 0 ) {
setCurrentWidget ( mpPageZeroWidget ) ;
setCurrentWidget ( mpPageZeroWidget ) ;
mpPageZeroWidget - > switchToMode ( tUBTGZeroPageMode_EDITION ) ;
mpPageZeroWidget - > switchToMode ( tUBTGZeroPageMode_EDITION ) ;
} else
}
else
setCurrentWidget ( mpEditionWidget ) ;
setCurrentWidget ( mpEditionWidget ) ;
}
}
@ -1137,3 +1167,11 @@ void UBTeacherGuideWidget::changeMode()
setCurrentWidget ( mpEditionWidget ) ;
setCurrentWidget ( mpEditionWidget ) ;
}
}
bool UBTeacherGuideWidget : : isModified ( )
{
if ( currentWidget ( ) = = mpPageZeroWidget )
return mpPageZeroWidget - > isModified ( ) ;
else
return mpEditionWidget - > isModified ( ) ;
}