|
|
@ -29,7 +29,7 @@ UBTBPageEditWidget::UBTBPageEditWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *p |
|
|
|
mUrls.clear(); |
|
|
|
mUrls.clear(); |
|
|
|
setAttribute(Qt::WA_StyledBackground, true); |
|
|
|
setAttribute(Qt::WA_StyledBackground, true); |
|
|
|
setStyleSheet(UBApplication::globalStyleSheet()); |
|
|
|
setStyleSheet(UBApplication::globalStyleSheet()); |
|
|
|
|
|
|
|
mClearingFields = false; |
|
|
|
mLayout.setContentsMargins(0, 0, 0, 0); |
|
|
|
mLayout.setContentsMargins(0, 0, 0, 0); |
|
|
|
setLayout(&mLayout); |
|
|
|
setLayout(&mLayout); |
|
|
|
|
|
|
|
|
|
|
@ -120,14 +120,18 @@ UBTBPageEditWidget::~UBTBPageEditWidget() |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::onTitleChanged() |
|
|
|
void UBTBPageEditWidget::onTitleChanged() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!mClearingFields){ |
|
|
|
mpDataMgr->setPageTitle(mpTitle->text()); |
|
|
|
mpDataMgr->setPageTitle(mpTitle->text()); |
|
|
|
emit valueChanged(); |
|
|
|
emit valueChanged(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::onCommentsChanged() |
|
|
|
void UBTBPageEditWidget::onCommentsChanged() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!mClearingFields){ |
|
|
|
mpDataMgr->setComments(mpComments->document()->toPlainText()); |
|
|
|
mpDataMgr->setComments(mpComments->document()->toPlainText()); |
|
|
|
emit valueChanged(); |
|
|
|
emit valueChanged(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::onActionButton() |
|
|
|
void UBTBPageEditWidget::onActionButton() |
|
|
@ -135,6 +139,7 @@ void UBTBPageEditWidget::onActionButton() |
|
|
|
UBTeacherStudentAction* pAction = new UBTeacherStudentAction(this); |
|
|
|
UBTeacherStudentAction* pAction = new UBTeacherStudentAction(this); |
|
|
|
mActions << pAction; |
|
|
|
mActions << pAction; |
|
|
|
mpActions->addWidget(pAction); |
|
|
|
mpActions->addWidget(pAction); |
|
|
|
|
|
|
|
emit valueChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::onLinkButton() |
|
|
|
void UBTBPageEditWidget::onLinkButton() |
|
|
@ -142,6 +147,7 @@ void UBTBPageEditWidget::onLinkButton() |
|
|
|
UBUrlWidget* pUrl = new UBUrlWidget(this); |
|
|
|
UBUrlWidget* pUrl = new UBUrlWidget(this); |
|
|
|
mUrls << pUrl; |
|
|
|
mUrls << pUrl; |
|
|
|
mpLinks->addWidget(pUrl); |
|
|
|
mpLinks->addWidget(pUrl); |
|
|
|
|
|
|
|
emit valueChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::onMediaDropped(const QString &url) |
|
|
|
void UBTBPageEditWidget::onMediaDropped(const QString &url) |
|
|
@ -149,9 +155,12 @@ void UBTBPageEditWidget::onMediaDropped(const QString &url) |
|
|
|
if("" != url){ |
|
|
|
if("" != url){ |
|
|
|
QWidget* pMedia = mpMediaContainer->generateMediaWidget(url); |
|
|
|
QWidget* pMedia = mpMediaContainer->generateMediaWidget(url); |
|
|
|
if(NULL != pMedia){ |
|
|
|
if(NULL != pMedia){ |
|
|
|
mpDataMgr->medias()->append(pMedia); |
|
|
|
mMedias << pMedia; |
|
|
|
mpDataMgr->addMediaUrl(url); |
|
|
|
mMediaUrls << url; |
|
|
|
|
|
|
|
//mpDataMgr->medias()->append(pMedia);
|
|
|
|
|
|
|
|
//mpDataMgr->addMediaUrl(url);
|
|
|
|
mpMediaContainer->addWidget(pMedia); |
|
|
|
mpMediaContainer->addWidget(pMedia); |
|
|
|
|
|
|
|
emit valueChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -170,6 +179,8 @@ void UBTBPageEditWidget::saveFields() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mpDataMgr->actions()->clear(); |
|
|
|
mpDataMgr->actions()->clear(); |
|
|
|
mpDataMgr->urls()->clear(); |
|
|
|
mpDataMgr->urls()->clear(); |
|
|
|
|
|
|
|
mpDataMgr->mediaUrls().clear(); |
|
|
|
|
|
|
|
mpDataMgr->medias()->clear(); |
|
|
|
|
|
|
|
|
|
|
|
foreach(UBTeacherStudentAction* pAct, mActions){ |
|
|
|
foreach(UBTeacherStudentAction* pAct, mActions){ |
|
|
|
sAction action; |
|
|
|
sAction action; |
|
|
@ -183,6 +194,12 @@ void UBTBPageEditWidget::saveFields() |
|
|
|
link.link = pUrl->url(); |
|
|
|
link.link = pUrl->url(); |
|
|
|
mpDataMgr->urls()->append(link); |
|
|
|
mpDataMgr->urls()->append(link); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach(QString url, mMediaUrls){ |
|
|
|
|
|
|
|
mpDataMgr->mediaUrls().append(url); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach(QWidget* pMedia, mMedias){ |
|
|
|
|
|
|
|
mpDataMgr->medias()->append(pMedia); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::updateFields() |
|
|
|
void UBTBPageEditWidget::updateFields() |
|
|
@ -203,7 +220,7 @@ void UBTBPageEditWidget::updateFields() |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
QWidget* pWidget = mpMediaContainer->generateMediaWidget(url); |
|
|
|
QWidget* pWidget = mpMediaContainer->generateMediaWidget(url); |
|
|
|
if(pWidget != NULL){ |
|
|
|
if(pWidget != NULL){ |
|
|
|
mpDataMgr->medias()->append(pWidget); |
|
|
|
mMedias << pWidget; |
|
|
|
mpMediaContainer->addWidget(pWidget); |
|
|
|
mpMediaContainer->addWidget(pWidget); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -221,6 +238,7 @@ void UBTBPageEditWidget::updateFields() |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::clearFields() |
|
|
|
void UBTBPageEditWidget::clearFields() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
mClearingFields = true; |
|
|
|
// Title
|
|
|
|
// Title
|
|
|
|
mpTitle->setText(""); |
|
|
|
mpTitle->setText(""); |
|
|
|
// Actions
|
|
|
|
// Actions
|
|
|
@ -230,13 +248,14 @@ void UBTBPageEditWidget::clearFields() |
|
|
|
} |
|
|
|
} |
|
|
|
mActions.clear(); |
|
|
|
mActions.clear(); |
|
|
|
// Medias
|
|
|
|
// Medias
|
|
|
|
foreach(QWidget* pMedia, *mpDataMgr->medias()){ |
|
|
|
foreach(QWidget* pMedia, mMedias){ |
|
|
|
if(NULL != pMedia){ |
|
|
|
if(NULL != pMedia){ |
|
|
|
mpMediaContainer->removeWidget(pMedia); |
|
|
|
mpMediaContainer->removeWidget(pMedia); |
|
|
|
DELETEPTR(pMedia); |
|
|
|
DELETEPTR(pMedia); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
mpDataMgr->mediaUrls().clear(); |
|
|
|
mMedias.clear(); |
|
|
|
|
|
|
|
mMediaUrls.clear(); |
|
|
|
// Links
|
|
|
|
// Links
|
|
|
|
foreach(UBUrlWidget* pLink, mUrls){ |
|
|
|
foreach(UBUrlWidget* pLink, mUrls){ |
|
|
|
mpLinks->removeWidget(pLink); |
|
|
|
mpLinks->removeWidget(pLink); |
|
|
@ -245,6 +264,8 @@ void UBTBPageEditWidget::clearFields() |
|
|
|
mUrls.clear(); |
|
|
|
mUrls.clear(); |
|
|
|
// Comments
|
|
|
|
// Comments
|
|
|
|
mpComments->setText(""); |
|
|
|
mpComments->setText(""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mClearingFields = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------------------------
|
|
|
|
// ---------------------------------------------------------------------------------------------
|
|
|
|