first merge

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 7ee53b07ad
commit 50a237306f
  1. 7
      resources/style.qss
  2. 1
      src/adaptors/UBExportCFF.cpp
  3. 6
      src/adaptors/UBThumbnailAdaptor.cpp
  4. 7
      src/board/UBBoardController.cpp
  5. 1
      src/board/UBBoardController.h
  6. 24
      src/board/UBBoardPaletteManager.cpp
  7. 8
      src/board/UBBoardPaletteManager.h
  8. 88
      src/board/UBFeaturesController.cpp
  9. 30
      src/board/UBFeaturesController.h
  10. 2
      src/core/main.cpp
  11. 2
      src/customWidgets/UBActionableWidget.cpp
  12. 2
      src/customWidgets/UBMediaWidget.cpp
  13. 2
      src/domain/UBAbstractUndoCommand.cpp
  14. 2
      src/domain/UBAngleWidget.cpp
  15. 8
      src/domain/UBGraphicsDelegateFrame.cpp
  16. 101
      src/domain/UBGraphicsItemDelegate.cpp
  17. 54
      src/domain/UBGraphicsItemDelegate.h
  18. 4
      src/domain/UBGraphicsItemUndoCommand.cpp
  19. 4
      src/domain/UBGraphicsMediaItem.cpp
  20. 2
      src/domain/UBGraphicsStrokesGroup.cpp
  21. 17
      src/domain/UBGraphicsTextItemDelegate.cpp
  22. 65
      src/domain/UBGraphicsVideoItemDelegate.cpp
  23. 4
      src/domain/UBGraphicsVideoItemDelegate.h
  24. 2
      src/domain/ubgraphicsgroupcontaineritem.cpp
  25. 3
      src/domain/ubgraphicsgroupcontaineritemdelegate.cpp
  26. 3
      src/frameworks/UBCoreGraphicsScene.cpp
  27. 2
      src/gui/UBDockDownloadWidget.cpp
  28. 2
      src/gui/UBDockTeacherGuideWidget.cpp
  29. 19
      src/gui/UBFeaturesActionBar.cpp
  30. 3
      src/gui/UBFeaturesActionBar.h
  31. 202
      src/gui/UBFeaturesWidget.cpp
  32. 33
      src/gui/UBFeaturesWidget.h
  33. 3
      src/gui/UBLibItemProperties.cpp
  34. 3
      src/gui/UBLibNavigatorWidget.cpp
  35. 3
      src/gui/UBLibPathViewer.cpp
  36. 3
      src/gui/UBLibWebView.cpp
  37. 3
      src/gui/UBLibWidget.cpp
  38. 5
      src/gui/UBPageNavigationWidget.cpp
  39. 2
      src/gui/UBTeacherGuideWidget.cpp
  40. 2
      src/gui/UBTeacherGuideWidgetsTools.cpp
  41. 2
      src/pdf-merger/CCITTFaxDecode.cpp
  42. 2
      src/pdf-merger/DCTDecode.cpp
  43. 1
      src/pdf-merger/JBIG2Decode.cpp
  44. 2
      src/web/UBOEmbedParser.cpp

@ -26,6 +26,13 @@ QWidget#UBLibWebView
border: 2px solid #999999; border: 2px solid #999999;
} }
QWidget#UBFeaturesWebView
{
background: #EEEEEE;
border-radius : 10px;
border: 2px solid #999999;
}
QListView QListView
{ {
background: #EEEEEE; background: #EEEEEE;

@ -3,6 +3,7 @@
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "core/UBDocumentManager.h" #include "core/UBDocumentManager.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
UBExportCFF::UBExportCFF(QObject *parent) UBExportCFF::UBExportCFF(QObject *parent)

@ -37,14 +37,14 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
{ {
QList<QPixmap> thumbnails; QList<QPixmap> thumbnails;
if (!proxy || proxy->persistencePath().size() == 0) if (!proxy || proxy->persistencePath().isEmpty())
return thumbnails; return thumbnails;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails //compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
int existingPageCount = proxy->pageCount(); int existingPageCount = proxy->pageCount();
QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", UBApplication::boardController->sceneIndexFromPage(existingPageCount));
QFile thumbFile(thumbFileName); QFile thumbFile(thumbFileName);
@ -77,7 +77,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
//end compatibility with older format //end compatibility with older format
bool moreToProcess = true; bool moreToProcess = true;
int pageCount = 0; int pageCount = UBApplication::boardController->sceneIndexFromPage(0);
while (moreToProcess) { while (moreToProcess) {
pageCount++; pageCount++;

@ -163,6 +163,13 @@ int UBBoardController::pageFromSceneIndex(int sceneIndex)
return sceneIndex+1; return sceneIndex+1;
} }
int UBBoardController::sceneIndexFromPage(int page)
{
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return page-1;
return page;
}
void UBBoardController::setupViews() void UBBoardController::setupViews()
{ {
mControlContainer = new QWidget(mMainWindow->centralWidget()); mControlContainer = new QWidget(mMainWindow->centralWidget());

@ -60,6 +60,7 @@ class UBBoardController : public QObject
int currentPage(); int currentPage();
int pageFromSceneIndex(int sceneIndex); int pageFromSceneIndex(int sceneIndex);
int sceneIndexFromPage(int page);
UBDocumentProxy* activeDocument() UBDocumentProxy* activeDocument()
{ {

@ -58,10 +58,10 @@
#include "UBBoardController.h" #include "UBBoardController.h"
#include "core/memcheck.h"
#include "document/UBDocumentController.h" #include "document/UBDocumentController.h"
#include "core/memcheck.h"
UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardController* pBoardController) UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardController* pBoardController)
: QObject(container) : QObject(container)
, mKeyboardPalette(0) , mKeyboardPalette(0)
@ -81,7 +81,9 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mPendingPanButtonPressed(false) , mPendingPanButtonPressed(false)
, mPendingEraseButtonPressed(false) , mPendingEraseButtonPressed(false)
, mpPageNavigWidget(NULL) , mpPageNavigWidget(NULL)
#ifdef USE_WEB_WIDGET
, mpLibWidget(NULL) , mpLibWidget(NULL)
#endif
, mpCachePropWidget(NULL) , mpCachePropWidget(NULL)
, mpDownloadWidget(NULL) , mpDownloadWidget(NULL)
, mpDesktopLibWidget(NULL) , mpDesktopLibWidget(NULL)
@ -129,7 +131,12 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
//------------------------------------------------// //------------------------------------------------//
// Create the widgets for the dock palettes // Create the widgets for the dock palettes
mpPageNavigWidget = new UBPageNavigationWidget();
#ifdef USE_WEB_WIDGET
mpLibWidget = new UBLibWidget(); mpLibWidget = new UBLibWidget();
#endif
mpCachePropWidget = new UBCachePropertiesWidget(); mpCachePropWidget = new UBCachePropertiesWidget();
@ -158,8 +165,11 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette->addTab(mpFeaturesWidget); mRightPalette->addTab(mpFeaturesWidget);
//Do not show deprecated lib widget to prevent collisions. Uncomment to return lib widget //Do not show deprecated lib widget to prevent collisions. Uncomment to return lib widget
// mRightPalette->registerWidget(mpLibWidget);
// mRightPalette->addTab(mpLibWidget); #ifdef USE_WEB_WIDGET
mRightPalette->registerWidget(mpLibWidget);
mRightPalette->addTab(mpLibWidget);
#endif
// The cache widget will be visible only if a cache is put on the page // The cache widget will be visible only if a cache is put on the page
@ -840,10 +850,10 @@ void UBBoardPaletteManager::addItemToLibrary()
} }
QImage image = mPixmap.toImage(); QImage image = mPixmap.toImage();
if(NULL != mpLibWidget) #ifdef USE_WEB_WIDGET
{
mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image); mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
} #endif
} }
else else
{ {

@ -43,6 +43,10 @@ class UBMainWindow;
class UBApplicationController; class UBApplicationController;
class UBDockTeacherGuideWidget; class UBDockTeacherGuideWidget;
// Uncomment this to use old-styles lib paletter
// #define USE_WEB_WIDGET
class UBBoardPaletteManager : public QObject class UBBoardPaletteManager : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -125,8 +129,12 @@ class UBBoardPaletteManager : public QObject
/** The page navigator widget */ /** The page navigator widget */
UBPageNavigationWidget* mpPageNavigWidget; UBPageNavigationWidget* mpPageNavigWidget;
#ifdef USE_WEB_WIDGET
/** The library widget */ /** The library widget */
UBLibWidget* mpLibWidget; UBLibWidget* mpLibWidget;
#endif
/** The cache properties widget */ /** The cache properties widget */
UBCachePropertiesWidget* mpCachePropWidget; UBCachePropertiesWidget* mpCachePropWidget;

@ -24,7 +24,15 @@ UBFeature::UBFeature(const QString &url, const QPixmap &icon, const QString &nam
} }
bool UBFeature::operator ==( const UBFeature &f )const
{
return virtualPath == f.getUrl() && mName == f.getName() && mPath == f.getFullPath() && elementType == f.getType();
}
bool UBFeature::operator !=( const UBFeature &f )const
{
return !(*this == f);
}
bool UBFeature::isFolder() const bool UBFeature::isFolder() const
{ {
@ -32,6 +40,10 @@ bool UBFeature::isFolder() const
|| elementType == FEATURE_FOLDER; || elementType == FEATURE_FOLDER;
} }
bool UBFeature::isDeletable()const
{
return elementType == FEATURE_ITEM;
}
UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
QObject(pParentWidget), QObject(pParentWidget),
@ -53,6 +65,7 @@ void UBFeaturesController::initDirectoryTree()
mLibInteractiveDirectoryPath = UBSettings::settings()->applicationInteractivesDirectory(); mLibInteractiveDirectoryPath = UBSettings::settings()->applicationInteractivesDirectory();
mLibApplicationsDirectoryPath = UBSettings::settings()->applicationApplicationsLibraryDirectory(); mLibApplicationsDirectoryPath = UBSettings::settings()->applicationApplicationsLibraryDirectory();
mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ; mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ;
mLibSearchDirectoryPath = UBSettings::settings()->userSearchDirectory();
trashDirectoryPath = UBSettings::userTrashDirPath(); trashDirectoryPath = UBSettings::userTrashDirPath();
featuresList = new QList <UBFeature>(); featuresList = new QList <UBFeature>();
@ -72,18 +85,24 @@ void UBFeaturesController::initDirectoryTree()
trashPath = rootPath + "/Trash"; trashPath = rootPath + "/Trash";
favoritePath = rootPath + "/Favorites"; favoritePath = rootPath + "/Favorites";
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath ) ); audiosElement = UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath ) ); featuresList->append( audiosElement );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath ) ); moviesElement = UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath );
featuresList->append( moviesElement );
picturesElement = UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath );
featuresList->append( picturesElement );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ApplicationsCategory.svg"), "Applications" , mUserInteractiveDirectoryPath ) ); featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ApplicationsCategory.svg"), "Applications" , mUserInteractiveDirectoryPath ) );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath ) ); flashElement = UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath ) ); featuresList->append( flashElement );
interactElement = UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath );
featuresList->append( interactElement );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ShapesCategory.svg"), "Shapes" , mLibShapesDirectoryPath ) ); featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/ShapesCategory.svg"), "Shapes" , mLibShapesDirectoryPath ) );
trashElement = UBFeature( rootPath, QPixmap(":images/libpalette/TrashCategory.svg"), "Trash", trashDirectoryPath, FEATURE_TRASH ); trashElement = UBFeature( rootPath, QPixmap(":images/libpalette/TrashCategory.svg"), "Trash", trashDirectoryPath, FEATURE_TRASH );
featuresList->append( trashElement ); featuresList->append( trashElement );
favoriteElement = UBFeature( rootPath, QPixmap(":images/libpalette/FavoritesCategory.svg"), "Favorites", "favorites", FEATURE_FAVORITE ); favoriteElement = UBFeature( rootPath, QPixmap(":images/libpalette/FavoritesCategory.svg"), "Favorites", "favorites", FEATURE_FAVORITE );
featuresList->append( favoriteElement ); featuresList->append( favoriteElement );
searchElement = UBFeature( rootPath, QPixmap(":images/libpalette/WebSearchCategory.svg"), "Web search", mLibSearchDirectoryPath );
featuresList->append( searchElement );
loadFavoriteList(); loadFavoriteList();
foreach (UBToolsManager::UBToolDescriptor tool, tools) foreach (UBToolsManager::UBToolDescriptor tool, tools)
@ -105,7 +124,7 @@ void UBFeaturesController::initDirectoryTree()
fileSystemScan( mLibShapesDirectoryPath, shapesPath ); fileSystemScan( mLibShapesDirectoryPath, shapesPath );
fileSystemScan( mLibInteractiveDirectoryPath, interactPath ); fileSystemScan( mLibInteractiveDirectoryPath, interactPath );
fileSystemScan( trashDirectoryPath, trashPath ); fileSystemScan( trashDirectoryPath, trashPath );
fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
} }
@ -120,7 +139,13 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
UBFeatureElementType fileType = fileInfo->isDir() ? FEATURE_FOLDER : FEATURE_ITEM; UBFeatureElementType fileType = fileInfo->isDir() ? FEATURE_FOLDER : FEATURE_ITEM;
QString fileName = fileInfo->fileName(); QString fileName = fileInfo->fileName();
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") ) { if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") )
{
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application/search") )
{
fileType = FEATURE_SEARCH;
}
else
fileType = FEATURE_INTERACTIVE; fileType = FEATURE_INTERACTIVE;
} }
QString itemName = (fileType != FEATURE_ITEM) ? fileName : fileInfo->completeBaseName(); QString itemName = (fileType != FEATURE_ITEM) ? fileName : fileInfo->completeBaseName();
@ -268,6 +293,12 @@ QPixmap UBFeaturesController::thumbnailForFile(const QString &path)
return thumb; return thumb;
} }
bool UBFeaturesController::isDeletable( const QUrl &url )
{
UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) );
return type == FEATURE_ITEM;
}
QPixmap UBFeaturesController::createThumbnail(const QString &path) QPixmap UBFeaturesController::createThumbnail(const QString &path)
{ {
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path); QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path);
@ -315,7 +346,34 @@ UBFeature UBFeaturesController::newFolder( const QString &name )
void UBFeaturesController::addItemToPage(const UBFeature &item) void UBFeaturesController::addItemToPage(const UBFeature &item)
{ {
if ( item.getType() == FEATURE_INTERNAL )
{
UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) );
}
else
{
UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) ); UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) );
}
}
UBFeature UBFeaturesController::getDestinationForItem( const QUrl &url )
{
QString mimetype = UBFileSystemUtils::mimeTypeFromFileName( fileNameFromUrl(url) );
if ( mimetype.contains("audio") )
return audiosElement;
if ( mimetype.contains("video") )
return moviesElement;
else if ( mimetype.contains("image") )
return picturesElement;
else if ( mimetype.contains("application") )
{
if ( mimetype.contains( "x-shockwave-flash") )
return flashElement;
else
return interactElement;
}
return UBFeature();
} }
UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination ) UBFeature UBFeaturesController::moveItemToFolder( const QUrl &url, const UBFeature &destination )
@ -331,9 +389,19 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
Q_ASSERT( QFileInfo( sourcePath ).exists() ); Q_ASSERT( QFileInfo( sourcePath ).exists() );
UBFeature possibleDest = getDestinationForItem( url );
UBFeature dest = destination;
if ( destination != trashElement &&
!destination.getVirtualPath().startsWith( possibleDest.getVirtualPath(), Qt::CaseInsensitive ) )
{
dest = possibleDest;
}
QString name = QFileInfo( sourcePath ).fileName(); QString name = QFileInfo( sourcePath ).fileName();
QString destPath = destination.getFullPath(); QString destPath = dest.getFullPath();
QString destVirtualPath = destination.getUrl() + "/" + destination.getName(); QString destVirtualPath = dest.getVirtualPath();
QString newFullPath = destPath + "/" + name; QString newFullPath = destPath + "/" + name;
QFile( sourcePath ).copy( newFullPath ); QFile( sourcePath ).copy( newFullPath );

@ -4,6 +4,7 @@
#include <QMetaType> #include <QMetaType>
#include <QObject> #include <QObject>
#include <QWidget> #include <QWidget>
#include <QSet>
#include <QVector> #include <QVector>
#include <QString> #include <QString>
#include <QPixmap> #include <QPixmap>
@ -17,12 +18,13 @@ enum UBFeatureElementType
FEATURE_INTERNAL, FEATURE_INTERNAL,
FEATURE_ITEM, FEATURE_ITEM,
FEATURE_TRASH, FEATURE_TRASH,
FEATURE_FAVORITE FEATURE_FAVORITE,
FEATURE_SEARCH
}; };
class UBFeature class UBFeature
{ {
public: public:
UBFeature() {;} UBFeature() {;}
//UBFeature(const UBFeature &f); //UBFeature(const UBFeature &f);
UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY); UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
@ -32,9 +34,13 @@ public:
QString getUrl() const { return virtualPath; } QString getUrl() const { return virtualPath; }
//QString getPath() const { return mPath; }; //QString getPath() const { return mPath; };
QString getFullPath() const { return mPath; } QString getFullPath() const { return mPath; }
QString getVirtualPath() const { return virtualPath + "/" + mName; }
UBFeatureElementType getType() const { return elementType; } UBFeatureElementType getType() const { return elementType; }
bool isFolder() const; bool isFolder() const;
private: bool isDeletable() const;
bool operator ==( const UBFeature &f )const;
bool operator !=( const UBFeature &f )const;
private:
QString virtualPath; QString virtualPath;
QPixmap mThumbnail; QPixmap mThumbnail;
QString mName; QString mName;
@ -44,10 +50,10 @@ private:
Q_DECLARE_METATYPE( UBFeature ) Q_DECLARE_METATYPE( UBFeature )
class UBFeaturesController : public QObject class UBFeaturesController : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesController(QWidget *parentWidget); UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController(); virtual ~UBFeaturesController();
@ -69,13 +75,15 @@ public:
static QString fileNameFromUrl( const QUrl &url ); static QString fileNameFromUrl( const QUrl &url );
static QPixmap thumbnailForFile( const QString &path ); static QPixmap thumbnailForFile( const QString &path );
private: static bool isDeletable( const QUrl &url );
private:
void initDirectoryTree(); void initDirectoryTree();
void fileSystemScan(const QString &currPath, const QString & currVirtualPath); void fileSystemScan(const QString &currPath, const QString & currVirtualPath);
static QPixmap createThumbnail(const QString &path); static QPixmap createThumbnail(const QString &path);
//void addImageToCurrentPage( const QString &path ); //void addImageToCurrentPage( const QString &path );
void loadFavoriteList(); void loadFavoriteList();
void saveFavoriteList(); void saveFavoriteList();
UBFeature getDestinationForItem( const QUrl &url );
static UBFeatureElementType fileTypeFromUrl( const QString &path ); static UBFeatureElementType fileTypeFromUrl( const QString &path );
@ -97,6 +105,7 @@ private:
QString mLibApplicationsDirectoryPath; QString mLibApplicationsDirectoryPath;
QString mLibShapesDirectoryPath; QString mLibShapesDirectoryPath;
QString trashDirectoryPath; QString trashDirectoryPath;
QString mLibSearchDirectoryPath;
QString rootPath; QString rootPath;
QString audiosPath; QString audiosPath;
@ -113,6 +122,13 @@ private:
UBFeature currentElement; UBFeature currentElement;
UBFeature trashElement; UBFeature trashElement;
UBFeature favoriteElement; UBFeature favoriteElement;
UBFeature audiosElement;
UBFeature moviesElement;
UBFeature picturesElement;
UBFeature interactElement;
UBFeature flashElement;
UBFeature shapesElement;
UBFeature searchElement;
QSet <QString> *favoriteSet; QSet <QString> *favoriteSet;
}; };

@ -72,7 +72,7 @@ int main(int argc, char *argv[])
// Uncomment next section to have memory leaks information // Uncomment next section to have memory leaks information
// tracing in VC++ debug mode under Windows // tracing in VC++ debug mode under Windows
/* /*
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif #endif

@ -18,6 +18,8 @@
#include "UBActionableWidget.h" #include "UBActionableWidget.h"
#include "core/memcheck.h"
UBActionableWidget::UBActionableWidget(QWidget *parent, const char *name):QWidget(parent) UBActionableWidget::UBActionableWidget(QWidget *parent, const char *name):QWidget(parent)
, mShowActions(false) , mShowActions(false)
{ {

@ -16,6 +16,8 @@
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "UBMediaWidget.h" #include "UBMediaWidget.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param type as the media type * @param type as the media type

@ -15,6 +15,8 @@
#include "UBAbstractUndoCommand.h" #include "UBAbstractUndoCommand.h"
#include "core/memcheck.h"
UBAbstractUndoCommand::UBAbstractUndoCommand() UBAbstractUndoCommand::UBAbstractUndoCommand()
{ {
// NOOP // NOOP

@ -1,6 +1,8 @@
#include "UBAngleWidget.h" #include "UBAngleWidget.h"
#include <QPainter> #include <QPainter>
#include "core/memcheck.h"
UBAngleWidget::UBAngleWidget(QWidget *parent) UBAngleWidget::UBAngleWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {

@ -390,6 +390,9 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QSizeF newSize = resizableItem->size() + incVector; QSizeF newSize = resizableItem->size() + incVector;
if (!(mDelegate->getToolBarItem()->isVisibleOnBoard()
&& (newSize.width() < mDelegate->getToolBarItem()->minWidth() / mDelegate->antiScaleRatio()
|| newSize.height() < mDelegate->getToolBarItem()->minWidth() / mDelegate->antiScaleRatio() * 3/4)))
resizableItem->resize(newSize); resizableItem->resize(newSize);
} }
} }
@ -579,6 +582,11 @@ void UBGraphicsDelegateFrame::setVisible(bool visible)
void UBGraphicsDelegateFrame::positionHandles() void UBGraphicsDelegateFrame::positionHandles()
{ {
QRectF itemRect = delegated()->boundingRect(); QRectF itemRect = delegated()->boundingRect();
if (mDelegate->getToolBarItem()->isVisibleOnBoard()
&& mDelegate->getToolBarItem()->isShifting())
itemRect.setHeight(itemRect.height() + mDelegate->getToolBarItem()->rect().height() * mDelegate->antiScaleRatio() * 1.1);
QTransform itemTransform = delegated()->sceneTransform(); QTransform itemTransform = delegated()->sceneTransform();
QPointF topLeft = itemTransform.map(itemRect.topLeft()); QPointF topLeft = itemTransform.map(itemRect.topLeft());
QPointF topRight = itemTransform.map(itemRect.topRight()); QPointF topRight = itemTransform.map(itemRect.topRight());

@ -37,6 +37,9 @@
#include "UBGraphicsWidgetItem.h" #include "UBGraphicsWidgetItem.h"
#include "domain/UBAbstractWidget.h" #include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "web/UBWebController.h" #include "web/UBWebController.h"
@ -47,6 +50,27 @@
class UBGraphicsParaschoolEditorWidgetItem; class UBGraphicsParaschoolEditorWidgetItem;
DelegateButton::DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent, Qt::WindowFrameSection section)
: QGraphicsSvgItem(fileName, parent)
, mDelegated(pDelegated)
, mIsTransparentToMouseEvent(false)
, mButtonAlignmentSection(section)
{
setAcceptedMouseButtons(Qt::LeftButton);
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
}
DelegateButton::~DelegateButton()
{
// NOOP
}
void DelegateButton::setFileName(const QString & fileName)
{
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event) void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
// make sure delegate is selected, to avoid control being hidden // make sure delegate is selected, to avoid control being hidden
@ -93,6 +117,8 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
void UBGraphicsItemDelegate::init() void UBGraphicsItemDelegate::init()
{ {
mToolBarItem = new UBGraphicsToolBarItem(delegated());
mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio); mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio);
mFrame->hide(); mFrame->hide();
mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true); mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true);
@ -122,11 +148,14 @@ void UBGraphicsItemDelegate::init()
buildButtons(); buildButtons();
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
{
if (button->getSection() != Qt::TitleBarArea)
{ {
button->hide(); button->hide();
button->setFlag(QGraphicsItem::ItemIsSelectable, true); button->setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
} }
}
UBGraphicsItemDelegate::~UBGraphicsItemDelegate() UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
@ -292,13 +321,20 @@ void UBGraphicsItemDelegate::positionHandles()
updateButtons(true); updateButtons(true);
if (mToolBarItem->isVisibleOnBoard())
{
updateToolBar();
mToolBarItem->show();
}
} else { } else {
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
button->hide(); button->hide();
mFrame->hide(); mFrame->hide();
mToolBarItem->hide();
} }
} }
void UBGraphicsItemDelegate::setZOrderButtonsVisible(bool visible) void UBGraphicsItemDelegate::setZOrderButtonsVisible(bool visible)
{ {
if (visible) { if (visible) {
@ -335,6 +371,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene->removeItem(mFrame); scene->removeItem(mFrame);
scene->removeItem(mDelegated); scene->removeItem(mDelegated);
scene->removeItem(mToolBarItem);
if (canUndo) if (canUndo)
{ {
@ -577,14 +614,16 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated)
int i = 1, j = 0, k = 0; int i = 1, j = 0, k = 0;
while ((i + j + k) < mButtons.size()) { while ((i + j + k) < mButtons.size()) {
DelegateButton* button = mButtons[i + j]; DelegateButton* button = mButtons[i + j];
button->setParentItem(mFrame);
button->setTransform(tr);
if (button->getSection() == Qt::TopLeftSection) { if (button->getSection() == Qt::TopLeftSection) {
button->setParentItem(mFrame);
button->setPos(topX + (i++ * 1.6 * mFrameWidth * mAntiScaleRatio), topY); button->setPos(topX + (i++ * 1.6 * mFrameWidth * mAntiScaleRatio), topY);
button->setTransform(tr);
} else if (button->getSection() == Qt::BottomLeftSection) { } else if (button->getSection() == Qt::BottomLeftSection) {
button->setParentItem(mFrame);
button->setPos(bottomX + (++j * 1.6 * mFrameWidth * mAntiScaleRatio), bottomY); button->setPos(bottomX + (++j * 1.6 * mFrameWidth * mAntiScaleRatio), bottomY);
} else if (button->getSection() == Qt::NoSection) { button->setTransform(tr);
} else if (button->getSection() == Qt::TitleBarArea || button->getSection() == Qt::NoSection){
++k; ++k;
} }
if (!button->scene()) if (!button->scene())
@ -599,9 +638,65 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated)
} }
} }
void UBGraphicsItemDelegate::updateToolBar()
{
QTransform transformForToolbarButtons;
transformForToolbarButtons.scale(mAntiScaleRatio, 1);
QRectF toolBarRect = mToolBarItem->rect();
toolBarRect.setWidth(delegated()->boundingRect().width() - 10);
mToolBarItem->setRect(toolBarRect);
if (mToolBarItem->isShifting())
mToolBarItem->setPos(delegated()->boundingRect().bottomLeft() + QPointF(5 * mAntiScaleRatio, 0));
else mToolBarItem->setPos(delegated()->boundingRect().bottomLeft() - QPointF(-5 * mAntiScaleRatio, mToolBarItem->rect().height() * 1.1 * mAntiScaleRatio));
int offsetOnToolBar = 5 * mAntiScaleRatio;
QList<QGraphicsItem*> itemList = mToolBarItem->itemsOnToolBar();
foreach (QGraphicsItem* item, itemList)
{
item->setPos(offsetOnToolBar, 0);
offsetOnToolBar += (item->boundingRect().width() + 5) * mAntiScaleRatio;
item->setTransform(transformForToolbarButtons);
item->show();
}
mToolBarItem->setOffsetOnToolBar(offsetOnToolBar);
QTransform tr;
tr.scale(1, mAntiScaleRatio);
mToolBarItem->setTransform(tr);
}
void UBGraphicsItemDelegate::setButtonsVisible(bool visible) void UBGraphicsItemDelegate::setButtonsVisible(bool visible)
{ {
foreach(DelegateButton* pButton, mButtons){ foreach(DelegateButton* pButton, mButtons){
pButton->setVisible(visible); pButton->setVisible(visible);
} }
} }
UBGraphicsToolBarItem::UBGraphicsToolBarItem(QGraphicsItem * parent) :
QGraphicsRectItem(parent),
mShifting(true),
mVisible(false),
mMinWidth(200)
{
QRectF rect = this->rect();
rect.setHeight(26);
this->setRect(rect);
setBrush(QColor(UBSettings::paletteColor));
setPen(Qt::NoPen);
hide();
}
void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
QPainterPath path;
path.addRoundedRect(rect(), 10, 10);
painter->fillPath(path, brush());
}

@ -35,30 +35,16 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT Q_OBJECT
public: public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection) DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection);
: QGraphicsSvgItem(fileName, parent)
, mDelegated(pDelegated)
, mIsTransparentToMouseEvent(false)
, mButtonAlignmentSection(section)
{
setAcceptedMouseButtons(Qt::LeftButton);
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
}
virtual ~DelegateButton() virtual ~DelegateButton();
{
// NOOP
}
void setTransparentToMouseEvent(bool tr) void setTransparentToMouseEvent(bool tr)
{ {
mIsTransparentToMouseEvent = tr; mIsTransparentToMouseEvent = tr;
} }
void setFileName(const QString & fileName) void setFileName(const QString & fileName);
{
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;} void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;}
Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;} Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;}
@ -84,6 +70,31 @@ class DelegateButton: public QGraphicsSvgItem
}; };
class UBGraphicsToolBarItem : public QGraphicsRectItem, public QObject
{
public:
UBGraphicsToolBarItem(QGraphicsItem * parent = 0);
virtual ~UBGraphicsToolBarItem() {};
bool isVisibleOnBoard() const { return mVisible; }
void setVisibleOnBoard(bool visible) { mVisible = visible; }
bool isShifting() const { return mShifting; }
void setShifting(bool shifting) { mShifting = shifting; }
int offsetOnToolBar() const { return mOffsetOnToolBar; }
void setOffsetOnToolBar(int pOffset) { mOffsetOnToolBar = pOffset; }
QList<QGraphicsItem*> itemsOnToolBar() const { return mItemsOnToolBar; }
void setItemsOnToolBar(QList<QGraphicsItem*> itemsOnToolBar) { mItemsOnToolBar = itemsOnToolBar;}
int minWidth() { return mMinWidth; }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
private:
bool mShifting;
bool mVisible;
int mOffsetOnToolBar;
int mMinWidth;
QList<QGraphicsItem*> mItemsOnToolBar;
};
class UBGraphicsItemDelegate : public QObject class UBGraphicsItemDelegate : public QObject
{ {
@ -138,6 +149,10 @@ class UBGraphicsItemDelegate : public QObject
void setButtonsVisible(bool visible); void setButtonsVisible(bool visible);
UBGraphicsToolBarItem* getToolBarItem() const { return mToolBarItem; }
qreal antiScaleRatio() const { return mAntiScaleRatio; }
signals: signals:
void showOnDisplayChanged(bool shown); void showOnDisplayChanged(bool shown);
void lockChanged(bool locked); void lockChanged(bool locked);
@ -183,12 +198,17 @@ class UBGraphicsItemDelegate : public QObject
QList<DelegateButton*> mButtons; QList<DelegateButton*> mButtons;
UBGraphicsToolBarItem* mToolBarItem;
protected slots: protected slots:
virtual void gotoContentSource(bool checked); virtual void gotoContentSource(bool checked);
private: private:
void updateFrame(); void updateFrame();
void updateButtons(bool showUpdated = false); void updateButtons(bool showUpdated = false);
void updateToolBar();
QPointF mOffset; QPointF mOffset;
QTransform mPreviousTransform; QTransform mPreviousTransform;

@ -19,12 +19,12 @@
#include "UBGraphicsScene.h" #include "UBGraphicsScene.h"
#include "core/memcheck.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "core/memcheck.h"
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems, UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems,
const QSet<QGraphicsItem*>& pAddedItems) const QSet<QGraphicsItem*>& pAddedItems)
: mScene(pScene) : mScene(pScene)

@ -23,10 +23,10 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
bool UBGraphicsMediaItem::sIsMutedByDefault = false; bool UBGraphicsMediaItem::sIsMutedByDefault = false;
UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent) UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent)

@ -1,5 +1,7 @@
#include "UBGraphicsStrokesGroup.h" #include "UBGraphicsStrokesGroup.h"
#include "core/memcheck.h"
UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsItemGroup(parent) UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsItemGroup(parent)
{ {
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true); mDelegate = new UBGraphicsItemDelegate(this, 0, true, true);

@ -24,9 +24,10 @@
#include "domain/UBGraphicsDelegateFrame.h" #include "domain/UBGraphicsDelegateFrame.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "core/memcheck.h"
const int UBGraphicsTextItemDelegate::sMinPixelSize = 8; const int UBGraphicsTextItemDelegate::sMinPixelSize = 8;
const int UBGraphicsTextItemDelegate::sMinPointSize = 8; const int UBGraphicsTextItemDelegate::sMinPointSize = 8;
@ -94,17 +95,21 @@ void UBGraphicsTextItemDelegate::buildButtons()
{ {
UBGraphicsItemDelegate::buildButtons(); UBGraphicsItemDelegate::buildButtons();
mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mFrame, Qt::TopLeftSection); mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mFrame, Qt::TopLeftSection); mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mFrame, Qt::TopLeftSection); mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mFrame, Qt::TopLeftSection); mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mFontButton, SIGNAL(clicked(bool)), this, SLOT(pickFont())); connect(mFontButton, SIGNAL(clicked(bool)), this, SLOT(pickFont()));
connect(mColorButton, SIGNAL(clicked(bool)), this, SLOT(pickColor())); connect(mColorButton, SIGNAL(clicked(bool)), this, SLOT(pickColor()));
connect(mDecreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(decreaseSize())); connect(mDecreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(decreaseSize()));
connect(mIncreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(increaseSize())); connect(mIncreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(increaseSize()));
mButtons << mFontButton << mColorButton << mDecreaseSizeButton << mIncreaseSizeButton; QList<QGraphicsItem*> itemsOnToolBar;
itemsOnToolBar << mFontButton << mColorButton << mDecreaseSizeButton << mIncreaseSizeButton;
mToolBarItem->setItemsOnToolBar(itemsOnToolBar);
mToolBarItem->setVisibleOnBoard(true);
} }
void UBGraphicsTextItemDelegate::contentsChanged() void UBGraphicsTextItemDelegate::contentsChanged()

@ -39,22 +39,19 @@ UBGraphicsVideoItemDelegate::UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pD
void UBGraphicsVideoItemDelegate::buildButtons() void UBGraphicsVideoItemDelegate::buildButtons()
{ {
mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mFrame); mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mFrame); mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mStopButton->hide();
if (delegated()->isMuted()) mVideoControl = new DelegateVideoControl(delegated(), mToolBarItem);
mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mFrame);
else
mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mFrame);
mMuteButton->hide();
mVideoControl = new DelegateVideoControl(delegated(), mFrame);
UBGraphicsItem::assignZValue(mVideoControl, delegated()->zValue()); UBGraphicsItem::assignZValue(mVideoControl, delegated()->zValue());
mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true); mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true);
if (delegated()->isMuted())
mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
else
mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause()));
connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop()));
connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute()));
@ -62,6 +59,10 @@ void UBGraphicsVideoItemDelegate::buildButtons()
mButtons << mPlayPauseButton << mStopButton << mMuteButton; mButtons << mPlayPauseButton << mStopButton << mMuteButton;
QList<QGraphicsItem*> itemsOnToolBar;
itemsOnToolBar << mPlayPauseButton << mStopButton << mVideoControl << mMuteButton;
mToolBarItem->setItemsOnToolBar(itemsOnToolBar);
mMedia->setTickInterval(50); mMedia->setTickInterval(50);
connect(mMedia, SIGNAL(stateChanged (Phonon::State, Phonon::State)), this, SLOT(mediaStateChanged (Phonon::State, Phonon::State))); connect(mMedia, SIGNAL(stateChanged (Phonon::State, Phonon::State)), this, SLOT(mediaStateChanged (Phonon::State, Phonon::State)));
@ -69,6 +70,8 @@ void UBGraphicsVideoItemDelegate::buildButtons()
connect(mMedia, SIGNAL(tick(qint64)), this, SLOT(updateTicker(qint64))); connect(mMedia, SIGNAL(tick(qint64)), this, SLOT(updateTicker(qint64)));
connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64))); connect(mMedia, SIGNAL(totalTimeChanged(qint64)), this, SLOT(totalTimeChanged(qint64)));
mToolBarItem->setVisibleOnBoard(true);
mToolBarItem->setShifting(false);
} }
@ -86,21 +89,24 @@ void UBGraphicsVideoItemDelegate::positionHandles()
{ {
qreal scaledFrameWidth = mFrameWidth * mAntiScaleRatio; qreal scaledFrameWidth = mFrameWidth * mAntiScaleRatio;
int offset = 0;
foreach (DelegateButton* button, mButtons)
{
if (button->getSection() == Qt::TitleBarArea)
offset += button->boundingRect().width() * mAntiScaleRatio;
}
qreal width = mFrame->rect().width(); mVideoControl->setRect(mVideoControl->rect().x()
qreal height = mFrame->rect().height(); , scaledFrameWidth/6 - 0.5
, (mToolBarItem->rect().width() - 35 - offset) / mAntiScaleRatio
qreal x = mFrame->rect().left(); , (2 * scaledFrameWidth) / mAntiScaleRatio);
qreal y = mFrame->rect().top();
mVideoControl->setRect(x + 2 * scaledFrameWidth offset += (mVideoControl->rect().width() + 5) * mAntiScaleRatio;
, y + height - 3 * scaledFrameWidth mMuteButton->setPos(offset, 0);
, width - 4 * scaledFrameWidth
, 2 * scaledFrameWidth);
if (!mVideoControl->scene()) if (!mVideoControl->scene())
{ {
mVideoControl->setParentItem(mFrame);//update parent for the case the item has been previously removed from scene mVideoControl->setParentItem(mToolBarItem);//update parent for the case the item has been previously removed from scene
mDelegated->scene()->addItem(mVideoControl); mDelegated->scene()->addItem(mVideoControl);
} }
@ -215,12 +221,17 @@ DelegateVideoControl::DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGra
, mAntiScale(1.0) , mAntiScale(1.0)
, mCurrentTimeInMs(0) , mCurrentTimeInMs(0)
, mTotalTimeInMs(0) , mTotalTimeInMs(0)
, mStartWidth(200)
{ {
setAcceptedMouseButtons(Qt::LeftButton); setAcceptedMouseButtons(Qt::LeftButton);
setBrush(QBrush(UBSettings::paletteColor)); setBrush(QBrush(Qt::white));
setPen(Qt::NoPen); setPen(Qt::NoPen);
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
QRectF rect = this->rect();
rect.setWidth(mStartWidth);
this->setRect(rect);
} }
@ -250,8 +261,8 @@ void DelegateVideoControl::paint(QPainter *painter,
{ {
painter->setBrush(UBSettings::paletteColor); painter->setBrush(UBSettings::paletteColor);
painter->setPen(QPen(Qt::NoPen)); painter->setPen(QPen(Qt::NoPen));
QRectF balloon(rect().x() + position - frameWidth, rect().y() - (frameWidth * 1.2), 2 * frameWidth, frameWidth); mBalloon.setRect(rect().x() + position - frameWidth, rect().y() - (frameWidth * 1.2), 2 * frameWidth, frameWidth);
painter->drawRoundedRect(balloon, frameWidth/2, frameWidth/2); painter->drawRoundedRect(mBalloon, frameWidth/2, frameWidth/2);
QTime t; QTime t;
t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs); t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs);
@ -259,7 +270,7 @@ void DelegateVideoControl::paint(QPainter *painter,
f.setPointSizeF(f.pointSizeF() * mAntiScale); f.setPointSizeF(f.pointSizeF() * mAntiScale);
painter->setFont(f); painter->setFont(f);
painter->setPen(Qt::white); painter->setPen(Qt::white);
painter->drawText(balloon, Qt::AlignCenter, t.toString("m:ss")); painter->drawText(mBalloon, Qt::AlignCenter, t.toString("m:ss"));
} }
} }
@ -298,9 +309,13 @@ void DelegateVideoControl::mousePressEvent(QGraphicsSceneMouseEvent *event)
void DelegateVideoControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void DelegateVideoControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
if (shape().contains(event->pos() - QPointF(mBalloon.width()/2,0))
&& shape().contains(event->pos() + QPointF(mBalloon.width()/2,0)))
{
seekToMousePos(event->pos()); seekToMousePos(event->pos());
update(); update();
event->accept(); event->accept();
}
} }

@ -63,6 +63,9 @@ class DelegateVideoControl: public QGraphicsRectItem
qint64 mCurrentTimeInMs; qint64 mCurrentTimeInMs;
qint64 mTotalTimeInMs; qint64 mTotalTimeInMs;
private:
int mStartWidth;
QRectF mBalloon;
}; };
@ -107,7 +110,6 @@ class UBGraphicsVideoItemDelegate : public UBGraphicsItemDelegate
DelegateVideoControl *mVideoControl; DelegateVideoControl *mVideoControl;
Phonon::MediaObject* mMedia; Phonon::MediaObject* mMedia;
}; };

@ -6,6 +6,8 @@
#include "domain/ubgraphicsgroupcontaineritemdelegate.h" #include "domain/ubgraphicsgroupcontaineritemdelegate.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent) UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent)
: QGraphicsItemGroup(parent) : QGraphicsItemGroup(parent)
{ {

@ -8,9 +8,10 @@
#include "domain/UBGraphicsDelegateFrame.h" #include "domain/UBGraphicsDelegateFrame.h"
#include "domain/ubgraphicsgroupcontaineritem.h" #include "domain/ubgraphicsgroupcontaineritem.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "core/memcheck.h"
UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGraphicsItem *pDelegated, QObject *parent) : UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGraphicsItem *pDelegated, QObject *parent) :
UBGraphicsItemDelegate(pDelegated, parent), mDestroyGroupButton(0) UBGraphicsItemDelegate(pDelegated, parent), mDestroyGroupButton(0)

@ -15,12 +15,13 @@
#include "UBCoreGraphicsScene.h" #include "UBCoreGraphicsScene.h"
#include "core/memcheck.h"
#include "domain/UBGraphicsAudioItem.h" #include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsVideoItem.h" #include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsMediaItem.h" #include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsWidgetItem.h" #include "domain/UBGraphicsWidgetItem.h"
#include "core/memcheck.h"
UBCoreGraphicsScene::UBCoreGraphicsScene(QObject * parent) UBCoreGraphicsScene::UBCoreGraphicsScene(QObject * parent)
: QGraphicsScene ( parent ) : QGraphicsScene ( parent )
{ {

@ -17,6 +17,8 @@
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "core/memcheck.h"
UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name) UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name)
, mpLayout(NULL) , mpLayout(NULL)
, mpDLWidget(NULL) , mpDLWidget(NULL)

@ -19,6 +19,8 @@
#include "UBDockTeacherGuideWidget.h" #include "UBDockTeacherGuideWidget.h"
#include "UBTeacherGuideWidget.h" #include "UBTeacherGuideWidget.h"
#include "core/memcheck.h"
UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char* name): UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char* name):
UBDockPaletteWidget(parent,name) UBDockPaletteWidget(parent,name)

@ -1,4 +1,5 @@
#include "UBFeaturesActionBar.h" #include "UBFeaturesActionBar.h"
#include "core/memcheck.h"
UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent) UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent)
, featuresController(controller) , featuresController(controller)
@ -143,6 +144,16 @@ void UBFeaturesActionBar::setButtons()
mpRemoveFavoriteBtn->show(); mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide(); mpNewFolderBtn->hide();
break; break;
case IN_TRASH:
mpFavoriteBtn->hide();
mpSocialBtn->hide();
mSearchBar->show();
//mpSearchBtn->show();
//mpDeleteBtn->hide();
mpCloseBtn->hide();
//mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide();
break;
default: default:
break; break;
} }
@ -169,7 +180,9 @@ void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event ) void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event )
{ {
if (event->mimeData()->hasFormat("text/uri-list")) if (event->mimeData()->hasFormat("text/uri-list"))
{
event->acceptProposedAction(); event->acceptProposedAction();
}
} }
void UBFeaturesActionBar::dropEvent( QDropEvent *event ) void UBFeaturesActionBar::dropEvent( QDropEvent *event )
@ -177,6 +190,12 @@ void UBFeaturesActionBar::dropEvent( QDropEvent *event )
QWidget *dest = childAt( event->pos() ); QWidget *dest = childAt( event->pos() );
if ( dest == mpDeleteBtn ) if ( dest == mpDeleteBtn )
{ {
QList <QUrl> urls = event->mimeData()->urls();
foreach ( QUrl url, urls )
{
if ( !UBFeaturesController::isDeletable( url ) )
return;
}
event->setDropAction( Qt::MoveAction ); event->setDropAction( Qt::MoveAction );
event->accept(); event->accept();
emit deleteElements( *event->mimeData() ); emit deleteElements( *event->mimeData() );

@ -12,7 +12,8 @@ enum UBFeaturesActionBarState
IN_ROOT, IN_ROOT,
IN_FOLDER, IN_FOLDER,
IN_PROPERTIES, IN_PROPERTIES,
IN_FAVORITE IN_FAVORITE,
IN_TRASH
}; };
class UBFeaturesActionBar : public QWidget class UBFeaturesActionBar : public QWidget

@ -1,3 +1,5 @@
#include <QDomDocument>
#include "UBFeaturesWidget.h" #include "UBFeaturesWidget.h"
#include "domain/UBAbstractWidget.h" #include "domain/UBAbstractWidget.h"
#include "gui/UBThumbnailWidget.h" #include "gui/UBThumbnailWidget.h"
@ -6,6 +8,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBDownloadManager.h" #include "core/UBDownloadManager.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "board/UBBoardController.h"
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
{ {
@ -49,12 +52,14 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
//featuresListView->setStyleSheet( QString("background: #EEEEEE;border-radius: 10px;border: 2px solid #999999;") ); //featuresListView->setStyleSheet( QString("background: #EEEEEE;border-radius: 10px;border: 2px solid #999999;") );
featuresListView->setDragDropMode( QAbstractItemView::DragDrop ); featuresListView->setDragDropMode( QAbstractItemView::DragDrop );
featuresListView->setSelectionMode( QAbstractItemView::ContiguousSelection );
featuresListView->setModel( featuresProxyModel ); featuresListView->setModel( featuresProxyModel );
featuresListView->setResizeMode( QListView::Adjust ); featuresListView->setResizeMode( QListView::Adjust );
featuresListView->setViewMode( QListView::IconMode ); featuresListView->setViewMode( QListView::IconMode );
itemDelegate = new UBFeaturesItemDelegate( this, featuresListView ); itemDelegate = new UBFeaturesItemDelegate( this, featuresListView );
featuresListView->setItemDelegate( itemDelegate ); featuresListView->setItemDelegate( itemDelegate );
//featuresListView->setSelectionRectVisible(false);
featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) ); featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) );
featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) ); featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) );
@ -70,13 +75,17 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
pathListView->setSelectionMode( QAbstractItemView::NoSelection ); pathListView->setSelectionMode( QAbstractItemView::NoSelection );
pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); pathListView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); pathListView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
pathListView->setFlow( QListView::LeftToRight );
pathListView->setWrapping(false);
//pathListView->setResizeMode( QListView::Adjust ); //pathListView->setResizeMode( QListView::Adjust );
//pathListView->setMovement( QListView::Static ); //pathListView->setMovement( QListView::Static );
pathListView->setDragDropMode( QAbstractItemView::DragDrop ); pathListView->setDragDropMode( QAbstractItemView::DropOnly );
pathScene = new QGraphicsScene(this); pathScene = new QGraphicsScene(this);
//pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this ); //pathViewer = new UBFeaturesPathViewer( QPixmap(":images/libpalette/home.png"), controller->getRootPath(), pathScene, this );
featureProperties = new UBFeatureProperties(this); featureProperties = new UBFeatureProperties(this);
webView = new UBFeaturesWebView(this);
//layout->addWidget( pathViewer ); //layout->addWidget( pathViewer );
//pathViewer->show(); //pathViewer->show();
@ -86,6 +95,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
stackedWidget->addWidget( featuresListView ); stackedWidget->addWidget( featuresListView );
stackedWidget->addWidget( featureProperties ); stackedWidget->addWidget( featureProperties );
stackedWidget->addWidget( webView );
stackedWidget->setCurrentIndex(ID_LISTVIEW); stackedWidget->setCurrentIndex(ID_LISTVIEW);
currentStackedWidget = ID_LISTVIEW; currentStackedWidget = ID_LISTVIEW;
@ -169,11 +179,20 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
{ {
mActionBar->setCurrentState( IN_FAVORITE ); mActionBar->setCurrentState( IN_FAVORITE );
} }
else if (feature.getType() == FEATURE_TRASH)
{
mActionBar->setCurrentState( IN_TRASH );
}
else else
{ {
mActionBar->setCurrentState( IN_FOLDER ); mActionBar->setCurrentState( IN_FOLDER );
} }
} }
else if ( feature.getType() == FEATURE_SEARCH )
{
webView->showElement( feature );
switchToWebView();
}
else else
{ {
featureProperties->showElement( feature ); featureProperties->showElement( feature );
@ -207,6 +226,10 @@ void UBFeaturesWidget::currentPathChanged(const QModelIndex &index)
{ {
mActionBar->setCurrentState( IN_FAVORITE ); mActionBar->setCurrentState( IN_FAVORITE );
} }
else if (feature.getType() == FEATURE_TRASH)
{
mActionBar->setCurrentState( IN_TRASH );
}
else else
{ {
mActionBar->setCurrentState( IN_FOLDER ); mActionBar->setCurrentState( IN_FOLDER );
@ -223,7 +246,6 @@ void UBFeaturesWidget::createNewFolder()
featuresModel->addItem( newFolder ); featuresModel->addItem( newFolder );
featuresProxyModel->invalidate(); featuresProxyModel->invalidate();
} }
} }
void UBFeaturesWidget::deleteElements( const QMimeData & mimeData ) void UBFeaturesWidget::deleteElements( const QMimeData & mimeData )
@ -295,6 +317,11 @@ void UBFeaturesWidget::switchToProperties()
currentStackedWidget = ID_PROPERTIES; currentStackedWidget = ID_PROPERTIES;
} }
void UBFeaturesWidget::switchToWebView()
{
stackedWidget->setCurrentIndex(ID_WEBVIEW);
currentStackedWidget = ID_WEBVIEW;
}
/* /*
@ -314,11 +341,39 @@ UBFeaturesWidget::~UBFeaturesWidget()
{ {
} }
UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name ) : QListView(parent) UBFeaturesListView::UBFeaturesListView( QWidget* parent, const char* name )
: QListView(parent)
{ {
setObjectName(name); setObjectName(name);
//rubberBand = new UBRubberBand( QRubberBand::Rectangle, this );
}
/*
void UBFeaturesListView::mousePressEvent( QMouseEvent *event )
{
rubberOrigin = event->pos();
rubberBand->setGeometry( QRect( rubberOrigin, QSize() ) );
//qDebug() << rubberOrigin.x() << rubberOrigin.y();
rubberBand->show();
QListView::mousePressEvent(event);
}
void UBFeaturesListView::mouseMoveEvent( QMouseEvent *event )
{
QPoint current = event->pos();
rubberBand->setGeometry( QRect( rubberOrigin, current ).normalized() );
//setSelection( rubberBand->rect(), QItemSelectionModel::Select );
QListView::mouseMoveEvent(event);
}
void UBFeaturesListView::mouseReleaseEvent( QMouseEvent *event )
{
rubberBand->hide();
QListView::mouseReleaseEvent(event);
} }
*/
void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event ) void UBFeaturesListView::dragEnterEvent( QDragEnterEvent *event )
{ {
if ( event->mimeData()->hasUrls() ) if ( event->mimeData()->hasUrls() )
@ -335,6 +390,96 @@ void UBFeaturesListView::dropEvent( QDropEvent *event )
} }
UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
, mpWebSettings(NULL)
, mpLayout(NULL)
, mpSankoreAPI(NULL)
{
setObjectName(name);
SET_STYLE_SHEET();
mpLayout = new QVBoxLayout();
setLayout(mpLayout);
mpView = new QWebView(this);
mpView->setObjectName("SearchEngineView");
mpSankoreAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene());
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI);
mpWebSettings = QWebSettings::globalSettings();
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true);
mpWebSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
mpWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
mpWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
mpWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
mpLayout->addWidget(mpView);
connect(mpView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
}
UBFeaturesWebView::~UBFeaturesWebView()
{
if(NULL != mpSankoreAPI){
delete mpSankoreAPI;
mpSankoreAPI = NULL;
}
if(NULL != mpView){
delete mpView;
mpView = NULL;
}
if(NULL != mpLayout){
delete mpLayout;
mpLayout = NULL;
}
}
void UBFeaturesWebView::showElement(const UBFeature &elem)
{
QString qsWidgetName;
QString path = elem.getFullPath();
QString qsConfigPath = QString("%0/config.xml").arg(path);
if(QFile::exists(qsConfigPath))
{
QFile f(qsConfigPath);
if(f.open(QIODevice::ReadOnly))
{
QDomDocument domDoc;
domDoc.setContent(QString(f.readAll()));
QDomElement root = domDoc.documentElement();
QDomNode node = root.firstChild();
while(!node.isNull())
{
if(node.toElement().tagName() == "content")
{
QDomAttr srcAttr = node.toElement().attributeNode("src");
qsWidgetName = srcAttr.value();
break;
}
node = node.nextSibling();
}
f.close();
}
}
mpView->load(QUrl::fromLocalFile(QString("%0/%1").arg(path).arg(qsWidgetName)));
}
void UBFeaturesWebView::onLoadFinished(bool ok)
{
if(ok && NULL != mpSankoreAPI){
mpView->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mpSankoreAPI);
}
}
UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent) UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) : QWidget(parent)
, mpLayout(NULL) , mpLayout(NULL)
, mpButtonLayout(NULL) , mpButtonLayout(NULL)
@ -460,6 +605,16 @@ void UBFeatureProperties::onAddToPage()
UBFeatureProperties::~UBFeatureProperties() UBFeatureProperties::~UBFeatureProperties()
{ {
if ( mpOrigPixmap )
{
delete mpOrigPixmap;
mpOrigPixmap = NULL;
}
if ( mpElement )
{
delete mpElement;
mpElement = NULL;
}
} }
UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent) UBFeatureItemButton::UBFeatureItemButton(QWidget *parent, const char *name):QPushButton(parent)
@ -536,19 +691,15 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
int endRow = 0; int endRow = 0;
UBFeature parentFeature;
if ( !parent.isValid() ) if ( !parent.isValid() )
{ {
return false; parentFeature = dynamic_cast<UBFeaturesWidget *>(QObject::parent())->getFeaturesController()->getCurrentElement();
/*if (row < 0)
endRow = featuresList->size();
else
endRow = qMin( row, featuresList->size() );*/
} }
else else
endRow = parent.row(); {
Q_UNUSED(endRow) //why do we need this variable? parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>();
}
UBFeature parentFeature = parent.data( Qt::UserRole + 1).value<UBFeature>();
QList<QUrl> urls = mimeData->urls(); QList<QUrl> urls = mimeData->urls();
@ -627,8 +778,25 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
return Qt::ItemIsDragEnabled | defaultFlags; return Qt::ItemIsDragEnabled | defaultFlags;
if ( item.isFolder() && !item.getFullPath().isNull() ) if ( item.isFolder() && !item.getFullPath().isNull() )
return defaultFlags | Qt::ItemIsDropEnabled; return defaultFlags | Qt::ItemIsDropEnabled;
else return defaultFlags; else return defaultFlags | Qt::ItemIsDropEnabled;
}
/*if ( index.isValid() )
{
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
switch( item.getType() )
{
case FEATURE_CATEGORY:
case FEATURE_FOLDER:
case FEATURE_FAVORITE:
case FEATURE_TRASH:
return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled;
case FEATURE_INTERACTIVE:
case FEATURE_INTERNAL:
case FEATURE_ITEM:
return Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
default:;
} }
}*/
return defaultFlags | Qt::ItemIsDropEnabled; return defaultFlags | Qt::ItemIsDropEnabled;
} }
@ -692,13 +860,7 @@ QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLoc
{ {
const QFontMetrics fm = listView->fontMetrics(); const QFontMetrics fm = listView->fontMetrics();
const QSize iSize = listView->iconSize(); const QSize iSize = listView->iconSize();
return elidedText( fm, iSize.width(), Qt::ElideRight, text );
if ( iSize.width() > 0 && fm.width(text) > iSize.width() )
{
while (fm.width(text) > iSize.width())
text.resize(text.size()-1);
text += "...";
}
} }
return text; return text;
} }

@ -18,12 +18,15 @@
#include "UBDockPaletteWidget.h" #include "UBDockPaletteWidget.h"
//#include "UBLibActionBar.h" //#include "UBLibActionBar.h"
#include "board/UBFeaturesController.h" #include "board/UBFeaturesController.h"
#include "api/UBWidgetUniboardAPI.h"
#include "UBFeaturesActionBar.h" #include "UBFeaturesActionBar.h"
#include "UBRubberBand.h"
#define THUMBNAIL_WIDTH 400 #define THUMBNAIL_WIDTH 400
#define ID_LISTVIEW 0 #define ID_LISTVIEW 0
#define ID_PROPERTIES 1 #define ID_PROPERTIES 1
#define ID_WEBVIEW 2
class UBListModel; class UBListModel;
@ -37,6 +40,7 @@ class UBFeaturesPathViewer;
class UBFeatureProperties; class UBFeatureProperties;
class UBFeatureItemButton; class UBFeatureItemButton;
class UBFeaturesListView; class UBFeaturesListView;
class UBFeaturesWebView;
class UBFeaturesWidget : public UBDockPaletteWidget class UBFeaturesWidget : public UBDockPaletteWidget
{ {
@ -58,6 +62,7 @@ public:
private: private:
void switchToListView(); void switchToListView();
void switchToProperties(); void switchToProperties();
void switchToWebView();
UBFeaturesController *controller; UBFeaturesController *controller;
@ -78,8 +83,10 @@ private:
QGraphicsScene *pathScene; QGraphicsScene *pathScene;
UBFeaturesActionBar *mActionBar; UBFeaturesActionBar *mActionBar;
UBFeatureProperties *featureProperties; UBFeatureProperties *featureProperties;
UBFeaturesWebView *webView;
QStackedWidget *stackedWidget; QStackedWidget *stackedWidget;
int currentStackedWidget; int currentStackedWidget;
QModelIndex trashIndex; QModelIndex trashIndex;
private slots: private slots:
@ -105,8 +112,32 @@ public:
protected: protected:
virtual void dragEnterEvent( QDragEnterEvent *event ); virtual void dragEnterEvent( QDragEnterEvent *event );
virtual void dropEvent( QDropEvent *event ); virtual void dropEvent( QDropEvent *event );
/*virtual void mousePressEvent( QMouseEvent *event );
virtual void mouseMoveEvent( QMouseEvent *event );
virtual void mouseReleaseEvent( QMouseEvent *event );*/
private:
//UBRubberBand *rubberBand;
//QPoint rubberOrigin;
}; };
class UBFeaturesWebView : public QWidget
{
Q_OBJECT
public:
UBFeaturesWebView(QWidget* parent = 0, const char* name = "UBFeaturesWebView");
~UBFeaturesWebView();
void showElement(const UBFeature &elem);
private slots:
void onLoadFinished(bool ok);
private:
QWebView* mpView;
QWebSettings* mpWebSettings;
QVBoxLayout* mpLayout;
UBWidgetUniboardAPI* mpSankoreAPI;
};
class UBFeatureProperties : public QWidget class UBFeatureProperties : public QWidget
{ {
@ -174,7 +205,7 @@ public:
Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }
void setFeaturesList( QList <UBFeature> *flist ) { featuresList = flist; } void setFeaturesList(QList <UBFeature> *flist ) { featuresList = flist; }
private: private:
QList <UBFeature> *featuresList; QList <UBFeature> *featuresList;
}; };

@ -18,12 +18,13 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBDownloadManager.h" #include "core/UBDownloadManager.h"
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor

@ -16,10 +16,11 @@
#include "UBLibWidget.h" #include "UBLibWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "core/memcheck.h"
static int lowBoundForSlider = 40; static int lowBoundForSlider = 40;
static int topBoundForSlider = 120; static int topBoundForSlider = 120;
static int tickIntervalForSlider = 10; static int tickIntervalForSlider = 10;

@ -20,10 +20,11 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "core/UBDownloadManager.h" #include "core/UBDownloadManager.h"
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget

@ -1,7 +1,6 @@
#include <QDomDocument> #include <QDomDocument>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
@ -9,7 +8,7 @@
#include "UBLibWebView.h" #include "UBLibWebView.h"
#include "core/memcheck.h"
UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent) UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL) , mpView(NULL)

@ -17,10 +17,11 @@
#include "UBLibWidget.h" #include "UBLibWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget

@ -14,12 +14,13 @@
*/ */
#include "UBPageNavigationWidget.h" #include "UBPageNavigationWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
@ -175,7 +176,7 @@ void UBPageNavigationWidget::updateTime()
*/ */
void UBPageNavigationWidget::setPageNumber(int current, int total) void UBPageNavigationWidget::setPageNumber(int current, int total)
{ {
mPageNbr->setText(QString("%1 / %2").arg(current).arg(total)); mPageNbr->setText(QString("%1 / %2").arg(current).arg(UBApplication::boardController->sceneIndexFromPage(total)));
} }
/** /**

@ -44,6 +44,7 @@
#include "document/UBDocumentController.h" #include "document/UBDocumentController.h"
#include "domain/UBGraphicsTextItem.h" #include "domain/UBGraphicsTextItem.h"
#include "core/memcheck.h"
#define UBTG_SEPARATOR_FIXED_HEIGHT 3 #define UBTG_SEPARATOR_FIXED_HEIGHT 3
@ -196,7 +197,6 @@ QDomElement* UBTeacherGuideEditionWidget::save(QDomElement* parentElement)
void UBTeacherGuideEditionWidget::onActiveSceneChanged() void UBTeacherGuideEditionWidget::onActiveSceneChanged()
{ {
load(UBSvgSubsetAdaptor::sTeacherGuideNode); load(UBSvgSubsetAdaptor::sTeacherGuideNode);
qDebug() << "UBSvgSubsetAdaptor::sTeacherGuideNode " << UBSvgSubsetAdaptor::sTeacherGuideNode;
mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage())); mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage()));
UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument(); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument();
if(mpDocumentTitle) if(mpDocumentTitle)

@ -36,6 +36,8 @@
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
/*************************************************************************** /***************************************************************************
* class UBAddItem * * class UBAddItem *

@ -16,6 +16,8 @@
#include <QtGlobal> #include <QtGlobal>
#include "CCITTFaxDecode.h" #include "CCITTFaxDecode.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
bool CCITTFaxDecode::encode(std::string & decoded) bool CCITTFaxDecode::encode(std::string & decoded)

@ -16,6 +16,8 @@
#include <QtGlobal> #include <QtGlobal>
#include "DCTDecode.h" #include "DCTDecode.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
bool DCTDecode::encode(std::string & decoded) bool DCTDecode::encode(std::string & decoded)

@ -15,6 +15,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "JBIG2Decode.h" #include "JBIG2Decode.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;

@ -24,6 +24,8 @@
#include "UBOEmbedParser.h" #include "UBOEmbedParser.h"
#include "core/memcheck.h"
UBOEmbedParser::UBOEmbedParser(QObject *parent, const char* name) UBOEmbedParser::UBOEmbedParser(QObject *parent, const char* name)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);

Loading…
Cancel
Save