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

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

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

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

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

Loading…
Cancel
Save