|
|
@ -35,13 +35,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "web/UBWebController.h" |
|
|
|
#include "web/UBWebController.h" |
|
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
#define UBTG_SEPARATOR_FIXED_HEIGHT 3 |
|
|
|
{ |
|
|
|
|
|
|
|
eUBTGAddSubItemWidgetType_None, |
|
|
|
|
|
|
|
eUBTGAddSubItemWidgetType_Action , |
|
|
|
|
|
|
|
eUBTGAddSubItemWidgetType_Media, |
|
|
|
|
|
|
|
eUBTGAddSubItemWidgetType_Url |
|
|
|
|
|
|
|
}eUBTGAddSubItemWidgetType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
/***************************************************************************
|
|
|
@ -52,33 +46,52 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const |
|
|
|
QWidget(parent) |
|
|
|
QWidget(parent) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpDocumentTitle(NULL) |
|
|
|
, mpDocumentTitle(NULL) |
|
|
|
|
|
|
|
, mpPageNumberLabel(NULL) |
|
|
|
, mpPageTitle(NULL) |
|
|
|
, mpPageTitle(NULL) |
|
|
|
, mpComment(NULL) |
|
|
|
, mpComment(NULL) |
|
|
|
|
|
|
|
, mpSeparator(NULL) |
|
|
|
, mpTreeWidget(NULL) |
|
|
|
, mpTreeWidget(NULL) |
|
|
|
, mpRootWidgetItem(NULL) |
|
|
|
, mpRootWidgetItem(NULL) |
|
|
|
, 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->setAlignment(Qt::AlignRight); |
|
|
|
|
|
|
|
mpPageNumberLabel->setObjectName("UBTGEditionPageNumberLabel"); |
|
|
|
|
|
|
|
mpLayout->addWidget(mpPageNumberLabel); |
|
|
|
// tree basic configuration
|
|
|
|
// tree basic configuration
|
|
|
|
mpDocumentTitle = new QLabel(this); |
|
|
|
mpDocumentTitle = new QLabel(this); |
|
|
|
mpDocumentTitle->setText("title document"); |
|
|
|
mpDocumentTitle->setText("Document title"); |
|
|
|
mpDocumentTitle->setStyleSheet( "QWidget {background-color: white}"); |
|
|
|
mpDocumentTitle->setObjectName("UBTGEditionDocumentTitle"); |
|
|
|
mpLayout->addWidget(mpDocumentTitle); |
|
|
|
mpLayout->addWidget(mpDocumentTitle); |
|
|
|
|
|
|
|
|
|
|
|
mpPageTitle = new UBTGAdaptableText(0,this); |
|
|
|
mpPageTitle = new UBTGAdaptableText(0,this); |
|
|
|
|
|
|
|
mpPageTitle->setObjectName("UBTGEditionPageTitle"); |
|
|
|
|
|
|
|
mpPageTitle->setPlaceHolderText(tr("Type title here ...")); |
|
|
|
mpLayout->addWidget(mpPageTitle); |
|
|
|
mpLayout->addWidget(mpPageTitle); |
|
|
|
|
|
|
|
|
|
|
|
mpComment = new UBTGAdaptableText(0,this); |
|
|
|
mpComment = new UBTGAdaptableText(0,this); |
|
|
|
|
|
|
|
mpComment->setObjectName("UBTGEditionComment"); |
|
|
|
|
|
|
|
mpComment->setPlaceHolderText(tr("Type comment here ...")); |
|
|
|
mpLayout->addWidget(mpComment); |
|
|
|
mpLayout->addWidget(mpComment); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpSeparator = new QFrame(this); |
|
|
|
|
|
|
|
mpSeparator->setObjectName("UBTGEditionSeparator"); |
|
|
|
|
|
|
|
mpSeparator->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); |
|
|
|
|
|
|
|
mpLayout->addWidget(mpSeparator); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
@ -88,9 +101,10 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const |
|
|
|
mpTreeWidget->header()->setStretchLastSection(false); |
|
|
|
mpTreeWidget->header()->setStretchLastSection(false); |
|
|
|
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(32); |
|
|
|
mpTreeWidget->header()->setDefaultSectionSize(18); |
|
|
|
|
|
|
|
|
|
|
|
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())); |
|
|
|
|
|
|
|
|
|
|
|
mpAddAnActionItem = new UBAddItem(tr("Add an action"),eUBTGAddSubItemWidgetType_Action,mpTreeWidget); |
|
|
|
mpAddAnActionItem = new UBAddItem(tr("Add an action"),eUBTGAddSubItemWidgetType_Action,mpTreeWidget); |
|
|
|
mpAddAMediaItem = new UBAddItem(tr("Add a media"),eUBTGAddSubItemWidgetType_Media,mpTreeWidget); |
|
|
|
mpAddAMediaItem = new UBAddItem(tr("Add a media"),eUBTGAddSubItemWidgetType_Media,mpTreeWidget); |
|
|
@ -104,15 +118,31 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const |
|
|
|
UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget() |
|
|
|
UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
DELETEPTR(mpDocumentTitle); |
|
|
|
DELETEPTR(mpDocumentTitle); |
|
|
|
|
|
|
|
DELETEPTR(mpPageNumberLabel); |
|
|
|
DELETEPTR(mpPageTitle); |
|
|
|
DELETEPTR(mpPageTitle); |
|
|
|
DELETEPTR(mpComment); |
|
|
|
DELETEPTR(mpComment); |
|
|
|
|
|
|
|
DELETEPTR(mpSeparator); |
|
|
|
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) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mpPageTitle->setFocus(); |
|
|
|
|
|
|
|
mpComment->setFocus(); |
|
|
|
|
|
|
|
setFocus(); |
|
|
|
|
|
|
|
QWidget::showEvent(event); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuideEditionWidget::onActiveSceneChanged() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
cleanData(); |
|
|
|
|
|
|
|
mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->activeSceneIndex() + 1)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuideEditionWidget::cleanData() |
|
|
|
void UBTeacherGuideEditionWidget::cleanData() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -141,12 +171,12 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getPageAndCommentData() |
|
|
|
QVector<tUBGEElementNode*>result; |
|
|
|
QVector<tUBGEElementNode*>result; |
|
|
|
tUBGEElementNode* pageTitle = new tUBGEElementNode(); |
|
|
|
tUBGEElementNode* pageTitle = new tUBGEElementNode(); |
|
|
|
pageTitle->type = "pageTitle"; |
|
|
|
pageTitle->type = "pageTitle"; |
|
|
|
pageTitle->attributes.insert("value",mpPageTitle->toPlainText()); |
|
|
|
pageTitle->attributes.insert("value",mpPageTitle->text()); |
|
|
|
result << pageTitle; |
|
|
|
result << pageTitle; |
|
|
|
|
|
|
|
|
|
|
|
tUBGEElementNode* comment = new tUBGEElementNode(); |
|
|
|
tUBGEElementNode* comment = new tUBGEElementNode(); |
|
|
|
comment->type = "comment"; |
|
|
|
comment->type = "comment"; |
|
|
|
comment->attributes.insert("value",mpComment->toPlainText()); |
|
|
|
comment->attributes.insert("value",mpComment->text()); |
|
|
|
result << comment; |
|
|
|
result << comment; |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
@ -229,36 +259,58 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare |
|
|
|
, mpComment(NULL) |
|
|
|
, mpComment(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpLayout(NULL) |
|
|
|
, mpButtonTitleLayout(NULL) |
|
|
|
, mpButtonTitleLayout(NULL) |
|
|
|
, mpDocumentTile(NULL) |
|
|
|
, mpDocumentTitle(NULL) |
|
|
|
|
|
|
|
, mpPageNumberLabel(NULL) |
|
|
|
|
|
|
|
, mpSeparator(NULL) |
|
|
|
, mpModePushButton(NULL) |
|
|
|
, mpModePushButton(NULL) |
|
|
|
, mpTreeWidget(NULL) |
|
|
|
, mpTreeWidget(NULL) |
|
|
|
, mpRootWidgetItem(NULL) |
|
|
|
, mpRootWidgetItem(NULL) |
|
|
|
, mpMediaSwitchItem(NULL) |
|
|
|
, mpMediaSwitchItem(NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
|
|
mpLayout = new QVBoxLayout(this); |
|
|
|
mpLayout = new QVBoxLayout(this); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpPageNumberLabel = new QLabel(this); |
|
|
|
|
|
|
|
mpPageNumberLabel->setAlignment(Qt::AlignRight); |
|
|
|
|
|
|
|
mpPageNumberLabel->setObjectName("UBTGPresentationPageNumberLabel"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addWidget(mpPageNumberLabel); |
|
|
|
|
|
|
|
|
|
|
|
mpButtonTitleLayout = new QHBoxLayout(0); |
|
|
|
mpButtonTitleLayout = new QHBoxLayout(0); |
|
|
|
|
|
|
|
|
|
|
|
mpModePushButton = new QPushButton(this); |
|
|
|
mpModePushButton = new QPushButton(this); |
|
|
|
mpModePushButton->setIcon(QIcon(":images/pencil.svg")); |
|
|
|
mpModePushButton->setIcon(QIcon(":images/pencil.svg")); |
|
|
|
|
|
|
|
mpModePushButton->setMaximumWidth(32); |
|
|
|
|
|
|
|
|
|
|
|
connect(mpModePushButton,SIGNAL(clicked()),parentWidget(),SLOT(changeMode())); |
|
|
|
connect(mpModePushButton,SIGNAL(clicked()),parentWidget(),SLOT(changeMode())); |
|
|
|
|
|
|
|
|
|
|
|
mpDocumentTile = new QLabel(this); |
|
|
|
mpDocumentTitle = new QLabel(this); |
|
|
|
mpDocumentTile->setText("Document title"); |
|
|
|
mpDocumentTitle->setObjectName("UBTGPresentationDocumentTitle"); |
|
|
|
|
|
|
|
mpDocumentTitle->setText("Document title"); |
|
|
|
|
|
|
|
|
|
|
|
mpButtonTitleLayout->addWidget(mpModePushButton); |
|
|
|
mpButtonTitleLayout->addWidget(mpModePushButton); |
|
|
|
mpButtonTitleLayout->addWidget(mpDocumentTile); |
|
|
|
mpButtonTitleLayout->addWidget(mpDocumentTitle); |
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addLayout(mpButtonTitleLayout); |
|
|
|
mpLayout->addLayout(mpButtonTitleLayout); |
|
|
|
|
|
|
|
|
|
|
|
mpPageTitle = new UBTGAdaptableText(0,this); |
|
|
|
mpPageTitle = new UBTGAdaptableText(0,this); |
|
|
|
|
|
|
|
mpPageTitle->setObjectName("UBTGPresentationPageTitle"); |
|
|
|
mpPageTitle->setReadOnly(true); |
|
|
|
mpPageTitle->setReadOnly(true); |
|
|
|
|
|
|
|
mpPageTitle->setStyleSheet("background-color:transparent"); |
|
|
|
mpLayout->addWidget(mpPageTitle); |
|
|
|
mpLayout->addWidget(mpPageTitle); |
|
|
|
|
|
|
|
|
|
|
|
mpComment = new UBTGAdaptableText(0,this); |
|
|
|
mpComment = new UBTGAdaptableText(0,this); |
|
|
|
|
|
|
|
mpComment->setObjectName("UBTGPresentationComment"); |
|
|
|
mpComment->setReadOnly(true); |
|
|
|
mpComment->setReadOnly(true); |
|
|
|
|
|
|
|
mpComment->setStyleSheet("background-color:transparent"); |
|
|
|
mpLayout->addWidget(mpComment); |
|
|
|
mpLayout->addWidget(mpComment); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mpSeparator = new QFrame(this); |
|
|
|
|
|
|
|
mpSeparator->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); |
|
|
|
|
|
|
|
mpSeparator->setObjectName("UBTGPresentationSepartor"); |
|
|
|
|
|
|
|
mpLayout->addWidget(mpSeparator); |
|
|
|
|
|
|
|
|
|
|
|
mpTreeWidget = new QTreeWidget(this); |
|
|
|
mpTreeWidget = new QTreeWidget(this); |
|
|
|
mpLayout->addWidget(mpTreeWidget); |
|
|
|
mpLayout->addWidget(mpTreeWidget); |
|
|
|
|
|
|
|
|
|
|
@ -268,31 +320,55 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare |
|
|
|
mpTreeWidget->setDropIndicatorShown(false); |
|
|
|
mpTreeWidget->setDropIndicatorShown(false); |
|
|
|
mpTreeWidget->header()->close(); |
|
|
|
mpTreeWidget->header()->close(); |
|
|
|
mpTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
|
|
mpTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
|
|
// mpTreeWidget->setColumnCount(1);
|
|
|
|
|
|
|
|
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())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() |
|
|
|
UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
DELETEPTR(mpComment); |
|
|
|
DELETEPTR(mpComment); |
|
|
|
DELETEPTR(mpPageTitle); |
|
|
|
DELETEPTR(mpPageTitle); |
|
|
|
|
|
|
|
DELETEPTR(mpPageNumberLabel); |
|
|
|
|
|
|
|
DELETEPTR(mpSeparator); |
|
|
|
DELETEPTR(mpMediaSwitchItem); |
|
|
|
DELETEPTR(mpMediaSwitchItem); |
|
|
|
DELETEPTR(mpModePushButton); |
|
|
|
DELETEPTR(mpModePushButton); |
|
|
|
DELETEPTR(mpDocumentTile); |
|
|
|
DELETEPTR(mpDocumentTitle); |
|
|
|
DELETEPTR(mpButtonTitleLayout); |
|
|
|
DELETEPTR(mpButtonTitleLayout); |
|
|
|
DELETEPTR(mpTreeWidget); |
|
|
|
DELETEPTR(mpTreeWidget); |
|
|
|
DELETEPTR(mpLayout); |
|
|
|
DELETEPTR(mpLayout); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuidePresentationWidget::cleanData() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mpPageTitle->showText(""); |
|
|
|
|
|
|
|
mpComment->showText(""); |
|
|
|
|
|
|
|
//tree clean
|
|
|
|
|
|
|
|
QList<QTreeWidgetItem*> itemToRemove = mpRootWidgetItem->takeChildren(); |
|
|
|
|
|
|
|
foreach(QTreeWidgetItem* eachItem, itemToRemove){ |
|
|
|
|
|
|
|
DELETEPTR(eachItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// the mpMediaSwitchItem is deleted by the previous loop but the pointer is not set to zero
|
|
|
|
|
|
|
|
mpMediaSwitchItem = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuidePresentationWidget::onActiveSceneChanged() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
cleanData(); |
|
|
|
|
|
|
|
mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->activeSceneIndex() + 1)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuidePresentationWidget::createMediaButtonItem() |
|
|
|
void UBTeacherGuidePresentationWidget::createMediaButtonItem() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!mpMediaSwitchItem){ |
|
|
|
if(!mpMediaSwitchItem){ |
|
|
|
//create the media button
|
|
|
|
//create the media button
|
|
|
|
mpMediaSwitchItem = new QTreeWidgetItem(mpRootWidgetItem); |
|
|
|
mpMediaSwitchItem = new QTreeWidgetItem(mpRootWidgetItem); |
|
|
|
mpMediaSwitchItem->setIcon(0,QIcon(":images/plus.svg")); |
|
|
|
//mpMediaSwitchItem->setIcon(0,QIcon(":images/plus.svg"));
|
|
|
|
|
|
|
|
mpMediaSwitchItem->setText(0,"+"); |
|
|
|
mpMediaSwitchItem->setExpanded(false); |
|
|
|
mpMediaSwitchItem->setExpanded(false); |
|
|
|
mpMediaSwitchItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_EXPAND); |
|
|
|
mpMediaSwitchItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_EXPAND); |
|
|
|
|
|
|
|
mpMediaSwitchItem->setData(0,Qt::BackgroundRole,QVariant(QColor(200,200,200))); |
|
|
|
|
|
|
|
mpMediaSwitchItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),16))); |
|
|
|
|
|
|
|
mpMediaSwitchItem->setData(0,Qt::TextAlignmentRole,QVariant(Qt::AlignCenter)); |
|
|
|
mpRootWidgetItem->addChild(mpMediaSwitchItem); |
|
|
|
mpRootWidgetItem->addChild(mpMediaSwitchItem); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -300,13 +376,7 @@ void UBTeacherGuidePresentationWidget::createMediaButtonItem() |
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data) |
|
|
|
void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//tree clean
|
|
|
|
cleanData(); |
|
|
|
QList<QTreeWidgetItem*> itemToRemove = mpRootWidgetItem->takeChildren(); |
|
|
|
|
|
|
|
foreach(QTreeWidgetItem* eachItem, itemToRemove){ |
|
|
|
|
|
|
|
DELETEPTR(eachItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// the mpMediaSwitchItem is deleted by the previous loop but the pointer is not set to zero
|
|
|
|
|
|
|
|
mpMediaSwitchItem = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(tUBGEElementNode* element, data){ |
|
|
|
foreach(tUBGEElementNode* element, data){ |
|
|
|
if(element->type == "pageTitle") |
|
|
|
if(element->type == "pageTitle") |
|
|
@ -316,20 +386,23 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data) |
|
|
|
else if(element->type == "action"){ |
|
|
|
else if(element->type == "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")); |
|
|
|
QColor color = element->attributes.value("owner").toInt()?QColor().red():QColor().green(); |
|
|
|
QColor color = element->attributes.value("owner").toInt() == 0 ? QColor(Qt::red):QColor(Qt::green); |
|
|
|
newWidgetItem->setTextColor(0,color); |
|
|
|
newWidgetItem->setData(0,Qt::ForegroundRole,QBrush(color)); |
|
|
|
newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_NONE); |
|
|
|
newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_NONE); |
|
|
|
|
|
|
|
newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11))); |
|
|
|
mpRootWidgetItem->addChild(newWidgetItem); |
|
|
|
mpRootWidgetItem->addChild(newWidgetItem); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(element->type == "media"){ |
|
|
|
else if(element->type == "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->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))); |
|
|
|
mpRootWidgetItem->addChild(newWidgetItem); |
|
|
|
mpRootWidgetItem->addChild(newWidgetItem); |
|
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* mediaItem = new QTreeWidgetItem(newWidgetItem); |
|
|
|
QTreeWidgetItem* mediaItem = new QTreeWidgetItem(newWidgetItem); |
|
|
|
mediaItem->setText(0,element->attributes.value("title")); |
|
|
|
//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); |
|
|
@ -338,13 +411,14 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data) |
|
|
|
else if(element->type == "link"){ |
|
|
|
else if(element->type == "link"){ |
|
|
|
createMediaButtonItem(); |
|
|
|
createMediaButtonItem(); |
|
|
|
QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpMediaSwitchItem); |
|
|
|
QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpMediaSwitchItem); |
|
|
|
|
|
|
|
newWidgetItem->setIcon(0,QIcon(":images/teacherGuide/link.png")); |
|
|
|
newWidgetItem->setText(0,element->attributes.value("title")); |
|
|
|
newWidgetItem->setText(0,element->attributes.value("title")); |
|
|
|
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))); |
|
|
|
mpRootWidgetItem->addChild(newWidgetItem); |
|
|
|
mpRootWidgetItem->addChild(newWidgetItem); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget, int column) |
|
|
|
void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget, int column) |
|
|
@ -355,6 +429,10 @@ void UBTeacherGuidePresentationWidget::onAddItemClicked(QTreeWidgetItem* widget, |
|
|
|
{ |
|
|
|
{ |
|
|
|
case tUBTGActionAssociateOnClickItem_EXPAND: |
|
|
|
case tUBTGActionAssociateOnClickItem_EXPAND: |
|
|
|
widget->setExpanded(!widget->isExpanded()); |
|
|
|
widget->setExpanded(!widget->isExpanded()); |
|
|
|
|
|
|
|
if(widget->isExpanded()) |
|
|
|
|
|
|
|
mpMediaSwitchItem->setText(0,"-"); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
mpMediaSwitchItem->setText(0,"+"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case tUBTGActionAssociateOnClickItem_URL: |
|
|
|
case tUBTGActionAssociateOnClickItem_URL: |
|
|
|
widget->data(column,tUBTGTreeWidgetItemRole_HasAnUrl).toString(); |
|
|
|
widget->data(column,tUBTGTreeWidgetItemRole_HasAnUrl).toString(); |
|
|
@ -377,12 +455,13 @@ UBTeacherGuideWidget::UBTeacherGuideWidget(QWidget *parent, const char *name): Q |
|
|
|
, mpPresentationWidget(NULL) |
|
|
|
, mpPresentationWidget(NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setObjectName(name); |
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
|
|
mpEditionWidget = new UBTeacherGuideEditionWidget(this); |
|
|
|
mpEditionWidget = new UBTeacherGuideEditionWidget(this); |
|
|
|
addWidget(mpEditionWidget); |
|
|
|
addWidget(mpEditionWidget); |
|
|
|
mpPresentationWidget = new UBTeacherGuidePresentationWidget(this); |
|
|
|
mpPresentationWidget = new UBTeacherGuidePresentationWidget(this); |
|
|
|
addWidget(mpPresentationWidget); |
|
|
|
addWidget(mpPresentationWidget); |
|
|
|
|
|
|
|
|
|
|
|
setCurrentWidget(mpEditionWidget); |
|
|
|
setCurrentWidget(mpPresentationWidget); |
|
|
|
connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode())); |
|
|
|
connect(UBApplication::boardController->controlView(),SIGNAL(clickOnBoard()),this,SLOT(showPresentationMode())); |
|
|
|
connectToStylusPalette(); |
|
|
|
connectToStylusPalette(); |
|
|
|
} |
|
|
|
} |
|
|
@ -405,8 +484,8 @@ void UBTeacherGuideWidget::connectToStylusPalette() |
|
|
|
void UBTeacherGuideWidget::showPresentationMode() |
|
|
|
void UBTeacherGuideWidget::showPresentationMode() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(currentWidget()!=mpPresentationWidget){ |
|
|
|
if(currentWidget()!=mpPresentationWidget){ |
|
|
|
currentData = mpEditionWidget->getData(); |
|
|
|
mCurrentData = mpEditionWidget->getData(); |
|
|
|
mpPresentationWidget->showData(currentData); |
|
|
|
mpPresentationWidget->showData(mCurrentData); |
|
|
|
setCurrentWidget(mpPresentationWidget); |
|
|
|
setCurrentWidget(mpPresentationWidget); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|