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 {
}
VERSION_MAJ = 1
VERSION_MIN = 40
VERSION_MIN = 50
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 = $$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)
else if(element->type == "action"){
QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpRootWidgetItem);
newWidgetItem->setText(0,element->attributes.value("task"));
QColor color = element->attributes.value("owner").toInt() == 0 ? QColor(Qt::red):QColor(Qt::green);
newWidgetItem->setData(0,Qt::ForegroundRole,QBrush(color));
newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_NONE);
newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11)));
QString colorString = element->attributes.value("owner").toInt() == 0 ? "red":"green";
UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem,0);
textWidget->bottomMargin(14);
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);
}
else if(element->type == "media"){
......
......@@ -71,6 +71,7 @@ UBTGActionWidget::UBTGActionWidget(QTreeWidgetItem* widget, QWidget* parent, con
mpOwner->insertItems(0,qslOwner);
mpOwner->setCurrentIndex(0);
mpTask = new UBTGAdaptableText(widget,this);
mpTask->setPlaceHolderText(tr("Type task here ..."));
mpTask->setAcceptRichText(true);
mpTask->setTextColor(QColor().green());
mpTask->setObjectName("ActionWidgetTaskTextEdit");
......@@ -102,6 +103,7 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c
, mpTreeWidgetItem(widget)
, mMinimumHeight(20)
, mHasPlaceHolder(false)
, mIsUpdatingSize(false)
{
setObjectName(name);
setStyleSheet( "QWidget {background: white; border:1 solid #999999; border-radius : 10px; padding: 2px;}");
......@@ -113,36 +115,39 @@ UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, c
void UBTGAdaptableText::setPlaceHolderText(QString text)
{
mHasPlaceHolder = true;
// 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
mPlaceHolderText = text + " ";
setTextColor(QColor(Qt::lightGray));
setText(mPlaceHolderText);
onTextChanged();
if(isHidden())
show();
mHasPlaceHolder = true;
setPlainText(mPlaceHolderText);
}
void UBTGAdaptableText::focusInEvent(QFocusEvent *e)
void UBTGAdaptableText::keyPressEvent(QKeyEvent* e)
{
if(mHasPlaceHolder && toPlainText() == mPlaceHolderText){
setText("");
if(toPlainText() == mPlaceHolderText){
setTextColor(QColor(Qt::black));
setPlainText("");
}
e->accept();
QTextEdit::keyPressEvent(e);
}
void UBTGAdaptableText::focusOutEvent(QFocusEvent *e)
void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e)
{
if(mHasPlaceHolder && toPlainText().length() == 0){
QTextEdit::keyReleaseEvent(e);
if(toPlainText().isEmpty()){
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()
......@@ -156,6 +161,7 @@ QString UBTGAdaptableText::text()
void UBTGAdaptableText::onTextChanged()
{
mIsUpdatingSize = true;
if(document()->size().height() < mMinimumHeight)
setFixedHeight(mMinimumHeight);
else
......@@ -167,6 +173,7 @@ void UBTGAdaptableText::onTextChanged()
mpTreeWidgetItem->setExpanded(true);
setFocus();
}
mIsUpdatingSize = false;
}
void UBTGAdaptableText::showText(const QString & text)
......@@ -187,6 +194,12 @@ void UBTGAdaptableText::bottomMargin(int newValue)
onTextChanged();
}
void UBTGAdaptableText::resizeEvent(QResizeEvent* e)
{
QTextEdit::resizeEvent(e);
QTimer::singleShot(100,this,SLOT(onTextChanged()));
}
/***************************************************************************
* class UBTGMediaWidget *
***************************************************************************/
......@@ -210,7 +223,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const
setAcceptDrops(true);
addWidget(mpDropMeWidget);
setMinimumHeight(100);
setMinimumHeight(200);
}
UBTGMediaWidget::UBTGMediaWidget(QString relativePath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent)
......@@ -307,6 +320,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path)
mpLayout = new QVBoxLayout(mpWorkWidget);
if(!mIsPresentationMode){
mpTitle = new UBTGAdaptableText(mpTreeWidgetItem,mpWorkWidget);
mpTitle->setPlaceHolderText(tr("Type title here..."));
mpLayout->addWidget(mpTitle,1);
}
if(mpMediaLabelWidget){
......@@ -319,6 +333,7 @@ void UBTGMediaWidget::createWorkWidget(QString& path)
mpLayout->addWidget(mpMediaWidget);
}
else if (mpWebView){
mpWebView->setMaximumHeight(mpTreeWidgetItem->treeWidget()->size().width());
mpWebView->setParent(mpWorkWidget);
mpLayout->addWidget(mpWebView);
}
......@@ -347,8 +362,6 @@ void UBTGMediaWidget::parseMimeData(const QMimeData* pMimeData)
qDebug() << "No mime data present";
createWorkWidget(path);
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(path);
qDebug() << mimeType;
}
void UBTGMediaWidget::dropEvent(QDropEvent* event)
......
......@@ -96,14 +96,18 @@ public slots:
void onTextChanged();
protected:
void focusInEvent(QFocusEvent *e);
void focusOutEvent(QFocusEvent *e);
void keyPressEvent(QKeyEvent* e);
void keyReleaseEvent(QKeyEvent* e);
void showEvent(QShowEvent* e);
void resizeEvent(QResizeEvent* e);
private:
int mBottomMargin;
QTreeWidgetItem* mpTreeWidgetItem;
int mMinimumHeight;
bool mHasPlaceHolder;
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