Skip to content
Permalink
Browse files

make qgis_app a shared library and fix some more stl warnings with msvc

  • Loading branch information
jef-n committed Sep 6, 2013
1 parent 1632730 commit 0a1d44fc63a4a4c13eec0de36bbdc7de01c32c8c
Showing with 248 additions and 237 deletions.
  1. +1 −0 CMakeLists.txt
  2. +4 −4 python/core/composer/qgsatlascomposition.sip
  3. +1 −1 python/core/qgsgeometry.sip
  4. +5 −5 python/core/qgsprojectproperty.sip
  5. +3 −6 python/core/raster/qgsrasterbandstats.sip
  6. +2 −2 src/analysis/CMakeLists.txt
  7. +1 −1 src/analysis/vector/qgsgeometryanalyzer.cpp
  8. +11 −2 src/app/CMakeLists.txt
  9. +1 −44 src/app/main.cpp
  10. +45 −4 src/app/qgisapp.cpp
  11. +12 −6 src/app/qgisapp.h
  12. +1 −1 src/app/qgisappinterface.h
  13. +1 −1 src/app/qgisappstylesheet.h
  14. +1 −1 src/app/qgsabout.h
  15. +1 −1 src/app/qgsaddattrdialog.h
  16. +1 −1 src/app/qgsaddjoindialog.h
  17. +1 −1 src/app/qgsaddtaborgroup.h
  18. +1 −1 src/app/qgsannotationwidget.h
  19. +1 −1 src/app/qgsattributeactiondialog.h
  20. +1 −1 src/app/qgsattributetabledialog.h
  21. +1 −1 src/app/qgsattributetypedialog.h
  22. +1 −1 src/app/qgsattributetypeloaddialog.h
  23. +1 −1 src/app/qgsbookmarks.h
  24. +1 −1 src/app/qgsbrowserdockwidget.h
  25. +1 −1 src/app/qgsclipboard.h
  26. +1 −1 src/app/qgsconfigureshortcutsdialog.h
  27. +2 −2 src/app/qgscustomization.h
  28. +1 −1 src/app/qgscustomprojectiondialog.h
  29. +1 −1 src/app/qgsdecorationcopyright.h
  30. +1 −1 src/app/qgsdecorationcopyrightdialog.h
  31. +1 −1 src/app/qgsdecorationgrid.h
  32. +1 −1 src/app/qgsdecorationgriddialog.h
  33. +1 −1 src/app/qgsdecorationitem.h
  34. +1 −1 src/app/qgsdecorationnortharrow.h
  35. +1 −1 src/app/qgsdecorationnortharrowdialog.h
  36. +1 −1 src/app/qgsdecorationscalebar.h
  37. +1 −1 src/app/qgsdecorationscalebardialog.h
  38. +1 −1 src/app/qgsdelattrdialog.h
  39. +1 −1 src/app/qgsdiagramproperties.h
  40. +1 −1 src/app/qgsdisplayangle.h
  41. +1 −1 src/app/qgsfeatureaction.h
  42. +1 −1 src/app/qgsfieldcalculator.h
  43. +2 −2 src/app/qgsfieldsproperties.h
  44. +1 −1 src/app/qgsformannotationdialog.h
  45. +2 −2 src/app/qgshandlebadlayers.h
  46. +1 −1 src/app/qgshtmlannotationdialog.h
  47. +4 −4 src/app/qgsidentifyresultsdialog.h
  48. +1 −1 src/app/qgslabeldialog.h
  49. +1 −1 src/app/qgslabelengineconfigdialog.h
  50. +1 −1 src/app/qgslabelinggui.h
  51. +1 −1 src/app/qgslabelpreview.h
  52. +1 −1 src/app/qgslabelpropertydialog.h
  53. +1 −1 src/app/qgsloadstylefromdbdialog.h
  54. +1 −1 src/app/qgsmaptooladdfeature.h
  55. +1 −1 src/app/qgsmaptooladdpart.h
  56. +1 −1 src/app/qgsmaptooladdring.h
  57. +1 −1 src/app/qgsmaptoolannotation.h
  58. +1 −1 src/app/qgsmaptoolcapture.h
  59. +1 −1 src/app/qgsmaptoolchangelabelproperties.h
  60. +1 −1 src/app/qgsmaptooldeletepart.h
  61. +1 −1 src/app/qgsmaptooldeletering.h
  62. +1 −1 src/app/qgsmaptooledit.h
  63. +1 −1 src/app/qgsmaptoolfeatureaction.h
  64. +1 −1 src/app/qgsmaptoolformannotation.h
  65. +1 −1 src/app/qgsmaptoolhtmlannotation.h
  66. +1 −1 src/app/qgsmaptoolidentifyaction.h
  67. +1 −1 src/app/qgsmaptoollabel.h
  68. +1 −1 src/app/qgsmaptoolmeasureangle.h
  69. +1 −1 src/app/qgsmaptoolmovefeature.h
  70. +1 −1 src/app/qgsmaptoolmovelabel.h
  71. +1 −1 src/app/qgsmaptooloffsetcurve.h
  72. +1 −1 src/app/qgsmaptoolpinlabels.h
  73. +1 −1 src/app/qgsmaptoolreshape.h
  74. +1 −1 src/app/qgsmaptoolrotatefeature.h
  75. +1 −1 src/app/qgsmaptoolrotatelabel.h
  76. +1 −1 src/app/qgsmaptoolrotatepointsymbols.h
  77. +1 −1 src/app/qgsmaptoolselect.h
  78. +1 −1 src/app/qgsmaptoolselectfreehand.h
  79. +1 −1 src/app/qgsmaptoolselectpolygon.h
  80. +1 −1 src/app/qgsmaptoolselectradius.h
  81. +1 −1 src/app/qgsmaptoolselectrectangle.h
  82. +1 −1 src/app/qgsmaptoolshowhidelabels.h
  83. +3 −3 src/app/qgsmaptoolsimplify.h
  84. +1 −1 src/app/qgsmaptoolsplitfeatures.h
  85. +1 −1 src/app/qgsmaptoolsvgannotation.h
  86. +1 −1 src/app/qgsmaptooltextannotation.h
  87. +1 −1 src/app/qgsmaptoolvertexedit.h
  88. +1 −1 src/app/qgsmeasuredialog.h
  89. +1 −1 src/app/qgsmeasuretool.h
  90. +1 −1 src/app/qgsmergeattributesdialog.h
  91. +1 −1 src/app/qgsnewspatialitelayerdialog.h
  92. +1 −1 src/app/qgsoptions.h
  93. +1 −1 src/app/qgspastetransformations.h
  94. +1 −1 src/app/qgspluginmetadata.h
  95. +2 −2 src/app/qgspluginregistry.h
  96. +1 −1 src/app/qgspointrotationitem.h
  97. +1 −1 src/app/qgsprojectlayergroupdialog.h
  98. +1 −1 src/app/qgsprojectproperties.h
  99. +1 −1 src/app/qgsrastercalcdialog.h
  100. +1 −1 src/app/qgsrasterlayerproperties.h
  101. +1 −1 src/app/qgssavestyletodbdialog.h
  102. +1 −1 src/app/qgsshortcutsmanager.h
  103. +1 −1 src/app/qgssnappingdialog.h
  104. +1 −1 src/app/qgssponsors.h
  105. +1 −1 src/app/qgssvgannotationdialog.h
  106. +1 −1 src/app/qgstextannotationdialog.h
  107. +1 −1 src/app/qgstip.h
  108. +1 −1 src/app/qgstipfactory.h
  109. +1 −1 src/app/qgstipgui.h
  110. +1 −1 src/app/qgsundowidget.h
  111. +1 −1 src/app/qgsvectorlayerproperties.h
  112. +2 −2 src/core/CMakeLists.txt
  113. +1 −1 src/core/composer/qgsatlascomposition.h
  114. +9 −9 src/core/pal/pal.cpp
  115. +3 −3 src/core/pal/pal.h
  116. +1 −1 src/core/qgsgeometry.cpp
  117. +1 −1 src/core/qgslogger.cpp
  118. +2 −2 src/core/qgsprojectproperty.cpp
  119. +5 −5 src/core/qgsprojectproperty.h
  120. +2 −2 src/gui/CMakeLists.txt
  121. +1 −1 src/mapserver/qgshttprequesthandler.cpp
  122. +2 −2 src/plugins/sqlanywhere/CMakeLists.txt
  123. +8 −8 src/providers/gpx/gpsdata.cpp
  124. +10 −10 src/providers/gpx/gpsdata.h
  125. +1 −1 src/providers/gpx/qgsgpxfeatureiterator.cpp
  126. +1 −1 src/providers/grass/qgis.d.rast.c
  127. +2 −2 src/providers/sqlanywhere/sqlanyconnection/CMakeLists.txt
  128. +2 −2 src/python/CMakeLists.txt
@@ -494,6 +494,7 @@ ADD_DEFINITIONS("-DCORE_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")

#############################################################
# user-changeable settings which can be used to customize
@@ -50,19 +50,19 @@ public:
QString featureFilter() const;
void setFeatureFilter( const QString& expression );

size_t sortKeyAttributeIndex() const;
void setSortKeyAttributeIndex( size_t idx );
int sortKeyAttributeIndex() const;
void setSortKeyAttributeIndex( int idx );

/** Begins the rendering. */
void beginRender();
/** Ends the rendering. Restores original extent */
void endRender();

/** Returns the number of features in the coverage layer */
size_t numFeatures() const;
int numFeatures() const;

/** Prepare the atlas map for the given feature. Sets the extent and context variables */
void prepareForFeature( size_t i );
void prepareForFeature( int i );

/** Returns the current filename. Must be called after prepareForFeature( i ) */
const QString& currentFilename() const;
@@ -61,7 +61,7 @@ class QgsGeometry
/**
Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length.
This class will take ownership of the buffer.
*/
*/
void fromWkb( unsigned char * wkb /Array/, size_t length /ArraySize/ );
%MethodCode
// create copy of Python's string and pass it to fromWkb()
@@ -13,7 +13,7 @@ class QgsProperty
@param tabs is number of tabs to print; used for pretty-printing
hierarchy
*/
virtual void dump( size_t tabs = 0 ) const = 0;
virtual void dump( int tabs = 0 ) const = 0;

/** returns true if is a QgsPropertyKey */
virtual bool isKey() const = 0;
@@ -90,15 +90,15 @@ class QgsPropertyValue : QgsProperty
*/
bool isLeaf() const;

void dump( size_t tabs = 0 ) const;
void dump( int tabs = 0 ) const;

bool readXML( QDomNode & keyNode );

bool writeXML( const QString & nodeName,
QDomElement & element,
QDomDocument & document );

size_t count() const;
int count() const;

/** return keys that do not contain other keys

@@ -148,14 +148,14 @@ class QgsPropertyKey : QgsProperty
QgsPropertyValue * setValue( const QVariant & value );


void dump( size_t tabs = 0 ) const;
void dump( int tabs = 0 ) const;

bool readXML( QDomNode & keyNode );

bool writeXML( const QString &nodeName, QDomElement & element, QDomDocument & document );

/// how many elements are contained within this one?
size_t count() const;
int count() const;

/// Does this property not have any subkeys or values?
/* virtual */ bool isEmpty() const;
@@ -30,12 +30,9 @@ class QgsRasterBandStats
/** \brief The gdal band number (starts at 1)*/
int bandNumber;

/** Color table */
// QList<QgsColorRampShader::ColorRampItem> colorTable;

/** \brief The number of cells in the band. Equivalent to height x width.
* TODO: check if NO_DATA are excluded!*/
int elementCount;
/** \brief The number of not no data cells in the band. */
// TODO: check if no data are excluded in stats calculation
size_t elementCount;

/** \brief The maximum cell value in the raster band. NO_DATA values
* are ignored. This does not use the gdal GetMaximmum function. */
@@ -142,9 +142,9 @@ INCLUDE_DIRECTORIES(

IF (WIN32)
IF (MSVC)
ADD_DEFINITIONS("-DANALYSIS_EXPORT=__declspec(dllexport)")
ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLEXPORT}")
ELSE (MSVC)
ADD_DEFINITIONS("-UANALYSIS_EXPORT \"-DANALYSIS_EXPORT=__declspec(dllexport)\"")
ADD_DEFINITIONS("-UANALYSIS_EXPORT \"-DANALYSIS_EXPORT=${DLLEXPORT}\"")
ENDIF (MSVC)
ENDIF (WIN32)

@@ -737,7 +737,7 @@ void QgsGeometryAnalyzer::dissolveFeature( QgsFeature& f, int nProcessedFeatures

if ( nProcessedFeatures == 0 )
{
int geomSize = featureGeometry->wkbSize();
size_t geomSize = featureGeometry->wkbSize();
*dissolveGeometry = new QgsGeometry();
unsigned char* wkb = new unsigned char[geomSize];
memcpy( wkb, featureGeometry->asWkb(), geomSize );
@@ -456,8 +456,16 @@ ELSE (ANDROID)
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 main.cpp ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ENDIF (ANDROID)

IF (WIN32)
IF (MSVC)
ADD_DEFINITIONS("-DAPP_EXPORT=${DLLEXPORT}")
ELSE (MSVC)
ADD_DEFINITIONS("-UAPP_EXPORT \"-DAPP_EXPORT=${DLLEXPORT}\"")
ENDIF (MSVC)
ENDIF (WIN32)

# shared library used by tests - TODO: use it also for qgis executable?
ADD_LIBRARY(qgis_app STATIC ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})
ADD_LIBRARY(qgis_app SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})

TARGET_LINK_LIBRARIES(qgis_app
${QWT_LIBRARY}
@@ -498,6 +506,7 @@ ENDIF (ANDROID)
IF(WIN32)
ADD_DEFINITIONS(-DQWT_DLL)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} DbgHelp)
TARGET_LINK_LIBRARIES(qgis_app DbgHelp)
ENDIF(WIN32)

IF (APPLE)
@@ -511,7 +520,7 @@ ENDIF(APPLE)

IF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
FIND_LIBRARY(EXECINFO_LIBRARY NAMES execinfo)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${EXECINFO_LIBRARY})
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${EXECINFO_LIBRARY})
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")

IF (POSTGRES_FOUND)
@@ -149,49 +149,6 @@ bool bundleclicked( int argc, char *argv[] )
return ( argc > 1 && memcmp( argv[1], "-psn_", 5 ) == 0 );
}

#ifdef Q_OS_WIN
LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
{
QString dumpName = QDir::toNativeSeparators(
QString( "%1\\qgis-%2-%3-%4-%5.dmp" )
.arg( QDir::tempPath() )
.arg( QDateTime::currentDateTime().toString( "yyyyMMdd-hhmmss" ) )
.arg( GetCurrentProcessId() )
.arg( GetCurrentThreadId() )
.arg( QGis::QGIS_DEV_VERSION )
);

QString msg;
HANDLE hDumpFile = CreateFile( dumpName.toLocal8Bit(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0 );
if ( hDumpFile != INVALID_HANDLE_VALUE )
{
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = ExceptionInfo;
ExpParam.ClientPointers = TRUE;

if ( MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, ExceptionInfo ? &ExpParam : NULL, NULL, NULL ) )
{
msg = QObject::tr( "minidump written to %1" ).arg( dumpName );
}
else
{
msg = QObject::tr( "writing of minidump to %1 failed (%2)" ).arg( dumpName ).arg( GetLastError(), 0, 16 );
}

CloseHandle( hDumpFile );
}
else
{
msg = QObject::tr( "creation of minidump to %1 failed (%2)" ).arg( dumpName ).arg( GetLastError(), 0, 16 );
}

QMessageBox::critical( 0, QObject::tr( "Crash dumped" ), msg );

return EXCEPTION_EXECUTE_HANDLER;
}
#endif

void myPrint( const char *fmt, ... )
{
va_list ap;
@@ -421,7 +378,7 @@ int main( int argc, char *argv[] )
#endif

#ifdef Q_OS_WIN
SetUnhandledExceptionFilter( qgisCrashDump );
SetUnhandledExceptionFilter( QgisApp::qgisCrashDump );
#endif

// initialize random number seed
@@ -277,10 +277,11 @@ extern "C"

#include "qgspythonutils.h"

#ifndef WIN32
#ifndef Q_OS_WIN
#include <dlfcn.h>
#else
#include <windows.h>
#include <DbgHelp.h>
#endif

#ifdef HAVE_TOUCH
@@ -8864,14 +8865,11 @@ void QgisApp::keyPressEvent( QKeyEvent * e )
{
stopRendering();
}
#if 0
#if defined(Q_OS_WIN)&& defined(QGISDEBUG)
else if ( e->key() == Qt::Key_Backslash && e->modifiers() & Qt::ControlModifier )
{
extern LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
qgisCrashDump( 0 );
}
#endif
#endif
else
{
@@ -9403,3 +9401,46 @@ void QgisApp::tapAndHoldTriggered( QTapAndHoldGesture *gesture )
}
}
#endif

#ifdef Q_OS_WIN
LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
{
QString dumpName = QDir::toNativeSeparators(
QString( "%1\\qgis-%2-%3-%4-%5.dmp" )
.arg( QDir::tempPath() )
.arg( QDateTime::currentDateTime().toString( "yyyyMMdd-hhmmss" ) )
.arg( GetCurrentProcessId() )
.arg( GetCurrentThreadId() )
.arg( QGis::QGIS_DEV_VERSION )
);

QString msg;
HANDLE hDumpFile = CreateFile( dumpName.toLocal8Bit(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0 );
if ( hDumpFile != INVALID_HANDLE_VALUE )
{
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = ExceptionInfo;
ExpParam.ClientPointers = TRUE;

if ( MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, ExceptionInfo ? &ExpParam : NULL, NULL, NULL ) )
{
msg = QObject::tr( "minidump written to %1" ).arg( dumpName );
}
else
{
msg = QObject::tr( "writing of minidump to %1 failed (%2)" ).arg( dumpName ).arg( GetLastError(), 0, 16 );
}

CloseHandle( hDumpFile );
}
else
{
msg = QObject::tr( "creation of minidump to %1 failed (%2)" ).arg( dumpName ).arg( GetLastError(), 0, 16 );
}

QMessageBox::critical( 0, QObject::tr( "Crash dumped" ), msg );

return EXCEPTION_EXECUTE_HANDLER;
}
#endif
@@ -100,10 +100,14 @@ class QgsTileScaleWidget;
#include <QTapAndHoldGesture>
#endif

#ifdef Q_OS_WIN
#include <windows.h>
#endif

/*! \class QgisApp
* \brief Main window for the Qgis application
*/
class QgisApp : public QMainWindow, private Ui::MainWindow
class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
{
Q_OBJECT
public:
@@ -425,11 +429,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
* @note added in 1.9 */
int messageTimeout();

#ifdef Q_OS_WIN
//! ugly hack
void skipNextContextMenuEvent();
#endif

//! emit initializationCompleted signal
//! @note added in 1.6
void completeInitialization();
@@ -439,6 +438,13 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QList<QgsDecorationItem*> decorationItems() { return mDecorationItems; }
void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); }

#ifdef Q_OS_WIN
//! ugly hack
void skipNextContextMenuEvent();

static LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
#endif

public slots:
//! Zoom to full extent
void zoomFull();
@@ -36,7 +36,7 @@ class QgisApp;
* Only those functions "exposed" by QgisInterface can be called from within a
* plugin.
*/
class QgisAppInterface : public QgisInterface
class APP_EXPORT QgisAppInterface : public QgisInterface
{
Q_OBJECT

@@ -25,7 +25,7 @@
/** @class QgisAppStyleSheet
* @brief Adjustable stylesheet for the Qgis application
*/
class QgisAppStyleSheet: public QObject
class APP_EXPORT QgisAppStyleSheet: public QObject
{
Q_OBJECT

@@ -19,7 +19,7 @@

#include "ui_qgsabout.h"

class QgsAbout : public QDialog, private Ui::QgsAbout
class APP_EXPORT QgsAbout : public QDialog, private Ui::QgsAbout
{
Q_OBJECT
public:
@@ -24,7 +24,7 @@

class QgsVectorLayer;

class QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase
class APP_EXPORT QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase
{
Q_OBJECT
public:
@@ -21,7 +21,7 @@
#include "ui_qgsaddjoindialogbase.h"
class QgsVectorLayer;

class QgsAddJoinDialog: public QDialog, private Ui::QgsAddJoinDialogBase
class APP_EXPORT QgsAddJoinDialog: public QDialog, private Ui::QgsAddJoinDialogBase
{
Q_OBJECT
public:
@@ -25,7 +25,7 @@
class QTreeWidgetItem;
class QgsVectorLayer;

class QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroupBase
class APP_EXPORT QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroupBase
{
Q_OBJECT

@@ -25,7 +25,7 @@ class QgsMarkerSymbolV2;

/**A configuration widget to configure the annotation item properties. Usually embedded by QgsAnnotationItem
subclass configuration dialogs*/
class QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationWidgetBase
class APP_EXPORT QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationWidgetBase
{
Q_OBJECT
public:

0 comments on commit 0a1d44f

Please sign in to comment.
You can’t perform that action at this time.