Skip to content

Commit

Permalink
separate quarter as a separate library
Browse files Browse the repository at this point in the history
  • Loading branch information
ppphp authored and liukaiwen committed May 8, 2024
1 parent 8941b94 commit 3bbc010
Show file tree
Hide file tree
Showing 54 changed files with 164 additions and 225 deletions.
8 changes: 7 additions & 1 deletion src/3rdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ if (BUILD_ASSEMBLY AND NOT FREECAD_USE_EXTERNAL_ONDSELSOLVER)
git submodule update --init" )
endif()
add_subdirectory(OndselSolver)
endif()
endif()

# not allow to use external quarter, because currently
# Quarter is quite different from upstream
if (BUILD_GUI)
add_subdirectory(Quarter)
endif()
64 changes: 64 additions & 0 deletions src/3rdParty/Quarter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#quarter sources
FILE(GLOB_RECURSE Quarter_CPP_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
FILE(GLOB_RECURSE Quarter_H_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)

SET(Quarter_MOC_HDR
src/Quarter/SignalThread.h
src/Quarter/InteractionMode.h
src/Quarter/SensorManager.h
src/Quarter/ContextMenu.h
include/Quarter/eventhandlers/FocusHandler.h
include/Quarter/eventhandlers/DragDropHandler.h
include/Quarter/eventhandlers/EventFilter.h
include/Quarter/QuarterWidget.h
)

qt_wrap_cpp(Quarter_MOC_SRCS ${Quarter_MOC_HDR})

SET(Quarter_SRCS
${Quarter_CPP_SRC}
${Quarter_H_SRC}
${Quarter_MOC_SRCS}
)
SOURCE_GROUP("Quarter" FILES ${Quarter_SRCS})

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

if(Spacenav_FOUND)
add_definitions(-DHAVE_SPACENAV_LIB)
include_directories(${Spacenav_INCLUDE_DIR})
set(Extra_libraries ${Spacenav_LIBRARIES} ${Spacenav_LIBRARY})
endif()

if( UNIX )
set( Quarter_BUILD_SHARED ON )
ELSEIF ( APPLE )
set( Quarter_BUILD_SHARED ON )
ELSE()
set( Quarter_BUILD_SHARED OFF )
ENDIF ()

if ( Quarter_BUILD_SHARED )
message( STATUS "[Quarter] Building shared library" )
add_library(Quarter SHARED)
else()
message( STATUS "[Quarter] Building static library" )
add_library(Quarter STATIC)
endif()

target_sources(Quarter PRIVATE ${Quarter_SRCS})

set_target_properties(Quarter PROPERTIES PUBLIC_HEADER "${Quarter_H_SRC}")

target_include_directories(Quarter PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${COIN3D_INCLUDE_DIRS} ${QtCore_INCLUDE_DIRS} ${QtWidgets_INCLUDE_DIRS})
target_link_libraries(Quarter ${COIN3D_LIBRARIES} ${OPENGL_LIBRARIES} ${QtCore_LIBRARIES} ${QtWidgets_LIBRARIES} ${Extra_libraries})

SET_BIN_DIR(Quarter Quarter)

if(WIN32)
add_definitions(-DQUARTER_INTERNAL -DQUARTER_MAKE_DLL -DCOIN_DLL)
endif(WIN32)

install(TARGETS Quarter DESTINATION ${CMAKE_INSTALL_LIBDIR})
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@

#include <Inventor/events/SoEvent.h>
#include <Inventor/events/SoSubEvent.h>
#include <FCGlobal.h>
#include "Quarter/Basic.h"

/**
* @brief The SoMouseWheelEvent class is a temporary replacement for
* SoMouseWheelEvent from Coin, for until freecad stops using Coin version that
* doesn't have one (coin v 4.0.0a doesn't have SoMouseWheelEvent).
*/
class GuiExport SoMouseWheelEvent : public SoEvent {
class QUARTER_DLL_API SoMouseWheelEvent : public SoEvent {

Check warning on line 36 in src/3rdParty/Quarter/include/Inventor/events/SoMouseWheelEvent.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

class 'SoMouseWheelEvent' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions]
SO_EVENT_HEADER();
public: //methods
static void initClass(){
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class QImage;
class SbImage;

#include "Basic.h"
#include <Quarter/Basic.h>


namespace SIM { namespace Coin3D { namespace Quarter {

Check warning on line 42 in src/3rdParty/Quarter/include/Quarter/QtCoinCompatibility.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

nested namespaces can be concatenated [modernize-concat-nested-namespaces]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include "Basic.h"
#include <Quarter/Basic.h>

namespace SIM { namespace Coin3D { namespace Quarter {

Check warning on line 38 in src/3rdParty/Quarter/include/Quarter/Quarter.h

View workflow job for this annotation

GitHub Actions / Lint / Lint

nested namespaces can be concatenated [modernize-concat-nested-namespaces]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
#include <Inventor/actions/SoGLRenderAction.h>

#include <QColor>
#include <QGraphicsView>
#include <QUrl>
#include <QGraphicsView>
#include <QtOpenGL.h>

#include "Basic.h"
#include <Quarter/Basic.h>


class QMenu;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include <QtCore/QObject>
#include <QObject>
#include <Quarter/Basic.h>

class QEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
\**************************************************************************/

#include <Quarter/Basic.h>
#include <QtCore/QObject>
#include <QObject>

class QEvent;
class QPoint;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
* *
***************************************************************************/

#include "PreCompiled.h"

#include "SoMouseWheelEvent.h"
#include "Inventor/events/SoMouseWheelEvent.h"

SO_EVENT_SOURCE(SoMouseWheelEvent);

Check warning on line 25 in src/3rdParty/Quarter/src/Inventor/SoMouseWheelEvent.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Could not find a newline character at the end of the file. [whitespace/ending_newline] [5]
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include "ContextMenu.h"

#include <QActionGroup>
#include <QMenu>

#include "ContextMenu.h"
#include "QuarterWidget.h"
#include <Quarter/QuarterWidget.h>


using namespace SIM::Coin3D::Quarter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#ifndef QUARTER_CONTEXTMENUHANDLERP_H
#define QUARTER_CONTEXTMENUHANDLERP_H

#include <QtCore/QObject>
#include <QObject>

class QMenu;
class QAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@
functionality to the QuarterWidget.
*/

#include <Quarter/eventhandlers/DragDropHandler.h>

#include <QUrl>
#include <QFileInfo>
#include <QStringList>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QFileInfo>
#include <QMimeData>
#include <QStringList>
#include <QUrl>

#include <Inventor/SoInput.h>
#include <Inventor/nodes/SoSeparator.h>

#include "QuarterWidget.h"
#include "eventhandlers/DragDropHandler.h"

#include <Quarter/QuarterWidget.h>

namespace SIM { namespace Coin3D { namespace Quarter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
*/

#include <Quarter/eventhandlers/EventFilter.h>

#include <QEvent>
#include <QMouseEvent>

#include "QuarterWidget.h"
#include "devices/Keyboard.h"
#include "devices/Mouse.h"
#include "devices/SpaceNavigatorDevice.h"
#include "eventhandlers/EventFilter.h"
#include <Quarter/QuarterWidget.h>
#include <Quarter/devices/Mouse.h>
#include <Quarter/devices/Keyboard.h>
#include <Quarter/devices/SpaceNavigatorDevice.h>


namespace SIM { namespace Coin3D { namespace Quarter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@
focus out events, if installed on QuarterWidget.
*/

#include <QEvent>
#include <Quarter/eventhandlers/FocusHandler.h>
#include <Quarter/QuarterWidget.h>
#include <QtCore/QEvent>
#include <Inventor/SoEventManager.h>
#include <Inventor/scxml/SoScXMLStateMachine.h>

#include "QuarterWidget.h"
#include "eventhandlers/FocusHandler.h"


using namespace SIM::Coin3D::Quarter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include "ImageReader.h"
#include <Inventor/SbImage.h>
#include <QImage>

#include "ImageReader.h"
#include "QtCoinCompatibility.h"
#include <Quarter/QtCoinCompatibility.h>


using namespace SIM::Coin3D::Quarter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include <Inventor/SbBasic.h>

class SbImage;
class SbString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#ifdef _MSC_VER
#pragma warning(disable : 4267)
#endif

#include <Quarter/devices/InputDevice.h>
#include <QInputEvent>
#include <Inventor/events/SoEvents.h>

#include "devices/InputDevice.h"


using namespace SIM::Coin3D::Quarter;

/*!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@
Adjust how QuarterWidget reacts to alt key events
*/

#include "InteractionMode.h"
#include <QCoreApplication>
#include <QFocusEvent>
#include <QKeyEvent>

#include "InteractionMode.h"
#include "QuarterWidget.h"
#include <QFocusEvent>
#include <Quarter/QuarterWidget.h>


using namespace SIM::Coin3D::Quarter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include <QCursor>
#include <QObject>
#include <QCursor>
#include <Quarter/Basic.h>
#include <Inventor/SoEventManager.h>

#include "Basic.h"


class QEvent;
class SoEvent;
class QKeyEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@
the QuarterWidget.
*/

#ifdef _MSC_VER
#pragma warning(disable : 4267)
#endif
#include <Quarter/devices/Keyboard.h>

#include <QEvent>
#include <QKeyEvent>
#include <Inventor/events/SoEvent.h>
#include <Inventor/events/SoEvents.h>
#include <Inventor/events/SoKeyboardEvent.h>

#include "KeyboardP.h"
#include "devices/Keyboard.h"


using namespace SIM::Coin3D::Quarter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include <Inventor/errors/SoDebugError.h>

#include "KeyboardP.h"
#include "devices/Keyboard.h"

#include <Quarter/devices/Keyboard.h>
#include <QtCore/QMap>
#include <Inventor/errors/SoDebugError.h>

using namespace SIM::Coin3D::Quarter;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,17 @@
QuarterWidget.
*/

#include "PreCompiled.h"

#ifdef _MSC_VER
#pragma warning(disable : 4267)
#endif
#include <Quarter/devices/Mouse.h>

#include <QEvent>
#include <QMouseEvent>
#include <QSize>
#include <QWheelEvent>
#include <Quarter/QuarterWidget.h>

#include <Gui/SoMouseWheelEvent.h>
#include <Inventor/SbVec2s.h>
#include <Inventor/errors/SoDebugError.h>
#include <Inventor/events/SoEvents.h>

#include "QuarterWidget.h"
#include "devices/Mouse.h"

#include <Inventor/events/SoMouseWheelEvent.h>
#include <Inventor/errors/SoDebugError.h>

namespace SIM { namespace Coin3D { namespace Quarter {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/

#include <QObject>
#include <QEvent>

#ifdef HAVE_SPACENAV_LIB
Expand Down

0 comments on commit 3bbc010

Please sign in to comment.