@ -86,7 +86,6 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con
mpTask = new UBTGAdaptableText ( widget , this ) ;
mpTask = new UBTGAdaptableText ( widget , this ) ;
mpTask - > setPlaceHolderText ( tr ( " Type task here ... " ) ) ;
mpTask - > setPlaceHolderText ( tr ( " Type task here ... " ) ) ;
mpTask - > setAcceptRichText ( true ) ;
mpTask - > setAcceptRichText ( true ) ;
mpTask - > setTextColor ( QColor ( ) . green ( ) ) ;
mpTask - > setObjectName ( " ActionWidgetTaskTextEdit " ) ;
mpTask - > setObjectName ( " ActionWidgetTaskTextEdit " ) ;
mpLayout - > addWidget ( mpOwner ) ;
mpLayout - > addWidget ( mpOwner ) ;
mpLayout - > addWidget ( mpTask ) ;
mpLayout - > addWidget ( mpTask ) ;
@ -147,7 +146,6 @@ void UBTGAdaptableText::setPlaceHolderText(QString text)
// the space addition is to make this string unique and check against it to know
// the space addition is to make this string unique and check against it to know
// if we are talking about a typed string or the placeholder string
// if we are talking about a typed string or the placeholder string
mPlaceHolderText = text + " " ;
mPlaceHolderText = text + " " ;
setTextColor ( QColor ( Qt : : lightGray ) ) ;
setPlainText ( mPlaceHolderText ) ;
setPlainText ( mPlaceHolderText ) ;
}
}
@ -230,9 +228,12 @@ void UBTGAdaptableText::bottomMargin(int newValue)
onTextChanged ( ) ;
onTextChanged ( ) ;
}
}
void UBTGAdaptableText : : focusInEvent ( QFocusEvent * e ) {
void UBTGAdaptableText : : focusInEvent ( QFocusEvent * e )
{
qDebug ( ) < < " pippa " ;
if ( isReadOnly ( ) ) {
if ( isReadOnly ( ) ) {
e - > ignore ( ) ;
e - > ignore ( ) ;
qDebug ( ) < < " ignored " ;
}
}
managePlaceholder ( true ) ;
managePlaceholder ( true ) ;
QTextEdit : : focusInEvent ( e ) ;
QTextEdit : : focusInEvent ( e ) ;
@ -246,11 +247,13 @@ void UBTGAdaptableText::focusOutEvent(QFocusEvent* e){
void UBTGAdaptableText : : managePlaceholder ( bool focus ) {
void UBTGAdaptableText : : managePlaceholder ( bool focus ) {
if ( focus ) {
if ( focus ) {
if ( toPlainText ( ) = = mPlaceHolderText ) {
if ( toPlainText ( ) = = mPlaceHolderText ) {
qDebug ( ) < < " Place holder found " ;
setTextColor ( QColor ( Qt : : black ) ) ;
setTextColor ( QColor ( Qt : : black ) ) ;
setPlainText ( " " ) ;
setPlainText ( " " ) ;
}
}
setCursorToTheEnd ( ) ;
setCursorToTheEnd ( ) ;
} else {
}
else {
if ( toPlainText ( ) . isEmpty ( ) ) {
if ( toPlainText ( ) . isEmpty ( ) ) {
setTextColor ( QColor ( Qt : : lightGray ) ) ;
setTextColor ( QColor ( Qt : : lightGray ) ) ;
setPlainText ( mPlaceHolderText ) ;
setPlainText ( mPlaceHolderText ) ;
@ -323,6 +326,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
, mpDropMeWidget ( NULL )
, mpDropMeWidget ( NULL )
, mpWorkWidget ( NULL )
, mpWorkWidget ( NULL )
, mpLayout ( NULL )
, mpLayout ( NULL )
, mpMediaLayout ( NULL )
, mpTitle ( NULL )
, mpTitle ( NULL )
, mpMediaLabelWidget ( NULL )
, mpMediaLabelWidget ( NULL )
, mpMediaWidget ( NULL )
, mpMediaWidget ( NULL )
@ -330,6 +334,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
, mMediaPath ( QString ( " " ) )
, mMediaPath ( QString ( " " ) )
, mIsPresentationMode ( false )
, mIsPresentationMode ( false )
, mIsInitializationMode ( false )
, mIsInitializationMode ( false )
, mMediaWidgetHeight ( 150 )
{
{
setObjectName ( name ) ;
setObjectName ( name ) ;
mpDropMeWidget = new QLabel ( ) ;
mpDropMeWidget = new QLabel ( ) ;
@ -347,6 +352,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
, mpDropMeWidget ( NULL )
, mpDropMeWidget ( NULL )
, mpWorkWidget ( NULL )
, mpWorkWidget ( NULL )
, mpLayout ( NULL )
, mpLayout ( NULL )
, mpMediaLayout ( NULL )
, mpTitle ( NULL )
, mpTitle ( NULL )
, mpMediaLabelWidget ( NULL )
, mpMediaLabelWidget ( NULL )
, mpMediaWidget ( NULL )
, mpMediaWidget ( NULL )
@ -354,6 +360,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi
, mIsPresentationMode ( true )
, mIsPresentationMode ( true )
, mMediaType ( " " )
, mMediaType ( " " )
, mIsInitializationMode ( false )
, mIsInitializationMode ( false )
, mMediaWidgetHeight ( 150 )
{
{
setObjectName ( name ) ;
setObjectName ( name ) ;
mMediaPath = UBApplication : : boardController - > selectedDocument ( ) - > persistencePath ( ) + " / " + mediaPath ;
mMediaPath = UBApplication : : boardController - > selectedDocument ( ) - > persistencePath ( ) + " / " + mediaPath ;
@ -368,6 +375,7 @@ UBTGMediaWidget::~UBTGMediaWidget()
DELETEPTR ( mpMediaLabelWidget ) ;
DELETEPTR ( mpMediaLabelWidget ) ;
DELETEPTR ( mpMediaWidget ) ;
DELETEPTR ( mpMediaWidget ) ;
DELETEPTR ( mpWebView ) ;
DELETEPTR ( mpWebView ) ;
DELETEPTR ( mpMediaLayout ) ;
DELETEPTR ( mpLayout ) ;
DELETEPTR ( mpLayout ) ;
removeWidget ( mpDropMeWidget ) ;
removeWidget ( mpDropMeWidget ) ;
@ -456,9 +464,8 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
mpMediaLabelWidget = new QLabel ( ) ;
mpMediaLabelWidget = new QLabel ( ) ;
QPixmap pixmap = QPixmap ( mMediaPath ) ;
QPixmap pixmap = QPixmap ( mMediaPath ) ;
pixmap = pixmap . scaledToWidth ( mpTreeWidgetItem - > treeWidget ( ) - > size ( ) . width ( ) ) ;
pixmap = pixmap . scaledToHeight ( mMediaWidgetHeight ) ;
mpMediaLabelWidget - > setPixmap ( pixmap ) ;
mpMediaLabelWidget - > setPixmap ( pixmap ) ;
mpMediaLabelWidget - > setScaledContents ( true ) ;
}
}
else if ( mimeType . contains ( " widget " ) & & ! forceFlashMediaType ) {
else if ( mimeType . contains ( " widget " ) & & ! forceFlashMediaType ) {
mMediaType = " w3c " ;
mMediaType = " w3c " ;
@ -508,31 +515,43 @@ void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType)
if ( setMedia ) {
if ( setMedia ) {
setAcceptDrops ( false ) ;
setAcceptDrops ( false ) ;
mpWorkWidget = new QWidget ( this ) ;
mpWorkWidget = new QWidget ( this ) ;
mpLayout = new QVBoxLayout ( mpWorkWidget ) ;
if ( ! mIsPresentationMode ) {
if ( ! mIsPresentationMode ) {
mpLayout = new QVBoxLayout ( mpWorkWidget ) ;
mpTitle = new UBTGAdaptableText ( mpTreeWidgetItem , mpWorkWidget ) ;
mpTitle = new UBTGAdaptableText ( mpTreeWidgetItem , mpWorkWidget ) ;
mpTitle - > setPlaceHolderText ( tr ( " Type title here... " ) ) ;
mpTitle - > setPlaceHolderText ( tr ( " Type title here... " ) ) ;
mpLayout - > addWidget ( mpTitle ) ;
mpLayout - > addWidget ( mpTitle ) ;
mpMediaLayout = new QHBoxLayout ;
mpLayout - > addLayout ( mpMediaLayout ) ;
mpWorkWidget - > setLayout ( mpLayout ) ;
}
}
else {
mpMediaLayout = new QHBoxLayout ( mpWorkWidget ) ;
mpWorkWidget - > setLayout ( mpMediaLayout ) ;
}
mpMediaLayout - > addStretch ( 1 ) ;
if ( mpMediaLabelWidget ) {
if ( mpMediaLabelWidget ) {
mpMediaLabelWidget - > setMaximumHeight ( width ( ) ) ;
mpMediaLabelWidget - > setFixedHeight ( mMediaWidgetHeight ) ;
mpMediaLabelWidget - > setParent ( mpWorkWidget ) ;
mpMediaLabelWidget - > setParent ( mpWorkWidget ) ;
mpLayout - > addWidget ( mpMediaLabelWidget ) ;
mpMedia Layout - > addWidget ( mpMediaLabelWidget ) ;
}
}
else if ( mpMediaWidget ) {
else if ( mpMediaWidget ) {
mpMediaWidget - > setMaximumHeight ( width ( ) ) ;
mpMediaWidget - > setFixedHeight ( mMediaWidgetHeight ) ;
mpMediaWidget - > setParent ( mpWorkWidget ) ;
mpMediaWidget - > setParent ( mpWorkWidget ) ;
mpLayout - > addWidget ( mpMediaWidget ) ;
mpMedia Layout - > addWidget ( mpMediaWidget ) ;
}
}
else if ( mpWebView ) {
else if ( mpWebView ) {
mpWebView - > setMaximumHeight ( width ( ) ) ;
mpWebView - > setFixedHeight ( mMediaWidgetHeight ) ;
mpWebView - > setParent ( mpWorkWidget ) ;
mpWebView - > setParent ( mpWorkWidget ) ;
mpLayout - > addWidget ( mpWebView ) ;
mpMedia Layout - > addWidget ( mpWebView ) ;
mpWebView - > show ( ) ;
mpWebView - > show ( ) ;
}
}
mpWorkWidget - > setLayout ( mpLayout ) ;
mpMediaLayout - > addStretch ( 1 ) ;
addWidget ( mpWorkWidget ) ;
addWidget ( mpWorkWidget ) ;
setCurrentWidget ( mpWorkWidget ) ;
setCurrentWidget ( mpWorkWidget ) ;
mpWorkWidget - > show ( ) ;
}
}
}
}
@ -566,7 +585,6 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
if ( ! mIsPresentationMode )
if ( ! mIsPresentationMode )
event - > ignore ( ) ;
event - > ignore ( ) ;
else {
else {
QDrag * drag = new QDrag ( this ) ;
QDrag * drag = new QDrag ( this ) ;
QMimeData * mimeData = new QMimeData ( ) ;
QMimeData * mimeData = new QMimeData ( ) ;
QList < QUrl > urlList ;
QList < QUrl > urlList ;