Commit 3c28a2b6 authored by shibakaneki's avatar shibakaneki

Merge branch 'master' of github.com:Sankore/Sankore-3.1

parents bd2e393d 3bc011eb
...@@ -11,9 +11,9 @@ linux-g++-64 { ...@@ -11,9 +11,9 @@ linux-g++-64 {
} }
VERSION_MAJ = 1 VERSION_MAJ = 1
VERSION_MIN = 40 VERSION_MIN = 50
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 05 VERSION_PATCH = 00
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -386,10 +386,14 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data) ...@@ -386,10 +386,14 @@ 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() == 0 ? QColor(Qt::red):QColor(Qt::green); QString colorString = element->attributes.value("owner").toInt() == 0 ? "red":"green";
newWidgetItem->setData(0,Qt::ForegroundRole,QBrush(color)); UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem,0);
newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_NONE); textWidget->bottomMargin(14);
newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11))); textWidget->setStyleSheet("QWidget {background: #EEEEEE; border:none; color:" + colorString + ";}");
textWidget->showText(element->attributes.value("task"));
textWidget->document()->setDefaultFont(QFont(QApplication::font().family(),11));
mpTreeWidget->setItemWidget(newWidgetItem,0,textWidget);
mpRootWidgetItem->addChild(newWidgetItem); mpRootWidgetItem->addChild(newWidgetItem);
} }
else if(element->type == "media"){ else if(element->type == "media"){
......
...@@ -71,6 +71,7 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con ...@@ -71,6 +71,7 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con
mpOwner->insertItems(0,qslOwner); mpOwner->insertItems(0,qslOwner);
mpOwner->setCurrentIndex(0); mpOwner->setCurrentIndex(0);
mpTask = new UBTGAdaptableText(widget,this); mpTask = new UBTGAdaptableText(widget,this);
mpTask->setPlaceHolderText(tr("Type task here ..."));
mpTask->setAcceptRichText(true); mpTask->setAcceptRichText(true);
mpTask->setTextColor(QColor().green()); mpTask->setTextColor(QColor().green());
mpTask->setObjectName("ActionWidgetTaskTextEdit"); mpTask->setObjectName("ActionWidgetTaskTextEdit");
...@@ -102,6 +103,7 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c ...@@ -102,6 +103,7 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c
, mpTreeWidgetItem(widget) , mpTreeWidgetItem(widget)
, mMinimumHeight(20) , mMinimumHeight(20)
, mHasPlaceHolder(false) , mHasPlaceHolder(false)
, mIsUpdatingSize(false)
{ {
setObjectName(name); setObjectName(name);
setStyleSheet( "QWidget {background: white; border:1 solid #999999; border-radius : 10px; padding: 2px;}"); setStyleSheet( "QWidget {background: white; border:1 solid #999999; border-radius : 10px; padding: 2px;}");
...@@ -113,36 +115,39 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c ...@@ -113,36 +115,39 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c
void UBTGAdaptableText::setPlaceHolderText(QString text) void UBTGAdaptableText::setPlaceHolderText(QString text)
{ {
mHasPlaceHolder = true;
// 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)); setTextColor(QColor(Qt::lightGray));
setText(mPlaceHolderText); setPlainText(mPlaceHolderText);
onTextChanged();
if(isHidden())
show();
mHasPlaceHolder = true;
} }
void UBTGAdaptableText::focusInEvent(QFocusEvent *e) void UBTGAdaptableText::keyPressEvent(QKeyEvent* e)
{ {
if(mHasPlaceHolder && toPlainText() == mPlaceHolderText){ if(toPlainText() == mPlaceHolderText){
setText("");
setTextColor(QColor(Qt::black)); setTextColor(QColor(Qt::black));
setPlainText("");
} }
QTextEdit::keyPressEvent(e);
e->accept();
} }
void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e)
void UBTGAdaptableText::focusOutEvent(QFocusEvent *e)
{ {
if(mHasPlaceHolder && toPlainText().length() == 0){ QTextEdit::keyReleaseEvent(e);
if(toPlainText().isEmpty()){
setTextColor(QColor(Qt::lightGray)); setTextColor(QColor(Qt::lightGray));
setText(mPlaceHolderText); setPlainText(mPlaceHolderText);
} }
e->accept(); }
void UBTGAdaptableText::showEvent(QShowEvent* e)
{
Q_UNUSED(e);
if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty())
setPlainText(mPlaceHolderText);
} }
QString UBTGAdaptableText::text() QString UBTGAdaptableText::text()
...@@ -156,6 +161,7 @@ QString UBTGAdaptableText::text() ...@@ -156,6 +161,7 @@ QString UBTGAdaptableText::text()
void UBTGAdaptableText::onTextChanged() void UBTGAdaptableText::onTextChanged()
{ {
mIsUpdatingSize = true;
if(document()->size().height() < mMinimumHeight) if(document()->size().height() < mMinimumHeight)
setFixedHeight(mMinimumHeight); setFixedHeight(mMinimumHeight);
else else
...@@ -167,6 +173,7 @@ void UBTGAdaptableText::onTextChanged() ...@@ -167,6 +173,7 @@ void UBTGAdaptableText::onTextChanged()
mpTreeWidgetItem->setExpanded(true); mpTreeWidgetItem->setExpanded(true);
setFocus(); setFocus();
} }
mIsUpdatingSize = false;
} }
void UBTGAdaptableText::showText(const QString & text) void UBTGAdaptableText::showText(const QString & text)
...@@ -187,6 +194,12 @@ void UBTGAdaptableText::bottomMargin(int newValue) ...@@ -187,6 +194,12 @@ void UBTGAdaptableText::bottomMargin(int newValue)
onTextChanged(); onTextChanged();
} }
void UBTGAdaptableText::resizeEvent(QResizeEvent* e)
{
QTextEdit::resizeEvent(e);
QTimer::singleShot(100,this,SLOT(onTextChanged()));
}
/*************************************************************************** /***************************************************************************
* class UBTGMediaWidget * * class UBTGMediaWidget *
***************************************************************************/ ***************************************************************************/
...@@ -210,7 +223,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const ...@@ -210,7 +223,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
setAcceptDrops(true); setAcceptDrops(true);
addWidget(mpDropMeWidget); addWidget(mpDropMeWidget);
setMinimumHeight(100); setMinimumHeight(200);
} }
UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent)
...@@ -307,6 +320,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path) ...@@ -307,6 +320,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path)
mpLayout = new QVBoxLayout(mpWorkWidget); mpLayout = new QVBoxLayout(mpWorkWidget);
if(!mIsPresentationMode){ if(!mIsPresentationMode){
mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget); mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget);
mpTitle->setPlaceHolderText(tr("Type title here..."));
mpLayout->addWidget(mpTitle,1); mpLayout->addWidget(mpTitle,1);
} }
if(mpMediaLabelWidget){ if(mpMediaLabelWidget){
...@@ -319,6 +333,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path) ...@@ -319,6 +333,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path)
mpLayout->addWidget(mpMediaWidget); mpLayout->addWidget(mpMediaWidget);
} }
else if (mpWebView){ else if (mpWebView){
mpWebView->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width());
mpWebView->setParent(mpWorkWidget); mpWebView->setParent(mpWorkWidget);
mpLayout->addWidget(mpWebView); mpLayout->addWidget(mpWebView);
} }
...@@ -347,8 +362,6 @@ void UBTGMediaWidget::parseMimeData(const QMimeData* pMimeData) ...@@ -347,8 +362,6 @@ void UBTGMediaWidget::parseMimeData(const QMimeData* pMimeData)
qDebug() << "No mime data present"; qDebug() << "No mime data present";
createWorkWidget(path); createWorkWidget(path);
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(path);
qDebug() << mimeType;
} }
void UBTGMediaWidget::dropEvent(QDropEvent* event) void UBTGMediaWidget::dropEvent(QDropEvent* event)
......
...@@ -96,14 +96,18 @@ public slots: ...@@ -96,14 +96,18 @@ public slots:
void onTextChanged(); void onTextChanged();
protected: protected:
void focusInEvent(QFocusEvent *e); void keyPressEvent(QKeyEvent* e);
void focusOutEvent(QFocusEvent *e); void keyReleaseEvent(QKeyEvent* e);
void showEvent(QShowEvent* e);
void resizeEvent(QResizeEvent* e);
private: private:
int mBottomMargin; int mBottomMargin;
QTreeWidgetItem* mpTreeWidgetItem; QTreeWidgetItem* mpTreeWidgetItem;
int mMinimumHeight; int mMinimumHeight;
bool mHasPlaceHolder; bool mHasPlaceHolder;
QString mPlaceHolderText; QString mPlaceHolderText;
bool mIsUpdatingSize;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment