From 9a6575923d9e5a876163239e5fdc28e732ba80f9 Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Thu, 28 Dec 2023 11:31:19 +0100 Subject: [PATCH 1/3] make widget plugin loadable with qt5 georges editor --- nel/tools/3d/object_viewer_widget/src/interfaces.h | 3 ++- nel/tools/3d/object_viewer_widget/src/object_viewer.json | 4 ++++ nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 nel/tools/3d/object_viewer_widget/src/object_viewer.json diff --git a/nel/tools/3d/object_viewer_widget/src/interfaces.h b/nel/tools/3d/object_viewer_widget/src/interfaces.h index e47f5875f1..4dd1caf75a 100644 --- a/nel/tools/3d/object_viewer_widget/src/interfaces.h +++ b/nel/tools/3d/object_viewer_widget/src/interfaces.h @@ -78,6 +78,7 @@ namespace NLQT } /* namespace NLQT */ -Q_DECLARE_INTERFACE(NLQT::IObjectViewer,"com.ryzom.dev.IObjectViewer/0.1") +#define IObjectViewer_iid "com.ryzom.dev.IObjectViewer/0.1" +Q_DECLARE_INTERFACE(NLQT::IObjectViewer,IObjectViewer_iid) #endif \ No newline at end of file diff --git a/nel/tools/3d/object_viewer_widget/src/object_viewer.json b/nel/tools/3d/object_viewer_widget/src/object_viewer.json new file mode 100644 index 0000000000..08006eb60e --- /dev/null +++ b/nel/tools/3d/object_viewer_widget/src/object_viewer.json @@ -0,0 +1,4 @@ +{ + "Name" : "Object Viewer", + "Version" : "0.0.1" +} \ No newline at end of file diff --git a/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h b/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h index 69629ef400..91ed4cdeac 100644 --- a/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h +++ b/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h @@ -57,6 +57,9 @@ namespace NLQT public IObjectViewer { Q_OBJECT +#ifdef USE_QT5 + Q_PLUGIN_METADATA(IID IObjectViewer_iid FILE "object_viewer.json") +#endif Q_INTERFACES(NLQT::IObjectViewer) public: From 27d31eee19eb7594f2d18109a20c00fc2815554d Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Tue, 27 Aug 2024 17:30:37 +0000 Subject: [PATCH 2/3] move object viewer widget to qt5 and remove qt4 specifics --- nel/tools/3d/CMakeLists.txt | 2 +- .../3d/object_viewer_widget/CMakeLists.txt | 2 +- .../object_viewer_widget/src/CMakeLists.txt | 31 ++------- .../src/object_viewer_widget.cpp | 65 ------------------- .../src/object_viewer_widget.h | 14 ---- .../3d/object_viewer_widget/src/stdpch.h | 6 -- 6 files changed, 9 insertions(+), 111 deletions(-) diff --git a/nel/tools/3d/CMakeLists.txt b/nel/tools/3d/CMakeLists.txt index bad0382bf8..bb72259da7 100644 --- a/nel/tools/3d/CMakeLists.txt +++ b/nel/tools/3d/CMakeLists.txt @@ -70,10 +70,10 @@ IF(WITH_NEL_TOOLS AND WITH_3D) IF(WITH_QT OR WITH_QT5) ADD_SUBDIRECTORY(tile_edit_qt) - ADD_SUBDIRECTORY(object_viewer_widget) ENDIF() IF(WITH_QT5) + ADD_SUBDIRECTORY(object_viewer_widget) ADD_SUBDIRECTORY(shared_widgets) ADD_SUBDIRECTORY(panoply_preview) ENDIF() diff --git a/nel/tools/3d/object_viewer_widget/CMakeLists.txt b/nel/tools/3d/object_viewer_widget/CMakeLists.txt index 20e5b69e86..7561d30bb0 100644 --- a/nel/tools/3d/object_viewer_widget/CMakeLists.txt +++ b/nel/tools/3d/object_viewer_widget/CMakeLists.txt @@ -1,7 +1,7 @@ #----------------------------------------------------------------------------- # # Object Viewer Widget -# Copyright (C) 2010 Adrian Jäkel +# Copyright (C) 2010 Adrian Jäkel # #----------------------------------------------------------------------------- diff --git a/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt b/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt index 62df9e33fc..00a7d6ef64 100644 --- a/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt +++ b/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt @@ -1,30 +1,7 @@ -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${NEL_INCLUDE_DIR}) - FILE(GLOB OBJECT_VIEWER_WIDGET_SRC *.cpp *.h) SET(OBJECT_VIEWER_WIDGET_HDR object_viewer_widget.h) -IF(WITH_QT) - INCLUDE_DIRECTORIES(${QT_INCLUDES}) - INCLUDE(${QT_USE_FILE}) - - SET(QT_USE_QTGUI TRUE) - SET(QT_USE_QTOPENGL TRUE) - - QT4_WRAP_CPP(OBJECT_VIEWER_WIDGET_MOC_SRCS ${OBJECT_VIEWER_WIDGET_HDR}) - - ADD_DEFINITIONS(${QT_DEFINITIONS}) - ADD_DEFINITIONS(-DQT_NO_KEYWORDS) - ADD_DEFINITIONS(-DQT_PLUGIN) - ADD_DEFINITIONS(-DQT_SHARED) - #ADD_DEFINITIONS(-DQT_NO_DEBUG) - - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) -ELSE() - QT5_WRAP_CPP(OBJECT_VIEWER_WIDGET_MOC_SRCS ${OBJECT_VIEWER_WIDGET_HDR}) -ENDIF() +QT5_WRAP_CPP(OBJECT_VIEWER_WIDGET_MOC_SRCS ${OBJECT_VIEWER_WIDGET_HDR}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_WIDGET_MOC_SRCS}) @@ -38,6 +15,12 @@ ADD_LIBRARY(object_viewer_widget_qt ${TYPE} ${OBJECT_VIEWER_WIDGET_SRC} ${OBJECT_VIEWER_WIDGET_MOC_SRCS}) +TARGET_INCLUDE_DIRECTORIES(object_viewer_widget_qt + PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${NEL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(object_viewer_widget_qt nelmisc nel3d diff --git a/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index fbc379d957..f0e4cb9f2f 100644 --- a/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -47,10 +47,6 @@ along with this program. If not, see . // Project includes -#ifndef USE_QT5 -Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget) -#endif - #if defined(NL_OS_WINDOWS) typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); #elif defined(NL_OS_MAC) @@ -743,8 +739,6 @@ namespace NLQT _Scene->animate ( fdelta); } -#ifdef USE_QT5 - bool CObjectViewerWidget::nativeEvent(const QByteArray &eventType, void *message, long *result) { if (getDriver() && getDriver()->isActive()) @@ -770,63 +764,4 @@ namespace NLQT return false; } -#else - -#if defined(NL_OS_WINDOWS) - - bool CObjectViewerWidget::winEvent(MSG *message, long *result) - { - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - winProc proc = (winProc)driver->getWindowProc(); - return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); - } - } - - return false; - } - -#elif defined(NL_OS_MAC) - - bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event) - { - if(caller) - nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); - - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - cocoaProc proc = (cocoaProc)driver->getWindowProc(); - return proc(driver, event); - } - } - - return false; - } - -#elif defined(NL_OS_UNIX) - - bool CObjectViewerWidget::x11Event(XEvent *event) - { - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - x11Proc proc = (x11Proc)driver->getWindowProc(); - return proc(driver, event); - } - } - - return false; - } -#endif - -#endif - } /* namespace NLQT */ diff --git a/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h b/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h index 91ed4cdeac..2845552b51 100644 --- a/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h +++ b/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h @@ -57,9 +57,7 @@ namespace NLQT public IObjectViewer { Q_OBJECT -#ifdef USE_QT5 Q_PLUGIN_METADATA(IID IObjectViewer_iid FILE "object_viewer.json") -#endif Q_INTERFACES(NLQT::IObjectViewer) public: @@ -169,19 +167,7 @@ namespace NLQT virtual QString name() const {return ("ObjectViewerWidget");} protected: -#ifdef USE_QT5 virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result); -#else - -#if defined(NL_OS_WINDOWS) - virtual bool winEvent(MSG * message, long * result); -#elif defined(NL_OS_MAC) - virtual bool macEvent(EventHandlerCallRef caller, EventRef event); -#elif defined(NL_OS_UNIX) - virtual bool x11Event(XEvent *event); -#endif - -#endif private Q_SLOTS: void updateRender(); diff --git a/nel/tools/3d/object_viewer_widget/src/stdpch.h b/nel/tools/3d/object_viewer_widget/src/stdpch.h index d1dd781d7e..0eb46ba74e 100644 --- a/nel/tools/3d/object_viewer_widget/src/stdpch.h +++ b/nel/tools/3d/object_viewer_widget/src/stdpch.h @@ -32,14 +32,8 @@ along with this program. If not, see . #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -#define USE_QT5 -#endif - -#ifdef USE_QT5 #include #include -#endif #include #include From ab658856d6f26b73acf20387b96b0f56e17f5f8d Mon Sep 17 00:00:00 2001 From: Tobias Peters Date: Wed, 28 Aug 2024 16:20:53 +0000 Subject: [PATCH 3/3] compile plugin as module --- nel/tools/3d/object_viewer_widget/src/CMakeLists.txt | 8 +------- snowballs2/client/CMakeLists.txt | 1 + snowballs2/client/data/.gitkeep | 0 3 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 snowballs2/client/data/.gitkeep diff --git a/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt b/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt index 00a7d6ef64..2c2ef174f4 100644 --- a/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt +++ b/nel/tools/3d/object_viewer_widget/src/CMakeLists.txt @@ -5,13 +5,7 @@ QT5_WRAP_CPP(OBJECT_VIEWER_WIDGET_MOC_SRCS ${OBJECT_VIEWER_WIDGET_HDR}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_WIDGET_MOC_SRCS}) -IF(WITH_STATIC) - SET(TYPE STATIC) -ELSE() - SET(TYPE MODULE) -ENDIF() - -ADD_LIBRARY(object_viewer_widget_qt ${TYPE} +ADD_LIBRARY(object_viewer_widget_qt MODULE ${OBJECT_VIEWER_WIDGET_SRC} ${OBJECT_VIEWER_WIDGET_MOC_SRCS}) diff --git a/snowballs2/client/CMakeLists.txt b/snowballs2/client/CMakeLists.txt index 502b01c281..030719dcc7 100644 --- a/snowballs2/client/CMakeLists.txt +++ b/snowballs2/client/CMakeLists.txt @@ -9,4 +9,5 @@ INSTALL(DIRECTORY data/ COMPONENT snowballsdata PATTERN "CVS" EXCLUDE PATTERN ".svn" EXCLUDE + PATTERN ".gitkeep" EXCLUDE PATTERN "Makefile*" EXCLUDE) diff --git a/snowballs2/client/data/.gitkeep b/snowballs2/client/data/.gitkeep new file mode 100644 index 0000000000..e69de29bb2