Commit 5aebe0cf authored by Ivan Ilin's avatar Ivan Ilin

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

parents ac113dd7 652d966e
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <QDomDocument> #include <QDomDocument>
#include "core/memcheck.h"
//enum of xmlparse status //enum of xmlparse status
//tag names definition //tag names definition
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
#include "core/UBDocumentManager.h" #include "core/UBDocumentManager.h"
#include "core/memcheck.h"
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "domain/UBGraphicsPDFItem.h" #include "domain/UBGraphicsPDFItem.h"
...@@ -32,6 +31,8 @@ ...@@ -32,6 +31,8 @@
#include "quazipfile.h" #include "quazipfile.h"
#include "quazipfileinfo.h" #include "quazipfileinfo.h"
#include "core/memcheck.h"
UBImportCFF::UBImportCFF(QObject *parent) UBImportCFF::UBImportCFF(QObject *parent)
: UBImportAdaptor(parent) : UBImportAdaptor(parent)
{ {
......
...@@ -471,7 +471,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -471,7 +471,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{ {
if (annotationGroup) if (annotationGroup)
{ {
annotationGroup->addPolygon(polygonItem);
polygonItem->setStroke(annotationGroup); polygonItem->setStroke(annotationGroup);
} }
...@@ -492,7 +491,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -492,7 +491,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{ {
if (annotationGroup) if (annotationGroup)
{ {
annotationGroup->addPolygon(polygonItem);
polygonItem->setStroke(annotationGroup); polygonItem->setStroke(annotationGroup);
} }
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
#include "adaptors/publishing/UBDocumentPublisher.h" #include "adaptors/publishing/UBDocumentPublisher.h"
#include "core/memcheck.h"
#include "transition/UniboardSankoreTransition.h" #include "transition/UniboardSankoreTransition.h"
#include "core/memcheck.h"
UBWebPublisher::UBWebPublisher(QObject *parent) UBWebPublisher::UBWebPublisher(QObject *parent)
: UBExportAdaptor(parent) : UBExportAdaptor(parent)
{ {
......
...@@ -43,9 +43,10 @@ ...@@ -43,9 +43,10 @@
#include "UBSvgSubsetRasterizer.h" #include "UBSvgSubsetRasterizer.h"
#include "core/memcheck.h"
#include "../../core/UBApplication.h" #include "../../core/UBApplication.h"
#include "core/memcheck.h"
UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *parent) UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *parent)
: QObject(parent) : QObject(parent)
......
...@@ -33,6 +33,13 @@ UBDrawingController* UBDrawingController::drawingController() ...@@ -33,6 +33,13 @@ UBDrawingController* UBDrawingController::drawingController()
return sDrawingController; return sDrawingController;
} }
void UBDrawingController::destroy()
{
if(sDrawingController)
delete sDrawingController;
sDrawingController = NULL;
}
UBDrawingController::UBDrawingController(QObject * parent) UBDrawingController::UBDrawingController(QObject * parent)
: QObject(parent) : QObject(parent)
, mActiveRuler(NULL) , mActiveRuler(NULL)
......
...@@ -33,6 +33,7 @@ class UBDrawingController : public QObject ...@@ -33,6 +33,7 @@ class UBDrawingController : public QObject
public: public:
static UBDrawingController* drawingController(); static UBDrawingController* drawingController();
static void destroy();
int stylusTool(); int stylusTool();
int latestDrawingTool(); int latestDrawingTool();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBSetting.h" #include "core/UBSetting.h"
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"
#include "core/UBDownloadManager.h"
#include "domain/UBAbstractWidget.h" #include "domain/UBAbstractWidget.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
...@@ -110,7 +111,6 @@ void UBLibraryController::createDirectory(QUrl& pDirPath) ...@@ -110,7 +111,6 @@ void UBLibraryController::createDirectory(QUrl& pDirPath)
void UBLibraryController::routeItem(QString& pItem, QString pMiddleDirectory) void UBLibraryController::routeItem(QString& pItem, QString pMiddleDirectory)
{ {
qDebug() << "routeItem: " << pItem;
QFileInfo itemToRoute(pItem); QFileInfo itemToRoute(pItem);
QString mimetype = UBFileSystemUtils::mimeTypeFromFileName(itemToRoute.fileName()); QString mimetype = UBFileSystemUtils::mimeTypeFromFileName(itemToRoute.fileName());
QString destination(""); QString destination("");
...@@ -138,6 +138,7 @@ void UBLibraryController::routeItem(QString& pItem, QString pMiddleDirectory) ...@@ -138,6 +138,7 @@ void UBLibraryController::routeItem(QString& pItem, QString pMiddleDirectory)
createDirectory(url); createDirectory(url);
} }
destination = UBFileSystemUtils::normalizeFilePath(destination + "/" + itemToRoute.fileName()); destination = UBFileSystemUtils::normalizeFilePath(destination + "/" + itemToRoute.fileName());
QFile::copy(pItem, destination); QFile::copy(pItem, destination);
} }
} }
...@@ -187,7 +188,24 @@ void UBLibraryController::importItemOnLibrary(QString& pItemString) ...@@ -187,7 +188,24 @@ void UBLibraryController::importItemOnLibrary(QString& pItemString)
} }
} }
else{ else{
routeItem(pItemString); if(pItemString.startsWith("uniboardTool://") || pItemString.startsWith("file://") || pItemString.startsWith("/"))
{
// The user dropped a local file
routeItem(pItemString);
}
else
{
// The user dropped a file from the web. We must download it.
sDownloadFileDesc desc;
desc.currentSize = 0;
desc.id = 0;
desc.isBackground = false;
desc.modal = false;
desc.name = QFileInfo(pItemString).fileName();
desc.totalSize = 0;
desc.url = pItemString;
UBDownloadManager::downloadManager()->addFileToDownload(desc);
}
} }
} }
...@@ -458,7 +476,9 @@ QList<UBLibElement*> UBLibraryController::getContent(UBLibElement *element) ...@@ -458,7 +476,9 @@ QList<UBLibElement*> UBLibraryController::getContent(UBLibElement *element)
UBLibraryController::~UBLibraryController() UBLibraryController::~UBLibraryController()
{ {
cleanElementsList(); cleanElementsList();
//NOOP
qDeleteAll(mInternalLibElements);
mInternalLibElements.clear();
} }
void UBLibraryController::setItemAsBackground(UBLibElement* image) void UBLibraryController::setItemAsBackground(UBLibElement* image)
...@@ -760,6 +780,7 @@ UBChainedLibElement::~UBChainedLibElement() ...@@ -760,6 +780,7 @@ UBChainedLibElement::~UBChainedLibElement()
delete mpNextElem; delete mpNextElem;
mpNextElem = NULL; mpNextElem = NULL;
} }
delete mpElem;
} }
void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem) void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem)
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
UBLibElement(); UBLibElement();
UBLibElement(eUBLibElementType type, const QUrl& path, const QString& name); UBLibElement(eUBLibElementType type, const QUrl& path, const QString& name);
UBLibElement(UBLibElement* element); UBLibElement(UBLibElement* element);
~UBLibElement(); virtual ~UBLibElement();
static UBLibElement* trashElement(); static UBLibElement* trashElement();
...@@ -79,7 +79,7 @@ class UBChainedLibElement ...@@ -79,7 +79,7 @@ class UBChainedLibElement
{ {
public: public:
UBChainedLibElement(UBLibElement* pElem, UBChainedLibElement* pNextElem=NULL); UBChainedLibElement(UBLibElement* pElem, UBChainedLibElement* pNextElem=NULL);
~UBChainedLibElement(); virtual ~UBChainedLibElement();
UBChainedLibElement* nextElement(){return mpNextElem;} UBChainedLibElement* nextElement(){return mpNextElem;}
UBChainedLibElement* lastElement(); UBChainedLibElement* lastElement();
...@@ -120,6 +120,7 @@ class UBLibraryController : public QObject ...@@ -120,6 +120,7 @@ class UBLibraryController : public QObject
void createNewFolder(QString name, UBLibElement* parentElem); void createNewFolder(QString name, UBLibElement* parentElem);
bool canItemsOnElementBeDeleted(UBLibElement *pElement); bool canItemsOnElementBeDeleted(UBLibElement *pElement);
void routeItem(QString& pItem, QString pMiddleDirectory = QString());
signals: signals:
void dialogClosed(int state); void dialogClosed(int state);
...@@ -153,7 +154,6 @@ class UBLibraryController : public QObject ...@@ -153,7 +154,6 @@ class UBLibraryController : public QObject
QList<UBLibElement*> addVirtualElementsForItemPath(const QString& pPath); QList<UBLibElement*> addVirtualElementsForItemPath(const QString& pPath);
void createInternalWidgetItems(); void createInternalWidgetItems();
void routeItem(QString& pItem, QString pMiddleDirectory = QString());
void createDirectory(QUrl& pDirPath); void createDirectory(QUrl& pDirPath);
QUrl mAudioStandardDirectoryPath; QUrl mAudioStandardDirectoryPath;
......
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
#include "ui_mainWindow.h" #include "ui_mainWindow.h"
#include "frameworks/UBCryptoUtils.h"
#include "tools/UBToolsManager.h"
#include "core/memcheck.h" #include "core/memcheck.h"
QPointer<QUndoStack> UBApplication::undoStack; QPointer<QUndoStack> UBApplication::undoStack;
...@@ -182,21 +185,26 @@ UBApplication::~UBApplication() ...@@ -182,21 +185,26 @@ UBApplication::~UBApplication()
UBFileSystemUtils::deleteAllTempDirCreatedDuringSession(); UBFileSystemUtils::deleteAllTempDirCreatedDuringSession();
// delete mainWindow; delete mainWindow;
mainWindow = 0; mainWindow = 0;
// delete staticMemoryCleaner;
staticMemoryCleaner = 0;
delete mUniboardSankoreTransition; delete mUniboardSankoreTransition;
mUniboardSankoreTransition = 0; mUniboardSankoreTransition = 0;
if (mPreferencesController) UBPersistenceManager::destroy();
{
delete mPreferencesController; UBDownloadManager::destroy();
mPreferencesController = 0;
} UBDrawingController::destroy();
UBSettings::destroy();
UBCryptoUtils::destroy();
UBToolsManager::destroy();
delete staticMemoryCleaner;
staticMemoryCleaner = 0;
} }
int UBApplication::exec(const QString& pFileToImport) int UBApplication::exec(const QString& pFileToImport)
...@@ -633,15 +641,14 @@ QString UBApplication::globalStyleSheet() ...@@ -633,15 +641,14 @@ QString UBApplication::globalStyleSheet()
QString UBApplication::urlFromHtml(QString html) QString UBApplication::urlFromHtml(QString html)
{ {
qDebug() << "HTML: " << html.remove(QRegExp("[\\0]"));
QString url; QString url;
QDomDocument domDoc; QDomDocument domDoc;
domDoc.setContent(html); domDoc.setContent(html.remove(QRegExp("[\\0]")));
QDomElement rootElem = domDoc.documentElement(); QDomElement rootElem = domDoc.documentElement();
url = rootElem.attribute("src"); url = rootElem.attribute("src");
qDebug() << url;
return url; return url;
} }
...@@ -37,9 +37,10 @@ ...@@ -37,9 +37,10 @@
#include "UBSettings.h" #include "UBSettings.h"
#include "UBPersistenceManager.h" #include "UBPersistenceManager.h"
#include "core/memcheck.h"
#include "../adaptors/UBExportWeb.h" #include "../adaptors/UBExportWeb.h"
#include "core/memcheck.h"
UBDocumentManager* UBDocumentManager::sDocumentManager = 0; UBDocumentManager* UBDocumentManager::sDocumentManager = 0;
UBDocumentManager* UBDocumentManager::documentManager() UBDocumentManager* UBDocumentManager::documentManager()
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#include "UBDownloadManager.h" #include "UBDownloadManager.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
#include "core/memcheck.h"
/** The unique instance of the download manager */ /** The unique instance of the download manager */
static UBDownloadManager* pInstance = NULL; static UBDownloadManager* pInstance = NULL;
...@@ -53,6 +57,15 @@ UBDownloadManager* UBDownloadManager::downloadManager() ...@@ -53,6 +57,15 @@ UBDownloadManager* UBDownloadManager::downloadManager()
return pInstance; return pInstance;
} }
void UBDownloadManager::destroy()
{
if(pInstance)
{
delete pInstance;
}
pInstance = NULL;
}
/** /**
* \brief Add a file to the download list * \brief Add a file to the download list
* @param desc as the given file description * @param desc as the given file description
...@@ -73,6 +86,10 @@ void UBDownloadManager::addFileToDownload(sDownloadFileDesc desc) ...@@ -73,6 +86,10 @@ void UBDownloadManager::addFileToDownload(sDownloadFileDesc desc)
updateDownloadOrder(); updateDownloadOrder();
UBApplication::mainWindow->showDownloadWidget(); UBApplication::mainWindow->showDownloadWidget();
} }
else
{
UBApplication::boardController->paletteManager()->startDownloads();
}
emit fileAddedToDownload(); emit fileAddedToDownload();
} }
...@@ -190,6 +207,10 @@ void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl ...@@ -190,6 +207,10 @@ void UBDownloadManager::onDownloadFinished(int id, bool pSuccess, QUrl sourceUrl
// The downloaded file is modal so we must put it on the board // The downloaded file is modal so we must put it on the board
emit addDownloadedFileToBoard(pSuccess, sourceUrl, pContentTypeHeader, pData, pPos, pSize, isBackground); emit addDownloadedFileToBoard(pSuccess, sourceUrl, pContentTypeHeader, pData, pPos, pSize, isBackground);
} }
else
{
emit addDownloadedFileToLibrary(pSuccess, sourceUrl, pContentTypeHeader, pData);
}
break; break;
} }
} }
......
...@@ -63,21 +63,21 @@ class UBDownloadManager : public QObject ...@@ -63,21 +63,21 @@ class UBDownloadManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
UBDownloadManager(QObject* parent=0, const char* name="UBDownloadManager");
~UBDownloadManager();
static UBDownloadManager* downloadManager(); static UBDownloadManager* downloadManager();
void addFileToDownload(sDownloadFileDesc desc); void addFileToDownload(sDownloadFileDesc desc);
QVector<sDownloadFileDesc> currentDownloads(); QVector<sDownloadFileDesc> currentDownloads();
QVector<sDownloadFileDesc> pendingDownloads(); QVector<sDownloadFileDesc> pendingDownloads();
void cancelDownloads(); void cancelDownloads();
static void destroy();
signals: signals:
void fileAddedToDownload(); void fileAddedToDownload();
void downloadUpdated(int id, qint64 crnt, qint64 total); void downloadUpdated(int id, qint64 crnt, qint64 total);
void downloadFinished(int id); void downloadFinished(int id);
void downloadModalFinished(); void downloadModalFinished();
void addDownloadedFileToBoard(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground); void addDownloadedFileToBoard(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground);
void addDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData);
void cancelAllDownloads(); void cancelAllDownloads();
void allDownloadsFinished(); void allDownloadsFinished();
...@@ -88,6 +88,9 @@ private slots: ...@@ -88,6 +88,9 @@ private slots:
void onDownloadError(int id); void onDownloadError(int id);
private: private:
UBDownloadManager(QObject* parent=0, const char* name="UBDownloadManager");
~UBDownloadManager();
void init(); void init();
void updateDownloadOrder(); void updateDownloadOrder();
void updateFileCurrentSize(int id, qint64 received=-1, qint64 total=-1); void updateFileCurrentSize(int id, qint64 received=-1, qint64 total=-1);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "UBDownloadThread.h" #include "UBDownloadThread.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent object * @param parent as the parent object
......
...@@ -68,6 +68,13 @@ UBPersistenceManager* UBPersistenceManager::persistenceManager() ...@@ -68,6 +68,13 @@ UBPersistenceManager* UBPersistenceManager::persistenceManager()
return sSingleton; return sSingleton;
} }
void UBPersistenceManager::destroy()
{
if (sSingleton)
delete sSingleton;
sSingleton = NULL;
}
UBPersistenceManager::~UBPersistenceManager() UBPersistenceManager::~UBPersistenceManager()
{ {
foreach(QPointer<UBDocumentProxy> proxyGuard, documentProxies) foreach(QPointer<UBDocumentProxy> proxyGuard, documentProxies)
......
...@@ -58,6 +58,7 @@ class UBPersistenceManager : public QObject ...@@ -58,6 +58,7 @@ class UBPersistenceManager : public QObject
static const QString widgetDirectory; static const QString widgetDirectory;
static UBPersistenceManager* persistenceManager(); static UBPersistenceManager* persistenceManager();
static void destroy();
virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = ""); virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = "");
virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory); virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory);
......
...@@ -97,6 +97,23 @@ QString UBSettings::appPingMessage = "__uniboard_ping"; ...@@ -97,6 +97,23 @@ QString UBSettings::appPingMessage = "__uniboard_ping";
QString UBSettings::defaultDocumentGroupName; QString UBSettings::defaultDocumentGroupName;
QString UBSettings::documentTrashGroupName; QString UBSettings::documentTrashGroupName;
UBSettings* UBSettings::settings()
{
if (!sSingleton)
sSingleton = new UBSettings(qApp);
return sSingleton;
}
void UBSettings::destroy()
{
if (sSingleton)
delete sSingleton;
sSingleton = NULL;
}
QSettings* UBSettings::getAppSettings() QSettings* UBSettings::getAppSettings()
{ {
if (!UBSettings::sAppSettings) if (!UBSettings::sAppSettings)
......
...@@ -22,13 +22,8 @@ class UBSettings : public QObject ...@@ -22,13 +22,8 @@ class UBSettings : public QObject
public: public:
static UBSettings* settings() static UBSettings* settings();
{ static void destroy();
if (!sSingleton)
sSingleton = new UBSettings(qApp);
return sSingleton;
}
private: private:
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "UBApplication.h" #include "UBApplication.h"
#include "UBSettings.h" #include "UBSettings.h"
/* Uncomment this for memory leaks detection */
/*
#if defined(WIN32) && defined(_DEBUG) #if defined(WIN32) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#include <stdlib.h> #include <stdlib.h>
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
#define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ )
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
*/
void ub_message_output(QtMsgType type, const char *msg) { void ub_message_output(QtMsgType type, const char *msg) {
// We must temporarily remove the handler to avoid the infinite recursion of // We must temporarily remove the handler to avoid the infinite recursion of
......
...@@ -100,6 +100,7 @@ void UBGraphicsItemDelegate::init() ...@@ -100,6 +100,7 @@ void UBGraphicsItemDelegate::init()
UBGraphicsItemDelegate::~UBGraphicsItemDelegate() UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
{ {
qDeleteAll(mButtons);
// do not release mMimeData. // do not release mMimeData.
// the mMimeData is owned by QDrag since the setMimeData call as specified in the documentation // the mMimeData is owned by QDrag since the setMimeData call as specified in the documentation
} }
......
...@@ -53,25 +53,29 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth) ...@@ -53,25 +53,29 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth)
// NOOP // NOOP
} }
void UBGraphicsPolygonItem::clearStroke()
UBGraphicsPolygonItem::~UBGraphicsPolygonItem()
{ {
if (mStroke!=NULL) if (mStroke!=NULL)
{ {
QList<UBGraphicsPolygonItem*> pp = mStroke->polygons(); mStroke->remove(this);
int n = pp.indexOf(this); if (mStroke->polygons().empty())
if (n>=0) delete mStroke;
pp.removeAt(n); mStroke = NULL;
if (pp.empty())
delete mStroke;
} }
} }
UBGraphicsPolygonItem::~UBGraphicsPolygonItem()
{
clearStroke();
}
void UBGraphicsPolygonItem::setStroke(UBGraphicsStroke* stroke) void UBGraphicsPolygonItem::setStroke(UBGraphicsStroke* stroke)
{ {
mStroke = stroke; clearStroke();
mStroke = stroke;
mStroke->addPolygon(this);
} }
UBGraphicsStroke* UBGraphicsPolygonItem::stroke() const UBGraphicsStroke* UBGraphicsPolygonItem::stroke() const
......
...@@ -116,6 +116,9 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem ...@@ -116,6 +116,9 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
private: private:
void clearStroke();
bool mHasAlpha; bool mHasAlpha;
QLineF mOriginalLine; QLineF mOriginalLine;
......
...@@ -141,8 +141,11 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) ...@@ -141,8 +141,11 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
UBGraphicsScene::~UBGraphicsScene() UBGraphicsScene::~UBGraphicsScene()
{ {
// NOOP
DisposeMagnifierQWidgets(); DisposeMagnifierQWidgets();
if (mCurrentStroke)
if (mCurrentStroke->polygons().empty())
delete mCurrentStroke;
} }
void UBGraphicsScene::selectionChangedProcessing() void UBGraphicsScene::selectionChangedProcessing()
...@@ -190,6 +193,12 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre ...@@ -190,6 +193,12 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
if (UBDrawingController::drawingController()->isDrawingTool()) if (UBDrawingController::drawingController()->isDrawingTool())
{ {
qreal width = 0; qreal width = 0;
// delete current stroke, if not assigned to any polygon
if (mCurrentStroke)
if (mCurrentStroke->polygons().empty())
delete mCurrentStroke;
mCurrentStroke = new UBGraphicsStroke(); mCurrentStroke = new UBGraphicsStroke();
if (currentTool != UBStylusTool::Line) if (currentTool != UBStylusTool::Line)
...@@ -344,7 +353,12 @@ bool UBGraphicsScene::inputDeviceRelease() ...@@ -344,7 +353,12 @@ bool UBGraphicsScene::inputDeviceRelease()
UBDrawingController *dc = UBDrawingController::drawingController(); UBDrawingController *dc = UBDrawingController::drawingController();
if (dc->isDrawingTool()) if (dc->isDrawingTool())
{ {
mCurrentStroke = 0; if (mCurrentStroke)
{
if (mCurrentStroke->polygons().empty())
delete mCurrentStroke;
mCurrentStroke = 0;
}
} }
if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) if (mRemovedItems.size() > 0 || mAddedItems.size() > 0)
...@@ -503,7 +517,6 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth, ...@@ -503,7 +517,6 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
if (mCurrentStroke) if (mCurrentStroke)
{ {
mCurrentStroke->addPolygon(polygonItem);
polygonItem->setStroke(mCurrentStroke); polygonItem->setStroke(mCurrentStroke);
} }
......
...@@ -33,9 +33,16 @@ UBGraphicsStroke::~UBGraphicsStroke() ...@@ -33,9 +33,16 @@ UBGraphicsStroke::~UBGraphicsStroke()
void UBGraphicsStroke::addPolygon(UBGraphicsPolygonItem* pol) void UBGraphicsStroke::addPolygon(UBGraphicsPolygonItem* pol)
{ {
remove(pol);
mPolygons << pol; mPolygons << pol;
} }
void UBGraphicsStroke::remove(UBGraphicsPolygonItem* polygonItem)
{
int n = mPolygons.indexOf(polygonItem);
if (n>=0)
mPolygons.removeAt(n);
}
QList<UBGraphicsPolygonItem*> UBGraphicsStroke::polygons() const QList<UBGraphicsPolygonItem*> UBGraphicsStroke::polygons() const
{ {
......
...@@ -25,20 +25,25 @@ class UBGraphicsPolygonItem; ...@@ -25,20 +25,25 @@ class UBGraphicsPolygonItem;
class UBGraphicsStroke class UBGraphicsStroke
{ {
friend class UBGraphicsPolygonItem;
public: public:
UBGraphicsStroke(); UBGraphicsStroke();
virtual ~UBGraphicsStroke(); virtual ~UBGraphicsStroke();
bool hasPressure(); bool hasPressure();
void addPolygon(UBGraphicsPolygonItem* pol);
QList<UBGraphicsPolygonItem*> polygons() const; QList<UBGraphicsPolygonItem*> polygons() const;
void remove(UBGraphicsPolygonItem* polygonItem);
UBGraphicsStroke *deepCopy(); UBGraphicsStroke *deepCopy();
bool hasAlpha() const; bool hasAlpha() const;
protected:
void addPolygon(UBGraphicsPolygonItem* pol);
private: private:
QList<UBGraphicsPolygonItem*> mPolygons; QList<UBGraphicsPolygonItem*> mPolygons;
......
...@@ -23,6 +23,21 @@ UBCryptoUtils* UBCryptoUtils::sInstance(0); ...@@ -23,6 +23,21 @@ UBCryptoUtils* UBCryptoUtils::sInstance(0);
QString UBCryptoUtils::sAESKey("9ecHaspud9uD9ste5erAchehefrup3echej-caje6&thestawacuk=h#F3jet3aF"); QString UBCryptoUtils::sAESKey("9ecHaspud9uD9ste5erAchehefrup3echej-caje6&thestawacuk=h#F3jet3aF");
QString UBCryptoUtils::sAESSalt("6f0083e0-a90c-11de-ac21-0002a5d5c51b"); QString UBCryptoUtils::sAESSalt("6f0083e0-a90c-11de-ac21-0002a5d5c51b");
UBCryptoUtils* UBCryptoUtils::instance()
{
if(!sInstance)
sInstance = new UBCryptoUtils(UBApplication::staticMemoryCleaner);
return sInstance;
}
void UBCryptoUtils::destroy()
{
if (sInstance)
delete sInstance;
sInstance = NULL;
}
UBCryptoUtils::UBCryptoUtils(QObject * pParent) UBCryptoUtils::UBCryptoUtils(QObject * pParent)
: QObject(pParent) : QObject(pParent)
......
...@@ -28,13 +28,9 @@ class UBCryptoUtils : public QObject ...@@ -28,13 +28,9 @@ class UBCryptoUtils : public QObject
public: public:
static UBCryptoUtils* instance() static UBCryptoUtils* instance();
{ static void destroy();
if(!sInstance)
sInstance = new UBCryptoUtils(UBApplication::staticMemoryCleaner);
return sInstance;
}
QString symetricEncrypt(const QString& clear); QString symetricEncrypt(const QString& clear);
QString symetricDecrypt(const QString& encrypted); QString symetricDecrypt(const QString& encrypted);
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#include <QDesktopServices> #include <QDesktopServices>
#include "core/memcheck.h"
// TODO Qt 4.6 #error Delete this UBDesktopServices class, // TODO Qt 4.6 #error Delete this UBDesktopServices class,
// it was used to work around a bug in Qt 4.4 that was fixed in Qt 4.5 and another that should be fixed // it was used to work around a bug in Qt 4.4 that was fixed in Qt 4.5 and another that should be fixed
// in 4.5.1 // in 4.5.1
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
static QVector<UBGraphicsCache*> mCaches; static QVector<UBGraphicsCache*> mCaches;
UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
......
#include "UBDockPaletteWidget.h" #include "UBDockPaletteWidget.h"
#include "core/memcheck.h"
UBDockPaletteWidget::UBDockPaletteWidget(QWidget *parent, const char *name):QWidget(parent) UBDockPaletteWidget::UBDockPaletteWidget(QWidget *parent, const char *name):QWidget(parent)
{ {
setObjectName(name); setObjectName(name);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "UBDownloadWidget.h" #include "UBDownloadWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include "UBLeftPalette.h" #include "UBLeftPalette.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/memcheck.h"
/** /**
* \brief The constructor * \brief The constructor
*/ */
......
...@@ -143,8 +143,9 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl ...@@ -143,8 +143,9 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl
{ {
if(NULL != fromElem->nextElement()) if(NULL != fromElem->nextElement())
{ {
removeNextChainedElements(fromElem->nextElement()); //removeNextChainedElements(fromElem->nextElement());
delete fromElem->nextElement()->element(); //delete fromElem->nextElement()->element();
//delete fromElem->nextElement();
delete fromElem->nextElement(); delete fromElem->nextElement();
fromElem->setNextElement(NULL); fromElem->setNextElement(NULL);
} }
......
...@@ -80,16 +80,16 @@ UBLibPathViewer::~UBLibPathViewer() ...@@ -80,16 +80,16 @@ UBLibPathViewer::~UBLibPathViewer()
delete mpElems; delete mpElems;
mpElems = NULL; mpElems = NULL;
} }
if(NULL != mpElemsBackup) //if(NULL != mpElemsBackup)
{ //{
delete mpElemsBackup; // delete mpElemsBackup;
mpElemsBackup = NULL; // mpElemsBackup = NULL;
} //}
if(NULL != mpLayout) //if(NULL != mpLayout)
{ //{
delete mpLayout; // delete mpLayout;
mpLayout = NULL; // mpLayout = NULL;
} //}
if(NULL != mpScene) if(NULL != mpScene)
{ {
delete mpScene; delete mpScene;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#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)
, mpWebSettings(NULL) , mpWebSettings(NULL)
......
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
#include <QDebug> #include <QDebug>
#include "UBLibWidget.h" #include "UBLibWidget.h"
#include "core/memcheck.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <QList> #include <QList>
#include <QFileInfo> #include <QFileInfo>
#include <QDir>
#include "UBLibraryWidget.h" #include "UBLibraryWidget.h"
#include "core/UBSettings.h" #include "core/UBSettings.h"
...@@ -23,10 +24,12 @@ ...@@ -23,10 +24,12 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBLibraryController.h" #include "board/UBLibraryController.h"
#include "core/memcheck.h" #include "core/UBDownloadManager.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
...@@ -53,12 +56,6 @@ UBLibraryWidget::~UBLibraryWidget() ...@@ -53,12 +56,6 @@ UBLibraryWidget::~UBLibraryWidget()
delete mLibraryController; delete mLibraryController;
mLibraryController = NULL; mLibraryController = NULL;
} }
// if(NULL != chainedElements)
// {
// delete chainedElements;
// chainedElements = NULL;
// }
if(NULL != mpCrntDir) if(NULL != mpCrntDir)
{ {
delete mpCrntDir; delete mpCrntDir;
...@@ -87,6 +84,7 @@ void UBLibraryWidget::init() ...@@ -87,6 +84,7 @@ void UBLibraryWidget::init()
connect(this, SIGNAL(mouseClick(QGraphicsItem*,int)), this, SLOT(onItemClicked(QGraphicsItem*,int))); connect(this, SIGNAL(mouseClick(QGraphicsItem*,int)), this, SLOT(onItemClicked(QGraphicsItem*,int)));
connect(this, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(this, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
connect(UBDownloadManager::downloadManager(), SIGNAL(addDownloadedFileToLibrary(bool,QUrl,QString,QByteArray)), this, SLOT(onAddDownloadedFileToLibrary(bool,QUrl,QString,QByteArray)));
} }
/** /**
...@@ -362,7 +360,14 @@ void UBLibraryWidget::dropEvent(QDropEvent *event) ...@@ -362,7 +360,14 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
} }
else if (pMimeData->hasHtml()) else if (pMimeData->hasHtml())
{ {
qDebug() << "hasHtml Unsupported yet"; qDebug() << "hasHtml";
QString html = pMimeData->html();
QString url = UBApplication::urlFromHtml(html);
if("" != url)
{
mLibraryController->importItemOnLibrary(url);
bDropAccepted = true;
}
} }
else if (pMimeData->hasText()) else if (pMimeData->hasText())
{ {
...@@ -666,3 +671,24 @@ void UBNewFolderDlg::text_Edited(const QString &newText) ...@@ -666,3 +671,24 @@ void UBNewFolderDlg::text_Edited(const QString &newText)
QToolTip::showText(mpLineEdit->mapToGlobal(QPoint()), "A file name can`t contain any of the following characters:\r\n"+illegalCharList); QToolTip::showText(mpLineEdit->mapToGlobal(QPoint()), "A file name can`t contain any of the following characters:\r\n"+illegalCharList);
} }
} }
void UBLibraryWidget::onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData)
{
Q_UNUSED(pContentHeader);
if(pSuccess)
{
QDir dir;
dir.mkdir("tmp");
QString qsFileName = QFileInfo(sourceUrl.toString()).fileName();
QString qsFilePath = UBFileSystemUtils::normalizeFilePath(QString("tmp/%0").arg(qsFileName));
QFile f(qsFilePath);
if(f.open(QIODevice::WriteOnly))
{
f.write(pData);
f.close();
}
mLibraryController->routeItem(qsFilePath);
dir.remove(qsFileName);
dir.rmdir("tmp"); // Due to Qt, the directoy will be removed only if it's empty :)
}
}
...@@ -55,6 +55,8 @@ public slots: ...@@ -55,6 +55,8 @@ public slots:
void onSearchElement(QString elem); void onSearchElement(QString elem);
void onNewFolderToCreate(); void onNewFolderToCreate();
void onDropMe(const QMimeData* _data); void onDropMe(const QMimeData* _data);
void onAddDownloadedFileToLibrary(bool pSuccess, QUrl sourceUrl, QString pContentHeader, QByteArray pData);
signals: signals:
void navigBarUpdate(UBLibElement* pElem); void navigBarUpdate(UBLibElement* pElem);
void itemsSelected(QList<UBLibElement*> elemList, bool inTrash); void itemsSelected(QList<UBLibElement*> elemList, bool inTrash);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive) UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive)
: QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)) : QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint))
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "UBRightPalette.h" #include "UBRightPalette.h"
#include "core/memcheck.h"
/** /**
* \brief The constructor * \brief The constructor
*/ */
......
...@@ -26,17 +26,20 @@ ...@@ -26,17 +26,20 @@
UBRubberBand::UBRubberBand(Shape s, QWidget * p) UBRubberBand::UBRubberBand(Shape s, QWidget * p)
: QRubberBand(s, p) : QRubberBand(s, p)
{ {
QStyle* rubberBandStyle = QRubberBand::style(); customStyle = NULL;
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
rubberBandStyle = new QWindowsXPStyle(); customStyle = new QWindowsXPStyle();
#elif defined(Q_WS_MAC) #elif defined(Q_WS_MAC)
rubberBandStyle = new QMacStyle(); customStyle = new QMacStyle();
#endif #endif
QRubberBand::setStyle(rubberBandStyle);
if (customStyle)
QRubberBand::setStyle(customStyle);
} }
UBRubberBand::~UBRubberBand() UBRubberBand::~UBRubberBand()
{ {
// NOOP if (customStyle)
delete customStyle;
} }
...@@ -25,6 +25,8 @@ class UBRubberBand : public QRubberBand ...@@ -25,6 +25,8 @@ class UBRubberBand : public QRubberBand
public: public:
UBRubberBand(Shape s, QWidget * p = 0); UBRubberBand(Shape s, QWidget * p = 0);
virtual ~UBRubberBand(); virtual ~UBRubberBand();
private:
QStyle* customStyle;
}; };
#endif /* UBRUBBERBAND_H_ */ #endif /* UBRUBBERBAND_H_ */
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#include "core/memcheck.h"
UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
, mpLayout(NULL) , mpLayout(NULL)
, mpTitleLayout(NULL) , mpTitleLayout(NULL)
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h" #include "document/UBDocumentController.h"
#include "core/memcheck.h"
UBThumbnailWidget::UBThumbnailWidget(QWidget* parent) UBThumbnailWidget::UBThumbnailWidget(QWidget* parent)
: QGraphicsView(parent) : QGraphicsView(parent)
, mThumbnailWidth(UBSettings::defaultThumbnailWidth) , mThumbnailWidth(UBSettings::defaultThumbnailWidth)
......
...@@ -84,11 +84,10 @@ QNetworkReply* UBNetworkAccessManager::createRequest(Operation op, const QNetwor ...@@ -84,11 +84,10 @@ QNetworkReply* UBNetworkAccessManager::createRequest(Operation op, const QNetwor
QNetworkReply *UBNetworkAccessManager::get(const QNetworkRequest &request) QNetworkReply *UBNetworkAccessManager::get(const QNetworkRequest &request)
{ {
qDebug() << "request url: " << request.url(); QTime loadStartTime;
QTime loadStartTime;
loadStartTime.start(); loadStartTime.start();
QNetworkReply *networkReply = QNetworkAccessManager::get(request); QNetworkReply *networkReply = QNetworkAccessManager::get(request);
return networkReply; return networkReply;
} }
void UBNetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth) void UBNetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth)
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include <iostream> #include <iostream>
#include "ASCII85Decode.h" #include "ASCII85Decode.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
static const unsigned long pow85[] = { static const unsigned long pow85[] = {
85*85*85*85, 85*85*85, 85*85, 85, 1 85*85*85*85, 85*85*85, 85*85, 85, 1
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <string> #include <string>
#include "Utils.h" #include "Utils.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
const std::string WHITESPACES(" \t\f\v\n\r"); const std::string WHITESPACES(" \t\f\v\n\r");
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
*/ */
#include "AnnotsHandler.h" #include "AnnotsHandler.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
void AnnotsHandler::_processObjectContent(unsigned int startOfPageElement) void AnnotsHandler::_processObjectContent(unsigned int startOfPageElement)
{ {
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <string> #include <string>
#include <string.h> #include <string.h>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
using namespace std; using namespace std;
//concatenate stream of all objects which contain Content of Page //concatenate stream of all objects which contain Content of Page
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
const std::string firstObj("%PDF-1.4\n1 0 obj\n<<\n/Title ()/Creator ()/Producer (Qt 4.5.0 (C) 1992-2009 Nokia Corporation and/or its subsidiary(-ies))/CreationDate (D:20090424120829)\n>>\nendobj\n"); const std::string firstObj("%PDF-1.4\n1 0 obj\n<<\n/Title ()/Creator ()/Producer (Qt 4.5.0 (C) 1992-2009 Nokia Corporation and/or its subsidiary(-ies))/CreationDate (D:20090424120829)\n>>\nendobj\n");
const std::string zeroStr("0000000000"); const std::string zeroStr("0000000000");
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "JBIG2Decode.h" #include "JBIG2Decode.h"
#include "DCTDecode.h" #include "DCTDecode.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
std::map<std::string, Decoder *> Filter::_allDecoders; std::map<std::string, Decoder *> Filter::_allDecoders;
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "Object.h" #include "Object.h"
#include "Parser.h" #include "Parser.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
const std::string FilterPredictor::PREDICTOR_TOKEN = "/Predictor"; const std::string FilterPredictor::PREDICTOR_TOKEN = "/Predictor";
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "Utils.h" #include "Utils.h"
#include <string.h> #include <string.h>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
#define ZLIB_MEM_DELTA 65535 #define ZLIB_MEM_DELTA 65535
#define ZLIB_CHECK_ERR(err,msg) \ #define ZLIB_CHECK_ERR(err,msg) \
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "LZWDecode.h" #include "LZWDecode.h"
#include "FilterPredictor.h" #include "FilterPredictor.h"
#include "core/memcheck.h"
// method performs decoding // method performs decoding
using namespace merge_lib; using namespace merge_lib;
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <map> #include <map>
#include <iostream> #include <iostream>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
Parser Merger::_parser; Parser Merger::_parser;
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
std::string NUMBERANDWHITESPACE(" 0123456789"); std::string NUMBERANDWHITESPACE(" 0123456789");
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "Exception.h" #include "Exception.h"
#include "Object.h" #include "Object.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
using namespace std; using namespace std;
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <string.h> #include <string.h>
#include "Parser.h" #include "Parser.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
*/ */
#include "PageElementHandler.h" #include "PageElementHandler.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
std::set<std::string> PageElementHandler::_allPageFields; std::set<std::string> PageElementHandler::_allPageFields;
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include "Exception.h" #include "Exception.h"
#include "Utils.h" #include "Utils.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
using namespace std; using namespace std;
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <iostream> #include <iostream>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
Rectangle::Rectangle(const char * rectangleName): Rectangle::Rectangle(const char * rectangleName):
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
*/ */
#include "RemoveHimSelfHandler.h" #include "RemoveHimSelfHandler.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
void RemoveHimselfHandler::_changeObjectContent(unsigned int startOfPageElement) void RemoveHimselfHandler::_changeObjectContent(unsigned int startOfPageElement)
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
*/ */
#include "RunLengthDecode.h" #include "RunLengthDecode.h"
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
/* The encoded data is a sequence of /* The encoded data is a sequence of
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <fstream> #include <fstream>
#include <string.h> #include <string.h>
#include "core/memcheck.h"
using namespace merge_lib; using namespace merge_lib;
int Utils::stringToInt(const std::string & str) //throw ConvertException int Utils::stringToInt(const std::string & str) //throw ConvertException
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include "UBAbstractVideoEncoder.h" #include "UBAbstractVideoEncoder.h"
#include "core/memcheck.h"
UBAbstractVideoEncoder::UBAbstractVideoEncoder(QObject *pParent) UBAbstractVideoEncoder::UBAbstractVideoEncoder(QObject *pParent)
: QObject(pParent) : QObject(pParent)
, mFramesPerSecond(10) , mFramesPerSecond(10)
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "quicktime/UBAudioQueueRecorder.h" #include "quicktime/UBAudioQueueRecorder.h"
#endif #endif
#include "core/memcheck.h"
UBPodcastController* UBPodcastController::sInstance = 0; UBPodcastController* UBPodcastController::sInstance = 0;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "core/memcheck.h"
UBPodcastRecordingPalette::UBPodcastRecordingPalette(QWidget *parent) UBPodcastRecordingPalette::UBPodcastRecordingPalette(QWidget *parent)
: UBActionPalette(Qt::Horizontal, parent) : UBActionPalette(Qt::Horizontal, parent)
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "gui/UBMainWindow.h" #include "gui/UBMainWindow.h"
#include "core/memcheck.h"
UBIntranetPodcastPublisher::UBIntranetPodcastPublisher(QObject* pParent) UBIntranetPodcastPublisher::UBIntranetPodcastPublisher(QObject* pParent)
: QObject(pParent) : QObject(pParent)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "UBAudioQueueRecorder.h" #include "UBAudioQueueRecorder.h"
#include "core/memcheck.h"
AudioStreamBasicDescription UBAudioQueueRecorder::sAudioFormat; AudioStreamBasicDescription UBAudioQueueRecorder::sAudioFormat;
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "UBAudioQueueRecorder.h" #include "UBAudioQueueRecorder.h"
#include <QtGui> #include <QtGui>
#include "core/memcheck.h"
QQueue<UBQuickTimeFile::VideoFrame> UBQuickTimeFile::frameQueue; QQueue<UBQuickTimeFile::VideoFrame> UBQuickTimeFile::frameQueue;
QMutex UBQuickTimeFile::frameQueueMutex; QMutex UBQuickTimeFile::frameQueueMutex;
QWaitCondition UBQuickTimeFile::frameBufferNotEmpty; QWaitCondition UBQuickTimeFile::frameBufferNotEmpty;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "UBQuickTimeFile.h" #include "UBQuickTimeFile.h"
#include "core/memcheck.h"
UBQuickTimeVideoEncoder::UBQuickTimeVideoEncoder(QObject* pParent) UBQuickTimeVideoEncoder::UBQuickTimeVideoEncoder(QObject* pParent)
: UBAbstractVideoEncoder(pParent) : UBAbstractVideoEncoder(pParent)
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "Mmsystem.h" #include "Mmsystem.h"
#include "core/memcheck.h"
UBWaveRecorder::UBWaveRecorder(QObject * pParent) UBWaveRecorder::UBWaveRecorder(QObject * pParent)
: QObject(pParent) : QObject(pParent)
, mIsRecording(false) , mIsRecording(false)
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
UBWindowsMediaFile::UBWindowsMediaFile(QObject * pParent) UBWindowsMediaFile::UBWindowsMediaFile(QObject * pParent)
: QObject(pParent) : QObject(pParent)
, mWMhDC(0) , mWMhDC(0)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "UBWindowsMediaFile.h" #include "UBWindowsMediaFile.h"
#include "core/memcheck.h"
UBWindowsMediaVideoEncoder::UBWindowsMediaVideoEncoder(QObject* pParent) UBWindowsMediaVideoEncoder::UBWindowsMediaVideoEncoder(QObject* pParent)
: UBAbstractVideoEncoder(pParent) : UBAbstractVideoEncoder(pParent)
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "network/UBNetworkAccessManager.h" #include "network/UBNetworkAccessManager.h"
#include "network/UBServerXMLHttpRequest.h" #include "network/UBServerXMLHttpRequest.h"
#include "core/memcheck.h"
// API key linked to account dev.mnemis@gmail.com // API key linked to account dev.mnemis@gmail.com
const QString UBYouTubePublisher::sYouTubeDeveloperKey("AI39si62ga82stA4YBr5JjkfuRsFT-QyC4UYsFn7yYQFMe_dzg8xOc0r91BOhxSEhEr0gdWJGNnDsYbv9wvpyROd2Yre-6Zh7g"); const QString UBYouTubePublisher::sYouTubeDeveloperKey("AI39si62ga82stA4YBr5JjkfuRsFT-QyC4UYsFn7yYQFMe_dzg8xOc0r91BOhxSEhEr0gdWJGNnDsYbv9wvpyROd2Yre-6Zh7g");
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "UBRssHandler.h" #include "UBRssHandler.h"
#include "UBSoftwareUpdate.h" #include "UBSoftwareUpdate.h"
#include "core/memcheck.h"
const QString UBRssHandler::sRssItemElementName = "item"; const QString UBRssHandler::sRssItemElementName = "item";
const QString UBRssHandler::sRssLinkElementName = "link"; const QString UBRssHandler::sRssLinkElementName = "link";
const QString UBRssHandler::sUniboardVersionElementName = "ub:version"; // TODO UB 4.x map properly ub namespace const QString UBRssHandler::sUniboardVersionElementName = "ub:version"; // TODO UB 4.x map properly ub namespace
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "UBSoftwareUpdate.h" #include "UBSoftwareUpdate.h"
#include "core/memcheck.h"
UBSoftwareUpdate::UBSoftwareUpdate() UBSoftwareUpdate::UBSoftwareUpdate()
{ {
// NOOP // NOOP
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "board/UBBoardView.h" #include "board/UBBoardView.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem() UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
, mMaskColor(Qt::black) , mMaskColor(Qt::black)
......
...@@ -19,6 +19,21 @@ ...@@ -19,6 +19,21 @@
UBToolsManager* UBToolsManager::sManager = 0; UBToolsManager* UBToolsManager::sManager = 0;
UBToolsManager* UBToolsManager::manager()
{
if (!sManager)
sManager = new UBToolsManager(UBApplication::staticMemoryCleaner);
return sManager;
}
void UBToolsManager::destroy()
{
if (sManager)
delete sManager;
sManager = NULL;
}
UBToolsManager::UBToolsManager(QObject *parent) UBToolsManager::UBToolsManager(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
......
...@@ -38,12 +38,8 @@ class UBToolsManager : public QObject ...@@ -38,12 +38,8 @@ class UBToolsManager : public QObject
}; };
static UBToolsManager* manager() static UBToolsManager* manager();
{ static void destroy();
if (!sManager)
sManager = new UBToolsManager(UBApplication::staticMemoryCleaner);
return sManager;
}
QList<UBToolDescriptor> allTools() QList<UBToolDescriptor> allTools()
{ {
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
#include "core/memcheck.h"
UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) : UniboardSankoreTransition::UniboardSankoreTransition(QObject *parent) :
QObject(parent) QObject(parent)
, mTransitionDlg(NULL) , mTransitionDlg(NULL)
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <QtWebKit> #include <QtWebKit>
#include <QtGui> #include <QtGui>
#include "core/memcheck.h"
UBRoutedMouseEventWebView::UBRoutedMouseEventWebView(QWidget * parent) UBRoutedMouseEventWebView::UBRoutedMouseEventWebView(QWidget * parent)
: QWebView(parent) : QWebView(parent)
{ {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "ui_trapFlash.h" #include "ui_trapFlash.h"
#include "core/memcheck.h"
UBTrapFlashController::UBTrapFlashController(QWidget* parent) UBTrapFlashController::UBTrapFlashController(QWidget* parent)
: QObject(parent) : QObject(parent)
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "desktop/UBCustomCaptureWindow.h" #include "desktop/UBCustomCaptureWindow.h"
#include "board/UBBoardPaletteManager.h" #include "board/UBBoardPaletteManager.h"
#include "core/memcheck.h"
UBWebController::UBWebController(UBMainWindow* mainWindow) UBWebController::UBWebController(UBMainWindow* mainWindow)
: QObject(mainWindow->centralWidget()) : QObject(mainWindow->centralWidget())
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include "UBWebKitUtils.h" #include "UBWebKitUtils.h"
#include "core/memcheck.h"
UBWebKitUtils::UBWebKitUtils() UBWebKitUtils::UBWebKitUtils()
{ {
// NOOP // NOOP
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "pdf/UBWebPluginPDFWidget.h" #include "pdf/UBWebPluginPDFWidget.h"
#include "core/memcheck.h"
class UBWebPluginFactory : public QWebPluginFactory class UBWebPluginFactory : public QWebPluginFactory
{ {
public: public:
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "pdf/UBWebPluginPDFWidget.h" #include "pdf/UBWebPluginPDFWidget.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
UBWebPluginWidget::UBWebPluginWidget(const QUrl &url, QWidget *parent) UBWebPluginWidget::UBWebPluginWidget(const QUrl &url, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, mLoadingProgressBar(this) , mLoadingProgressBar(this)
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#include "ui_passworddialog.h" #include "ui_passworddialog.h"
#include "WBWebView.h" #include "WBWebView.h"
#include "core/memcheck.h"
WBDownloadManager *WBBrowserWindow::sDownloadManager = 0; WBDownloadManager *WBBrowserWindow::sDownloadManager = 0;
WBHistoryManager *WBBrowserWindow::sHistoryManager = 0; WBHistoryManager *WBBrowserWindow::sHistoryManager = 0;
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#include <QtGui> #include <QtGui>
#include "core/memcheck.h"
WBChaseWidget::WBChaseWidget(QWidget *parent, QPixmap pixmap, bool pixmapEnabled) WBChaseWidget::WBChaseWidget(QWidget *parent, QPixmap pixmap, bool pixmapEnabled)
: QWidget(parent) : QWidget(parent)
, mSegment(0) , mSegment(0)
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
#include <math.h> #include <math.h>
#include "core/memcheck.h"
/*! /*!
DownloadItem is a widget that is displayed in the download manager list. DownloadItem is a widget that is displayed in the download manager list.
It moves the data from the QNetworkReply into the QFile as well It moves the data from the QNetworkReply into the QFile as well
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
#include "WBEditTableView.h" #include "WBEditTableView.h"
#include <QtGui/QKeyEvent> #include <QtGui/QKeyEvent>
#include "core/memcheck.h"
WBEditTableView::WBEditTableView(QWidget *parent) WBEditTableView::WBEditTableView(QWidget *parent)
: QTableView(parent) : QTableView(parent)
{ {
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include "core/UBSettings.h" #include "core/UBSettings.h"
#include "network/UBAutoSaver.h" #include "network/UBAutoSaver.h"
#include "core/memcheck.h"
static const unsigned int HISTORY_VERSION = 23; static const unsigned int HISTORY_VERSION = 23;
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#include <QtCore> #include <QtCore>
#include "core/memcheck.h"
WBModelMenu::WBModelMenu(QWidget * parent) WBModelMenu::WBModelMenu(QWidget * parent)
: QMenu(parent) : QMenu(parent)
, m_maxRows(7) , m_maxRows(7)
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#include <QtGui> #include <QtGui>
#include "core/memcheck.h"
WBClearButton::WBClearButton(QWidget *parent) WBClearButton::WBClearButton(QWidget *parent)
: QAbstractButton(parent) : QAbstractButton(parent)
{ {
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
#include "WBSqueezeLabel.h" #include "WBSqueezeLabel.h"
#include "core/memcheck.h"
WBSqueezeLabel::WBSqueezeLabel(QWidget *parent) : QLabel(parent) WBSqueezeLabel::WBSqueezeLabel(QWidget *parent) : QLabel(parent)
{ {
} }
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
#include <QtGui> #include <QtGui>
#include <QSvgWidget> #include <QSvgWidget>
#include "core/memcheck.h"
WBTabBar::WBTabBar(QWidget *parent) WBTabBar::WBTabBar(QWidget *parent)
: QTabBar(parent) : QTabBar(parent)
{ {
......
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
#include "network/UBAutoSaver.h" #include "network/UBAutoSaver.h"
#include "core/memcheck.h"
/* /*
ToolbarSearch is a very basic search widget that also contains a small history. ToolbarSearch is a very basic search widget that also contains a small history.
Searches are turned into urls that use Google to perform search Searches are turned into urls that use Google to perform search
......
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
#include <QtGui> #include <QtGui>
#include "core/memcheck.h"
WBExLineEdit::WBExLineEdit(QWidget *parent) WBExLineEdit::WBExLineEdit(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, mLeftWidget(0) , mLeftWidget(0)
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "core/memcheck.h"
WBWebTrapWebView::WBWebTrapWebView(QWidget* parent) WBWebTrapWebView::WBWebTrapWebView(QWidget* parent)
: QWebView(parent) : QWebView(parent)
, mCurrentContentType(Unknown) , mCurrentContentType(Unknown)
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#include <QtWebKit> #include <QtWebKit>
#include <QtUiTools/QUiLoader> #include <QtUiTools/QUiLoader>
#include "core/memcheck.h"
WBWebPage::WBWebPage(QObject *parent) WBWebPage::WBWebPage(QObject *parent)
: UBWebPage(parent) : UBWebPage(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