|
|
@ -142,6 +142,7 @@ void UBTBPageEditWidget::onActionButton() |
|
|
|
UBTeacherStudentAction* pAction = new UBTeacherStudentAction(this); |
|
|
|
UBTeacherStudentAction* pAction = new UBTeacherStudentAction(this); |
|
|
|
mActions << pAction; |
|
|
|
mActions << pAction; |
|
|
|
mpActions->addWidget(pAction); |
|
|
|
mpActions->addWidget(pAction); |
|
|
|
|
|
|
|
connectActions(pAction); |
|
|
|
emit valueChanged(); |
|
|
|
emit valueChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -150,6 +151,7 @@ void UBTBPageEditWidget::onLinkButton() |
|
|
|
UBUrlWidget* pUrl = new UBUrlWidget(this); |
|
|
|
UBUrlWidget* pUrl = new UBUrlWidget(this); |
|
|
|
mUrls << pUrl; |
|
|
|
mUrls << pUrl; |
|
|
|
mpLinks->addWidget(pUrl); |
|
|
|
mpLinks->addWidget(pUrl); |
|
|
|
|
|
|
|
connectActions(pUrl); |
|
|
|
emit valueChanged(); |
|
|
|
emit valueChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -163,11 +165,20 @@ void UBTBPageEditWidget::onMediaDropped(const QString &url) |
|
|
|
//mpDataMgr->medias()->append(pMedia);
|
|
|
|
//mpDataMgr->medias()->append(pMedia);
|
|
|
|
//mpDataMgr->addMediaUrl(url);
|
|
|
|
//mpDataMgr->addMediaUrl(url);
|
|
|
|
mpMediaContainer->addWidget(pMedia); |
|
|
|
mpMediaContainer->addWidget(pMedia); |
|
|
|
|
|
|
|
connectActions(pMedia); |
|
|
|
emit valueChanged(); |
|
|
|
emit valueChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::connectActions(QWidget* w) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBActionableWidget* pActionable = dynamic_cast<UBActionableWidget*>(w); |
|
|
|
|
|
|
|
if(NULL != pActionable){ |
|
|
|
|
|
|
|
connect(pActionable, SIGNAL(close(QWidget*)), this, SLOT(onCloseWidget(QWidget*))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBTBPageEditWidget::onDocumentEditClicked() |
|
|
|
void UBTBPageEditWidget::onDocumentEditClicked() |
|
|
|
{ |
|
|
|
{ |
|
|
|
emit changeTBState(eTeacherBarState_DocumentEdit); |
|
|
|
emit changeTBState(eTeacherBarState_DocumentEdit); |
|
|
@ -217,6 +228,7 @@ void UBTBPageEditWidget::updateFields() |
|
|
|
pAction->setText(action.content); |
|
|
|
pAction->setText(action.content); |
|
|
|
mActions << pAction; |
|
|
|
mActions << pAction; |
|
|
|
mpActions->addWidget(pAction); |
|
|
|
mpActions->addWidget(pAction); |
|
|
|
|
|
|
|
connectActions(pAction); |
|
|
|
} |
|
|
|
} |
|
|
|
// Medias
|
|
|
|
// Medias
|
|
|
|
foreach(QString url, *mpDataMgr->mediaUrls()){ |
|
|
|
foreach(QString url, *mpDataMgr->mediaUrls()){ |
|
|
@ -226,6 +238,7 @@ void UBTBPageEditWidget::updateFields() |
|
|
|
if(pWidget != NULL){ |
|
|
|
if(pWidget != NULL){ |
|
|
|
mMedias << pWidget; |
|
|
|
mMedias << pWidget; |
|
|
|
mpMediaContainer->addWidget(pWidget); |
|
|
|
mpMediaContainer->addWidget(pWidget); |
|
|
|
|
|
|
|
connectActions(pWidget); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -237,6 +250,7 @@ void UBTBPageEditWidget::updateFields() |
|
|
|
urlWidget->setUrl(link.link); |
|
|
|
urlWidget->setUrl(link.link); |
|
|
|
mUrls << urlWidget; |
|
|
|
mUrls << urlWidget; |
|
|
|
mpLinks->addWidget(urlWidget); |
|
|
|
mpLinks->addWidget(urlWidget); |
|
|
|
|
|
|
|
connectActions(urlWidget); |
|
|
|
} |
|
|
|
} |
|
|
|
// Comments
|
|
|
|
// Comments
|
|
|
|
mpComments->document()->setPlainText(mpDataMgr->comments()); |
|
|
|
mpComments->document()->setPlainText(mpDataMgr->comments()); |
|
|
@ -287,7 +301,15 @@ void UBTBPageEditWidget::onCloseWidget(QWidget *w) |
|
|
|
mpLinks->removeWidget(pW); |
|
|
|
mpLinks->removeWidget(pW); |
|
|
|
mUrls.remove(mUrls.indexOf(pW)); |
|
|
|
mUrls.remove(mUrls.indexOf(pW)); |
|
|
|
DELETEPTR(w); |
|
|
|
DELETEPTR(w); |
|
|
|
}else if("UBTBMediaPicture" == w->objectName() || "UBMediaWidget" == w->objectName()){ |
|
|
|
}else if("UBTBMediaPicture" == w->objectName()){ |
|
|
|
|
|
|
|
UBPictureWidget* pW = dynamic_cast<UBPictureWidget*>(w); |
|
|
|
|
|
|
|
mMediaUrls.removeOne(pW->url()); |
|
|
|
|
|
|
|
mpMediaContainer->removeWidget(w); |
|
|
|
|
|
|
|
mMedias.remove(mMedias.indexOf(w)); |
|
|
|
|
|
|
|
DELETEPTR(w); |
|
|
|
|
|
|
|
}else if("UBMediaWidget" == w->objectName()){ |
|
|
|
|
|
|
|
UBMediaWidget* pW = dynamic_cast<UBMediaWidget*>(w); |
|
|
|
|
|
|
|
mMediaUrls.removeOne(pW->url()); |
|
|
|
mpMediaContainer->removeWidget(w); |
|
|
|
mpMediaContainer->removeWidget(w); |
|
|
|
mMedias.remove(mMedias.indexOf(w)); |
|
|
|
mMedias.remove(mMedias.indexOf(w)); |
|
|
|
DELETEPTR(w); |
|
|
|
DELETEPTR(w); |
|
|
@ -326,10 +348,12 @@ UBUrlWidget::UBUrlWidget(QWidget *parent, const char *name):UBActionableWidget(p |
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addLayout(mpTitleLayout); |
|
|
|
mpLayout->addLayout(mpTitleLayout); |
|
|
|
mpLayout->addLayout(mpLabelLayout); |
|
|
|
mpLayout->addLayout(mpLabelLayout); |
|
|
|
|
|
|
|
setActionsParent(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBUrlWidget::~UBUrlWidget() |
|
|
|
UBUrlWidget::~UBUrlWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
unsetActionsParent(); |
|
|
|
DELETEPTR(mpTitle); |
|
|
|
DELETEPTR(mpTitle); |
|
|
|
DELETEPTR(mpTitleLabel); |
|
|
|
DELETEPTR(mpTitleLabel); |
|
|
|
DELETEPTR(mpUrlLabel); |
|
|
|
DELETEPTR(mpUrlLabel); |
|
|
@ -460,6 +484,7 @@ QWidget* UBTBMediaContainer::generateMediaWidget(const QString& url) |
|
|
|
if(mimeType.contains("image")){ |
|
|
|
if(mimeType.contains("image")){ |
|
|
|
QPixmap pix = QPixmap(url); |
|
|
|
QPixmap pix = QPixmap(url); |
|
|
|
UBPictureWidget* pic = new UBPictureWidget(); |
|
|
|
UBPictureWidget* pic = new UBPictureWidget(); |
|
|
|
|
|
|
|
pic->setUrl(url); |
|
|
|
pix.scaledToWidth(pic->label()->width()); |
|
|
|
pix.scaledToWidth(pic->label()->width()); |
|
|
|
pic->label()->resize(pix.width(), pix.height()); |
|
|
|
pic->label()->resize(pix.width(), pix.height()); |
|
|
|
pic->label()->setPixmap(pix); |
|
|
|
pic->label()->setPixmap(pix); |
|
|
@ -470,6 +495,7 @@ QWidget* UBTBMediaContainer::generateMediaWidget(const QString& url) |
|
|
|
else if(mimeType.contains("video") || mimeType.contains("audio")){ |
|
|
|
else if(mimeType.contains("video") || mimeType.contains("audio")){ |
|
|
|
UBMediaWidget* mediaPlayer = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); |
|
|
|
UBMediaWidget* mediaPlayer = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); |
|
|
|
mediaPlayer->setFile(url); |
|
|
|
mediaPlayer->setFile(url); |
|
|
|
|
|
|
|
mediaPlayer->setUrl(url); |
|
|
|
pW = mediaPlayer; |
|
|
|
pW = mediaPlayer; |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
@ -511,11 +537,12 @@ UBTeacherStudentAction::UBTeacherStudentAction(QWidget *parent, const char *name |
|
|
|
mpText->setStyleSheet("background:white;"); |
|
|
|
mpText->setStyleSheet("background:white;"); |
|
|
|
|
|
|
|
|
|
|
|
mpLayout->addWidget(mpText, 1); |
|
|
|
mpLayout->addWidget(mpText, 1); |
|
|
|
|
|
|
|
setActionsParent(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBTeacherStudentAction::~UBTeacherStudentAction() |
|
|
|
UBTeacherStudentAction::~UBTeacherStudentAction() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
unsetActionsParent(); |
|
|
|
DELETEPTR(mpCombo); |
|
|
|
DELETEPTR(mpCombo); |
|
|
|
DELETEPTR(mpText); |
|
|
|
DELETEPTR(mpText); |
|
|
|
DELETEPTR(mpComboLayout); |
|
|
|
DELETEPTR(mpComboLayout); |
|
|
@ -568,15 +595,18 @@ UBPictureWidget::UBPictureWidget(QWidget *parent, const char *name):UBActionable |
|
|
|
mpLabel = new QLabel(this); |
|
|
|
mpLabel = new QLabel(this); |
|
|
|
mpLayout->addWidget(mpLabel); |
|
|
|
mpLayout->addWidget(mpLabel); |
|
|
|
mpLabel->setGeometry( 10, 10, width()-2*10, height()); |
|
|
|
mpLabel->setGeometry( 10, 10, width()-2*10, height()); |
|
|
|
|
|
|
|
setActionsParent(mpLabel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBPictureWidget::~UBPictureWidget() |
|
|
|
UBPictureWidget::~UBPictureWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
unsetActionsParent(); |
|
|
|
DELETEPTR(mpLabel); |
|
|
|
DELETEPTR(mpLabel); |
|
|
|
DELETEPTR(mpLayout); |
|
|
|
DELETEPTR(mpLayout); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBPictureWidget::resizeEvent(QResizeEvent *ev) |
|
|
|
void UBPictureWidget::resizeEvent(QResizeEvent *ev) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Q_UNUSED(ev); |
|
|
|
mpLabel->setGeometry( 10, 10, width()-2*10, height()); |
|
|
|
mpLabel->setGeometry( 10, 10, width()-2*10, height()); |
|
|
|
} |
|
|
|
} |
|
|
|