From b6603da5f648d772d749ae082001a87b093e5cf9 Mon Sep 17 00:00:00 2001 From: Frederic Cervenansky Date: Mon, 18 Oct 2010 15:28:56 +0000 Subject: [PATCH] QT interface --- CMakeLists.txt | 11 +++++++-- src/CMakeLists.txt | 42 ++++++++++++++++++++++++++++++-- src/creaImageIOGimmick.cpp | 11 +++++++++ src/creaImageIOGimmick.h | 3 +++ src/creaImageIOSimpleView.cpp | 1 + src/creaImageIOWxGimmickView.cpp | 9 ++----- 6 files changed, 66 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0ead96..b23075b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,15 +35,22 @@ SET(USE_VTK ON) SET(USE_ITK OFF) SET(USE_BOOST ON) OPTION(USE_WXWIDGETS "Use WxWidgets GUI" ON) -OPTION(USE_QT4 "USE WxWidgets GUI" OFF) +OPTION(USE_QT4 "USE QT4GUI" OFF) OPTION(USE_XERCES "USE Xerces if you want to use an beta version of outputModel" OFF) IF(USE_QT4) IF(USE_WXWIDGETS) - MESSAGE(STATUS "CANNOT USE QT WXWIDGETS IN SAME TIME") + MESSAGE(ERROR "CANNOT USE QT WXWIDGETS IN SAME TIME") ENDIF(USE_WXWIDGETS) ENDIF(USE_QT4) +IF(QT4_FOUND) + IF (WIN32) + MESSAGE("So ... ${QT_DIR}") + INCLUDE_DIRECTORIES(${QT_DIR}/../include) + LINK_DIRECTORIES(${QT_DIR}/../lib) + ENDIF(WIN32) +ENDIF(QT4_FOUND) OPTION(USE_GDCM "Use gdcm 1.3" ON) OPTION(USE_GDCM2 "Use gdcm 2.0.14 at least" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b584cc..618ca30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,8 +79,34 @@ FILE(GLOB SOURCES_CREAIMAGEIO_WX creaImageIOWxTreeView.cpp creaImageIOWxOutputDlg.cpp ) + SOURCE_GROUP("Source Files\\GUI" FILES ${SOURCES_CREAIMAGEIO_WX}) endif() +# USE QT, need to transform files (moc mechanism) +IF (USE_QT4) + #cpp + FILE(GLOB QT_CPP + QtGUI/*.cpp QtGUI/*.cxx + ) + + # headers + SET(QT4_HEADERS_TO_WRAP + QtGUI/creaimageioqtreeview.h + QtGUI/mainwindow.h + ) + + + QT4_WRAP_CPP(MOC_SOURCES ${QT4_HEADERS_TO_WRAP}) + SOURCE_GROUP("Source Files\\GUI" FILES ${MOC_SOURCES}) + + + # UI + FILE(GLOB UI_FILES QtGUI/*.ui) + QT4_WRAP_UI(UI_SOURCES ${UI_FILES}) + #SOURCE_GROUP("UI Files" FILES ${UI_FILES}) + SOURCE_GROUP("Source Files\\GUI" FILES ${UI_SOURCES}) +ENDIF(USE_QT4) + IF(USE_XERCES) FILE(GLOB SOURCES_CREAIMAGEIO_OUTPUT @@ -101,7 +127,6 @@ FILE(GLOB HEADER_CREAIMAGEIO_PACS PACS/*.h) SOURCE_GROUP("Source Files" FILES ${SOURCES_CREAIMAGEIO}) SOURCE_GROUP("Header Files" FILES ${HEADER_CREAIMAGEIO}) -SOURCE_GROUP("Source Files\\GUI" FILES ${SOURCES_CREAIMAGEIO_WX}) if(BUILD_CREA_PACS) SOURCE_GROUP("Source Files\\PACS" FILES ${SOURCES_CREAIMAGEIO_PACS}) SOURCE_GROUP("Header Files\\PACS" FILES ${HEADER_CREAIMAGEIO_PACS}) @@ -111,12 +136,25 @@ SOURCE_GROUP("Source Files\\Readers" FILES ${SOURCES_CREAIMAGEIO_IMG_READER} SOURCE_GROUP("Source Files\\Tree" FILES ${SOURCES_CREAIMAGEIO_TREE}) + + +IF(USE_WXWIDGETS) +SET( GUI_SRCS + ${SOURCES_CREAIMAGEIO_WX} + ) +ELSE(USE_WXWIDGETS) +SET( GUI_SRCS + ${QT_CPP} + ${UI_SOURCES} + ${MOC_SOURCES} + ) +ENDIF(USE_WXWIDGETS) SET( PRIMITIVE_SRCS ${SOURCES_CREAIMAGEIO} ${HEADER_CREAIMAGEIO} ${SOURCES_CREAIMAGEIO_IMG_READER} ${SOURCES_CREAIMAGEIO_IMG_DICOM_READER} - ${SOURCES_CREAIMAGEIO_WX} + ${GUI_SRCS} ${SOURCES_CREAIMAGEIO_TREE} ) diff --git a/src/creaImageIOGimmick.cpp b/src/creaImageIOGimmick.cpp index 5c7b07f..06e32ce 100644 --- a/src/creaImageIOGimmick.cpp +++ b/src/creaImageIOGimmick.cpp @@ -539,4 +539,15 @@ void Gimmick::fillVectInfos(std::vector i_attr, OutputAttr &infos) } } +const std::stringstream Gimmick::getSummary() +{ + const AddProgress& p = GetAddProgress(); + std::stringstream mess; + mess << "Dirs \tscanned\t: " << p.GetNumberScannedDirs() << "\n"; + mess << "Files\tscanned\t: " << p.GetNumberScannedFiles() << "\n"; + mess << "Files\thandled\t: " << p.GetNumberHandledFiles() << "\n\n"; + mess << "Files\tadded \t: " << p.GetNumberAddedFiles() << "\n\n"; + return mess; +} + } \ No newline at end of file diff --git a/src/creaImageIOGimmick.h b/src/creaImageIOGimmick.h index 49dfae4..55b8d14 100644 --- a/src/creaImageIOGimmick.h +++ b/src/creaImageIOGimmick.h @@ -208,6 +208,9 @@ namespace creaImageIO /// Decide if attributes are available through database void fillVectInfos(std::vector i_attr, OutputAttr &infos); + + /// Get Add Opertaion summary + const std::stringstream getSummary(); //============================================= private: SQLiteTreeHandler* mLocalDatabase; diff --git a/src/creaImageIOSimpleView.cpp b/src/creaImageIOSimpleView.cpp index 7a78629..6c640b3 100644 --- a/src/creaImageIOSimpleView.cpp +++ b/src/creaImageIOSimpleView.cpp @@ -50,6 +50,7 @@ namespace creaImageIO for(int i=0; iReadImage(names[i]) ); } } diff --git a/src/creaImageIOWxGimmickView.cpp b/src/creaImageIOWxGimmickView.cpp index 3bdc716..9c0d327 100644 --- a/src/creaImageIOWxGimmickView.cpp +++ b/src/creaImageIOWxGimmickView.cpp @@ -1210,13 +1210,8 @@ namespace creaImageIO //================================================= void WxGimmickView::DisplayAddSummary() { - const Gimmick::AddProgress& p = mGimmick->GetAddProgress(); - std::stringstream mess; - mess << "Dirs \tscanned\t: " << p.GetNumberScannedDirs() << "\n"; - mess << "Files\tscanned\t: " << p.GetNumberScannedFiles() << "\n"; - mess << "Files\thandled\t: " << p.GetNumberHandledFiles() << "\n\n"; - mess << "Files\tadded \t: " << p.GetNumberAddedFiles() << "\n\n"; - time_t end; + std::stringstream mess(mGimmick->getSummary()); + time_t end; time(&end); mess << "time to scan :" << difftime(end,mstart) << "sec"; wxMessageBox(std2wx(mess.str()),_T("Addition result"),wxOK,this); -- 2.47.1