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

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 2150f98a36
  1. 6
      resources/library/applications/GeoInfo.wgt/js/GeoInfo.js
  2. 2
      resources/library/applications/GeoInfo.wgt/js/soapclient.js
  3. 4
      resources/library/search/Image Planete.wgs/css/basic.css
  4. 0
      resources/library/search/Image Planete.wgs/images/down.png
  5. 0
      resources/library/search/Image Planete.wgs/images/greySquare.png
  6. 0
      resources/library/search/Image Planete.wgs/images/icon-close.png
  7. 0
      resources/library/search/Image Planete.wgs/images/popupBack.png
  8. 0
      resources/library/search/Image Planete.wgs/images/search.png
  9. 0
      resources/library/search/Image Planete.wgs/images/search_app.png
  10. 0
      resources/library/search/Image Planete.wgs/images/trgDown.png
  11. 0
      resources/library/search/Image Planete.wgs/images/trgUp.png
  12. 0
      resources/library/search/Image Planete.wgs/images/up.png
  13. 6
      resources/library/search/Image Planete.wgs/index.html
  14. 0
      resources/library/search/Image Planete.wgs/scripts/jquery-1.6.2.min.js
  15. BIN
      resources/library/videos/Sciences/video_bourgeon.flv
  16. BIN
      resources/library/videos/Sciences/video_bourgeon.mpg
  17. 10
      resources/style.qss
  18. 4
      src/adaptors/UBCFFSubsetAdaptor.cpp
  19. 1
      src/adaptors/UBSvgSubsetAdaptor.cpp
  20. 19
      src/board/UBBoardController.cpp
  21. 2
      src/board/UBBoardController.h
  22. 61
      src/board/UBBoardView.cpp
  23. 2
      src/board/UBBoardView.h
  24. 175
      src/board/UBFeaturesController.cpp
  25. 17
      src/board/UBFeaturesController.h
  26. 3
      src/core/UB.h
  27. 35
      src/document/UBDocumentController.cpp
  28. 2
      src/document/UBDocumentController.h
  29. 48
      src/domain/UBAngleWidget.cpp
  30. 25
      src/domain/UBAngleWidget.h
  31. 54
      src/domain/UBGraphicsDelegateFrame.cpp
  32. 5
      src/domain/UBGraphicsDelegateFrame.h
  33. 25
      src/domain/UBGraphicsItemDelegate.cpp
  34. 3
      src/domain/UBGraphicsItemDelegate.h
  35. 19
      src/domain/UBGraphicsMediaItem.cpp
  36. 4
      src/domain/UBGraphicsMediaItem.h
  37. 12
      src/domain/UBGraphicsMediaItemDelegate.cpp
  38. 19
      src/domain/UBGraphicsScene.cpp
  39. 3
      src/domain/UBGraphicsScene.h
  40. 11
      src/domain/UBGraphicsStrokesGroup.cpp
  41. 6
      src/domain/UBGraphicsWidgetItem.cpp
  42. 3
      src/domain/UBGraphicsWidgetItem.h
  43. 2
      src/domain/domain.pri
  44. 7
      src/gui/UBDockPalette.cpp
  45. 2
      src/gui/UBDockPalette.h
  46. 119
      src/gui/UBFeaturesWidget.cpp
  47. 30
      src/gui/UBFeaturesWidget.h
  48. 2
      src/gui/UBRubberBand.cpp
  49. 12
      src/gui/UBTeacherGuideWidget.cpp
  50. 4
      src/gui/UBTeacherGuideWidget.h
  51. 178
      src/gui/UBToolWidget.cpp
  52. 39
      src/gui/UBToolWidget.h
  53. 2
      src/podcast/quicktime/UBAudioQueueRecorder.cpp
  54. 2
      src/podcast/quicktime/UBQuickTimeFile.cpp
  55. 5
      src/web/UBWebController.cpp

@ -106,7 +106,8 @@ function popupInfo(text)
// affiche le text de l'erreur en cas de problème
function erreur(texteErreur)
{
alert(texteErreur);
//alert(texteErreur);
sankore.showMessage(texteErreur);
}
// permet d'appeller la fonction pour recevoir les statistiques du serveur
@ -136,7 +137,8 @@ function recevoirStatsReponse(resultat, soapResponse)
+ "\n"
+ "Version de l'application: " + objDomTree.getElements("env:Body")[0].getElements("ser:getInfosResponse")[0].getElements("GeoStats")[0].getElements("version")[0].getText());
alert(stats);
//alert(stats);
sankore.showMessage(stats);
}
// permet d'appeller la fonction pour recevoir les informations du pays

@ -155,7 +155,7 @@ SOAPClient._onLoadWsdl = function(url, method, parameters, async, callback, req)
}
SOAPClient._sendSoapRequest = function(url, method, parameters, async, callback, wsdl)
{
alert();
//alert();
// get namespace
var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;
// build SOAP request

@ -154,6 +154,10 @@ a {
vertical-align: top;
}
.imgContainer img{
max-width: 150px;
max-height:150px;
}
.filterContainer{
float: left;

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 931 B

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 475 B

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -8,7 +8,7 @@
<script type="text/javascript">
var category = "image";
var thumbnails = true;
var minHeight = 180;
var minHeight = 150;
var minWidth = 150;
var currentIndex = 0;
@ -78,12 +78,12 @@
// There is also a result.file property which has the escaped version
if (thumbnails) {
newImg.src = result.file;
if(result.height >= result.width)
/*if(result.height >= result.width)
newImg.height = minHeight;
else{
newImg.width = minWidth;
//newImg.style.margin = (120 - result.height)/2 + "px 0";
}
}*/
} else {
newImg.src = "./images/thumbnail_icon.png";
}

@ -70,6 +70,16 @@ QLabel#UBTGMediaDropMeLabel
padding: 2px;
}
QComboBox#DockPaletteWidgetComboBox QAbstractItemView
{
background-color: white;
color: black;
selection-background-color: lightgreen;
selection-color: black;
}
QComboBox#DockPaletteWidgetComboBox
{
background: white;

@ -1049,10 +1049,6 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite
QTransform rTransform;
QPointF newVector = rTransform.map(oldVector);
QRectF sr = mCurrentScene->sceneRect();
QRectF sr1 = mCurrentSceneRect;
QRectF sr2 = mCurrentScene->normalizedSceneRect();
QTransform tr = item->sceneTransform();
item->setTransform(rTransform.scale(fullScaleX, fullScaleY), true);
tr = item->sceneTransform();

@ -591,6 +591,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
if(strokesGroup){
polygonItem->setTransform(strokesGroup->transform());
strokesGroup->addToGroup(polygonItem);
polygonItem->setStrokesGroup(strokesGroup);
}
}else{
mScene->addItem(polygonItem);

@ -544,7 +544,8 @@ void UBBoardController::duplicateItem(UBItem *item)
QGraphicsItem *commonItem = dynamic_cast<QGraphicsItem*>(item);
if (commonItem)
{
itemPos = commonItem->pos();
qreal shifting = UBSettings::settings()->objectFrameWidth;
itemPos = commonItem->pos() + QPointF(shifting,shifting);
itemSize = commonItem->boundingRect().size();
}
@ -612,6 +613,10 @@ void UBBoardController::duplicateItem(UBItem *item)
{
createdItem->setSourceUrl(item->sourceUrl());
item->copyItemParameters(createdItem);
QGraphicsItem *createdGitem = dynamic_cast<QGraphicsItem*>(createdItem);
if (createdGitem)
createdGitem->setPos(itemPos);
}
}
@ -954,12 +959,12 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
if (!pSuccess)
{
UBApplication::showMessage(tr("Downloading content %1 failed").arg(sourceUrl.toString()));
showMessage(tr("Downloading content %1 failed").arg(sourceUrl.toString()));
return NULL;
}
if (!sourceUrl.toString().startsWith("file://") && !sourceUrl.toString().startsWith("uniboardTool://"))
UBApplication::showMessage(tr("Download finished"));
showMessage(tr("Download finished"));
if (UBMimeType::RasterImage == itemMimeType)
{
@ -1237,7 +1242,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
}
else
{
UBApplication::showMessage(tr("Unknown tool type %1").arg(sourceUrl.toString()));
showMessage(tr("Unknown tool type %1").arg(sourceUrl.toString()));
}
}
else if (sourceUrl.toString().contains("edumedia-sciences.com"))
@ -1292,7 +1297,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
}
else
{
UBApplication::showMessage(tr("Unknown content type %1").arg(pContentTypeHeader));
showMessage(tr("Unknown content type %1").arg(pContentTypeHeader));
qWarning() << "ignoring mime type" << pContentTypeHeader ;
}
@ -1484,8 +1489,12 @@ void UBBoardController::boardViewResized(QResizeEvent* event)
mControlView->centerOn(0,0);
if (mDisplayView)
mDisplayView->centerOn(0,0);
mPaletteManager->containerResized();
UBApplication::boardController->controlView()->scene()->moveMagnifier();
}

@ -193,7 +193,7 @@ class UBBoardController : public UBDocumentContainer
UBItem *downloadFinished(bool pSuccess, QUrl sourceUrl, QString pHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground = false);
void changeBackground(bool isDark, bool isCrossed);
void setToolCursor(int tool);
void showMessage(const QString& message, bool showSpinningWheel);
void showMessage(const QString& message, bool showSpinningWheel = false);
void hideMessage();
void setDisabled(bool disable);
void setColorIndex(int pColorIndex);

@ -71,6 +71,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent)
, suspendedMousePressEvent(NULL)
, mLongPressInterval(1000)
, mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false)
{
init ();
@ -86,6 +87,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int p
, suspendedMousePressEvent(NULL)
, mLongPressInterval(1000)
, mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false)
{
init ();
@ -206,6 +208,11 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
mController->addScene ();
break;
}
case Qt::Key_Control:
case Qt::Key_Shift:
{
mMultipleSelectionIsEnabled = true;
}break;
}
@ -266,6 +273,21 @@ UBBoardView::keyPressEvent (QKeyEvent *event)
}
}
void UBBoardView::keyReleaseEvent(QKeyEvent *event)
{
// if (!event->isAccepted ())
{
if (Qt::Key_Shift == event->key()
||Qt::Key_Control == event->key())
{
mMultipleSelectionIsEnabled = false;
}
}
QGraphicsView::keyReleaseEvent(event);
}
bool
UBBoardView::event (QEvent * e)
{
@ -424,7 +446,10 @@ bool UBBoardView::itemShouldReceiveMousePressEvent(QGraphicsItem *item)
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool();
if ((currentTool == UBStylusTool::Play) && UBGraphicsGroupContainerItem::Type == movingItem->type())
return movingItem == NULL;
{
movingItem = NULL;
return false;
}
switch(item->type())
{
@ -532,11 +557,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
return true;
case UBGraphicsTextItem::Type:
return !item->isSelected();
default:
return false;
}
return false;
}
@ -577,7 +598,8 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
if (movingItem && QGraphicsSvgItem::Type != movingItem->type()
&& UBGraphicsDelegateFrame::Type != movingItem->type())
&& UBGraphicsDelegateFrame::Type != movingItem->type()
&& !mMultipleSelectionIsEnabled)
{
foreach(QGraphicsItem *item, scene()->selectedItems())
{
@ -588,6 +610,9 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event)
}
}
if (mMultipleSelectionIsEnabled)
return;
if (itemShouldReceiveMousePressEvent(movingItem))
QGraphicsView::mousePressEvent (event);
else
@ -945,6 +970,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (currentTool == UBStylusTool::Selector)
{
bool bReleaseIsNeed = true;
if (mWidgetMoved)
{
mWidgetMoved = false;
@ -962,18 +988,34 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
else
{
if ( QGraphicsSvgItem::Type != movingItem->type()
&& UBGraphicsDelegateFrame::Type != movingItem->type())
if (QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBToolWidget::Type != movingItem->type())
{
bReleaseIsNeed = false;
if (movingItem->isSelected() && mMultipleSelectionIsEnabled)
movingItem->setSelected(false);
else
{
if (movingItem->isSelected())
bReleaseIsNeed = true;
movingItem->setSelected(true);
}
}
}
}
if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide();
}
if (bReleaseIsNeed)
{
QGraphicsView::mouseReleaseEvent (event);
}
}
else if (currentTool == UBStylusTool::Play)
{
if (mWidgetMoved)
@ -990,9 +1032,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
delete suspendedMousePressEvent;
suspendedMousePressEvent = NULL;
}
QGraphicsView::mouseReleaseEvent (event);
}
QGraphicsView::mouseReleaseEvent (event);
}
else if (currentTool == UBStylusTool::Text)
{

@ -65,6 +65,7 @@ class UBBoardView : public QGraphicsView
virtual bool event (QEvent * e);
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void tabletEvent(QTabletEvent * event);
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
@ -145,6 +146,7 @@ class UBBoardView : public QGraphicsView
QTimer mLongPressTimer;
bool mIsDragInProgress;
bool mMultipleSelectionIsEnabled;
private slots:

@ -21,7 +21,7 @@
const QString UBFeaturesController::virtualRootName = "root";
void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath)
void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet)
{
Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
@ -47,27 +47,29 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString &
emit sendFeature(testFeature);
emit featureSent();
emit scanPath(fullFileName);
// featuresList->append(testFeature);
// if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) {
// featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) );
// }
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));
}
if (featureType == FEATURE_FOLDER) {
scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName);
scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName, pFavoriteSet);
}
}
}
void UBFeaturesComputingThread::scanAll(QList<QPair<QUrl, QString> > pScanningData)
void UBFeaturesComputingThread::scanAll(QList<QPair<QUrl, QString> > pScanningData, const QSet<QUrl> &pFavoriteSet)
{
for (int i = 0; i < pScanningData.count(); i++) {
if (abort) {
return;
}
QPair<QUrl, QString> curPair = pScanningData.at(i);
scanFS(curPair.first, curPair.second);
emit scanCategory(UBFeaturesController::categoryNameForVirtualPath(curPair.second));
scanFS(curPair.first, curPair.second, pFavoriteSet);
}
}
@ -84,8 +86,6 @@ int UBFeaturesComputingThread::featuresCount(const QUrl &pPath)
if (featureType != FEATURE_INVALID && !fullFileName.contains(".thumbnail.")) {
noItems++;
} else {
continue;
}
if (featureType == FEATURE_FOLDER) {
@ -114,11 +114,12 @@ QThread(parent)
abort = false;
}
void UBFeaturesComputingThread::compute(const QList<QPair<QUrl, QString> > &pScanningData)
void UBFeaturesComputingThread::compute(const QList<QPair<QUrl, QString> > &pScanningData, QSet<QUrl> *pFavoritesSet)
{
QMutexLocker curLocker(&mMutex);
mScanningData = pScanningData;
mFavoriteSet = *pFavoritesSet;
if (!isRunning()) {
start(LowPriority);
@ -135,6 +136,7 @@ void UBFeaturesComputingThread::run()
mMutex.lock();
QList<QPair<QUrl, QString> > searchData = mScanningData;
QSet<QUrl> favoriteSet = mFavoriteSet;
mMutex.unlock();
if (abort) {
@ -152,7 +154,7 @@ void UBFeaturesComputingThread::run()
emit maxFilesCountEvaluated(fsCnt);
emit scanStarted();
scanAll(searchData);
scanAll(searchData, favoriteSet);
emit scanFinished();
mMutex.lock();
@ -213,6 +215,9 @@ bool UBFeature::isFolder() const
bool UBFeature::isDeletable() const
{
return elementType == FEATURE_ITEM
|| elementType == FEATURE_AUDIO
|| elementType == FEATURE_VIDEO
|| elementType == FEATURE_IMAGE
|| elementType == FEATURE_FOLDER;
}
@ -238,6 +243,7 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
shapesPath = rootPath + "/Shapes";
trashPath = rootPath + "/Trash";
favoritePath = rootPath + "/Favorites";
webSearchPath = rootPath + "/Web search";
//Initializing physical directories from UBSettings
mUserAudioDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAudioDirectory());
@ -295,11 +301,10 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
connect(&mCThread, SIGNAL(scanStarted()), this, SIGNAL(scanStarted()));
connect(&mCThread, SIGNAL(scanFinished()), this, SIGNAL(scanFinished()));
connect(&mCThread, SIGNAL(maxFilesCountEvaluated(int)), this, SIGNAL(maxFilesCountEvaluated(int)));
//Very unsafe function. Considering using deleteLater() instead
// connect(qApp, SIGNAL(aboutToQuit()), &mCThread, SLOT(terminate()));
connect(&mCThread, SIGNAL(scanCategory(QString)), this, SIGNAL(scanCategory(QString)));
connect(&mCThread, SIGNAL(scanPath(QString)), this, SIGNAL(scanPath(QString)));
QTimer::singleShot(0, this, SLOT(startThread()));
// startThread();
}
void UBFeaturesController::startThread()
@ -323,7 +328,7 @@ void UBFeaturesController::startThread()
<< QPair<QUrl, QString>(trashDirectoryPath, trashPath)
<< QPair<QUrl, QString>(mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
mCThread.compute(computingData);
mCThread.compute(computingData, favoriteSet);
}
void UBFeaturesController::scanFS()
@ -342,6 +347,7 @@ void UBFeaturesController::scanFS()
<< webSearchElement
<< trashElement;
//filling favoriteList
loadFavoriteList();
QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools();
@ -352,52 +358,7 @@ void UBFeaturesController::scanFS()
featuresList->append(UBFeature(favoritePath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL));
}
}
QTime time = QTime::currentTime();
//Claudio:
// don't change the order of the scans
// fileSystemScan( mLibAudiosDirectoryPath, audiosPath);
// fileSystemScan( mLibVideosDirectoryPath, moviesPath);
// fileSystemScan( mLibAnimationsDirectoryPath, flashPath);
// fileSystemScan( mLibPicturesDirectoryPath, picturesPath );
// fileSystemScan( mUserInteractiveDirectoryPath, appPath );
// fileSystemScan( mUserAudioDirectoryPath, audiosPath );
// fileSystemScan( mUserPicturesDirectoryPath, picturesPath );
// fileSystemScan( mUserVideoDirectoryPath, moviesPath );
// fileSystemScan( mUserAnimationDirectoryPath, flashPath );
// fileSystemScan( mLibApplicationsDirectoryPath, appPath );
// fileSystemScan( mLibShapesDirectoryPath, shapesPath );
// fileSystemScan( mLibInteractiveDirectoryPath, interactPath );
// fileSystemScan( trashDirectoryPath, trashPath );
// fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
int i =0;
i += featuresCount(mLibAudiosDirectoryPath);
i += featuresCount(mLibVideosDirectoryPath);
i += featuresCount(mLibAnimationsDirectoryPath);
i += featuresCount(mLibPicturesDirectoryPath);
i += featuresCount(mUserInteractiveDirectoryPath);
i += featuresCount(mUserAudioDirectoryPath);
i += featuresCount(mUserPicturesDirectoryPath);
i += featuresCount(mUserVideoDirectoryPath);
i += featuresCount(mUserAnimationDirectoryPath);
i += featuresCount(mLibApplicationsDirectoryPath);
i += featuresCount(mLibShapesDirectoryPath);
i += featuresCount(mLibInteractiveDirectoryPath);
i += featuresCount(trashDirectoryPath);
i += featuresCount(mLibSearchDirectoryPath);
int msecs = QTime(time).msecsTo(QTime::currentTime());
qDebug() << "Loading library" << msecs << "msecs\nNumber of elements" << i;
// emit TopIndexingLimitSet(i);
// emit indexingProgressValueChanged(i / 4);
}
void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QString & currVirtualPath)
{
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());
@ -492,7 +453,8 @@ void UBFeaturesController::addToFavorite( const QUrl &path )
{
QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName();
UBFeature elem(favoritePath, getIcon( filePath, FEATURE_CATEGORY ), fileName, path, fileTypeFromUrl(filePath) );
UBFeatureElementType type = fileTypeFromUrl(fileInfo.absoluteFilePath());
UBFeature elem(favoritePath, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) );
favoriteSet->insert( path );
saveFavoriteList();
@ -535,7 +497,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path
QString fileName = fileInfo.fileName();
QString mimeString = UBFileSystemUtils::mimeTypeFromFileName(fileName);
UBFeatureElementType fileType = fileInfo.isDir() ? FEATURE_FOLDER : FEATURE_ITEM;
UBFeatureElementType fileType = FEATURE_INVALID;
if ( mimeString.contains("application")) {
if (mimeString.contains("application/search")) {
@ -545,6 +507,16 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path
}
} else if ( path.contains("uniboardTool://")) {
fileType = FEATURE_INTERNAL;
} else if (mimeString.contains("audio")) {
fileType = FEATURE_AUDIO;
} else if (mimeString.contains("video")) {
fileType = FEATURE_VIDEO;
} else if (mimeString.contains("image")) {
fileType = FEATURE_IMAGE;
} else if (fileInfo.isDir()) {
fileType = FEATURE_FOLDER;
} else {
fileType = FEATURE_INVALID;
}
return fileType;
@ -554,64 +526,65 @@ QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType p
{
if (pFType == FEATURE_FOLDER) {
return QImage(":images/libpalette/folder.svg");
} else if (pFType == FEATURE_INTERACTIVE) {
} else if (pFType == FEATURE_INTERACTIVE || pFType == FEATURE_SEARCH) {
return QImage(UBGraphicsWidgetItem::iconFilePath(QUrl::fromLocalFile(path)));
}
if ( path.contains("uniboardTool://") ) {
} else if (pFType == FEATURE_INTERNAL) {
return QImage(UBToolsManager::manager()->iconFromToolId(path));
} if ( UBFileSystemUtils::mimeTypeFromFileName(path).contains("application")) {
return QImage( UBGraphicsWidgetItem::iconFilePath( QUrl::fromLocalFile(path) ) );
} else if (pFType == FEATURE_AUDIO) {
return QImage(":images/libpalette/soundIcon.svg");
} else if (pFType == FEATURE_VIDEO) {
return QImage(":images/libpalette/movieIcon.svg");
} else if (pFType == FEATURE_IMAGE) {
QImage pix(path);
if (pix.isNull()) {
pix = QImage(":images/libpalette/notFound.png");
} else {
pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()));
}
return pix;
}
QImage thumb;
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path);
if ( QFileInfo( thumbnailPath ).exists() )
thumb = QImage( thumbnailPath );
else thumb = createThumbnail( path );
return thumb;
return QImage(":images/libpalette/notFound.png");
}
bool UBFeaturesController::isDeletable( const QUrl &url )
{
UBFeatureElementType type = fileTypeFromUrl(fileNameFromUrl(url));
return type == FEATURE_ITEM;
return type == FEATURE_AUDIO
|| type == FEATURE_VIDEO
|| type == FEATURE_IMAGE
|| type == FEATURE_ITEM;
}
QString UBFeaturesController::categoryNameForVirtualPath(const QString &str)
{
QString result;
int ind = str.lastIndexOf("/");
if (ind != -1) {
result = str.right(str.count() - ind - 1);
}
return result;
}
QImage UBFeaturesController::createThumbnail(const QString &path)
{
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path);
QString thumbnailPath = path;
QString mimetype = UBFileSystemUtils::mimeTypeFromFileName(path);
QString extension = QFileInfo(path).completeSuffix();
if ( mimetype.contains("audio" ))
if ( mimetype.contains("audio" )) {
thumbnailPath = ":images/libpalette/soundIcon.svg";
else if ( mimetype.contains("video") )
} else if ( mimetype.contains("video")) {
thumbnailPath = ":images/libpalette/movieIcon.svg";
else
{
if ( extension.startsWith("svg", Qt::CaseInsensitive) || extension.startsWith("svgz", Qt::CaseInsensitive) )
{
thumbnailPath = path;
}
else
{
} else {
QImage pix(path);
if (!pix.isNull())
{
if (!pix.isNull()) {
pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()), Qt::SmoothTransformation);
pix.save(thumbnailPath);
UBPlatformUtils::hideFile(thumbnailPath);
}
else{
return pix;
} else {
thumbnailPath = ":images/libpalette/notFound.png";
}
}
}
return QImage(thumbnailPath);

@ -33,7 +33,7 @@ class UBFeaturesComputingThread : public QThread
public:
explicit UBFeaturesComputingThread(QObject *parent = 0);
virtual ~UBFeaturesComputingThread();
void compute(const QList<QPair<QUrl, QString> > &pScanningData);
void compute(const QList<QPair<QUrl, QString> > &pScanningData, QSet<QUrl> *pFavoritesSet);
protected:
void run();
@ -44,12 +44,14 @@ signals:
void scanStarted();
void scanFinished();
void maxFilesCountEvaluated(int max);
void scanCategory(const QString &str);
void scanPath(const QString &str);
public slots:
private:
void scanFS(const QUrl & currentPath, const QString & currVirtualPath);
void scanAll(QList<QPair<QUrl, QString> > pScanningData);
void scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet);
void scanAll(QList<QPair<QUrl, QString> > pScanningData, const QSet<QUrl> &pFavoriteSet);
int featuresCount(const QUrl &pPath);
int featuresCountAll(QList<QPair<QUrl, QString> > pScanningData);
@ -59,6 +61,7 @@ private:
QUrl mScanningPath;
QString mScanningVirtualPath;
QList<QPair<QUrl, QString> > mScanningData;
QSet<QUrl> mFavoriteSet;
bool restart;
bool abort;
};
@ -72,6 +75,9 @@ enum UBFeatureElementType
FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
FEATURE_ITEM,
FEATURE_AUDIO,
FEATURE_VIDEO,
FEATURE_IMAGE,
FEATURE_TRASH,
FEATURE_FAVORITE,
FEATURE_SEARCH,
@ -107,6 +113,7 @@ public:
private:
QString virtualDir;
QString virtualPath;
QImage mThumbnail;
QString mName;
QUrl mPath;
@ -167,6 +174,7 @@ public:
static QImage getIcon( const QString &path, UBFeatureElementType pFType );
static bool isDeletable( const QUrl &url );
static char featureTypeSplitter() {return ':';}
static QString categoryNameForVirtualPath(const QString &str);
static const QString virtualRootName;
@ -178,6 +186,8 @@ signals:
void scanStarted();
void scanFinished();
void featureAddedFromThread();
void scanCategory(const QString &);
void scanPath(const QString &);
private slots:
void addNewFolder(QString name);
@ -233,6 +243,7 @@ private:
QString interactPath;
QString trashPath;
QString favoritePath;
QString webSearchPath;
int mLastItemOffsetIndex;
UBFeature currentElement;

@ -142,7 +142,8 @@ struct UBGraphicsItemType
TriangleItemType,
MagnifierItemType,
cacheItemType,
groupContainerType
groupContainerType,
ToolWidgetItemType
};
};

@ -385,7 +385,12 @@ void UBDocumentController::setupViews()
mDocumentUI->thumbnailWidget->setBackgroundBrush(UBSettings::documentViewLightColor);
#ifdef Q_WS_MACX
mMessageWindow = new UBMessageWindow(NULL);
#else
mMessageWindow = new UBMessageWindow(mDocumentUI->thumbnailWidget);
#endif
mMessageWindow->hide();
}
@ -623,7 +628,7 @@ void UBDocumentController::deleteSelectedItem()
toBeDeleted << proxyTi;
}
UBApplication::showMessage(tr("Emptying trash"));
showMessage(tr("Emptying trash"));
for (int i = 0; i < toBeDeleted.count(); i++)
{
@ -633,7 +638,7 @@ void UBDocumentController::deleteSelectedItem()
UBPersistenceManager::persistenceManager()->deleteDocument(proxyTi->proxy());
}
UBApplication::showMessage(tr("Emptied trash"));
showMessage(tr("Emptied trash"));
QApplication::restoreOverrideCursor();
mMainWindow->actionDelete->setEnabled(false);
@ -683,7 +688,7 @@ void UBDocumentController::deleteSelectedItem()
{
UBDocumentProxyTreeItem* proxyTi = toBeDeleted.at(i);
UBApplication::showMessage(QString("Deleting %1").arg(proxyTi->proxy()->metaData(UBSettings::documentName).toString()));
showMessage(QString("Deleting %1").arg(proxyTi->proxy()->metaData(UBSettings::documentName).toString()));
// Move document to trash
QString oldGroupName = proxyTi->proxy()->metaData(UBSettings::documentGroupName).toString();
proxyTi->proxy()->setMetaData(UBSettings::documentGroupName, UBSettings::trashedDocumentGroupNamePrefix + oldGroupName);
@ -693,7 +698,7 @@ void UBDocumentController::deleteSelectedItem()
mTrashTi->addChild(proxyTi);
proxyTi->setFlags(proxyTi->flags() ^ Qt::ItemIsEditable);
UBApplication::showMessage(QString("%1 deleted").arg(groupTi->groupName()));
showMessage(QString("%1 deleted").arg(groupTi->groupName()));
}
// dont remove default group
@ -732,7 +737,7 @@ void UBDocumentController::exportDocument()
}
else
{
UBApplication::showMessage(tr("No document selected!"));
showMessage(tr("No document selected!"));
}
}
@ -917,7 +922,7 @@ void UBDocumentController::importFile()
if (groupName == UBSettings::defaultDocumentGroupName || fileInfo.suffix() != "ubz")
groupName = "";
UBApplication::showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true);
showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true);
createdDocument = docManager->importFile(selectedFile, groupName);
@ -927,7 +932,7 @@ void UBDocumentController::importFile()
}
else
{
UBApplication::showMessage(tr("Failed to import file ... "));
showMessage(tr("Failed to import file ... "));
}
}
@ -958,7 +963,7 @@ void UBDocumentController::addFolderOfImages()
if (importedImageNumber == 0)
{
UBApplication::showMessage(tr("Folder does not contain any image files!"));
showMessage(tr("Folder does not contain any image files!"));
UBApplication::applicationController->showDocument();
}
else
@ -1003,7 +1008,7 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
QApplication::processEvents();
QFile selectedFile(filePath);
UBApplication::showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true);
showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true);
success = UBDocumentManager::documentManager()->addFileToDocument(document, selectedFile);
@ -1014,7 +1019,7 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
}
else
{
UBApplication::showMessage(tr("Failed to import file ... "));
showMessage(tr("Failed to import file ... "));
}
}
@ -1381,14 +1386,20 @@ bool UBDocumentController::isOKToOpenDocument(UBDocumentProxy* proxy)
void UBDocumentController::showMessage(const QString& message, bool showSpinningWheel)
{
if (mMessageWindow)
{
int margin = UBSettings::boardMargin;
QRect newSize = mDocumentUI->thumbnailWidget->geometry();
if (mMessageWindow)
{
#ifdef Q_WS_MACX
QPoint point(newSize.left() + margin, newSize.bottom() - mMessageWindow->height() - margin);
mMessageWindow->move(mDocumentUI->thumbnailWidget->mapToGlobal(point));
#else
mMessageWindow->move(margin, newSize.height() - mMessageWindow->height() - margin);
#endif
mMessageWindow->showMessage(message, showSpinningWheel);
}
}

@ -71,7 +71,7 @@ class UBDocumentController : public UBDocumentContainer
void selectDocument(UBDocumentProxy* proxy, bool setAsCurrentDocument = true);
void show();
void hide();
void showMessage(const QString& message, bool showSpinningWheel);
void showMessage(const QString& message, bool showSpinningWheel = false);
void hideMessage();
void toggleDocumentToolsPalette();
void cut();

@ -1,48 +0,0 @@
#include "UBAngleWidget.h"
#include <QPainter>
#include "core/memcheck.h"
UBAngleWidget::UBAngleWidget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(45,30);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
this->setAttribute(Qt::WA_TranslucentBackground);
QImage mask_img(width(), height(), QImage::Format_Mono);
mask_img.fill(0xff);
QPainter mask_ptr(&mask_img);
mask_ptr.setBrush( QBrush( QColor(0, 0, 0) ) );
mask_ptr.drawRoundedRect(0,0,this->geometry().width() - 6,this->geometry().height() - 6,1,1);
bmpMask = QBitmap::fromImage(mask_img);
this->setMask(bmpMask);
}
UBAngleWidget::~UBAngleWidget()
{
}
void UBAngleWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
this->move(this->cursor().pos().x(), this->cursor().pos().y() - 30);
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QBrush brush(Qt::white);
painter.setBrush(brush);
painter.drawRoundedRect(1,1,this->geometry().width() - 10,this->geometry().height() - 10,1,1);
painter.setPen(QColor(85,50,127));
painter.setFont(QFont("Arial", 10));
painter.drawText(1,1,this->geometry().width() - 10,this->geometry().height() - 10, Qt::AlignCenter, text);
}
void UBAngleWidget::setText(QString newText)
{
text = newText;
text.append(QChar(176));
}

@ -1,25 +0,0 @@
#ifndef UBANGLEWIDGET_H
#define UBANGLEWIDGET_H
#include <QWidget>
#include <QBitmap>
class UBAngleWidget : public QWidget
{
Q_OBJECT
public:
UBAngleWidget(QWidget *parent = 0);
~UBAngleWidget();
void setText(QString);
protected:
void paintEvent(QPaintEvent *event);
private:
QString text;
QBitmap bmpMask;
};
#endif // UBANGLEWIDGET_H

@ -21,6 +21,9 @@
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "board/UBBoardController.h"
#include "board/UBBoardView.h"
#include "domain/UBGraphicsItemDelegate.h"
#include "domain/UBGraphicsScene.h"
#include "domain/UBGraphicsProxyWidget.h"
@ -90,14 +93,11 @@ UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelega
positionHandles();
this->setAcceptHoverEvents(true);
angleWidget = new UBAngleWidget();
}
UBGraphicsDelegateFrame::~UBGraphicsDelegateFrame()
{
delete angleWidget;
// NOOP
}
@ -226,10 +226,46 @@ void UBGraphicsDelegateFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
mInitialTransform = buildTransform();
mCurrentTool = toolFromPos(event->pos());
setCursorFromAngle(QString(""));
event->accept();
}
void UBGraphicsDelegateFrame::setCursorFromAngle(QString angle)
{
if (mCurrentTool == Rotate)
{
QWidget *controlViewport = UBApplication::boardController->controlView()->viewport();
QSize cursorSize(45,30);
QImage mask_img(cursorSize, QImage::Format_Mono);
mask_img.fill(0xff);
QPainter mask_ptr(&mask_img);
mask_ptr.setBrush( QBrush( QColor(0, 0, 0) ) );
mask_ptr.drawRoundedRect(0,0, cursorSize.width()-1, cursorSize.height()-1, 6, 6);
QBitmap bmpMask = QBitmap::fromImage(mask_img);
QPixmap pixCursor(cursorSize);
pixCursor.fill(QColor(Qt::white));
QPainter painter(&pixCursor);
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
painter.setBrush(QBrush(Qt::white));
painter.setPen(QPen(QColor(Qt::black)));
painter.drawRoundedRect(1,1,cursorSize.width()-2,cursorSize.height()-2,6,6);
painter.setFont(QFont("Arial", 10));
painter.drawText(1,1,cursorSize.width(),cursorSize.height(), Qt::AlignCenter, angle.append(QChar(176)));
painter.end();
pixCursor.setMask(bmpMask);
controlViewport->setCursor(pixCursor);
}
}
bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qreal scaleFactor)
{
bool res = false;
@ -427,12 +463,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
if (!angleWidget->isVisible())
angleWidget->show();
angleWidget->setText(QString::number((int)mAngle % 360));
angleWidget->update();
setCursorFromAngle(QString::number((int)mAngle % 360));
}
else if (moving())
{
@ -525,9 +556,6 @@ QTransform UBGraphicsDelegateFrame::buildTransform()
void UBGraphicsDelegateFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (angleWidget->isVisible())
angleWidget->hide();
updateResizeCursors();
mDelegate->commitUndoStep();

@ -18,7 +18,6 @@
#include <QtGui>
#include "core/UB.h"
#include "domain/UBAngleWidget.h"
class QGraphicsSceneMouseEvent;
class UBGraphicsItemDelegate;
@ -65,6 +64,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
inline bool resizingTop () const { return mCurrentTool == ResizeTop; }
inline bool rotating () const { return mCurrentTool == Rotate; }
inline bool moving () const { return mCurrentTool == Move; }
void setCursorFromAngle(QString angle);
bool canResizeBottomRight(qreal width, qreal height, qreal scaleFactor);
QTransform buildTransform ();
@ -120,8 +120,5 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
bool mResizing;
bool mMirroredXAtStart;
bool mMirroredYAtStart;
UBAngleWidget *angleWidget;
};
#endif /* UBGRAPHICSDELEGATEFRAME_H_ */

@ -418,10 +418,6 @@ bool UBGraphicsItemDelegate::isLocked()
void UBGraphicsItemDelegate::duplicate()
{
// TODO UB 4.x .. rewrite .. .this is absurde ... we know what we are duplicating
UBApplication::boardController->copy();
UBApplication::boardController->paste();
UBApplication::boardController->duplicateItem(dynamic_cast<UBItem*>(delegated()));
}
@ -1134,6 +1130,7 @@ DelegateMediaControl::DelegateMediaControl(UBGraphicsMediaItem* pDelegated, QGra
, mCurrentTimeInMs(0)
, mTotalTimeInMs(0)
, mStartWidth(200)
, mSeecAreaBorderHeight(0)
{
setAcceptedMouseButtons(Qt::LeftButton);
setBrush(QBrush(Qt::white));
@ -1157,13 +1154,14 @@ void DelegateMediaControl::paint(QPainter *painter,
mLCDTimerArea.setHeight(rect().height());
mLCDTimerArea.setWidth(rect().height());
mSeecArea = rect();
mSeecArea.setWidth(rect().width()-mLCDTimerArea.width()-2);
mSeecArea.setHeight(rect().height()-2*mSeecAreaBorderHeight);
mSeecArea.setY(mSeecAreaBorderHeight);
path.addRoundedRect(mSeecArea, mSeecArea.height()/2, mSeecArea.height()/2);
painter->fillPath(path, brush());
qreal frameWidth = rect().height() / 2;
qreal frameWidth = mSeecArea.height() / 2;
int position = frameWidth;
if (mTotalTimeInMs > 0)
@ -1173,7 +1171,7 @@ void DelegateMediaControl::paint(QPainter *painter,
int clearance = 2;
int radius = frameWidth-clearance;
QRectF r(position - radius, clearance, radius * 2, radius * 2);
QRectF r(position - radius, clearance+mSeecAreaBorderHeight, radius * 2, radius * 2);
painter->setBrush(UBSettings::documentViewLightColor);
painter->drawEllipse(r);
@ -1193,18 +1191,17 @@ void DelegateMediaControl::positionHandles()
mLCDTimerArea.setHeight(parentItem()->boundingRect().height());
lcdTimer->setRect(mLCDTimerArea);
lcdTimer->setPos(mSeecArea.width()-mLCDTimerArea.width(),0);
//lcdTimer->setRect(mLCDTimerArea);
//lcdTimer->setPos(mSeecArea.width()-mLCDTimerArea.width(),0);
mSeecArea.setWidth(rect().width()-mLCDTimerArea.width());
mSeecAreaBorderHeight = rect().height()/20;
mSeecArea.setWidth(rect().width()-mLCDTimerArea.width()-2);
mSeecArea.setHeight(rect().height()-2*mSeecAreaBorderHeight);
mSeecArea.setY(mSeecAreaBorderHeight);
QRectF selfRect = rect();
selfRect.setHeight(parentItem()->boundingRect().height());
setRect(selfRect);
lcdTimer->setPos(rect().width() - mLCDTimerArea.width(), 0);
//lcdTimer->setPos(rect().width() - mLCDTimerArea.width(), 0);
}
void DelegateMediaControl::update()
@ -1212,7 +1209,6 @@ void DelegateMediaControl::update()
QTime t;
t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs);
lcdTimer->display(t.toString("m:ss"));
//lcdTimer->display(t.toString("m:ss"));
QGraphicsRectItem::update();
}
@ -1247,7 +1243,7 @@ void DelegateMediaControl::mousePressEvent(QGraphicsSceneMouseEvent *event)
void DelegateMediaControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
qreal frameWidth = rect().height() / 2;
qreal frameWidth = mSeecArea.height() / 2;
if (boundingRect().contains(event->pos() - QPointF(frameWidth,0))
&& boundingRect().contains(event->pos() + QPointF(frameWidth,0)))
{
@ -1265,7 +1261,6 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos)
minX = frameWidth;
length = mSeecArea.width() - lcdTimer->rect().width();
length = mSeecArea.width() /*- lcdTimer->rect().width()*/;
qreal mouseX = mousePos.x();
if (mouseX >= (mSeecArea.width() - mSeecArea.height()/2))

@ -149,6 +149,7 @@ class DelegateMediaControl: public QObject, public QGraphicsRectItem
private:
int mStartWidth;
int mSeecAreaBorderHeight;
QRectF mSeecArea;
QRectF mLCDTimerArea;
@ -284,7 +285,7 @@ class UBGraphicsItemDelegate : public QObject
qreal mAntiScaleRatio;
QList<DelegateButton*> mButtons;
QList<DelegateButton*> mToolBarButtons;
UBGraphicsToolBarItem* mToolBarItem;
protected slots:

@ -35,11 +35,20 @@ UBAudioPresentationWidget::UBAudioPresentationWidget(QWidget *parent)
void UBAudioPresentationWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.fillRect(rect(), QBrush(Qt::black));
painter.fillRect(rect(), QBrush(Qt::white));
painter.drawRoundedRect(1,1, width()-2, height()-2, height()/5, height()/5);
QImage mask_img(size(), QImage::Format_Mono);
mask_img.fill(0xff);
QPainter mask_painter(&mask_img);
mask_painter.setBrush(QBrush( QColor(0, 0, 0)));
mask_painter.drawRoundedRect(1,1, width()-3, height()-3, height()/5, height()/5);
setMask(QBitmap::fromImage(mask_img));
if (QString() != mTitle)
{
painter.setPen(QPen(Qt::white));
painter.setPen(QPen(Qt::black));
QRect titleRect = rect();
titleRect.setX(mBorderSize);
titleRect.setY(2);
@ -54,13 +63,13 @@ bool UBGraphicsMediaItem::sIsMutedByDefault = false;
UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent)
: UBGraphicsProxyWidget(parent)
, mVideoWidget(NULL)
, mAudioWidget(NULL)
, mMuted(sIsMutedByDefault)
, mMutedByUserAction(sIsMutedByDefault)
, mMediaFileUrl(pMediaFileUrl)
, mInitialPos(0)
, mVideoWidget(NULL)
, mAudioWidget(NULL)
, mLinkedImage(NULL)
, mInitialPos(0)
{
update();

@ -139,8 +139,6 @@ private:
QUrl mMediaFileUrl;
QString mMediaSource;
qint64 mInitialPos;
mediaType mMediaType;
bool mShouldMove;
@ -149,5 +147,7 @@ private:
bool haveLinkedImage;
QGraphicsPixmapItem *mLinkedImage;
qint64 mInitialPos;
};
#endif // UBGRAPHICSMEDIAITEM_H

@ -94,7 +94,7 @@ void UBGraphicsMediaItemDelegate::buildButtons()
connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute()));
connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); // for changing button image
mButtons << mPlayPauseButton << mStopButton << mMuteButton;
mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton;
mToolBarItem->setItemsOnToolBar(QList<QGraphicsItem*>() << mPlayPauseButton << mStopButton << mMediaControl << mMuteButton);
mToolBarItem->setVisibleOnBoard(true);
@ -135,7 +135,6 @@ void UBGraphicsMediaItemDelegate::positionHandles()
if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video)
{
mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height());
// mToolBarItem->setScale(AntiScaleRatio);
toolBarRect.setWidth(delegated()->boundingRect().width());
}
@ -156,14 +155,11 @@ void UBGraphicsMediaItemDelegate::positionHandles()
int toolBarMinimumWidth = 0;
int mediaItemWidth = mToolBarItem->boundingRect().width();
foreach (DelegateButton* button, mButtons)
{
if (button->getSection() == Qt::TitleBarArea)
foreach (DelegateButton* button, mToolBarButtons)
{
mediaItemWidth -= button->boundingRect().width() + mToolBarItem->getElementsPadding();
toolBarMinimumWidth += button->boundingRect().width() + mToolBarItem->getElementsPadding();
}
}
toolBarMinimumWidth += mToolBarItem->boundingRect().height();
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(delegated()->widget());
@ -194,10 +190,6 @@ void UBGraphicsMediaItemDelegate::remove(bool canUndo)
if (delegated() && delegated()->mediaObject())
delegated()->mediaObject()->stop();
QGraphicsScene* scene = mDelegated->scene();
scene->removeItem(mMediaControl);
UBGraphicsItemDelegate::remove(canUndo);
}

@ -541,12 +541,14 @@ bool UBGraphicsScene::inputDeviceRelease()
mAddedItems.remove(mArcPolygonItem);
removeItem(mArcPolygonItem);
UBCoreGraphicsScene::removeItemFromDeletion(mArcPolygonItem);
mArcPolygonItem->setStrokesGroup(pStrokes);
pStrokes->addToGroup(mArcPolygonItem);
// Add the center cross
foreach(QGraphicsItem* item, mAddedItems){
removeItem(item);
UBCoreGraphicsScene::removeItemFromDeletion(item);
mArcPolygonItem->setStrokesGroup(pStrokes);
pStrokes->addToGroup(item);
}
@ -1979,7 +1981,16 @@ void UBGraphicsScene::addMagnifier(UBMagnifierParams params)
setModified(true);
}
void UBGraphicsScene::moveMagnifier(QPoint newPos)
void UBGraphicsScene::moveMagnifier()
{
if (magniferControlViewWidget)
{
QPoint magnifierPos = QPoint(magniferControlViewWidget->pos().x() + magniferControlViewWidget->size().width() / 2, magniferControlViewWidget->pos().y() + magniferControlViewWidget->size().height() / 2 );
moveMagnifier(magnifierPos, true);
}
}
void UBGraphicsScene::moveMagnifier(QPoint newPos, bool forceGrab)
{
QWidget *cContainer = (QWidget*)(UBApplication::boardController->controlContainer());
QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView();
@ -1987,6 +1998,8 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos)
QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0));
QRect qcr = cView->geometry();
QRect qdr = dView->geometry();
int cvW = cView->width();
int dvW = dView->width();
qreal wCoeff = (qreal)dvW / (qreal)cvW;
@ -1999,8 +2012,8 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos)
QPoint cvPoint = cView->mapFromGlobal(globalPoint);
QPoint dvPoint( cvPoint.x() * wCoeff + dvZeroPoint.x(), cvPoint.y() * hCoeff + dvZeroPoint.y());
magniferControlViewWidget->grabNMove(globalPoint, globalPoint, false, false);
magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, false, true);
magniferControlViewWidget->grabNMove(globalPoint, globalPoint, forceGrab, false);
magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, forceGrab, true);
setModified(true);
}

@ -326,7 +326,8 @@ public slots:
void selectionChangedProcessing();
void updateGroupButtonState();
void moveMagnifier(QPoint newPos);
void moveMagnifier();
void moveMagnifier(QPoint newPos, bool forceGrab = false);
void closeMagnifier();
void zoomInMagnifier();
void zoomOutMagnifier();

@ -1,5 +1,7 @@
#include "UBGraphicsStrokesGroup.h"
#include "domain/UBGraphicsPolygonItem.h"
#include "core/memcheck.h"
UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsItemGroup(parent)
@ -63,6 +65,15 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
{
UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup();
QList<QGraphicsItem*> chl = childItems();
foreach(QGraphicsItem *child, chl)
{
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
if (polygon)
copy->addToGroup(dynamic_cast<QGraphicsItem*>(polygon->deepCopy()));
}
copyItemParameters(copy);
return copy;

@ -107,10 +107,16 @@ void UBGraphicsWidgetItem::initialize()
QPalette palette = page()->palette();
palette.setBrush(QPalette::Base, QBrush(Qt::transparent));
page()->setPalette(palette);
page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(javaScriptWindowObjectCleared()));
connect(page(), SIGNAL(geometryChangeRequested(const QRect&)), this, SLOT(geometryChangeRequested(const QRect&)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(mainFrameLoadFinished (bool)));
connect(page(), SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&)));
}
void UBGraphicsWidgetItem::onLinkClicked(const QUrl& url){
UBApplication::webController->loadUrl(url);
}
QUrl UBGraphicsWidgetItem::mainHtml()

@ -152,6 +152,9 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
virtual void javaScriptWindowObjectCleared();
void mainFrameLoadFinished(bool ok);
private slots:
void onLinkClicked(const QUrl& url);
private:
bool mIsFrozen;
bool mIsTakingSnapshot;

@ -18,7 +18,6 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBGraphicsStroke.h \
src/domain/UBGraphicsMediaItem.h \
src/domain/UBAbstractUndoCommand.h\
src/domain/UBAngleWidget.h \
src/domain/UBGraphicsGroupContainerItem.h \
src/domain/UBGraphicsGroupContainerItemDelegate.h \
src/domain/UBGraphicsStrokesGroup.h
@ -50,7 +49,6 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBGraphicsStroke.cpp \
src/domain/UBGraphicsMediaItem.cpp \
src/domain/UBAbstractUndoCommand.cpp \
src/domain/UBAngleWidget.cpp \
src/domain/ubgraphicsgroupcontaineritem.cpp \
src/domain/ubgraphicsgroupcontaineritemdelegate.cpp \
src/domain/UBGraphicsStrokesGroup.cpp

@ -96,10 +96,6 @@ UBDockPalette::~UBDockPalette()
delete mpLayout;
mpLayout = NULL;
}
if (NULL != mTabPalette) {
delete mTabPalette;
mTabPalette = NULL;
}
}
/**
@ -533,6 +529,7 @@ void UBDockPalette::setVisible(bool visible)
bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode)
{
mLastOpenedTabForMode.insert(mCurrentMode, mpStackWidget->currentIndex());
mCurrentMode = mode;
bool hasVisibleElements = false;
//-------------------------------//
@ -556,7 +553,7 @@ bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode)
//-------------------------------//
if(mRegisteredWidgets.size() > 0)
showTabWidget(0);
showTabWidget(mLastOpenedTabForMode.value(mCurrentMode));
update();

@ -176,6 +176,8 @@ protected:
QVector<UBDockPaletteWidget*> mRegisteredWidgets;
/** The current tab widget */
QString mCrntTabWidget;
/** Last opened tab index depending on mode */
QMap<eUBDockPaletteWidgetMode,int> mLastOpenedTabForMode;
private slots:
void onToolbarPosUpdated();

@ -81,7 +81,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
connect(controller, SIGNAL(scanStarted()), mActionBar, SLOT(lockIt()));
connect(controller, SIGNAL(scanFinished()), mActionBar, SLOT(unlockIt()));
connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int)));
connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SLOT(increaseStatusBarValue()));
connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SIGNAL(increaseStatusBarValue()));
connect(controller, SIGNAL(scanCategory(QString)), centralWidget, SIGNAL(scanCategory(QString)));
connect(controller, SIGNAL(scanPath(QString)), centralWidget, SIGNAL(scanPath(QString)));
}
UBFeaturesWidget::~UBFeaturesWidget()
@ -497,15 +499,14 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare
connect(this, SIGNAL(sendFileNameList(QStringList)), dlg, SLOT(setFileNameList(QStringList)));
//Progress bar to show scanning progress
QProgressBar *progressBar = new QProgressBar();
UBFeaturesProgressInfo *progressBar = new UBFeaturesProgressInfo();
mAdditionalDataContainer->addWidget(progressBar);
mAdditionalDataContainer->setCurrentIndex(ProgressBarWidget);
progressBar->setMinimum(0);
progressBar->setValue(0);
progressBar->setMaximum(10000);
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setMaximum(int)));
connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setProgressMax(int)));
connect(this, SIGNAL(increaseStatusBarValue()), progressBar, SLOT(increaseProgressValue()));
connect(this, SIGNAL(scanCategory(QString)), progressBar, SLOT(setCommmonInfoText(QString)));
connect(this, SIGNAL(scanPath(QString)), progressBar, SLOT(setDetailedInfoText(QString)));
mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mAdditionalDataContainer, 0);
@ -546,6 +547,11 @@ UBFeature UBFeaturesCentralWidget::getCurElementFromProperties()
void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)
{
if (!mAdditionalDataContainer->widget(pWidgetType)) {
qDebug() << "can't find widget specified by UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)";
return;
}
mAdditionalDataContainer->setMaximumHeight(mAdditionalDataContainer->widget(pWidgetType)->sizeHint().height());
mAdditionalDataContainer->setCurrentIndex(pWidgetType);
@ -573,46 +579,21 @@ void UBFeaturesCentralWidget::hideAdditionalData()
void UBFeaturesCentralWidget::scanStarted()
{
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar && !progressBar->isVisible()) {
showAdditionalData((AddWidget)1);
}
showAdditionalData(ProgressBarWidget);
}
void UBFeaturesCentralWidget::scanFinished()
{
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar && progressBar->isVisible()) {
hideAdditionalData();
qDebug() << "progressBar max value is " << progressBar->maximum();
}
}
void UBFeaturesCentralWidget::increaseStatusBarValue()
{
if (!mAdditionalDataContainer->widget(ProgressBarWidget)) {
return;
}
QProgressBar *progressBar = qobject_cast<QProgressBar*>(mAdditionalDataContainer->widget(ProgressBarWidget));
if (progressBar) {
progressBar->setValue(progressBar->value() + 1);
}
}
UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent)
{
this->setStyleSheet("background:white;");
QVBoxLayout *mainLayout = new QVBoxLayout();
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QVBoxLayout *labelLayout = new QVBoxLayout(this);
QVBoxLayout *labelLayout = new QVBoxLayout();
QLabel *mLabel = new QLabel(labelText, this);
mLineEdit = new QLineEdit(this);
@ -622,7 +603,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
labelLayout->addWidget(mLabel);
labelLayout->addWidget(mLineEdit);
QHBoxLayout *buttonLayout = new QHBoxLayout(this);
QHBoxLayout *buttonLayout = new QHBoxLayout();
acceptButton = new QPushButton(acceptText, this);
QPushButton *cancelButton = new QPushButton(cancelText, this);
@ -676,6 +657,64 @@ void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr)
}
}
UBFeaturesProgressInfo::UBFeaturesProgressInfo(QWidget *parent) :
QWidget(parent),
mProgressBar(0),
mCommonInfoLabel(0),
mDetailedInfoLabel(0)
{
QVBoxLayout *mainLayer = new QVBoxLayout(this);
mProgressBar = new QProgressBar(this);
// setting defaults
mProgressBar->setMinimum(0);
mProgressBar->setMaximum(100000);
mProgressBar->setValue(0);
mProgressBar->setStyleSheet("background:white");
mCommonInfoLabel = new QLabel(this);
mDetailedInfoLabel = new QLabel(this);
mDetailedInfoLabel->setAlignment(Qt::AlignRight);
mCommonInfoLabel->hide();
mDetailedInfoLabel->hide();
mainLayer->addWidget(mCommonInfoLabel);
mainLayer->addWidget(mDetailedInfoLabel);
mainLayer->addWidget(mProgressBar);
}
void UBFeaturesProgressInfo::setCommmonInfoText(const QString &str)
{
mProgressBar->setFormat(str + tr(" load") + "(%p%)");
}
void UBFeaturesProgressInfo::setDetailedInfoText(const QString &str)
{
mDetailedInfoLabel->setText(str);
}
void UBFeaturesProgressInfo::setProgressMax(int pValue)
{
mProgressBar->setMaximum(pValue);
}
void UBFeaturesProgressInfo::setProgressMin(int pValue)
{
mProgressBar->setMinimum(pValue);
}
void UBFeaturesProgressInfo::increaseProgressValue()
{
mProgressBar->setValue(mProgressBar->value() + 1);
}
void UBFeaturesProgressInfo::sendFeature(UBFeature pFeature)
{
Q_UNUSED(pFeature);
}
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
, mpWebSettings(NULL)
@ -1295,6 +1334,9 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( item.getType() == FEATURE_INTERACTIVE
|| item.getType() == FEATURE_ITEM
|| item.getType() == FEATURE_AUDIO
|| item.getType() == FEATURE_VIDEO
|| item.getType() == FEATURE_IMAGE
|| item.getType() == FEATURE_INTERNAL
|| item.getType() == FEATURE_FOLDER)
@ -1340,7 +1382,10 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFile = feature.getType() == FEATURE_INTERACTIVE
|| feature.getType() == FEATURE_INTERNAL
|| feature.getType() == FEATURE_ITEM;
|| feature.getType() == FEATURE_ITEM
|| feature.getType() == FEATURE_AUDIO
|| feature.getType() == FEATURE_VIDEO
|| feature.getType() == FEATURE_IMAGE;
return isFile && filterRegExp().exactMatch( feature.getName() );
}

@ -45,6 +45,7 @@ class UBFeaturesNavigatorWidget;
class UBFeaturesMimeData;
class UBFeaturesCentralWidget;
class UBFeaturesNewFolderDialog;
class UBFeaturesProgressBar;
class UBFeaturesWidget : public UBDockPaletteWidget
{
@ -189,7 +190,6 @@ public:
void setPropertiesThumbnail(const QPixmap &pix);
StackElement currentView() const {return static_cast<StackElement>(mStackedWidget->currentIndex());}
UBFeature getCurElementFromProperties();
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
void setLockedExcludingAdditional(bool pLock);
@ -207,6 +207,12 @@ signals:
// progressbar widget related signals
void maxFilesCountEvaluated(int pValue);
void increaseStatusBarValue();
void scanCategory(const QString &);
void scanPath(const QString &);
public slots:
void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal);
private slots:
void createNewFolderSlot(QString pStr);
@ -214,7 +220,6 @@ private slots:
void scanStarted();
void scanFinished();
void increaseStatusBarValue();
private:
@ -252,6 +257,27 @@ private:
};
class UBFeaturesProgressInfo: public QWidget {
Q_OBJECT
public:
UBFeaturesProgressInfo(QWidget *parent = 0);
private slots:
void setCommmonInfoText(const QString &str);
void setDetailedInfoText(const QString &str);
void setProgressMin(int pValue);
void setProgressMax(int pValue);
void increaseProgressValue();
void sendFeature(UBFeature pFeature);
private:
QProgressBar *mProgressBar;
QLabel *mCommonInfoLabel;
QLabel *mDetailedInfoLabel;
};
class UBFeaturesWebView : public QWidget
{
Q_OBJECT

@ -33,8 +33,8 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p)
: QRubberBand(s, p)
, mResizingMode(None)
, mMouseIsPressed(false)
, mLastPressedPoint(QPoint())
, mResizingBorderHeight(20)
, mLastPressedPoint(QPoint())
{
customStyle = NULL;

@ -126,6 +126,11 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int)));
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged()));
#ifdef Q_WS_MAC
// on mac and with the custom qt the widget on the tree are not automatically relocated when using the vertical scrollbar. To relocate them we link the valueChange signal of the vertical scrollbar witht a local signal to trig a change and a repaint of the tree widget
connect(mpTreeWidget->verticalScrollBar(),SIGNAL(valueChanged(int)),this,SLOT(onSliderMoved(int)));
#endif
mpAddAnActionItem = new UBAddItem(tr("Add an action"), eUBTGAddSubItemWidgetType_Action, mpTreeWidget);
mpAddAMediaItem = new UBAddItem(tr("Add a media"), eUBTGAddSubItemWidgetType_Media, mpTreeWidget);
mpAddALinkItem = new UBAddItem(tr("Add a link"), eUBTGAddSubItemWidgetType_Url, mpTreeWidget);
@ -154,6 +159,13 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget()
DELETEPTR(mpLayout);
}
#ifdef Q_WS_MAC
void UBTeacherGuideEditionWidget::onSliderMoved(int size)
{
Q_UNUSED(size);
mpAddAMediaItem->setExpanded(true);
}
#endif
void UBTeacherGuideEditionWidget::showEvent(QShowEvent* event)
{
setFocus();

@ -75,7 +75,9 @@ private:
private slots:
void onActiveDocumentChanged();
#ifdef Q_WS_MACX
void onSliderMoved(int size);
#endif
};

@ -14,38 +14,33 @@
*/
#include <QtGui>
#include "UBToolWidget.h"
#include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "domain/UBGraphicsScene.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "api/UBWidgetUniboardAPI.h"
#include "api/UBW3CWidgetAPI.h"
#include "board/UBBoardController.h"
#include "board/UBBoardView.h"
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "domain/UBGraphicsScene.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
QPixmap* UBToolWidget::sClosePixmap = 0;
QPixmap* UBToolWidget::sUnpinPixmap = 0;
UBToolWidget::UBToolWidget(const QUrl& pUrl, QGraphicsItem *pParent)
: QGraphicsWidget(pParent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)
, mGraphicsWidgetItem(0)
, mGraphicsWebView(0)
, mShouldMoveWidget(false)
, mContentMargin(0)
, mFrameWidth(0)
, mGraphicsWebView(0)
, mGraphicsWidgetItem(0)
{
int widgetType = UBGraphicsWidgetItem::widgetType(pUrl);
if (widgetType == UBWidgetType::Apple)
mGraphicsWidgetItem = new UBGraphicsAppleWidgetItem(pUrl, this);
else if (widgetType == UBWidgetType::W3C)
@ -56,25 +51,23 @@ UBToolWidget::UBToolWidget(const QUrl& pUrl, QGraphicsItem *pParent)
initialize();
}
UBToolWidget::UBToolWidget(UBGraphicsWidgetItem *pWidget, QGraphicsItem *pParent)
: QGraphicsWidget(pParent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)
, mShouldMoveWidget(false)
, mContentMargin(0)
, mFrameWidth(0)
, mGraphicsWebView(0)
, mGraphicsWidgetItem(pWidget)
{
mGraphicsWidgetItem = pWidget;
initialize();
javaScriptWindowObjectCleared();
}
UBToolWidget::~UBToolWidget()
{
// NOOP
}
void UBToolWidget::initialize()
{
if (!sClosePixmap)
@ -108,131 +101,85 @@ void UBToolWidget::initialize()
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(javaScriptWindowObjectCleared()));
}
void UBToolWidget::javaScriptWindowObjectCleared()
{
UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), mGraphicsWidgetItem);
mGraphicsWebView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
UBGraphicsW3CWidgetItem *graphicsW3cWidgetItem = dynamic_cast<UBGraphicsW3CWidgetItem*>(mGraphicsWidgetItem);
if (graphicsW3cWidgetItem)
{
UBW3CWidgetAPI* widgetAPI = new UBW3CWidgetAPI(graphicsW3cWidgetItem);
mGraphicsWebView->page()->mainFrame()->addToJavaScriptWindowObject("widget", widgetAPI);
}
}
void UBToolWidget::setPos(const QPointF &point)
{
UBToolWidget::setPos(point.x(), point.y());
}
void UBToolWidget::setPos(qreal x, qreal y)
{
QGraphicsItem::setPos(x - mContentMargin * scale(), y - mContentMargin * scale());
}
QPointF UBToolWidget::pos() const
{
return QPointF(QGraphicsItem::pos().x() + mContentMargin * scale(), QGraphicsItem::pos().y() + mContentMargin * scale());
}
void UBToolWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QGraphicsWidget::paint(painter, option, widget);
if (isActiveWindow())
bool UBToolWidget::event(QEvent *event)
{
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(127, 127, 127, 127));
painter->drawRoundedRect(QRectF(sClosePixmap->width() / 2, sClosePixmap->height() / 2, preferredWidth() - sClosePixmap->width(), mFrameWidth), mFrameWidth / 2, mFrameWidth / 2);
painter->drawPixmap(0, 0, *sClosePixmap);
if (mGraphicsWidgetItem->canBeContent())
painter->drawPixmap(mContentMargin, 0, *sUnpinPixmap);
}
if (event->type() == QEvent::ShortcutOverride)
event->accept();
return QGraphicsWidget::event(event);
}
void UBToolWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsWidget::mousePressEvent(event);
// did webkit consume the mouse press ?
/* did webkit consume the mouse press ? */
mShouldMoveWidget = !event->isAccepted() && (event->buttons() & Qt::LeftButton);
mMousePressPos = event->pos();
event->accept();
update();
}
void UBToolWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton))
{
if(mShouldMoveWidget && (event->buttons() & Qt::LeftButton)) {
setPos(pos() - mMousePressPos + event->pos());
event->accept();
}
QGraphicsWidget::mouseMoveEvent(event);
}
void UBToolWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
mShouldMoveWidget = false;
if (event->pos().x() >= 0 && event->pos().x() < sClosePixmap->width()
&& event->pos().y() >= 0 && event->pos().y() < sClosePixmap->height())
{
if (event->pos().x() >= 0 && event->pos().x() < sClosePixmap->width() && event->pos().y() >= 0 && event->pos().y() < sClosePixmap->height()) {
remove();
event->accept();
}
else if (mGraphicsWidgetItem->canBeContent() && event->pos().x() >= mContentMargin && event->pos().x() < mContentMargin + sUnpinPixmap->width()
&& event->pos().y() >= 0 && event->pos().y() < sUnpinPixmap->height())
{
else if (mGraphicsWidgetItem->canBeContent() && event->pos().x() >= mContentMargin && event->pos().x() < mContentMargin + sUnpinPixmap->width() && event->pos().y() >= 0 && event->pos().y() < sUnpinPixmap->height()) {
UBApplication::boardController->moveToolWidgetToScene(this);
event->accept();
}
else
QGraphicsWidget::mouseReleaseEvent(event); // don't propgate to parent, the widget is deleted in UBApplication::boardController->removeTool
QGraphicsWidget::mouseReleaseEvent(event); /* don't propgate to parent, the widget is deleted in UBApplication */
}
bool UBToolWidget::eventFilter(QObject *obj, QEvent *event)
{
if (mShouldMoveWidget && obj == mGraphicsWidgetItem && event->type() == QEvent::MouseMove)
void UBToolWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QMouseEvent *mouseMoveEvent = static_cast<QMouseEvent*>(event);
QGraphicsWidget::paint(painter, option, widget);
if (mouseMoveEvent->buttons() & Qt::LeftButton)
{
setPos(pos() - mMousePressPos + mGraphicsWidgetItem->mapToItem(this, mouseMoveEvent->pos()));
/* painting lightweight toolbar */
if (isActiveWindow()) {
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(127, 127, 127, 127));
event->accept();
return true;
painter->drawRoundedRect(QRectF(sClosePixmap->width() / 2, sClosePixmap->height() / 2, preferredWidth() - sClosePixmap->width(), mFrameWidth), mFrameWidth / 2, mFrameWidth / 2);
painter->drawPixmap(0, 0, *sClosePixmap);
if (mGraphicsWidgetItem->canBeContent())
painter->drawPixmap(mContentMargin, 0, *sUnpinPixmap);
}
}
// standard event processing
return QObject::eventFilter(obj, event);
}
void UBToolWidget::javaScriptWindowObjectCleared()
{
UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), mGraphicsWidgetItem);
mGraphicsWebView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
void UBToolWidget::centerOn(const QPointF& pos)
UBGraphicsW3CWidgetItem *graphicsW3cWidgetItem = dynamic_cast<UBGraphicsW3CWidgetItem*>(mGraphicsWidgetItem);
if (graphicsW3cWidgetItem)
{
QGraphicsWidget::setPos(pos - QPointF(preferredWidth() / 2, preferredHeight() / 2));
UBW3CWidgetAPI* widgetAPI = new UBW3CWidgetAPI(graphicsW3cWidgetItem);
mGraphicsWebView->page()->mainFrame()->addToJavaScriptWindowObject("widget", widgetAPI);
}
}
UBGraphicsWidgetItem* UBToolWidget::graphicsWidgetItem() const
{
return mGraphicsWidgetItem;
}
QPointF UBToolWidget::naturalCenter() const
{
@ -242,10 +189,15 @@ QPointF UBToolWidget::naturalCenter() const
return QPointF(0, 0);
}
void UBToolWidget::centerOn(const QPointF& pos)
{
QGraphicsWidget::setPos(pos - QPointF(preferredWidth() / 2, preferredHeight() / 2));
}
UBGraphicsWidgetItem* UBToolWidget::graphicsWidgetItem() const
void UBToolWidget::remove()
{
return mGraphicsWidgetItem;
mGraphicsWebView->setHtml(QString());
scene()->removeItem(this);
}
UBGraphicsScene* UBToolWidget::scene()
@ -253,8 +205,22 @@ UBGraphicsScene* UBToolWidget::scene()
return qobject_cast<UBGraphicsScene*>(QGraphicsItem::scene());
}
void UBToolWidget::remove()
QPointF UBToolWidget::pos() const
{
mGraphicsWebView->setHtml(QString());
scene()->removeItem(this);
return QPointF(QGraphicsItem::pos().x() + mContentMargin * scale(), QGraphicsItem::pos().y() + mContentMargin * scale());
}
void UBToolWidget::setPos(const QPointF &point)
{
UBToolWidget::setPos(point.x(), point.y());
}
void UBToolWidget::setPos(qreal x, qreal y)
{
QGraphicsItem::setPos(x - mContentMargin * scale(), y - mContentMargin * scale());
}
int UBToolWidget::type() const
{
return Type;
}

@ -18,10 +18,10 @@
#include <QtGui>
#include <QtWebKit>
#include "core/UB.h"
class UBGraphicsWidgetItem;
class QWidget;
class UBGraphicsScene;
class UBGraphicsWidgetItem;
class UBToolWidget : public QGraphicsWidget
{
@ -32,44 +32,45 @@ class UBToolWidget : public QGraphicsWidget
UBToolWidget(UBGraphicsWidgetItem* pGraphicsWidgetItem, QGraphicsItem *pParent = 0);
virtual ~UBToolWidget();
void centerOn(const QPointF& pos);
UBGraphicsWidgetItem* graphicsWidgetItem() const;
QPointF naturalCenter() const;
UBGraphicsWidgetItem* graphicsWidgetItem() const;
void centerOn(const QPointF& pos);
void remove();
virtual UBGraphicsScene* scene();
virtual QPointF pos() const;
virtual void setPos(const QPointF &point);
virtual void setPos(qreal x, qreal y);
virtual QPointF pos() const;
virtual int type() const;
enum
{
Type = UBGraphicsItemType::ToolWidgetItemType
};
protected:
void initialize();
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual bool event(QEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual bool eventFilter(QObject *obj, QEvent *event);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private slots:
void javaScriptWindowObjectCleared();
protected:
static QPixmap *sClosePixmap;
static QPixmap *sUnpinPixmap;
UBGraphicsWidgetItem *mGraphicsWidgetItem;
QGraphicsWebView *mGraphicsWebView;
QPointF mMousePressPos;
bool mShouldMoveWidget;
int mContentMargin;
int mFrameWidth;
QGraphicsWebView *mGraphicsWebView;
UBGraphicsWidgetItem *mGraphicsWidgetItem;
QPointF mMousePressPos;
static QPixmap *sClosePixmap;
static QPixmap *sUnpinPixmap;
};
#endif /* UBTOOLWIDGET_H_ */

@ -139,7 +139,7 @@ QString UBAudioQueueRecorder::deviceUIDFromDeviceID(AudioDeviceID id)
{
char *cname = new char[1024];
bool result = CFStringGetCString (name, cname, 1024, kCFStringEncodingASCII);
CFStringGetCString (name, cname, 1024, kCFStringEncodingASCII);
int length = CFStringGetLength (name);
uid = QString::fromAscii(cname, length);

@ -151,7 +151,7 @@ bool UBQuickTimeFile::createCompressionSession()
}
OSStatus err = noErr;
ICMEncodedFrameOutputRecord encodedFrameOutputRecord = {0};
ICMEncodedFrameOutputRecord encodedFrameOutputRecord = {NULL, NULL, NULL};
ICMCompressionSessionOptionsRef sessionOptions = 0;
err = ICMCompressionSessionOptionsCreate(0, &sessionOptions);

@ -719,15 +719,16 @@ bool UBWebController::isEduMedia(const QUrl& pUrl)
void UBWebController::loadUrl(const QUrl& url)
{
UBApplication::applicationController->showInternet();
if (UBSettings::settings()->webUseExternalBrowser->get().toBool())
{
QDesktopServices::openUrl(url);
}
else
{
UBApplication::applicationController->showInternet();
bool webBrowserAlreadyInstanciated = mStackedWidget->widget(WebBrowser) != NULL;
if (mCurrentWebBrowser && !(*mCurrentWebBrowser)) {
if (!webBrowserAlreadyInstanciated) {
(*mCurrentWebBrowser)->loadUrl(url);
}
else {

Loading…
Cancel
Save