diff --git a/JournalDesModifications.pdf b/JournalDesModifications.pdf index 577818a4..79f01f9d 100644 Binary files a/JournalDesModifications.pdf and b/JournalDesModifications.pdf differ diff --git a/ReleaseNotes.pdf b/ReleaseNotes.pdf index 0f4885f3..220a99a7 100644 Binary files a/ReleaseNotes.pdf and b/ReleaseNotes.pdf differ diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index c08d5dec..ce2ac094 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -11,7 +11,7 @@ CONFIG += debug_and_release \ VERSION_MAJ = 2 VERSION_MIN = 00 VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error -VERSION_PATCH = 05 +VERSION_PATCH = 06 VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = $$replace(VERSION, "\\.r", "") diff --git a/resources/library/applications/Sel video.wgt/css/main.css b/resources/library/applications/Sel video.wgt/css/main.css index 63b2c7b5..43d6ee71 100644 --- a/resources/library/applications/Sel video.wgt/css/main.css +++ b/resources/library/applications/Sel video.wgt/css/main.css @@ -1,7 +1,6 @@ body{ - margin-top:10px; - margin-left:10px; + margin: 0; font-family:Arial, Sans-serif; font-size:15px; color:#444; @@ -104,7 +103,6 @@ body{ } #embeded-content{ - border:1px solid rgb(230,230,230); position:relative; z-index:3; float:left; diff --git a/resources/library/applications/Sel video.wgt/index.html b/resources/library/applications/Sel video.wgt/index.html index e7a51830..752b7f58 100644 --- a/resources/library/applications/Sel video.wgt/index.html +++ b/resources/library/applications/Sel video.wgt/index.html @@ -143,7 +143,7 @@ top:($("#embeded-content").children(":first").height()-35)/2 }); - adaptWidgetSize(5, 13); + adaptWidgetSize(3, 0); return false; }; diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index b13b7312..57019aac 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -20,6 +20,19 @@ #include "gui/UBFeaturesWidget.h" const QString UBFeaturesController::virtualRootName = "root"; +const QString UBFeaturesController::rootPath = "/" + virtualRootName; + +const QString UBFeaturesController::appPath = rootPath + "/Applications"; +const QString UBFeaturesController::audiosPath = rootPath + "/Audios"; +const QString UBFeaturesController::moviesPath = rootPath + "/Movies"; +const QString UBFeaturesController::picturesPath = rootPath + "/Pictures"; +const QString UBFeaturesController::flashPath = rootPath + "/Animations"; +const QString UBFeaturesController::interactPath = rootPath + "/Interactivities"; +const QString UBFeaturesController::shapesPath = rootPath + "/Shapes"; +const QString UBFeaturesController::trashPath = rootPath + "/Trash"; +const QString UBFeaturesController::favoritePath = rootPath + "/Favorites"; +const QString UBFeaturesController::webSearchPath = rootPath + "/Web search"; + void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet &pFavoriteSet) { @@ -43,7 +56,7 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & if ( fullFileName.contains(".thumbnail.")) continue; - UBFeature testFeature(currVirtualPath, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType); + UBFeature testFeature(currVirtualPath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType); emit sendFeature(testFeature); emit featureSent(); @@ -51,7 +64,7 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & if ( pFavoriteSet.find(QUrl::fromLocalFile(fullFileName)) != pFavoriteSet.end()) { //TODO send favoritePath from the controller or make favoritePath public and static - emit sendFeature(UBFeature( "/root/Favorites", icon, fileName, QUrl::fromLocalFile(fullFileName), featureType)); + emit sendFeature(UBFeature( UBFeaturesController::favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType)); } if (featureType == FEATURE_FOLDER) { @@ -182,14 +195,42 @@ UBFeaturesComputingThread::~UBFeaturesComputingThread() } UBFeature::UBFeature(const QString &url, const QImage &icon, const QString &name, const QUrl &realPath, UBFeatureElementType type) -: virtualDir(url), mThumbnail(icon), mName(name), mPath(realPath), elementType(type) + : mThumbnail(icon), mDisplayName(name), mPath(realPath), elementType(type) { + mName = getNameFromVirtualPath(url); + virtualDir = getVirtualDirFromVirtualPath(url); } UBFeature::~UBFeature() { } +QString UBFeature::getNameFromVirtualPath(const QString &pVirtPath) +{ + QString result; + int slashPos = pVirtPath.lastIndexOf("/"); + if (slashPos != -1) { + result = pVirtPath.right(pVirtPath.count() - slashPos - 1); + } else { + qDebug() << "UBFeature: incorrect virtual path parameter specified"; + } + + return result; +} + +QString UBFeature::getVirtualDirFromVirtualPath(const QString &pVirtPath) +{ + QString result; + int slashPos = pVirtPath.lastIndexOf("/"); + if (slashPos != -1) { + result = pVirtPath.left(slashPos); + } else { + qDebug() << "UBFeature: incorrect virtual path parameter specified"; + } + + return result; +} + QString UBFeature::getUrl() const { if ( elementType == FEATURE_INTERNAL ) @@ -233,20 +274,6 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : ,featuresList(0) ,mLastItemOffsetIndex(0) { - //Initializing virtual structure of the list - rootPath = "/" + virtualRootName; - - appPath = rootPath + "/Applications"; - audiosPath = rootPath + "/Audios"; - moviesPath = rootPath + "/Movies"; - picturesPath = rootPath + "/Pictures"; - flashPath = rootPath + "/Animations"; - interactPath = rootPath + "/Interactivities"; - shapesPath = rootPath + "/Shapes"; - trashPath = rootPath + "/Trash"; - favoritePath = rootPath + "/Favorites"; - webSearchPath = rootPath + "/Web search"; - //Initializing physical directories from UBSettings mUserAudioDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAudioDirectory()); mUserVideoDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userVideoDirectory()); @@ -264,18 +291,18 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : mLibSearchDirectoryPath =QUrl::fromLocalFile(UBSettings::settings()->userSearchDirectory()); trashDirectoryPath = QUrl::fromLocalFile(UBSettings::userTrashDirPath()); - rootElement = UBFeature(QString(), QImage( ":images/libpalette/home.png" ), "root", QUrl()); - audiosElement = UBFeature( rootPath, QImage(":images/libpalette/AudiosCategory.svg"), tr("Audios") , mUserAudioDirectoryPath, FEATURE_CATEGORY); - moviesElement = UBFeature( rootPath, QImage(":images/libpalette/MoviesCategory.svg"), tr("Movies") , mUserVideoDirectoryPath, FEATURE_CATEGORY); - picturesElement = UBFeature( rootPath, QImage(":images/libpalette/PicturesCategory.svg"), tr("Pictures") , mUserPicturesDirectoryPath, FEATURE_CATEGORY); - flashElement = UBFeature( rootPath, QImage(":images/libpalette/FlashCategory.svg"), tr("Animations") , mUserAnimationDirectoryPath, FEATURE_CATEGORY); - interactElement = UBFeature( rootPath, QImage(":images/libpalette/InteractivesCategory.svg"), tr("Interactivities") , mLibInteractiveDirectoryPath, FEATURE_CATEGORY); - applicationsElement = UBFeature( rootPath, QImage(":images/libpalette/ApplicationsCategory.svg"), tr("Applications") , mUserInteractiveDirectoryPath, FEATURE_CATEGORY); - shapesElement = UBFeature( rootPath, QImage(":images/libpalette/ShapesCategory.svg"), tr("Shapes") , mLibShapesDirectoryPath, FEATURE_CATEGORY ); - favoriteElement = UBFeature( rootPath, QImage(":images/libpalette/FavoritesCategory.svg"), tr("Favorites"), QUrl("favorites"), FEATURE_FAVORITE ); - webSearchElement = UBFeature( rootPath, QImage(":images/libpalette/WebSearchCategory.svg"), tr("Web search"), mLibSearchDirectoryPath, FEATURE_CATEGORY); + rootElement = UBFeature(rootPath, QImage( ":images/libpalette/home.png" ), "root", QUrl()); + audiosElement = UBFeature( audiosPath, QImage(":images/libpalette/AudiosCategory.svg"), tr("Audios") , mUserAudioDirectoryPath, FEATURE_CATEGORY); + moviesElement = UBFeature( moviesPath, QImage(":images/libpalette/MoviesCategory.svg"), tr("Movies") , mUserVideoDirectoryPath, FEATURE_CATEGORY); + picturesElement = UBFeature( picturesPath, QImage(":images/libpalette/PicturesCategory.svg"), tr("Pictures") , mUserPicturesDirectoryPath, FEATURE_CATEGORY); + flashElement = UBFeature( flashPath, QImage(":images/libpalette/FlashCategory.svg"), tr("Animations") , mUserAnimationDirectoryPath, FEATURE_CATEGORY); + interactElement = UBFeature( interactPath, QImage(":images/libpalette/InteractivesCategory.svg"), tr("Interactivities") , mLibInteractiveDirectoryPath, FEATURE_CATEGORY); + applicationsElement = UBFeature( appPath, QImage(":images/libpalette/ApplicationsCategory.svg"), tr("Applications") , mUserInteractiveDirectoryPath, FEATURE_CATEGORY); + shapesElement = UBFeature( shapesPath, QImage(":images/libpalette/ShapesCategory.svg"), tr("Shapes") , mLibShapesDirectoryPath, FEATURE_CATEGORY ); + favoriteElement = UBFeature( favoritePath, QImage(":images/libpalette/FavoritesCategory.svg"), tr("Favorites"), QUrl("favorites"), FEATURE_FAVORITE ); + webSearchElement = UBFeature( webSearchPath, QImage(":images/libpalette/WebSearchCategory.svg"), tr("Web search"), mLibSearchDirectoryPath, FEATURE_CATEGORY); - trashElement = UBFeature( rootPath, QImage(":images/libpalette/TrashCategory.svg"), tr("Trash"), trashDirectoryPath, FEATURE_TRASH ); + trashElement = UBFeature( trashPath, QImage(":images/libpalette/TrashCategory.svg"), tr("Trash"), trashDirectoryPath, FEATURE_TRASH); featuresList = new QList (); @@ -340,7 +367,7 @@ void UBFeaturesController::createNpApiFeature(const QString &str) QString widgetName = QFileInfo(str).fileName(); - featuresModel->addItem(UBFeature(QString(appPath+"/Web"), QImage(UBGraphicsWidgetItem::iconFilePath(QUrl::fromLocalFile(str))), widgetName, QUrl::fromLocalFile(str), FEATURE_INTERACTIVE)); + featuresModel->addItem(UBFeature(QString(appPath + "/Web/" + widgetName), QImage(UBGraphicsWidgetItem::iconFilePath(QUrl::fromLocalFile(str))), widgetName, QUrl::fromLocalFile(str), FEATURE_INTERACTIVE)); } void UBFeaturesController::scanFS() @@ -365,9 +392,9 @@ void UBFeaturesController::scanFS() QList tools = UBToolsManager::manager()->allTools(); foreach (UBToolsManager::UBToolDescriptor tool, tools) { - featuresList->append(UBFeature(appPath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL)); + featuresList->append(UBFeature(appPath + "/" + tool.label, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL)); if (favoriteSet->find(QUrl(tool.id)) != favoriteSet->end()) { - featuresList->append(UBFeature(favoritePath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL)); + featuresList->append(UBFeature(favoritePath + "/" + tool.label, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL)); } } } @@ -386,12 +413,12 @@ void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QStrin if ( fullFileName.contains(".thumbnail.")) continue; - UBFeature testFeature(currVirtualPath, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType); + UBFeature testFeature(currVirtualPath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType); featuresList->append(testFeature); if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) { - featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) ); + featuresList->append( UBFeature( favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) ); } if (featureType == FEATURE_FOLDER) { @@ -466,7 +493,7 @@ void UBFeaturesController::addToFavorite( const QUrl &path ) QFileInfo fileInfo( filePath ); QString fileName = fileInfo.fileName(); UBFeatureElementType type = fileTypeFromUrl(fileInfo.absoluteFilePath()); - UBFeature elem(favoritePath, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) ); + UBFeature elem(favoritePath + "/" + fileName, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) ); favoriteSet->insert( path ); saveFavoriteList(); @@ -631,7 +658,7 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de image.save(filePath); QImage thumb = createThumbnail( filePath ); - UBFeature resultItem = UBFeature( dest.getFullVirtualPath(), thumb, mFileName, + UBFeature resultItem = UBFeature( dest.getFullVirtualPath() + "/" + mFileName, thumb, mFileName, QUrl::fromLocalFile( filePath ), FEATURE_ITEM ); featuresModel->addItem(resultItem); @@ -671,10 +698,10 @@ void UBFeaturesController::addNewFolder(QString name) if(!QFileInfo(path).exists()) { QDir().mkpath(path); } - UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath(), QImage(":images/libpalette/folder.svg"), + UBFeature newFeatureFolder = UBFeature( currentElement.getFullVirtualPath() + "/" + name, QImage(":images/libpalette/folder.svg"), name, QUrl::fromLocalFile( path ), FEATURE_FOLDER ); - featuresModel->addItem( newFeatureFolder ); + featuresModel->addItem(newFeatureFolder); featuresProxyModel->invalidate(); } @@ -710,9 +737,9 @@ UBFeature UBFeaturesController::getDestinationFeatureForUrl( const QUrl &url ) void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteArray &pData) { - UBFeature dest = getDestinationFeatureForUrl( sourceUrl ); + UBFeature dest = getDestinationFeatureForUrl(sourceUrl); - if ( dest == UBFeature() ) + if (dest == UBFeature()) return; QString fileName = QFileInfo( sourceUrl.toString() ).fileName(); @@ -724,7 +751,7 @@ void UBFeaturesController::addDownloadedFile(const QUrl &sourceUrl, const QByteA file.write(pData); file.close(); - UBFeature downloadedFeature = UBFeature( dest.getFullVirtualPath(), getIcon( filePath ), + UBFeature downloadedFeature = UBFeature(dest.getFullVirtualPath() + "/" + fileName, getIcon( filePath ), fileName, QUrl::fromLocalFile(filePath), FEATURE_ITEM); if (downloadedFeature != UBFeature()) { featuresModel->addItem(downloadedFeature); @@ -742,7 +769,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu Q_ASSERT( QFileInfo( sourcePath ).exists() ); - UBFeature possibleDest = getDestinationFeatureForUrl( url ); + UBFeature possibleDest = getDestinationFeatureForUrl(url); UBFeature dest = destination; @@ -767,7 +794,7 @@ UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeatu UBFeatureElementType type = FEATURE_ITEM; if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) type = FEATURE_INTERACTIVE; - UBFeature newElement( destVirtualPath, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); + UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); return newElement; } @@ -861,7 +888,7 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu UBFeatureElementType type = FEATURE_ITEM; if (UBFileSystemUtils::mimeTypeFromFileName(newFullPath).contains("application")) type = FEATURE_INTERACTIVE; - UBFeature newElement( destVirtualPath, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); + UBFeature newElement( destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile( newFullPath ), type ); return newElement; } @@ -899,7 +926,7 @@ void UBFeaturesController::moveExternalData(const QUrl &url, const UBFeature &de Q_ASSERT(QFileInfo(newFullPath).exists()); QImage thumb = getIcon(newFullPath, type); - UBFeature newElement(destVirtualPath, thumb, name, QUrl::fromLocalFile(newFullPath), type); + UBFeature newElement(destVirtualPath + "/" + name, thumb, name, QUrl::fromLocalFile(newFullPath), type); featuresModel->addItem(newElement); } diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index 6d57e5d4..92c31224 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -94,6 +94,7 @@ public: // UBFeature(); virtual ~UBFeature(); QString getName() const { return mName; } + QString getDisplayName() const {return mDisplayName;} QImage getThumbnail() const {return mThumbnail;} QString getVirtualPath() const { return virtualDir; } //QString getPath() const { return mPath; }; @@ -112,11 +113,17 @@ public: const QMap & getMetadata() const { return metadata; } void setMetadata( const QMap &data ) { metadata = data; } + +private: + QString getNameFromVirtualPath(const QString &pVirtPath); + QString getVirtualDirFromVirtualPath(const QString &pVirtPath); + private: QString virtualDir; QString virtualPath; QImage mThumbnail; QString mName; + QString mDisplayName; QUrl mPath; UBFeatureElementType elementType; QMap metadata; @@ -182,6 +189,19 @@ public: void assignFeaturesListVeiw(UBFeaturesListView *pList); void assignPathListView(UBFeaturesListView *pList); +public: + static const QString rootPath; + static const QString audiosPath; + static const QString moviesPath; + static const QString picturesPath; + static const QString appPath; + static const QString flashPath; + static const QString shapesPath; + static const QString interactPath; + static const QString trashPath; + static const QString favoritePath; + static const QString webSearchPath; + signals: void maxFilesCountEvaluated(int pLimit); void scanStarted(); @@ -235,17 +255,7 @@ private: QUrl trashDirectoryPath; QUrl mLibSearchDirectoryPath; - QString rootPath; - QString audiosPath; - QString moviesPath; - QString picturesPath; - QString appPath; - QString flashPath; - QString shapesPath; - QString interactPath; - QString trashPath; - QString favoritePath; - QString webSearchPath; + int mLastItemOffsetIndex; UBFeature currentElement; diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 75591e73..d3aed832 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -233,7 +233,7 @@ void UBApplication::setupTranslator(QString forcedLanguage) mApplicationTranslator = new QTranslator(this); mQtGuiTranslator = new QTranslator(this); - mApplicationTranslator->load(UBPlatformUtils::translationPath(QString("sankore_"),language)); + mApplicationTranslator->load(UBPlatformUtils::translationPath(QString("sankore_"),language)); installTranslator(mApplicationTranslator); diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 258c1ff8..6ca9ba87 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -66,8 +66,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) , mDesktopStylusTool(UBDrawingController::drawingController()->stylusTool()) { - mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast(NULL), true); // deleted in UBDesktopAnnotationController::destructor - + mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast(0), true); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); #ifdef Q_WS_MAC mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 78b4725e..78823404 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -259,7 +259,7 @@ void UBFeaturesWidget::onDisplayMetadata( QMap metadata ) }break; } - UBFeature feature( QString(), QImage(previewImageUrl), QString(), metadata["Url"], FEATURE_ITEM ); + UBFeature feature( "/root", QImage(previewImageUrl), QString(), metadata["Url"], FEATURE_ITEM ); feature.setMetadata( metadata ); centralWidget->showElement(feature, UBFeaturesCentralWidget::FeaturePropertiesList); @@ -1080,7 +1080,7 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const return QVariant(); if (role == Qt::DisplayRole) { - return featuresList->at(index.row()).getName(); + return featuresList->at(index.row()).getDisplayName(); } else if (role == Qt::DecorationRole) { @@ -1311,7 +1311,7 @@ void UBFeaturesModel::moveData(const UBFeature &source, const UBFeature &destina } } - UBFeature newElement( destVirtualPath, sourceIcon, name, QUrl::fromLocalFile(destFullPath), sourceType ); + UBFeature newElement( destVirtualPath + "/" + name, sourceIcon, name, QUrl::fromLocalFile(destFullPath), sourceType ); addItem(newElement); if (deleteManualy) { diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 7de10dbf..ca73ec76 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -685,6 +685,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpSessionTitle = new UBTGAdaptableText(0, this, "UBTGSessionTitle"); mpSessionTitle->setPlaceHolderText(tr("Type session title here ...")); mpButtonTitleLayout->addWidget(mpSessionTitle); + connect(this, SIGNAL(resized()), mpSessionTitle, SLOT(onTextChanged())); mpLayout->addLayout(mpButtonTitleLayout); @@ -703,6 +704,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpAuthors->setObjectName("UBTGZeroPageInputText"); mpAuthors->setPlaceHolderText(tr("Type authors here ...")); mpLayout->addWidget(mpAuthors); + connect(this, SIGNAL(resized()), mpAuthors, SLOT(onTextChanged())); mpCreationLabel = new QLabel(this); mpCreationLabel->setObjectName("UBTGZeroPageDateLabel"); @@ -727,6 +729,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpObjectives->setObjectName("UBTGZeroPageInputText"); mpObjectives->setPlaceHolderText(tr("Type objectives here...")); mpLayout->addWidget(mpObjectives); + connect(this, SIGNAL(resized()), mpObjectives, SLOT(onTextChanged())); mpSeparatorObjectives = new QFrame(this); mpSeparatorObjectives->setFixedHeight(UBTG_SEPARATOR_FIXED_HEIGHT); @@ -747,6 +750,7 @@ UBTeacherGuidePageZeroWidget::UBTeacherGuidePageZeroWidget(QWidget* parent, cons mpKeywords = new UBTGAdaptableText(0, this); mpKeywords->setPlaceHolderText(tr("Type keywords here ...")); mpLayout->addWidget(mpKeywords); + connect(this, SIGNAL(resized()), mpKeywords, SLOT(onTextChanged())); mpSchoolLevelItemLabel = new QLabel(this); mpSchoolLevelItemLabel->setObjectName("UBTGZeroPageItemLabel"); @@ -1122,6 +1126,12 @@ bool UBTeacherGuidePageZeroWidget::isModified() return result; } +void UBTeacherGuidePageZeroWidget::resizeEvent(QResizeEvent* ev){ + emit resized(); + + QWidget::resizeEvent(ev); +} + /*************************************************************************** * class UBTeacherGuideWidget * ***************************************************************************/ @@ -1238,3 +1248,4 @@ bool UBTeacherGuideWidget::isModified() else return mpEditionWidget->isModified(); } + diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 1d165f13..a970807e 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -136,11 +136,16 @@ public: QVector getData(); bool isModified(); +signals: + void resized(); public slots: void onActiveSceneChanged(); void switchToMode(tUBTGZeroPageMode mode = tUBTGZeroPageMode_EDITION); +protected: + void resizeEvent(QResizeEvent* ev); + private: void fillComboBoxes(); void loadData(); diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index d9c88efd..55246e99 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -174,6 +174,7 @@ void UBTGAdaptableText::showEvent(QShowEvent* e) if(!mIsUpdatingSize && mHasPlaceHolder && toPlainText().isEmpty()) setPlainText(mPlaceHolderText); else + // If the teacherguide is collapsed, don't updated the size. Or set the size as the expanded size onTextChanged(); } @@ -188,9 +189,12 @@ QString UBTGAdaptableText::text() void UBTGAdaptableText::onTextChanged() { + qDebug() << ">> onTextChanged CALLED!"; qreal documentSize = document()->size().height(); - if(height() == documentSize + mBottomMargin) - return; + qDebug() << ">> documentSize: " << documentSize << ", height: " << height(); + if(height() == documentSize + mBottomMargin){ + return; + } mIsUpdatingSize = true; @@ -208,6 +212,7 @@ void UBTGAdaptableText::onTextChanged() setFocus(); } mIsUpdatingSize = false; + } void UBTGAdaptableText::setInitialText(const QString& text) {