Commit 214e0711 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

Some memory-leaks problems detected and fixed

parent 83212cc4
...@@ -3,6 +3,7 @@ ...@@ -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)
......
...@@ -58,10 +58,10 @@ ...@@ -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 ...@@ -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)
...@@ -132,7 +134,9 @@ void UBBoardPaletteManager::setupDockPaletteWidgets() ...@@ -132,7 +134,9 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpPageNavigWidget = new UBPageNavigationWidget(); mpPageNavigWidget = new UBPageNavigationWidget();
#ifdef USE_WEB_WIDGET
mpLibWidget = new UBLibWidget(); mpLibWidget = new UBLibWidget();
#endif
mpCachePropWidget = new UBCachePropertiesWidget(); mpCachePropWidget = new UBCachePropertiesWidget();
...@@ -159,8 +163,11 @@ void UBBoardPaletteManager::setupDockPaletteWidgets() ...@@ -159,8 +163,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
...@@ -841,10 +848,10 @@ void UBBoardPaletteManager::addItemToLibrary() ...@@ -841,10 +848,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; ...@@ -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 ...@@ -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;
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "domain/UBGraphicsVideoItem.h" #include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsWidgetItem.h" #include "domain/UBGraphicsWidgetItem.h"
#include "core/memcheck.h"
UBFeature::UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type) UBFeature::UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type)
: virtualPath(url), mThumbnail(icon), mName(name), mPath(realPath), elementType(type) : virtualPath(url), mThumbnail(icon), mName(name), mPath(realPath), elementType(type)
{ {
...@@ -67,12 +69,10 @@ void UBFeaturesController::initDirectoryTree() ...@@ -67,12 +69,10 @@ void UBFeaturesController::initDirectoryTree()
mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ; mLibShapesDirectoryPath = UBSettings::settings()->applicationShapeLibraryDirectory() ;
trashDirectoryPath = UBSettings::userTrashDirPath(); trashDirectoryPath = UBSettings::userTrashDirPath();
featuresList = new QList <UBFeature>();
QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools(); QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools();
featuresList->append( UBFeature( QString(), QPixmap( ":images/libpalette/home.png" ), "root", QString() ) ); featuresList.append( UBFeature( QString(), QPixmap( ":images/libpalette/home.png" ), "root", QString() ) );
currentElement = featuresList->at(0); currentElement = featuresList.at(0);
appPath = rootPath + "/Applications"; appPath = rootPath + "/Applications";
audiosPath = rootPath + "/Audios"; audiosPath = rootPath + "/Audios";
...@@ -85,30 +85,30 @@ void UBFeaturesController::initDirectoryTree() ...@@ -85,30 +85,30 @@ void UBFeaturesController::initDirectoryTree()
favoritePath = rootPath + "/Favorites"; favoritePath = rootPath + "/Favorites";
audiosElement = UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath ); audiosElement = UBFeature( rootPath, QPixmap(":images/libpalette/AudiosCategory.svg"), "Audios" , mUserAudioDirectoryPath );
featuresList->append( audiosElement ); featuresList.append( audiosElement );
moviesElement = UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath ); moviesElement = UBFeature( rootPath, QPixmap(":images/libpalette/MoviesCategory.svg"), "Movies" , mUserVideoDirectoryPath );
featuresList->append( moviesElement ); featuresList.append( moviesElement );
picturesElement = UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath ); picturesElement = UBFeature( rootPath, QPixmap(":images/libpalette/PicturesCategory.svg"), "Pictures" , mUserPicturesDirectoryPath );
featuresList->append( picturesElement ); 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 ) );
flashElement = UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath ); flashElement = UBFeature( rootPath, QPixmap(":images/libpalette/FlashCategory.svg"), "Animations" , mUserAnimationDirectoryPath );
featuresList->append( flashElement ); featuresList.append( flashElement );
interactElement = UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath ); interactElement = UBFeature( rootPath, QPixmap(":images/libpalette/InteractivesCategory.svg"), "Interactivities" , mLibInteractiveDirectoryPath );
featuresList->append( interactElement ); 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 );
loadFavoriteList(); loadFavoriteList();
foreach (UBToolsManager::UBToolDescriptor tool, tools) foreach (UBToolsManager::UBToolDescriptor tool, tools)
{ {
featuresList->append( UBFeature( appPath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) ); featuresList.append( UBFeature( appPath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) );
if ( favoriteSet->find( tool.id ) != favoriteSet->end() ) if ( favoriteSet.find( tool.id ) != favoriteSet.end() )
{ {
featuresList->append( UBFeature( favoritePath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) ); featuresList.append( UBFeature( favoritePath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) );
} }
} }
fileSystemScan( mUserInteractiveDirectoryPath, appPath ); fileSystemScan( mUserInteractiveDirectoryPath, appPath );
...@@ -163,10 +163,10 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt ...@@ -163,10 +163,10 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
icon = QPixmap( thumbnailPath ); icon = QPixmap( thumbnailPath );
else icon = createThumbnail( fullFileName );*/ else icon = createThumbnail( fullFileName );*/
} }
featuresList->append( UBFeature( currVirtualPath, icon, fileName, fullFileName, fileType ) ); featuresList.append( UBFeature( currVirtualPath, icon, fileName, fullFileName, fileType ) );
if ( favoriteSet->find( fullFileName ) != favoriteSet->end() ) if ( favoriteSet.find( fullFileName ) != favoriteSet.end() )
{ {
featuresList->append( UBFeature( favoritePath, icon, fileName, fullFileName, fileType ) ); featuresList.append( UBFeature( favoritePath, icon, fileName, fullFileName, fileType ) );
} }
if ( fileType == FEATURE_FOLDER ) if ( fileType == FEATURE_FOLDER )
...@@ -179,7 +179,6 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt ...@@ -179,7 +179,6 @@ void UBFeaturesController::fileSystemScan(const QString & currentPath, const QSt
void UBFeaturesController::loadFavoriteList() void UBFeaturesController::loadFavoriteList()
{ {
favoriteSet = new QSet<QString>();
QFile file( UBSettings::userDataDirectory() + "/favorites.dat" ); QFile file( UBSettings::userDataDirectory() + "/favorites.dat" );
if ( file.exists() ) if ( file.exists() )
{ {
...@@ -196,7 +195,7 @@ void UBFeaturesController::loadFavoriteList() ...@@ -196,7 +195,7 @@ void UBFeaturesController::loadFavoriteList()
UBFeature elem( favoritePath, thumbnailForFile( path ), fileName, path, fileTypeFromUrl(path) ); UBFeature elem( favoritePath, thumbnailForFile( path ), fileName, path, fileTypeFromUrl(path) );
featuresList->append( elem );*/ featuresList->append( elem );*/
favoriteSet->insert( path ); favoriteSet.insert( path );
} }
} }
} }
...@@ -207,8 +206,8 @@ void UBFeaturesController::saveFavoriteList() ...@@ -207,8 +206,8 @@ void UBFeaturesController::saveFavoriteList()
file.resize(0); file.resize(0);
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
QDataStream out(&file); QDataStream out(&file);
out << favoriteSet->size(); out << favoriteSet.size();
for ( QSet<QString>::iterator it = favoriteSet->begin(); it != favoriteSet->end(); ++it ) for ( QSet<QString>::iterator it = favoriteSet.begin(); it != favoriteSet.end(); ++it )
{ {
out << (*it); out << (*it);
} }
...@@ -218,12 +217,12 @@ void UBFeaturesController::saveFavoriteList() ...@@ -218,12 +217,12 @@ void UBFeaturesController::saveFavoriteList()
UBFeature UBFeaturesController::addToFavorite( const QUrl &path ) UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
{ {
QString filePath = fileNameFromUrl( path ); QString filePath = fileNameFromUrl( path );
if ( favoriteSet->find( filePath ) == favoriteSet->end() ) if ( favoriteSet.find( filePath ) == favoriteSet.end() )
{ {
QFileInfo fileInfo( filePath ); QFileInfo fileInfo( filePath );
QString fileName = fileInfo.fileName(); QString fileName = fileInfo.fileName();
UBFeature elem( favoritePath, thumbnailForFile( filePath ), fileName, filePath, fileTypeFromUrl(filePath) ); UBFeature elem( favoritePath, thumbnailForFile( filePath ), fileName, filePath, fileTypeFromUrl(filePath) );
favoriteSet->insert( filePath ); favoriteSet.insert( filePath );
saveFavoriteList(); saveFavoriteList();
return elem; return elem;
} }
...@@ -233,9 +232,9 @@ UBFeature UBFeaturesController::addToFavorite( const QUrl &path ) ...@@ -233,9 +232,9 @@ UBFeature UBFeaturesController::addToFavorite( const QUrl &path )
void UBFeaturesController::removeFromFavorite( const QUrl &path ) void UBFeaturesController::removeFromFavorite( const QUrl &path )
{ {
QString filePath = fileNameFromUrl( path ); QString filePath = fileNameFromUrl( path );
if ( favoriteSet->find( filePath ) != favoriteSet->end() ) if ( favoriteSet.find( filePath ) != favoriteSet.end() )
{ {
favoriteSet->erase( favoriteSet->find( filePath ) ); favoriteSet.erase( favoriteSet.find( filePath ) );
saveFavoriteList(); saveFavoriteList();
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -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>
...@@ -57,7 +58,7 @@ public: ...@@ -57,7 +58,7 @@ public:
UBFeaturesController(QWidget *parentWidget); UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController(); virtual ~UBFeaturesController();
QList <UBFeature>* getFeatures()const { return featuresList; } const QList <UBFeature>& getFeatures()const { return featuresList; }
const QString& getRootPath()const { return rootPath; } const QString& getRootPath()const { return rootPath; }
...@@ -87,7 +88,7 @@ private: ...@@ -87,7 +88,7 @@ private:
static UBFeatureElementType fileTypeFromUrl( const QString &path ); static UBFeatureElementType fileTypeFromUrl( const QString &path );
QList <UBFeature> *featuresList; QList <UBFeature> featuresList;
UBFeature *rootElement; UBFeature *rootElement;
QString mUserAudioDirectoryPath; QString mUserAudioDirectoryPath;
...@@ -128,7 +129,7 @@ private: ...@@ -128,7 +129,7 @@ private:
UBFeature flashElement; UBFeature flashElement;
UBFeature shapesElement; UBFeature shapesElement;
QSet <QString> *favoriteSet; QSet <QString> favoriteSet;
}; };
......
...@@ -18,6 +18,8 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -15,6 +15,8 @@
#include "UBAbstractUndoCommand.h" #include "UBAbstractUndoCommand.h"
#include "core/memcheck.h"
UBAbstractUndoCommand::UBAbstractUndoCommand() UBAbstractUndoCommand::UBAbstractUndoCommand()
{ {
// NOOP // NOOP
......
#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)
{ {
......
...@@ -19,12 +19,12 @@ ...@@ -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 @@ ...@@ -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)
......
#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 @@ ...@@ -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;
......
...@@ -6,6 +6,8 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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)
......
#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)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,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 "core/memcheck.h"
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
{ {
...@@ -500,6 +501,16 @@ void UBFeatureProperties::onAddToPage() ...@@ -500,6 +501,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)
...@@ -519,19 +530,19 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const ...@@ -519,19 +530,19 @@ QVariant UBFeaturesModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
return featuresList->at(index.row()).getName(); return featuresList.at(index.row()).getName();
else if (role == Qt::DecorationRole) else if (role == Qt::DecorationRole)
{ {
return QIcon( featuresList->at(index.row()).getThumbnail() ); return QIcon( featuresList.at(index.row()).getThumbnail() );
} }
else if (role == Qt::UserRole) else if (role == Qt::UserRole)
{ {
return featuresList->at(index.row()).getUrl(); return featuresList.at(index.row()).getUrl();
} }
else if (role == Qt::UserRole + 1) else if (role == Qt::UserRole + 1)
{ {
//return featuresList->at(index.row()).getType(); //return featuresList->at(index.row()).getType();
UBFeature f = featuresList->at(index.row()); UBFeature f = featuresList.at(index.row());
return QVariant::fromValue( f ); return QVariant::fromValue( f );
} }
...@@ -607,17 +618,17 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act ...@@ -607,17 +618,17 @@ bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction act
void UBFeaturesModel::addItem( const UBFeature &item ) void UBFeaturesModel::addItem( const UBFeature &item )
{ {
beginInsertRows( QModelIndex(), featuresList->size(), featuresList->size() ); beginInsertRows( QModelIndex(), featuresList.size(), featuresList.size() );
featuresList->push_back( item ); featuresList.push_back( item );
endInsertRows(); endInsertRows();
} }
void UBFeaturesModel::deleteFavoriteItem( const QString &path ) void UBFeaturesModel::deleteFavoriteItem( const QString &path )
{ {
for ( int i = 0; i < featuresList->size(); ++i ) for ( int i = 0; i < featuresList.size(); ++i )
{ {
if ( !QString::compare( featuresList->at(i).getFullPath(), path, Qt::CaseInsensitive ) && if ( !QString::compare( featuresList.at(i).getFullPath(), path, Qt::CaseInsensitive ) &&
!QString::compare( featuresList->at(i).getUrl(), "/root/favorites", Qt::CaseInsensitive ) ) !QString::compare( featuresList.at(i).getUrl(), "/root/favorites", Qt::CaseInsensitive ) )
{ {
removeRow( i, QModelIndex() ); removeRow( i, QModelIndex() );
return; return;
...@@ -629,11 +640,11 @@ bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent ...@@ -629,11 +640,11 @@ bool UBFeaturesModel::removeRows( int row, int count, const QModelIndex & parent
{ {
if ( row < 0 ) if ( row < 0 )
return false; return false;
if ( row + count > featuresList->size() ) if ( row + count > featuresList.size() )
return false; return false;
beginRemoveRows( parent, row, row + count - 1 ); beginRemoveRows( parent, row, row + count - 1 );
//featuresList->remove( row, count ); //featuresList->remove( row, count );
featuresList->erase( featuresList->begin() + row, featuresList->begin() + row + count ); featuresList.erase( featuresList.begin() + row, featuresList.begin() + row + count );
endRemoveRows(); endRemoveRows();
return true; return true;
} }
...@@ -642,11 +653,11 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent ) ...@@ -642,11 +653,11 @@ bool UBFeaturesModel::removeRow( int row, const QModelIndex & parent )
{ {
if ( row < 0 ) if ( row < 0 )
return false; return false;
if ( row >= featuresList->size() ) if ( row >= featuresList.size() )
return false; return false;
beginRemoveRows( parent, row, row ); beginRemoveRows( parent, row, row );
//featuresList->remove( row ); //featuresList->remove( row );
featuresList->erase( featuresList->begin() + row ); featuresList.erase( featuresList.begin() + row );
endRemoveRows(); endRemoveRows();
return true; return true;
} }
...@@ -698,7 +709,7 @@ int UBFeaturesModel::rowCount(const QModelIndex &parent) const ...@@ -698,7 +709,7 @@ int UBFeaturesModel::rowCount(const QModelIndex &parent) const
if (parent.isValid()) if (parent.isValid())
return 0; return 0;
else else
return featuresList->size(); return featuresList.size();
} }
......
...@@ -181,9 +181,9 @@ public: ...@@ -181,9 +181,9 @@ 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(const QList <UBFeature> &flist ) { featuresList = flist; }
private: private:
QList <UBFeature> *featuresList; QList <UBFeature> featuresList;
}; };
class UBFeaturesProxyModel : public QSortFilterProxyModel class UBFeaturesProxyModel : public QSortFilterProxyModel
......
...@@ -18,12 +18,13 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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
......
#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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <QModelIndex> #include <QModelIndex>
#include "UBTGWidgetTreeDelegate.h" #include "UBTGWidgetTreeDelegate.h"
#include "core/memcheck.h"
UBTGWidgetTreeDelegate::UBTGWidgetTreeDelegate(QObject *parent) : UBTGWidgetTreeDelegate::UBTGWidgetTreeDelegate(QObject *parent) :
QStyledItemDelegate(parent) QStyledItemDelegate(parent)
{ {
......
#include "UBTeacherGuideDelegate.h" #include "UBTeacherGuideDelegate.h"
#include "core/memcheck.h"
UBTeacherGuideDelegate::UBTeacherGuideDelegate() UBTeacherGuideDelegate::UBTeacherGuideDelegate()
{ {
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h" #include "document/UBDocumentController.h"
#include "core/memcheck.h"
#define UBTG_SEPARATOR_FIXED_HEIGHT 3 #define UBTG_SEPARATOR_FIXED_HEIGHT 3
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
/*************************************************************************** /***************************************************************************
* class UBAddItem * * class UBAddItem *
......
...@@ -16,6 +16,8 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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);
......
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