Merge remote-tracking branch 'origin/claudio-dev' into develop

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 0f2640efde
  1. 17
      src/core/UBApplication.cpp
  2. 6
      src/gui/UBTeacherGuideWidget.cpp
  3. 14
      src/gui/UBTeacherGuideWidgetsTools.cpp

@ -216,14 +216,17 @@ QString UBApplication::checkLanguageAvailabilityForSankore(QString &language)
void UBApplication::setupTranslators(QStringList args)
{
QString forcedLanguage;
QString forcedLanguage("");
if(args.contains("-lang"))
forcedLanguage=args.at(args.indexOf("-lang") + 1);
else{
QString setLanguage = UBSettings::settings()->appPreferredLanguage->get().toString();
if(!setLanguage.isEmpty())
forcedLanguage = setLanguage;
}
// TODO claudio: this has been commented because some of the translation seem to be loaded at this time
// especially tools name. This is a workaround and we have to be able to load settings without
// impacting the translations
// else{
// QString setLanguage = UBSettings::settings()->appPreferredLanguage->get().toString();
// if(!setLanguage.isEmpty())
// forcedLanguage = setLanguage;
// }
QString language("");
@ -242,7 +245,6 @@ void UBApplication::setupTranslators(QStringList args)
else{
mApplicationTranslator = new QTranslator(this);
mQtGuiTranslator = new QTranslator(this);
mApplicationTranslator->load(UBPlatformUtils::translationPath(QString("sankore_"),language));
installTranslator(mApplicationTranslator);
@ -256,7 +258,6 @@ void UBApplication::setupTranslators(QStringList args)
}
if(!qtGuiTranslationPath.isEmpty()){
qDebug() << "qtGuiTranslationPath " << qtGuiTranslationPath;
mQtGuiTranslator->load(qtGuiTranslationPath);
installTranslator(mQtGuiTranslator);
}

@ -551,9 +551,9 @@ void UBTeacherGuidePresentationWidget::showData( QVector<tUBGEElementNode*> data
else if (element->name == "comment")
mpComment->showText(element->attributes.value("value"));
else if (element->name == "action") {
QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem( mpRootWidgetItem);
QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpRootWidgetItem);
newWidgetItem->setText(0, element->attributes.value("task"));
newWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
newWidgetItem->setFlags(Qt::ItemIsEnabled /*| Qt::ItemIsSelectable*/);
QString colorString = element->attributes.value("owner").toInt() == 0 ? "blue" : "green";
UBTGAdaptableText* textWidget = new UBTGAdaptableText(newWidgetItem, 0);
textWidget->bottomMargin(14);
@ -679,7 +679,9 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons
mpLayout->addWidget(mpPageNumberLabel);
mpScrollArea = new QScrollArea();
mpScrollArea->setFocusPolicy(Qt::NoFocus);
mpContainerWidget = new QWidget();
mpContainerWidget->setFocusPolicy(Qt::NoFocus);
mpContainerWidgetLayout = new QVBoxLayout();
mpLayout->addWidget(mpScrollArea);

@ -164,7 +164,7 @@ void UBTGAdaptableText::keyReleaseEvent(QKeyEvent* e)
void UBTGAdaptableText::showEvent(QShowEvent* e)
{
Q_UNUSED(e);
if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){
if(!mIsUpdatingSize && !hasFocus() && mHasPlaceHolder && toPlainText().isEmpty() && !isReadOnly()){
setTextColor(QColor(Qt::lightGray));
setPlainText(mPlaceHolderText);
}
@ -193,7 +193,8 @@ void UBTGAdaptableText::onTextChanged()
if(documentSize < mMinimumHeight){
setFixedHeight(mMinimumHeight);
}else{
}
else{
setFixedHeight(documentSize+mBottomMargin);
}
@ -237,12 +238,14 @@ void UBTGAdaptableText::focusInEvent(QFocusEvent* e)
QTextEdit::focusInEvent(e);
}
void UBTGAdaptableText::focusOutEvent(QFocusEvent* e){
void UBTGAdaptableText::focusOutEvent(QFocusEvent* e)
{
managePlaceholder(false);
QTextEdit::focusOutEvent(e);
}
void UBTGAdaptableText::managePlaceholder(bool focus){
void UBTGAdaptableText::managePlaceholder(bool focus)
{
if(focus){
if(toPlainText() == mPlaceHolderText){
setTextColor(QColor(Qt::black));
@ -258,7 +261,8 @@ void UBTGAdaptableText::managePlaceholder(bool focus){
}
}
void UBTGAdaptableText::setCursorToTheEnd(){
void UBTGAdaptableText::setCursorToTheEnd()
{
QTextDocument* doc = document();
if(NULL != doc){
QTextBlock block = doc->lastBlock();

Loading…
Cancel
Save