From 65dc04227a430f5c9aad4429125661e68c4bfce5 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Mon, 6 Feb 2012 13:48:07 +0100 Subject: [PATCH] Merge branch 'master' of github.com:Sankore/Sankore-3.1 src/customWidgets/customWidgets.pri --- Sankore_3.1.pro | 2 + src/adaptors/UBExportDocument.cpp | 4 ++ src/adaptors/UBExportWeb.cpp | 4 ++ src/adaptors/UBImportCFF.cpp | 4 ++ src/adaptors/UBImportDocument.cpp | 4 ++ .../publishing/UBDocumentPublisher.cpp | 4 ++ src/board/UBBoardPaletteManager.cpp | 35 -------------- src/customWidgets/UBGlobals.h | 9 ---- src/customWidgets/UBMediaWidget.cpp | 2 +- src/customWidgets/UBWidgetList.cpp | 2 +- src/customWidgets/customWidgets.pri | 2 +- src/globals/UBGlobals.h | 46 +++++++++++++++++++ src/gui/UBTBDocumentEditWidget.cpp | 2 +- src/gui/UBTBDocumentPreviewWidget.cpp | 2 +- src/gui/UBTBPageEditWidget.cpp | 2 +- src/gui/UBTeacherBarDataMgr.cpp | 2 +- src/gui/UBTeacherBarPreviewWidget.cpp | 2 +- src/gui/UBTeacherBarWidget.cpp | 2 +- src/pdf/XPDFRenderer.h | 5 ++ 19 files changed, 82 insertions(+), 53 deletions(-) delete mode 100644 src/customWidgets/UBGlobals.h create mode 100644 src/globals/UBGlobals.h diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index bdc7704c..e17a120a 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -35,6 +35,7 @@ QT += script QT += xmlpatterns INCLUDEPATH += src +INCLUDEPATH += globals include($$THIRD_PARTY_PATH/libs.pri) include(src/adaptors/adaptors.pri) @@ -83,6 +84,7 @@ UB_LIBRARY.files = resources/library UB_FONTS.files = resources/fonts UB_THIRDPARTY_INTERACTIVE.files = thirdparty/interactive +DEFINES += NO_THIRD_PARTY_WARNINGS DEFINES += UBVERSION=\"\\\"$${LONG_VERSION}\"\\\" \ UBVERSION_RC=$$VERSION_RC ALPHA_BETA_STR = $$find(VERSION, "[ab]") diff --git a/src/adaptors/UBExportDocument.cpp b/src/adaptors/UBExportDocument.cpp index 27ea87d7..95a8e4bc 100644 --- a/src/adaptors/UBExportDocument.cpp +++ b/src/adaptors/UBExportDocument.cpp @@ -22,8 +22,12 @@ #include "document/UBDocumentProxy.h" +#include "globals/UBGlobals.h" + +THIRD_PARTY_WARNINGS_DISABLE #include "quazip.h" #include "quazipfile.h" +THIRD_PARTY_WARNINGS_ENABLE #include "transition/UniboardSankoreTransition.h" diff --git a/src/adaptors/UBExportWeb.cpp b/src/adaptors/UBExportWeb.cpp index bfdedfe5..59a9c31b 100644 --- a/src/adaptors/UBExportWeb.cpp +++ b/src/adaptors/UBExportWeb.cpp @@ -23,8 +23,12 @@ #include "document/UBDocumentProxy.h" +#include "globals/UBGlobals.h" + +THIRD_PARTY_WARNINGS_DISABLE #include "quazip.h" #include "quazipfile.h" +THIRD_PARTY_WARNINGS_ENABLE #include "core/memcheck.h" diff --git a/src/adaptors/UBImportCFF.cpp b/src/adaptors/UBImportCFF.cpp index 448e2834..6b4fa318 100644 --- a/src/adaptors/UBImportCFF.cpp +++ b/src/adaptors/UBImportCFF.cpp @@ -27,9 +27,13 @@ #include "UBCFFSubsetAdaptor.h" #include "UBImportCFF.h" +#include "globals/UBGlobals.h" + +THIRD_PARTY_WARNINGS_DISABLE #include "quazip.h" #include "quazipfile.h" #include "quazipfileinfo.h" +THIRD_PARTY_WARNINGS_ENABLE #include "core/memcheck.h" diff --git a/src/adaptors/UBImportDocument.cpp b/src/adaptors/UBImportDocument.cpp index f441b980..3e7808cf 100644 --- a/src/adaptors/UBImportDocument.cpp +++ b/src/adaptors/UBImportDocument.cpp @@ -22,9 +22,13 @@ #include "core/UBSettings.h" #include "core/UBPersistenceManager.h" +#include "globals/UBGlobals.h" + +THIRD_PARTY_WARNINGS_DISABLE #include "quazip.h" #include "quazipfile.h" #include "quazipfileinfo.h" +THIRD_PARTY_WARNINGS_ENABLE #include "core/memcheck.h" diff --git a/src/adaptors/publishing/UBDocumentPublisher.cpp b/src/adaptors/publishing/UBDocumentPublisher.cpp index d3ec39dd..686b9d94 100644 --- a/src/adaptors/publishing/UBDocumentPublisher.cpp +++ b/src/adaptors/publishing/UBDocumentPublisher.cpp @@ -34,8 +34,12 @@ #include "domain/UBGraphicsWidgetItem.h" +#include "globals/UBGlobals.h" + +THIRD_PARTY_WARNINGS_DISABLE #include "quazip.h" #include "quazipfile.h" +THIRD_PARTY_WARNINGS_ENABLE #include "adaptors/UBExportFullPDF.h" #include "adaptors/UBExportDocument.h" diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index 1fefd94b..54fe2a33 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -92,43 +92,8 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll UBBoardPaletteManager::~UBBoardPaletteManager() { - if(NULL != mpDownloadWidget) - { - delete mpDownloadWidget; - mpDownloadWidget = NULL; - } - if(NULL != mpTeacherBarWidget) - { - delete mpTeacherBarWidget; - mpTeacherBarWidget = NULL; - } - if(NULL != mpPageNavigWidget) - { - delete mpPageNavigWidget; - mpPageNavigWidget = NULL; - } - if(NULL != mpLibWidget) - { - delete mpLibWidget; - mpLibWidget = NULL; - } - if(NULL != mpCachePropWidget) - { - delete mpCachePropWidget; - mpCachePropWidget = NULL; - } delete mAddItemPalette; - if(NULL != mLeftPalette) - { - delete mLeftPalette; - mLeftPalette = NULL; - } - if(NULL != mRightPalette) - { - delete mRightPalette; - mRightPalette = NULL; - } if(NULL != mStylusPalette) { diff --git a/src/customWidgets/UBGlobals.h b/src/customWidgets/UBGlobals.h deleted file mode 100644 index 1707ceac..00000000 --- a/src/customWidgets/UBGlobals.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef UBGLOBALS_H -#define UBGLOBALS_H - -#define DELETEPTR(ptr) if(NULL != ptr){ \ - delete ptr; \ - ptr = NULL; \ - } - -#endif // UBGLOBALS_H diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index ee71a664..8fb69cc3 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -13,7 +13,7 @@ * along with this program. If not, see . */ #include "core/UBApplication.h" -#include "UBGlobals.h" +#include "globals/UBGlobals.h" #include "UBMediaWidget.h" /** diff --git a/src/customWidgets/UBWidgetList.cpp b/src/customWidgets/UBWidgetList.cpp index 62ed6677..dce108e1 100644 --- a/src/customWidgets/UBWidgetList.cpp +++ b/src/customWidgets/UBWidgetList.cpp @@ -3,7 +3,7 @@ #include #include -#include "UBGlobals.h" +#include "globals/UBGlobals.h" #include "UBWidgetList.h" UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation, const char* name):QScrollArea(parent) diff --git a/src/customWidgets/customWidgets.pri b/src/customWidgets/customWidgets.pri index 5fe74b8c..c531d4b3 100644 --- a/src/customWidgets/customWidgets.pri +++ b/src/customWidgets/customWidgets.pri @@ -2,7 +2,7 @@ HEADERS += src/customWidgets/UBWidgetList.h \ src/customWidgets/UBDraggableLabel.h \ src/customWidgets/UBMediaWidget.h \ - src/customWidgets/UBGlobals.h \ + src/globals/UBGlobals.h \ src/customWidgets/UBDraggableMedia.h \ src/customWidgets/UBActionableWidget.h diff --git a/src/globals/UBGlobals.h b/src/globals/UBGlobals.h new file mode 100644 index 00000000..a76d6cad --- /dev/null +++ b/src/globals/UBGlobals.h @@ -0,0 +1,46 @@ +#ifndef UBGLOBALS_H +#define UBGLOBALS_H + +#define DELETEPTR(ptr) if(NULL != ptr){ \ + delete ptr; \ + ptr = NULL; \ + } + +#ifdef Q_WS_WIN + +#define WARNINGS_DISABLE __pragma(warning(push, 0)); +#define WARNINGS_ENABLE __pragma(warning(pop)); + +#ifdef NO_THIRD_PARTY_WARNINGS +// disabling warning level to 0 and save old state +#define THIRD_PARTY_WARNINGS_DISABLE WARNINGS_DISABLE +#else +// just save old state (needs for not empty define) +#define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push)); +#endif //#ifdef NO_THIRD_PARTY_WARNINGS +// anyway on WIN +#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE + +#else //#ifdef Q_WS_WIN + +#define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \ +_Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \ +_Pragma("GCC diagnostic ignored \"-Wunused-variable\""); \ +_Pragma("GCC diagnostic ignored \"-Wsign-compare\""); + +#define WARNINGS_ENABLE _Pragma("GCC diagnostic pop"); + +#ifdef NO_THIRD_PARTY_WARNINGS +//disabling some warnings +#define THIRD_PARTY_WARNINGS_DISABLE WARNINGS_DISABLE + +#else +// just save old state (needs for not empty define) +#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE + +#endif //#ifdef NO_THIRD_PARTY_WARNINGS + +#endif //#ifdef Q_WS_WIN + +#endif // UBGLOBALS_H + \ No newline at end of file diff --git a/src/gui/UBTBDocumentEditWidget.cpp b/src/gui/UBTBDocumentEditWidget.cpp index 4139a9d2..261372b3 100644 --- a/src/gui/UBTBDocumentEditWidget.cpp +++ b/src/gui/UBTBDocumentEditWidget.cpp @@ -1,7 +1,7 @@ #include #include "UBTBDocumentEditWidget.h" -#include "customWidgets/UBGlobals.h" +#include "globals/UBGlobals.h" UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QWidget *parent, const char *name):QWidget(parent) , mpPageViewButton(NULL) diff --git a/src/gui/UBTBDocumentPreviewWidget.cpp b/src/gui/UBTBDocumentPreviewWidget.cpp index 81dbad2e..9f2ca0d8 100644 --- a/src/gui/UBTBDocumentPreviewWidget.cpp +++ b/src/gui/UBTBDocumentPreviewWidget.cpp @@ -1,4 +1,4 @@ -#include "customWidgets/UBGlobals.h" +#include "globals/UBGlobals.h" #include "UBTBDocumentPreviewWidget.h" UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *parent, const char *name):QWidget(parent) diff --git a/src/gui/UBTBPageEditWidget.cpp b/src/gui/UBTBPageEditWidget.cpp index 12424a1a..68928bce 100644 --- a/src/gui/UBTBPageEditWidget.cpp +++ b/src/gui/UBTBPageEditWidget.cpp @@ -1,4 +1,4 @@ -#include "customWidgets/UBGlobals.h" +#include "globals/UBGlobals.h" #include "core/UBApplication.h" #include "frameworks/UBFileSystemUtils.h" #include "gui/UBMediaPlayer.h" diff --git a/src/gui/UBTeacherBarDataMgr.cpp b/src/gui/UBTeacherBarDataMgr.cpp index dd1f2b44..e2e2bdad 100644 --- a/src/gui/UBTeacherBarDataMgr.cpp +++ b/src/gui/UBTeacherBarDataMgr.cpp @@ -7,7 +7,7 @@ #include "board/UBBoardController.h" -#include "customWidgets/UBGlobals.h" +#include "globals/UBGlobals.h" #include "adaptors/UBMetadataDcSubsetAdaptor.h" diff --git a/src/gui/UBTeacherBarPreviewWidget.cpp b/src/gui/UBTeacherBarPreviewWidget.cpp index a02794b8..e82acd30 100644 --- a/src/gui/UBTeacherBarPreviewWidget.cpp +++ b/src/gui/UBTeacherBarPreviewWidget.cpp @@ -1,5 +1,5 @@ #include "core/UBApplication.h" -#include "customWidgets/UBGlobals.h" +#include "globals/UBGlobals.h" #include "board/UBBoardController.h" #include "frameworks/UBFileSystemUtils.h" diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index 1596b6b0..7ee9a70b 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -15,7 +15,7 @@ #include "customWidgets/UBDraggableLabel.h" #include "customWidgets/UBMediaWidget.h" -#include "customWidgets/UBGlobals.h" +#include "globals/UBGlobals.h" #include "core/memcheck.h" diff --git a/src/pdf/XPDFRenderer.h b/src/pdf/XPDFRenderer.h index b8ad475e..3b6d48c3 100644 --- a/src/pdf/XPDFRenderer.h +++ b/src/pdf/XPDFRenderer.h @@ -18,10 +18,15 @@ #include #include "PDFRenderer.h" #include + +#include "globals/UBGlobals.h" + +THIRD_PARTY_WARNINGS_DISABLE #include #include #include #include +THIRD_PARTY_WARNINGS_ENABLE class PDFDoc;