From 1f11e291b689207978c086b8fd4dbd9bbd705fe6 Mon Sep 17 00:00:00 2001 From: Paul Leroy Date: Tue, 14 May 2024 16:49:07 +0200 Subject: [PATCH] disclaimer --- CMakeLists.txt | 57 +++++++++++++++++++++- include/CMakeLists.txt | 1 + include/qG3PointDisclaimer.h | 29 +++++++++++ src/ActionA.cpp | 6 +++ src/CMakeLists.txt | 1 + src/qG3PointDisclaimer.cpp | 51 +++++++++++++++++++ ui/CMakeLists.txt | 1 + ui/qG3PointDisclaimer.ui | 95 ++++++++++++++++++++++++++++++++++++ 8 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 include/qG3PointDisclaimer.h create mode 100644 src/qG3PointDisclaimer.cpp create mode 100644 ui/qG3PointDisclaimer.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index a5a61d7..38d92be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,9 @@ if ( PLUGIN_G3POINT ) project( G3PointPlugin ) AddPlugin( NAME ${PROJECT_NAME} ) - + +set(QG3POINT_PLUGIN_VERSION "0.1") + add_subdirectory( include ) add_subdirectory( src ) add_subdirectory( ui ) @@ -31,4 +33,57 @@ if ( PLUGIN_G3POINT ) set( OPENCV_DEP_DLL_FILES ${Open3D_DIR}/../bin/Open3D.dll ) copy_files( "${OPENCV_DEP_DLL_FILES}" "${CLOUDCOMPARE_DEST_FOLDER}" ) #mind the quotes! + #================ + # git commit hash + # Get the current working branch + execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH_G3POINT + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Get the latest commit hash + execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH_G3POINT + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Get the latest commit hash + execute_process( + COMMAND git describe + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_TAG_G3POINT + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Get the current working branch + execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH_CC + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Get the latest commit hash + execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH_CC + OUTPUT_STRIP_TRAILING_WHITESPACE) + + message(${PROJECT_NAME} " " GIT_BRANCH_G3POINT " " ${GIT_BRANCH_G3POINT}) + message(${PROJECT_NAME} " " GIT_COMMIT_HASH_G3POINT " " ${GIT_COMMIT_HASH_G3POINT}) + message(${PROJECT_NAME} " " GIT_TAG_G3POINT " " ${GIT_TAG_G3POINT}) + message(${PROJECT_NAME} " " GIT_BRANCH_CC " " ${GIT_BRANCH_CC}) + message(${PROJECT_NAME} " " GIT_COMMIT_HASH_CC " " ${GIT_COMMIT_HASH_CC}) + message(${PROJECT_NAME} " " QG3POINT_VERSION " " ${QG3POINT_PLUGIN_VERSION}) + + target_compile_definitions(${PROJECT_NAME} PRIVATE + GIT_BRANCH_CC="${GIT_BRANCH_CC}" + GIT_COMMMIT_HASH_CC="${GIT_COMMIT_HASH_CC}" + PUBLIC GIT_BRANCH_G3POINT="${GIT_BRANCH_G3POINT}" + GIT_COMMMIT_HASH_G3POINT="${GIT_COMMIT_HASH_G3POINT}" + GIT_TAG_G3POINT="${GIT_TAG_G3POINT}" + G3POINT_VERSION="${QG3POINT_PLUGIN_VERSION}" + ) + endif() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 9f19a1f..992920e 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -5,6 +5,7 @@ target_sources( ${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/G3Point.h ${CMAKE_CURRENT_LIST_DIR}/G3PointDialog.h ${CMAKE_CURRENT_LIST_DIR}/GrainsAsEllipsoids.h + ${CMAKE_CURRENT_LIST_DIR}/qG3PointDisclaimer.h ) target_include_directories( ${PROJECT_NAME} diff --git a/include/qG3PointDisclaimer.h b/include/qG3PointDisclaimer.h new file mode 100644 index 0000000..06a5cee --- /dev/null +++ b/include/qG3PointDisclaimer.h @@ -0,0 +1,29 @@ +#ifndef QG3POINTDISCLAIMER_H +#define QG3POINTDISCLAIMER_H + +#include + +class ccMainAppInterface; + +namespace Ui { +class G3PointDisclaimer; +} + +class qG3PointDisclaimer : public QDialog +{ + Q_OBJECT + +public: + explicit qG3PointDisclaimer(QWidget *parent = nullptr); + ~qG3PointDisclaimer(); + + static bool show(ccMainAppInterface* app); + +private: + //whether disclaimer has already been displayed (and accepted) or not + static bool s_disclaimerAccepted; + + Ui::G3PointDisclaimer *ui; +}; + +#endif // QG3POINTDISCLAIMER_H diff --git a/src/ActionA.cpp b/src/ActionA.cpp index eeeb680..1b7adfb 100644 --- a/src/ActionA.cpp +++ b/src/ActionA.cpp @@ -37,6 +37,8 @@ #include +#include + namespace G3Point { G3PointAction* G3PointAction::s_g3PointAction = nullptr; @@ -61,6 +63,10 @@ G3PointAction::~G3PointAction() void G3PointAction::GetG3PointAction(ccPointCloud *cloud, ccMainAppInterface *app) { + //disclaimer accepted? + if (!qG3PointDisclaimer::show(app)) + return; + if (!s_g3PointAction) // create the singleton if needed { s_g3PointAction = new G3PointAction(cloud, app); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e75b65..a40631b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,4 +5,5 @@ target_sources( ${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/G3Point.cpp ${CMAKE_CURRENT_LIST_DIR}/G3PointDialog.cpp ${CMAKE_CURRENT_LIST_DIR}/GrainsAsEllipsoids.cpp + ${CMAKE_CURRENT_LIST_DIR}/qG3PointDisclaimer.cpp ) diff --git a/src/qG3PointDisclaimer.cpp b/src/qG3PointDisclaimer.cpp new file mode 100644 index 0000000..d0cbce8 --- /dev/null +++ b/src/qG3PointDisclaimer.cpp @@ -0,0 +1,51 @@ +#include "qG3PointDisclaimer.h" +#include "ui_qG3PointDisclaimer.h" + +//qCC_plugins +#include + +//Qt +#include + +bool qG3PointDisclaimer::s_disclaimerAccepted = false; + +qG3PointDisclaimer::qG3PointDisclaimer(QWidget *parent) + : QDialog(parent) + , ui(new Ui::G3PointDisclaimer) +{ + ui->setupUi(this); + + QString compilationInfo; + compilationInfo += "Version " + QString(G3POINT_VERSION); + compilationInfo += QStringLiteral("
Compiled with"); + +#if defined(_MSC_VER) + compilationInfo += QStringLiteral(" MSVC %1 and").arg(_MSC_VER); +#endif + + compilationInfo += QStringLiteral(" Qt %1").arg(QT_VERSION_STR); + compilationInfo += QStringLiteral(""); + compilationInfo += " [cc " + QString(GIT_BRANCH_CC) + "/" + QString(GIT_COMMMIT_HASH_CC) + "]"; + compilationInfo += " [g3point " + + QString(GIT_TAG_G3POINT) + " " + + QString(GIT_BRANCH_G3POINT) + "/" + + QString(GIT_COMMMIT_HASH_G3POINT) + "]"; + + ui->labelCompilationInformation->setText(compilationInfo); +} + +qG3PointDisclaimer::~qG3PointDisclaimer() +{ + delete ui; +} + +bool qG3PointDisclaimer::show(ccMainAppInterface *app) +{ + if ( !s_disclaimerAccepted ) + { + //if the user "cancels" it, then he refuses the disclaimer + s_disclaimerAccepted = qG3PointDisclaimer(app ? app->getMainWindow() : 0).exec(); + } + + return s_disclaimerAccepted; +} diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index b31dd72..a86ce3b 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1,4 +1,5 @@ target_sources( ${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/qG3PointDialog.ui + ${CMAKE_CURRENT_LIST_DIR}/qG3PointDisclaimer.ui ) diff --git a/ui/qG3PointDisclaimer.ui b/ui/qG3PointDisclaimer.ui new file mode 100644 index 0000000..2a832ba --- /dev/null +++ b/ui/qG3PointDisclaimer.ui @@ -0,0 +1,95 @@ + + + G3PointDisclaimer + + + + 0 + 0 + 1086 + 263 + + + + Dialog + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> +p, li { white-space: pre-wrap; } +hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } +</style></head><body style=" font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Calibri,sans-serif'; font-size:12pt; font-weight:700; color:#1f497d;">G3Point: grain segmentation algorithm</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:10pt; font-weight:600; color:#1f497d;">Code </span><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:10pt; color:#1f497d;">P. Leroy</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:6pt; color:#1f497d; background-color:#ffffff;"> </span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:10pt; font-weight:700; color:#1f497d; background-color:#ffffff;">Article</span><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:10pt; color:#1f497d; background-color:#ffffff;"> Steer, P., Guerit, L., Lague, D., Crave, A., and Gourdon, A.</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:10pt; font-style:italic; color:#1f497d; background-color:#ffffff;">Size, shape and orientation matter: fast and semi-automatic measurement of grain geometries from 3D point clouds</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Slack-Lato','appleLogo','sans-serif'; font-size:10pt; color:#1f497d; background-color:#ffffff;">Earth Surf. Dynam., 10, 1211–1232, https://doi.org/10.5194/esurf-10-1211-2022, 2022.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Calibri,sans-serif'; font-size:6pt; color:#1f497d;"> </span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:700; color:#ff0000;">Comments / remarks =&gt; Section G3Point of the forum https://www.cloudcompare.org/forum/</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:6pt;"> </span><span style=" font-family:'Calibri,sans-serif'; font-size:6pt; color:#1f497d; background-color:#ffffff;"> </span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Calibri,sans-serif'; font-size:10pt; color:#1f497d; background-color:#ffffff;">Observatoire des Sciences de l'Univers de Rennes - Géosciences Rennes</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Calibri,sans-serif'; font-size:10pt; color:#1f497d; background-color:#ffffff;">Université de Rennes - Centre National de la Recherche Scientifique</span></p></body></html> + + + + + + + Compilation information: - + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + G3PointDisclaimer + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + G3PointDisclaimer + reject() + + + 316 + 260 + + + 286 + 274 + + + + +