Commit 50a23730 authored by Claudio Valerio's avatar Claudio Valerio

first merge

parent 7ee53b07
......@@ -26,6 +26,13 @@ QWidget#UBLibWebView
border: 2px solid #999999;
}
QWidget#UBFeaturesWebView
{
background: #EEEEEE;
border-radius : 10px;
border: 2px solid #999999;
}
QListView
{
background: #EEEEEE;
......
......@@ -3,6 +3,7 @@
#include "document/UBDocumentProxy.h"
#include "core/UBDocumentManager.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
UBExportCFF::UBExportCFF(QObject *parent)
......
......@@ -37,14 +37,14 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
{
QList<QPixmap> thumbnails;
if (!proxy || proxy->persistencePath().size() == 0)
if (!proxy || proxy->persistencePath().isEmpty())
return thumbnails;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
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);
......@@ -63,7 +63,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
thumbCount++;
if (displayMessage && thumbCount == 1)
UBApplication::showMessage(tr("Generating preview thumbnails ..."));
UBApplication::showMessage(tr("Generating preview thumbnails ..."));
persistScene(proxy->persistencePath(), scene, i);
}
......@@ -77,7 +77,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
//end compatibility with older format
bool moreToProcess = true;
int pageCount = 0;
int pageCount = UBApplication::boardController->sceneIndexFromPage(0);
while (moreToProcess) {
pageCount++;
......@@ -104,8 +104,8 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
{
int existingPageCount = proxy->pageCount();
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index >= existingPageCount)
return QPixmap();
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index >= existingPageCount)
return QPixmap();
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount);
......@@ -127,7 +127,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
thumbCount++;
if (displayMessage && thumbCount == 1)
UBApplication::showMessage(tr("Generating preview thumbnails ..."));
UBApplication::showMessage(tr("Generating preview thumbnails ..."));
persistScene(proxy->persistencePath(), scene, i);
}
......@@ -144,7 +144,7 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
QFile file(fileName);
if (file.exists())
{
{
QPixmap pix;
//Warning. Works only with modified Qt
#ifdef Q_WS_X11
......@@ -152,9 +152,9 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
#else
pix.load(fileName, 0, Qt::AutoColor, false);
#endif
return pix;
}
return QPixmap();
return pix;
}
return QPixmap();
}
void UBThumbnailAdaptor::persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified)
......
......@@ -163,6 +163,13 @@ int UBBoardController::pageFromSceneIndex(int sceneIndex)
return sceneIndex+1;
}
int UBBoardController::sceneIndexFromPage(int page)
{
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool())
return page-1;
return page;
}
void UBBoardController::setupViews()
{
mControlContainer = new QWidget(mMainWindow->centralWidget());
......@@ -686,7 +693,7 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
void UBBoardController::handScroll(qreal dx, qreal dy)
{
mControlView->translate(dx, dy);
UBApplication::applicationController->adjustDisplayView();
emit controlViewportChanged();
......@@ -1549,17 +1556,17 @@ void UBBoardController::updateSystemScaleFactor()
if (mActiveScene)
{
QSize pageNominalSize = mActiveScene->nominalSize();
//we're going to keep scale factor untouched if the size is custom
QMap<DocumentSizeRatio::Enum, QSize> sizesMap = UBSettings::settings()->documentSizes;
if(pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio16_9) || pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio4_3))
{
QSize controlSize = controlViewport();
//we're going to keep scale factor untouched if the size is custom
QMap<DocumentSizeRatio::Enum, QSize> sizesMap = UBSettings::settings()->documentSizes;
if(pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio16_9) || pageNominalSize == sizesMap.value(DocumentSizeRatio::Ratio4_3))
{
QSize controlSize = controlViewport();
qreal hFactor = ((qreal)controlSize.width()) / ((qreal)pageNominalSize.width());
qreal vFactor = ((qreal)controlSize.height()) / ((qreal)pageNominalSize.height());
qreal hFactor = ((qreal)controlSize.width()) / ((qreal)pageNominalSize.width());
qreal vFactor = ((qreal)controlSize.height()) / ((qreal)pageNominalSize.height());
newScaleFactor = qMin(hFactor, vFactor);
}
newScaleFactor = qMin(hFactor, vFactor);
}
}
if (mSystemScaleFactor != newScaleFactor)
......
......@@ -60,6 +60,7 @@ class UBBoardController : public QObject
int currentPage();
int pageFromSceneIndex(int sceneIndex);
int sceneIndexFromPage(int page);
UBDocumentProxy* activeDocument()
{
......
......@@ -58,10 +58,10 @@
#include "UBBoardController.h"
#include "core/memcheck.h"
#include "document/UBDocumentController.h"
#include "core/memcheck.h"
UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardController* pBoardController)
: QObject(container)
, mKeyboardPalette(0)
......@@ -81,7 +81,9 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
, mPendingPanButtonPressed(false)
, mPendingEraseButtonPressed(false)
, mpPageNavigWidget(NULL)
#ifdef USE_WEB_WIDGET
, mpLibWidget(NULL)
#endif
, mpCachePropWidget(NULL)
, mpDownloadWidget(NULL)
, mpDesktopLibWidget(NULL)
......@@ -129,7 +131,12 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
//------------------------------------------------//
// Create the widgets for the dock palettes
mpPageNavigWidget = new UBPageNavigationWidget();
#ifdef USE_WEB_WIDGET
mpLibWidget = new UBLibWidget();
#endif
mpCachePropWidget = new UBCachePropertiesWidget();
......@@ -158,8 +165,11 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mRightPalette->addTab(mpFeaturesWidget);
//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
......@@ -840,10 +850,10 @@ void UBBoardPaletteManager::addItemToLibrary()
}
QImage image = mPixmap.toImage();
if(NULL != mpLibWidget)
{
mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
}
#ifdef USE_WEB_WIDGET
mpLibWidget->libNavigator()->libraryWidget()->libraryController()->importImageOnLibrary(image);
#endif
}
else
{
......
......@@ -43,6 +43,10 @@ class UBMainWindow;
class UBApplicationController;
class UBDockTeacherGuideWidget;
// Uncomment this to use old-styles lib paletter
// #define USE_WEB_WIDGET
class UBBoardPaletteManager : public QObject
{
Q_OBJECT
......@@ -125,8 +129,12 @@ class UBBoardPaletteManager : public QObject
/** The page navigator widget */
UBPageNavigationWidget* mpPageNavigWidget;
#ifdef USE_WEB_WIDGET
/** The library widget */
UBLibWidget* mpLibWidget;
#endif
/** The cache properties widget */
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
{
......@@ -32,6 +40,10 @@ bool UBFeature::isFolder() const
|| elementType == FEATURE_FOLDER;
}
bool UBFeature::isDeletable()const
{
return elementType == FEATURE_ITEM;
}
UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) :
QObject(pParentWidget),
......@@ -53,6 +65,7 @@ void UBFeaturesController::initDirectoryTree()
mLibInteractiveDirectoryPath = UBSettings::settings()->applicationInteractivesDirectory();
mLibApplicationsDirectoryPath = UBSettings::settings()->applicationApplicationsLibraryDirectory();
mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ;
mLibSearchDirectoryPath = UBSettings::settings()->userSearchDirectory();
trashDirectoryPath = UBSettings::userTrashDirPath();
featuresList = new QList <UBFeature>();
......@@ -72,18 +85,24 @@ void UBFeaturesController::initDirectoryTree()
trashPath = rootPath + "/Trash";
favoritePath = rootPath + "/Favorites";
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath ) );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath ) );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath ) );
audiosElement = UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath );
featuresList->append( audiosElement );
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/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath ) );
featuresList->append( UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath ) );
flashElement = UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath );
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 ) );
trashElement = UBFeature( rootPath, QPixmap(":images/libpalette/TrashCategory.svg"), "Trash", trashDirectoryPath, FEATURE_TRASH );
featuresList->append( trashElement );
favoriteElement = UBFeature( rootPath, QPixmap(":images/libpalette/FavoritesCategory.svg"), "Favorites", "favorites", FEATURE_FAVORITE );
featuresList->append( favoriteElement );
searchElement = UBFeature( rootPath, QPixmap(":images/libpalette/WebSearchCategory.svg"), "Web search", mLibSearchDirectoryPath );
featuresList->append( searchElement );
loadFavoriteList();
foreach (UBToolsManager::UBToolDescriptor tool, tools)
......@@ -105,7 +124,7 @@ void UBFeaturesController::initDirectoryTree()
fileSystemScan( mLibShapesDirectoryPath, shapesPath );
fileSystemScan( mLibInteractiveDirectoryPath, interactPath );
fileSystemScan( trashDirectoryPath, trashPath );
fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" );
}
......@@ -120,8 +139,14 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
UBFeatureElementType fileType = fileInfo->isDir() ? FEATURE_FOLDER : FEATURE_ITEM;
QString fileName = fileInfo->fileName();
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") ) {
fileType = FEATURE_INTERACTIVE;
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application") )
{
if ( UBFileSystemUtils::mimeTypeFromFileName(fileName).contains("application/search") )
{
fileType = FEATURE_SEARCH;
}
else
fileType = FEATURE_INTERACTIVE;
}
QString itemName = (fileType != FEATURE_ITEM) ? fileName : fileInfo->completeBaseName();
QPixmap icon = QPixmap(":images/libpalette/soundIcon.svg");
......@@ -268,6 +293,12 @@ QPixmap UBFeaturesController::thumbnailForFile(const QString &path)
return thumb;
}
bool UBFeaturesController::isDeletable( const QUrl &url )
{
UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) );
return type == FEATURE_ITEM;
}
QPixmap UBFeaturesController::createThumbnail(const QString &path)
{
QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path);
......@@ -315,7 +346,34 @@ UBFeature UBFeaturesController::newFolder( const QString &name )
void UBFeaturesController::addItemToPage(const UBFeature &item)
{
UBApplication::boardController->downloadURL( QUrl::fromLocalFile( item.getFullPath() ) );
if ( item.getType() == FEATURE_INTERNAL )
{
UBApplication::boardController->downloadURL( QUrl( item.getFullPath() ) );
}
else
{
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 )
......@@ -331,9 +389,19 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
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 destPath = destination.getFullPath();
QString destVirtualPath = destination.getUrl() + "/" + destination.getName();
QString destPath = dest.getFullPath();
QString destVirtualPath = dest.getVirtualPath();
QString newFullPath = destPath + "/" + name;
QFile( sourcePath ).copy( newFullPath );
......
......@@ -4,117 +4,133 @@
#include <QMetaType>
#include <QObject>
#include <QWidget>
#include <QSet>
#include <QVector>
#include <QString>
#include <QPixmap>
enum UBFeatureElementType
{
FEATURE_CATEGORY,
FEATURE_VIRTUALFOLDER,
FEATURE_FOLDER,
FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
FEATURE_ITEM,
FEATURE_TRASH,
FEATURE_FAVORITE
FEATURE_CATEGORY,
FEATURE_VIRTUALFOLDER,
FEATURE_FOLDER,
FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
FEATURE_ITEM,
FEATURE_TRASH,
FEATURE_FAVORITE,
FEATURE_SEARCH
};
class UBFeature
{
public:
UBFeature() {;}
//UBFeature(const UBFeature &f);
UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
virtual ~UBFeature() {;}
QString getName() const { return mName; }
QPixmap getThumbnail() const {return mThumbnail;}
QString getUrl() const { return virtualPath; }
//QString getPath() const { return mPath; };
QString getFullPath() const { return mPath; }
UBFeatureElementType getType() const { return elementType; }
bool isFolder() const;
private:
QString virtualPath;
QPixmap mThumbnail;
QString mName;
QString mPath;
UBFeatureElementType elementType;
public:
UBFeature() {;}
//UBFeature(const UBFeature &f);
UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
virtual ~UBFeature() {;}
QString getName() const { return mName; }
QPixmap getThumbnail() const {return mThumbnail;}
QString getUrl() const { return virtualPath; }
//QString getPath() const { return mPath; };
QString getFullPath() const { return mPath; }
QString getVirtualPath() const { return virtualPath + "/" + mName; }
UBFeatureElementType getType() const { return elementType; }
bool isFolder() const;
bool isDeletable() const;
bool operator ==( const UBFeature &f )const;
bool operator !=( const UBFeature &f )const;
private:
QString virtualPath;
QPixmap mThumbnail;
QString mName;
QString mPath;
UBFeatureElementType elementType;
};
Q_DECLARE_METATYPE( UBFeature )
class UBFeaturesController : public QObject
class UBFeaturesController : public QObject
{
Q_OBJECT
public:
UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController();
QList <UBFeature>* getFeatures()const { return featuresList; }
const QString& getRootPath()const { return rootPath; }
void addItemToPage(const UBFeature &item);
const UBFeature& getCurrentElement()const { return currentElement; }
void setCurrentElement( const UBFeature &elem ) { currentElement = elem; }
const UBFeature & getTrashElement () const { return trashElement; }
UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
void deleteItem( const QUrl &url );
bool isTrash( const QUrl &url );
UBFeature newFolder( const QString &name );
UBFeature addToFavorite( const QUrl &path );
void removeFromFavorite( const QUrl &path );
static QString fileNameFromUrl( const QUrl &url );
static QPixmap thumbnailForFile( const QString &path );
private:
void initDirectoryTree();
void fileSystemScan(const QString &currPath, const QString & currVirtualPath);
static QPixmap createThumbnail(const QString &path);
//void addImageToCurrentPage( const QString &path );
void loadFavoriteList();
void saveFavoriteList();
static UBFeatureElementType fileTypeFromUrl( const QString &path );
QList <UBFeature> *featuresList;
UBFeature *rootElement;
QString mUserAudioDirectoryPath;
QString mUserVideoDirectoryPath;
QString mUserPicturesDirectoryPath;
QString mUserInteractiveDirectoryPath;
QString mUserAnimationDirectoryPath;
QString libraryPath;
QString mLibAudioDirectoryPath;
QString mLibVideoDirectoryPath;
QString mLibPicturesDirectoryPath;
QString mLibInteractiveDirectoryPath;
QString mLibAnimationDirectoryPath;
QString mLibApplicationsDirectoryPath;
QString mLibShapesDirectoryPath;
QString trashDirectoryPath;
QString rootPath;
QString audiosPath;
QString moviesPath;
QString picturesPath;
QString appPath;
QString flashPath;
QString shapesPath;
QString interactPath;
QString trashPath;
QString favoritePath;
int mLastItemOffsetIndex;
UBFeature currentElement;
UBFeature trashElement;
UBFeature favoriteElement;
QSet <QString> *favoriteSet;
Q_OBJECT
public:
UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController();
QList <UBFeature>* getFeatures()const { return featuresList; }
const QString& getRootPath()const { return rootPath; }
void addItemToPage(const UBFeature &item);
const UBFeature& getCurrentElement()const { return currentElement; }
void setCurrentElement( const UBFeature &elem ) { currentElement = elem; }
const UBFeature & getTrashElement () const { return trashElement; }
UBFeature moveItemToFolder( const QUrl &url, const UBFeature &destination );
UBFeature copyItemToFolder( const QUrl &url, const UBFeature &destination );
void deleteItem( const QUrl &url );
bool isTrash( const QUrl &url );
UBFeature newFolder( const QString &name );
UBFeature addToFavorite( const QUrl &path );
void removeFromFavorite( const QUrl &path );
static QString fileNameFromUrl( const QUrl &url );
static QPixmap thumbnailForFile( const QString &path );
static bool isDeletable( const QUrl &url );
private:
void initDirectoryTree();
void fileSystemScan(const QString &currPath, const QString & currVirtualPath);
static QPixmap createThumbnail(const QString &path);
//void addImageToCurrentPage( const QString &path );
void loadFavoriteList();
void saveFavoriteList();
UBFeature getDestinationForItem( const QUrl &url );
static UBFeatureElementType fileTypeFromUrl( const QString &path );
QList <UBFeature> *featuresList;
UBFeature *rootElement;
QString mUserAudioDirectoryPath;
QString mUserVideoDirectoryPath;
QString mUserPicturesDirectoryPath;
QString mUserInteractiveDirectoryPath;
QString mUserAnimationDirectoryPath;
QString libraryPath;
QString mLibAudioDirectoryPath;
QString mLibVideoDirectoryPath;
QString mLibPicturesDirectoryPath;
QString mLibInteractiveDirectoryPath;
QString mLibAnimationDirectoryPath;
QString mLibApplicationsDirectoryPath;
QString mLibShapesDirectoryPath;
QString trashDirectoryPath;
QString mLibSearchDirectoryPath;
QString rootPath;
QString audiosPath;
QString moviesPath;
QString picturesPath;
QString appPath;
QString flashPath;
QString shapesPath;
QString interactPath;
QString trashPath;
QString favoritePath;
int mLastItemOffsetIndex;
UBFeature currentElement;
UBFeature trashElement;
UBFeature favoriteElement;
UBFeature audiosElement;
UBFeature moviesElement;
UBFeature picturesElement;
UBFeature interactElement;
UBFeature flashElement;
UBFeature shapesElement;
UBFeature searchElement;
QSet <QString> *favoriteSet;
};
......
......@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
// Uncomment next section to have memory leaks information
// tracing in VC++ debug mode under Windows
/*
/*
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
......
......@@ -18,6 +18,8 @@
#include "UBActionableWidget.h"
#include "core/memcheck.h"
UBActionableWidget::UBActionableWidget(QWidget *parent, const char *name):QWidget(parent)
, mShowActions(false)
{
......
......@@ -16,6 +16,8 @@
#include "globals/UBGlobals.h"
#include "UBMediaWidget.h"
#include "core/memcheck.h"
/**
* \brief Constructor
* @param type as the media type
......
......@@ -15,6 +15,8 @@
#include "UBAbstractUndoCommand.h"
#include "core/memcheck.h"
UBAbstractUndoCommand::UBAbstractUndoCommand()
{
// NOOP
......
#include "UBAngleWidget.h"
#include <QPainter>
#include "core/memcheck.h"
UBAngleWidget::UBAngleWidget(QWidget *parent)
: QWidget(parent)
{
......
This diff is collapsed.
......@@ -37,6 +37,9 @@
#include "UBGraphicsWidgetItem.h"
#include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "web/UBWebController.h"
......@@ -47,6 +50,27 @@
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)
{
// make sure delegate is selected, to avoid control being hidden
......@@ -93,6 +117,8 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
void UBGraphicsItemDelegate::init()
{
mToolBarItem = new UBGraphicsToolBarItem(delegated());
mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio);
mFrame->hide();
mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true);
......@@ -123,10 +149,13 @@ void UBGraphicsItemDelegate::init()
foreach(DelegateButton* button, mButtons)
{
if (button->getSection() != Qt::TitleBarArea)
{
button->hide();
button->setFlag(QGraphicsItem::ItemIsSelectable, true);
}
}
}
UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
......@@ -292,13 +321,20 @@ void UBGraphicsItemDelegate::positionHandles()
updateButtons(true);
if (mToolBarItem->isVisibleOnBoard())
{
updateToolBar();
mToolBarItem->show();
}
} else {
foreach(DelegateButton* button, mButtons)
button->hide();
mFrame->hide();
mToolBarItem->hide();
}
}
void UBGraphicsItemDelegate::setZOrderButtonsVisible(bool visible)
{
if (visible) {
......@@ -335,6 +371,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene->removeItem(mFrame);
scene->removeItem(mDelegated);
scene->removeItem(mToolBarItem);
if (canUndo)
{
......@@ -577,14 +614,16 @@ void UBGraphicsItemDelegate::updateButtons(bool showUpdated)
int i = 1, j = 0, k = 0;
while ((i + j + k) < mButtons.size()) {
DelegateButton* button = mButtons[i + j];
button->setParentItem(mFrame);
button->setTransform(tr);
if (button->getSection() == Qt::TopLeftSection) {
button->setParentItem(mFrame);
button->setPos(topX + (i++ * 1.6 * mFrameWidth * mAntiScaleRatio), topY);
button->setTransform(tr);
} else if (button->getSection() == Qt::BottomLeftSection) {
button->setParentItem(mFrame);
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;
}
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)
{
foreach(DelegateButton* pButton, mButtons){
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());
}
\ No newline at end of file
......@@ -35,30 +35,16 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT
public:
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));
}
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection);
virtual ~DelegateButton()
{
// NOOP
}
virtual ~DelegateButton();
void setTransparentToMouseEvent(bool tr)
{
mIsTransparentToMouseEvent = tr;
}
void setFileName(const QString & fileName)
{
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void setFileName(const QString & fileName);
void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;}
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
{
......@@ -138,6 +149,10 @@ class UBGraphicsItemDelegate : public QObject
void setButtonsVisible(bool visible);
UBGraphicsToolBarItem* getToolBarItem() const { return mToolBarItem; }
qreal antiScaleRatio() const { return mAntiScaleRatio; }
signals:
void showOnDisplayChanged(bool shown);
void lockChanged(bool locked);
......@@ -183,12 +198,17 @@ class UBGraphicsItemDelegate : public QObject
QList<DelegateButton*> mButtons;
UBGraphicsToolBarItem* mToolBarItem;
protected slots:
virtual void gotoContentSource(bool checked);
private:
void updateFrame();
void updateButtons(bool showUpdated = false);
void updateToolBar();
QPointF mOffset;
QTransform mPreviousTransform;
......
......@@ -19,12 +19,12 @@
#include "UBGraphicsScene.h"
#include "core/memcheck.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems,
const QSet<QGraphicsItem*>& pAddedItems)
: mScene(pScene)
......
......@@ -23,10 +23,10 @@
#include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
bool UBGraphicsMediaItem::sIsMutedByDefault = false;
UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent)
......
#include "UBGraphicsStrokesGroup.h"
#include "core/memcheck.h"
UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsItemGroup(parent)
{
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true);
......
......@@ -24,9 +24,10 @@
#include "domain/UBGraphicsDelegateFrame.h"
#include "core/UBSettings.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
const int UBGraphicsTextItemDelegate::sMinPixelSize = 8;
const int UBGraphicsTextItemDelegate::sMinPointSize = 8;
......@@ -94,17 +95,21 @@ void UBGraphicsTextItemDelegate::buildButtons()
{
UBGraphicsItemDelegate::buildButtons();
mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mFrame, Qt::TopLeftSection);
mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mFrame, Qt::TopLeftSection);
mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mFrame, Qt::TopLeftSection);
mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mFrame, Qt::TopLeftSection);
mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mFontButton, SIGNAL(clicked(bool)), this, SLOT(pickFont()));
connect(mColorButton, SIGNAL(clicked(bool)), this, SLOT(pickColor()));
connect(mDecreaseSizeButton, SIGNAL(clicked(bool)), this, SLOT(decreaseSize()));
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()
......
This diff is collapsed.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGRAPHICSVIDEOITEMDELEGATE_H_
#define UBGRAPHICSVIDEOITEMDELEGATE_H_
#include <QtGui>
#include <phonon/MediaObject>
#include "core/UB.h"
#include "UBGraphicsItemDelegate.h"
class QGraphicsSceneMouseEvent;
class QGraphicsItem;
class UBGraphicsVideoItem;
class DelegateVideoControl: public QGraphicsRectItem
{
public:
DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGraphicsItem * parent = 0);
virtual ~DelegateVideoControl()
{
// NOOP
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
QPainterPath shape() const;
void setAntiScale(qreal antiScale){ mAntiScale = antiScale; }
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void updateTicker(qint64 time);
void totalTimeChanged( qint64 newTotalTime);
protected:
void seekToMousePos(QPointF mousePos);
UBGraphicsVideoItem* mDelegate;
bool mDisplayCurrentTime;
qreal mAntiScale;
qint64 mCurrentTimeInMs;
qint64 mTotalTimeInMs;
};
class UBGraphicsVideoItemDelegate : public UBGraphicsItemDelegate
{
Q_OBJECT
public:
UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent = 0);
virtual ~UBGraphicsVideoItemDelegate();
virtual void positionHandles();
public slots:
void toggleMute();
void updateTicker(qint64 time);
protected slots:
virtual void remove(bool canUndo = true);
void togglePlayPause();
void mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate );
void updatePlayPauseState();
void totalTimeChanged( qint64 newTotalTime);
protected:
virtual void buildButtons();
private:
UBGraphicsVideoItem* delegated();
DelegateButton* mPlayPauseButton;
DelegateButton* mStopButton;
DelegateButton* mMuteButton;
DelegateVideoControl *mVideoControl;
Phonon::MediaObject* mMedia;
};
#endif /* UBGRAPHICSVIDEOITEMDELEGATE_H_ */
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGRAPHICSVIDEOITEMDELEGATE_H_
#define UBGRAPHICSVIDEOITEMDELEGATE_H_
#include <QtGui>
#include <phonon/MediaObject>
#include "core/UB.h"
#include "UBGraphicsItemDelegate.h"
class QGraphicsSceneMouseEvent;
class QGraphicsItem;
class UBGraphicsVideoItem;
class DelegateVideoControl: public QGraphicsRectItem
{
public:
DelegateVideoControl(UBGraphicsVideoItem* pDelegated, QGraphicsItem * parent = 0);
virtual ~DelegateVideoControl()
{
// NOOP
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
QPainterPath shape() const;
void setAntiScale(qreal antiScale){ mAntiScale = antiScale; }
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void updateTicker(qint64 time);
void totalTimeChanged( qint64 newTotalTime);
protected:
void seekToMousePos(QPointF mousePos);
UBGraphicsVideoItem* mDelegate;
bool mDisplayCurrentTime;
qreal mAntiScale;
qint64 mCurrentTimeInMs;
qint64 mTotalTimeInMs;
private:
int mStartWidth;
QRectF mBalloon;
};
class UBGraphicsVideoItemDelegate : public UBGraphicsItemDelegate
{
Q_OBJECT
public:
UBGraphicsVideoItemDelegate(UBGraphicsVideoItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent = 0);
virtual ~UBGraphicsVideoItemDelegate();
virtual void positionHandles();
public slots:
void toggleMute();
void updateTicker(qint64 time);
protected slots:
virtual void remove(bool canUndo = true);
void togglePlayPause();
void mediaStateChanged ( Phonon::State newstate, Phonon::State oldstate );
void updatePlayPauseState();
void totalTimeChanged( qint64 newTotalTime);
protected:
virtual void buildButtons();
private:
UBGraphicsVideoItem* delegated();
DelegateButton* mPlayPauseButton;
DelegateButton* mStopButton;
DelegateButton* mMuteButton;
DelegateVideoControl *mVideoControl;
Phonon::MediaObject* mMedia;
};
#endif /* UBGRAPHICSVIDEOITEMDELEGATE_H_ */
......@@ -6,6 +6,8 @@
#include "domain/ubgraphicsgroupcontaineritemdelegate.h"
#include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent)
: QGraphicsItemGroup(parent)
{
......
......@@ -8,9 +8,10 @@
#include "domain/UBGraphicsDelegateFrame.h"
#include "domain/ubgraphicsgroupcontaineritem.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGraphicsItem *pDelegated, QObject *parent) :
UBGraphicsItemDelegate(pDelegated, parent), mDestroyGroupButton(0)
......
......@@ -15,12 +15,13 @@
#include "UBCoreGraphicsScene.h"
#include "core/memcheck.h"
#include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsWidgetItem.h"
#include "core/memcheck.h"
UBCoreGraphicsScene::UBCoreGraphicsScene(QObject * parent)
: QGraphicsScene ( parent )
{
......
......@@ -17,6 +17,8 @@
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name)
, mpLayout(NULL)
, mpDLWidget(NULL)
......
......@@ -19,6 +19,8 @@
#include "UBDockTeacherGuideWidget.h"
#include "UBTeacherGuideWidget.h"
#include "core/memcheck.h"
UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char* name):
UBDockPaletteWidget(parent,name)
......
#include "UBFeaturesActionBar.h"
#include "core/memcheck.h"
UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWidget* parent, const char* name ) : QWidget (parent)
, featuresController(controller)
......@@ -143,6 +144,16 @@ void UBFeaturesActionBar::setButtons()
mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide();
break;
case IN_TRASH:
mpFavoriteBtn->hide();
mpSocialBtn->hide();
mSearchBar->show();
//mpSearchBtn->show();
//mpDeleteBtn->hide();
mpCloseBtn->hide();
//mpRemoveFavoriteBtn->show();
mpNewFolderBtn->hide();
break;
default:
break;
}
......@@ -169,7 +180,9 @@ void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event )
{
if (event->mimeData()->hasFormat("text/uri-list"))
{
event->acceptProposedAction();
}
}
void UBFeaturesActionBar::dropEvent( QDropEvent *event )
......@@ -177,6 +190,12 @@ void UBFeaturesActionBar::dropEvent( QDropEvent *event )
QWidget *dest = childAt( event->pos() );
if ( dest == mpDeleteBtn )
{
QList <QUrl> urls = event->mimeData()->urls();
foreach ( QUrl url, urls )
{
if ( !UBFeaturesController::isDeletable( url ) )
return;
}
event->setDropAction( Qt::MoveAction );
event->accept();
emit deleteElements( *event->mimeData() );
......
......@@ -12,7 +12,8 @@ enum UBFeaturesActionBarState
IN_ROOT,
IN_FOLDER,
IN_PROPERTIES,
IN_FAVORITE
IN_FAVORITE,
IN_TRASH
};
class UBFeaturesActionBar : public QWidget
......
This diff is collapsed.
......@@ -18,12 +18,15 @@
#include "UBDockPaletteWidget.h"
//#include "UBLibActionBar.h"
#include "board/UBFeaturesController.h"
#include "api/UBWidgetUniboardAPI.h"
#include "UBFeaturesActionBar.h"
#include "UBRubberBand.h"
#define THUMBNAIL_WIDTH 400
#define ID_LISTVIEW 0
#define ID_PROPERTIES 1
#define ID_WEBVIEW 2
class UBListModel;
......@@ -37,6 +40,7 @@ class UBFeaturesPathViewer;
class UBFeatureProperties;
class UBFeatureItemButton;
class UBFeaturesListView;
class UBFeaturesWebView;
class UBFeaturesWidget : public UBDockPaletteWidget
{
......@@ -58,6 +62,7 @@ public:
private:
void switchToListView();
void switchToProperties();
void switchToWebView();
UBFeaturesController *controller;
......@@ -78,7 +83,9 @@ private:
QGraphicsScene *pathScene;
UBFeaturesActionBar *mActionBar;
UBFeatureProperties *featureProperties;
UBFeaturesWebView *webView;
QStackedWidget *stackedWidget;
int currentStackedWidget;
QModelIndex trashIndex;
......@@ -105,8 +112,32 @@ public:
protected:
virtual void dragEnterEvent( QDragEnterEvent *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
{
......@@ -174,7 +205,7 @@ public:
Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }
void setFeaturesList( QList <UBFeature> *flist ) { featuresList = flist; }
void setFeaturesList(QList <UBFeature> *flist ) { featuresList = flist; }
private:
QList <UBFeature> *featuresList;
};
......
......@@ -18,12 +18,13 @@
#include "core/UBApplication.h"
#include "core/UBDownloadManager.h"
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h"
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
/**
* \brief Constructor
......
......@@ -16,10 +16,11 @@
#include "UBLibWidget.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
static int lowBoundForSlider = 40;
static int topBoundForSlider = 120;
static int tickIntervalForSlider = 10;
......
......@@ -20,10 +20,11 @@
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "core/UBDownloadManager.h"
#include "board/UBBoardPaletteManager.h"
#include "core/memcheck.h"
/**
* \brief Constructor
* @param parent as the parent widget
......
#include <QDomDocument>
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h"
......@@ -9,7 +8,7 @@
#include "UBLibWebView.h"
#include "core/memcheck.h"
UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
......
......@@ -17,10 +17,11 @@
#include "UBLibWidget.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
/**
* \brief Constructor
* @param parent as the parent widget
......
......@@ -14,12 +14,13 @@
*/
#include "UBPageNavigationWidget.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h"
#include "globals/UBGlobals.h"
#include "core/memcheck.h"
/**
* \brief Constructor
* @param parent as the parent widget
......@@ -175,7 +176,7 @@ void UBPageNavigationWidget::updateTime()
*/
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 "domain/UBGraphicsTextItem.h"
#include "core/memcheck.h"
#define UBTG_SEPARATOR_FIXED_HEIGHT 3
......@@ -196,7 +197,6 @@ QDomElement* UBTeacherGuideEditionWidget::save(QDomElement* parentElement)
void UBTeacherGuideEditionWidget::onActiveSceneChanged()
{
load(UBSvgSubsetAdaptor::sTeacherGuideNode);
qDebug() << "UBSvgSubsetAdaptor::sTeacherGuideNode " << UBSvgSubsetAdaptor::sTeacherGuideNode;
mpPageNumberLabel->setText(tr("Page: %0").arg(UBApplication::boardController->currentPage()));
UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument();
if(mpDocumentTitle)
......
......@@ -36,6 +36,8 @@
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
/***************************************************************************
* class UBAddItem *
......
......@@ -16,6 +16,8 @@
#include <QtGlobal>
#include "CCITTFaxDecode.h"
#include "core/memcheck.h"
using namespace merge_lib;
bool CCITTFaxDecode::encode(std::string & decoded)
......
......@@ -16,6 +16,8 @@
#include <QtGlobal>
#include "DCTDecode.h"
#include "core/memcheck.h"
using namespace merge_lib;
bool DCTDecode::encode(std::string & decoded)
......
......@@ -15,6 +15,7 @@
#include <QtGlobal>
#include "JBIG2Decode.h"
#include "core/memcheck.h"
using namespace merge_lib;
......
......@@ -24,6 +24,8 @@
#include "UBOEmbedParser.h"
#include "core/memcheck.h"
UBOEmbedParser::UBOEmbedParser(QObject *parent, const char* name)
{
Q_UNUSED(parent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment