From 4a4eb5e96ac181c52b3abb757be6e6a2e21a1e5a Mon Sep 17 00:00:00 2001 From: DUC ANH HOANG Date: Mon, 29 Apr 2024 10:37:07 +0200 Subject: [PATCH] cmake for compilation of AppNameCustomize --- .../AppNameCustomize.cxx} | 12 +++---- src/LightApp/CMakeLists.txt | 18 ++++++++++ .../LightApp_Msg.cxx} | 35 +++++++------------ .../LightApp_Msg.h} | 11 ++---- .../AppNameCustomize.pro | 7 ---- 5 files changed, 39 insertions(+), 44 deletions(-) rename src/{LightAppMsg_Customize/AppNameCustomize.cpp => LightApp/AppNameCustomize.cxx} (91%) rename src/{LightAppMsg_Customize/LightApp_msg.cpp => LightApp/LightApp_Msg.cxx} (81%) rename src/{LightAppMsg_Customize/LightApp_msg.h => LightApp/LightApp_Msg.h} (87%) delete mode 100644 src/LightAppMsg_Customize/AppNameCustomize.pro diff --git a/src/LightAppMsg_Customize/AppNameCustomize.cpp b/src/LightApp/AppNameCustomize.cxx similarity index 91% rename from src/LightAppMsg_Customize/AppNameCustomize.cpp rename to src/LightApp/AppNameCustomize.cxx index 0defc2e1b..7ad9ad8f6 100644 --- a/src/LightAppMsg_Customize/AppNameCustomize.cpp +++ b/src/LightApp/AppNameCustomize.cxx @@ -1,6 +1,6 @@ -#include "LightApp_msg.h" +#include "LightApp_Msg.h" -using namespace LightApp_msg; +using namespace LightApp_Msg; bool qmTots(const QString &qmFilePath, const QString &tsFilePath) { QProcess process; @@ -43,7 +43,7 @@ bool tsToqm(const QString &tsFilePath, const QString &qmFilePath){ } } -bool LightApp_msg_patching(const QString& app_name,const QString& qmFilePath) +bool LightApp_Msg_patching(const QString& app_name,const QString& qmFilePath) { // Get GUI_ROOT_DIR QByteArray gui_root_dir_env = qgetenv("GUI_ROOT_DIR"); @@ -77,7 +77,7 @@ bool LightApp_msg_patching(const QString& app_name,const QString& qmFilePath) } std::unique_ptr> Context_list(new QList); - LightApp_msg_handling LAMsg_handling(std::move(Context_list)); + LightApp_Msg_handling LAMsg_handling(std::move(Context_list)); LAMsg_handling.read(&input_tsFile); @@ -127,9 +127,9 @@ int main(int argc, char *argv[]) { for (const QString& qmFilePath:qmFilePath_list) { - if(!LightApp_msg_patching(app_name,qmFilePath)) + if(!LightApp_Msg_patching(app_name,qmFilePath)) { - qDebug() << "LightApp_msg_patching failed!!!!"; + qDebug() << "LightApp_Msg_patching failed!!!!"; return 1; } } diff --git a/src/LightApp/CMakeLists.txt b/src/LightApp/CMakeLists.txt index 55172bee0..677cde862 100644 --- a/src/LightApp/CMakeLists.txt +++ b/src/LightApp/CMakeLists.txt @@ -294,6 +294,20 @@ SET(_other_SOURCES LightApp_WgViewModel.cxx LightApp_ExtInfoDlg.cxx ) + +SET(APPNAMECUSTOMIZE_SRC + AppNameCustomize.cxx + LightApp_Msg.cxx +) + +SET(APPNAMECUSTOMIZE_header + LightApp_Msg.h +) + +QT_WRAP_MOC(moc_APPNAMECUSTOMIZE_header ${APPNAMECUSTOMIZE_header}) + +SET(APPNAMECUSTOMIZE_SOURCES ${moc_APPNAMECUSTOMIZE_header} ${APPNAMECUSTOMIZE_SRC}) + IF(SALOME_USE_GLVIEWER) LIST(APPEND _other_SOURCES LightApp_GLSelector.cxx) ENDIF() @@ -338,3 +352,7 @@ INSTALL(FILES ${LightApp_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) + +ADD_EXECUTABLE(AppNameCustomize ${APPNAMECUSTOMIZE_SOURCES} ) +TARGET_LINK_LIBRARIES(AppNameCustomize ${QT_LIBRARIES}) +INSTALL(TARGETS AppNameCustomize EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS}) diff --git a/src/LightAppMsg_Customize/LightApp_msg.cpp b/src/LightApp/LightApp_Msg.cxx similarity index 81% rename from src/LightAppMsg_Customize/LightApp_msg.cpp rename to src/LightApp/LightApp_Msg.cxx index 716801495..4d1247bd4 100644 --- a/src/LightAppMsg_Customize/LightApp_msg.cpp +++ b/src/LightApp/LightApp_Msg.cxx @@ -1,17 +1,6 @@ -#include "LightApp_msg.h" - -using namespace LightApp_msg; - -QString CustomEntityResolver::resolveUndeclaredEntity(const QString &name) { - if (name == "&") - return "&"; - else if (name == """) - return """; - else if (name == "'") - return "'"; - return QString(); -} +#include "LightApp_Msg.h" +using namespace LightApp_Msg; QString Context::ExportContext() { @@ -38,7 +27,7 @@ Message* Context::GetMessagebySrc(const QString& src) -Context* LightApp_msg_handling::GetContextbyName(const QString& name) +Context* LightApp_Msg_handling::GetContextbyName(const QString& name) { int i(0); while(i < Context_list->size() && (*Context_list)[i].GetContext_name() != name) @@ -47,12 +36,12 @@ Context* LightApp_msg_handling::GetContextbyName(const QString& name) return &(*Context_list)[i]; else { - qDebug()<<"Context with name " << name << " doesn't exist in LightApp_msg_handling"; + qDebug()<<"Context with name " << name << " doesn't exist in LightApp_Msg_handling"; return nullptr; } } -bool LightApp_msg_handling::HaveContext(const QString& name) +bool LightApp_Msg_handling::HaveContext(const QString& name) { int i(0); while(i < Context_list->size() && (*Context_list)[i].GetContext_name() != name) @@ -63,7 +52,7 @@ bool LightApp_msg_handling::HaveContext(const QString& name) return false; } -QString LightApp_msg_handling::write() +QString LightApp_Msg_handling::write() { QString updateXml; updateXml.append(header); @@ -74,7 +63,7 @@ QString LightApp_msg_handling::write() return updateXml; } -void LightApp_msg_handling::read(QIODevice *device) +void LightApp_Msg_handling::read(QIODevice *device) { //header @@ -97,7 +86,7 @@ void LightApp_msg_handling::read(QIODevice *device) } -void LightApp_msg_handling::readContext() +void LightApp_Msg_handling::readContext() { Q_ASSERT(xmlReader.isStartElement() && xmlReader.name() == "context"); @@ -109,7 +98,7 @@ void LightApp_msg_handling::readContext() if (!HaveContext(name)) Context_list->append(Context(name)); else - qWarning()<<"Context with name " << name << " is already appended in LightApp_msg_handling"; + qWarning()<<"Context with name " << name << " is already appended in LightApp_Msg_handling"; } else if (xmlReader.name() == "message") { @@ -120,7 +109,7 @@ void LightApp_msg_handling::readContext() } } -void LightApp_msg_handling::readMessage() +void LightApp_Msg_handling::readMessage() { Q_ASSERT(xmlReader.isStartElement() && xmlReader.name() == "message"); @@ -139,7 +128,7 @@ void LightApp_msg_handling::readMessage() (*Context_list)[Context_list->size() - 1].AddMsg(msg); } -void LightApp_msg_handling::readSrc(Message& msg) +void LightApp_Msg_handling::readSrc(Message& msg) { Q_ASSERT(xmlReader.isStartElement() && xmlReader.name() == "source"); @@ -148,7 +137,7 @@ void LightApp_msg_handling::readSrc(Message& msg) msg.Set_Source(src); } -void LightApp_msg_handling::readTranslation(Message& msg) +void LightApp_Msg_handling::readTranslation(Message& msg) { Q_ASSERT(xmlReader.isStartElement() && xmlReader.name() == "translation"); diff --git a/src/LightAppMsg_Customize/LightApp_msg.h b/src/LightApp/LightApp_Msg.h similarity index 87% rename from src/LightAppMsg_Customize/LightApp_msg.h rename to src/LightApp/LightApp_Msg.h index c4b322f60..5fb5bdf05 100644 --- a/src/LightAppMsg_Customize/LightApp_msg.h +++ b/src/LightApp/LightApp_Msg.h @@ -10,7 +10,7 @@ #include #include -namespace LightApp_msg +namespace LightApp_Msg { class Message @@ -41,10 +41,10 @@ class Context QList Message_list; }; -class LightApp_msg_handling +class LightApp_Msg_handling { public: - LightApp_msg_handling(std::unique_ptr> Context_list): + LightApp_Msg_handling(std::unique_ptr> Context_list): Context_list(std::move(Context_list)){}; void read(QIODevice *device); QString write(); @@ -62,8 +62,3 @@ private: }; } - -class CustomEntityResolver : public QXmlStreamEntityResolver { -public: - QString resolveUndeclaredEntity(const QString &name); -}; \ No newline at end of file diff --git a/src/LightAppMsg_Customize/AppNameCustomize.pro b/src/LightAppMsg_Customize/AppNameCustomize.pro deleted file mode 100644 index 5fa86fcc1..000000000 --- a/src/LightAppMsg_Customize/AppNameCustomize.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -QT += core gui -CONFIG += c++11 -SOURCES += \ - AppNameCustomize.cpp \ - LightApp_msg.cpp -HEADERS += LightApp_msg.h \ No newline at end of file -- 2.39.2