Skip to content

Commit

Permalink
Merge branch 'master' into qt5
Browse files Browse the repository at this point in the history
Conflicts:
	CMake/ctkMacroGenerateMocs.cmake
	CMake/ctkMacroSetupQt.cmake
	Libs/Core/Testing/Cpp/CMakeLists.txt
	SuperBuild.cmake
  • Loading branch information
saschazelzer committed May 6, 2014
2 parents 588b1b7 + 1df03ea commit 467359d
Show file tree
Hide file tree
Showing 862 changed files with 38,445 additions and 7,620 deletions.
91 changes: 41 additions & 50 deletions Applications/Testing/Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,49 @@
set(KIT CTKApplication)

set(KIT_TEST_SRCS)
set(KIT_target_libraries)

## Query / Retrieve Testing
if(CTK_APP_ctkDICOMQuery AND CTK_APP_ctkDICOMRetrieve)
list(APPEND KIT_TEST_SRCS
ctkDICOMApplicationTest1.cpp
)
ctkFunctionGetTargetLibraries(KIT_target_libraries ${ctkDICOMQuery_SOURCE_DIR})
ctkFunctionGetTargetLibraries(KIT_target_libraries ${ctkDICOMRetrieve_SOURCE_DIR})
endif()

if(KIT_TEST_SRCS)

create_test_sourcelist(Tests ${KIT}CppTests.cpp
${KIT_TEST_SRCS}
#
# create a dcm query/retrieve service config file that points to the build dir
#
set(DCMQRSCP_STORE_DIR ${CTK_BINARY_DIR}/Testing/Temporary)
set(ctkDICOMRetrieve_STORE_DIR ${CTK_BINARY_DIR}/Testing/Temporary/ctkDICOMRetrieveStorage)
set(DCMQRSCP_CONFIG ${CTK_BINARY_DIR}/Testing/Temporary/dcmqrscp.cfg)
configure_file( dcmqrscp.cfg.in ${DCMQRSCP_CONFIG} )

set(ctkDICOMQuery_DB_FILE ${CTK_BINARY_DIR}/Testing/Temporary/ctkDICOMApplicationTest1.db)

#
# find the helper executables
#
find_program(DCMTK_DCMQRSCP_EXECUTABLE dcmqrscp
PATHS
${DCMTK_DIR}/bin
NO_DEFAULT_PATH
)

SET (TestsToRun ${Tests})
REMOVE (TestsToRun ${KIT}CppTests.cpp)

add_executable(${KIT}CppTests ${Tests})
if(KIT_target_libraries)
target_link_libraries(${KIT}CppTests ${KIT_target_libraries})
endif()

## Query / Retrieve Testing
if(CTK_APP_ctkDICOMQuery AND CTK_APP_ctkDICOMRetrieve)

# create a dcm query/retrieve service config file that points to the build dir
set(DCMQRSCP_STORE_DIR ${CTK_BINARY_DIR}/Testing/Temporary)
set(ctkDICOMRetrieve_STORE_DIR ${CTK_BINARY_DIR}/Testing/Temporary/ctkDICOMRetrieveStorage)
set(DCMQRSCP_CONFIG ${CTK_BINARY_DIR}/Testing/Temporary/dcmqrscp.cfg)
configure_file( dcmqrscp.cfg.in ${DCMQRSCP_CONFIG} )

set(ctkDICOMQuery_DB_FILE ${CTK_BINARY_DIR}/Testing/Temporary/ctkDICOMApplicationTest1.db)

#
# Add Tests
#

SIMPLE_TEST( ctkDICOMApplicationTest1
${DCMTK_DCMQRSCP_EXECUTABLE}
${DCMQRSCP_CONFIG}
${CTKData_DIR}/Data/DICOM/MRHEAD/000055.IMA
${CTKData_DIR}/Data/DICOM/MRHEAD/000056.IMA
${DCMTK_STORESCU_EXECUTABLE}
$<TARGET_FILE:ctkDICOMQuery>
${ctkDICOMQuery_DB_FILE}
$<TARGET_FILE:ctkDICOMRetrieve>
${ctkDICOMRetrieve_STORE_DIR}
)
endif()
find_program(DCMTK_STORESCU_EXECUTABLE storescu
PATHS
${DCMTK_DIR}/bin
NO_DEFAULT_PATH
)

#
# Add Tests
#
add_executable(ctkDICOMApplicationTest1 ctkDICOMApplicationTest1.cpp)
target_link_libraries(ctkDICOMApplicationTest1 ${QT_LIBRARIES})

ADD_TEST( NAME ctkDICOMApplicationTest1
COMMAND
$<TARGET_FILE:ctkDICOMApplicationTest1>
${DCMTK_DCMQRSCP_EXECUTABLE}
${DCMQRSCP_CONFIG}
${CTKData_DIR}/Data/DICOM/MRHEAD/000055.IMA
${CTKData_DIR}/Data/DICOM/MRHEAD/000056.IMA
${DCMTK_STORESCU_EXECUTABLE}
$<TARGET_FILE:ctkDICOMQuery>
${ctkDICOMQuery_DB_FILE}
$<TARGET_FILE:ctkDICOMRetrieve>
${ctkDICOMRetrieve_STORE_DIR}
)
endif()

2 changes: 1 addition & 1 deletion Applications/Testing/Cpp/ctkDICOMApplicationTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
// ./CTK-build/Testing/Temporary/ctkDICOMRetrieveStorage
//

int ctkDICOMApplicationTest1(int argc, char * argv []) {
int main(int argc, char * argv []) {

QCoreApplication app(argc, argv);
QTextStream out(stdout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <ctkCmdLineModuleFrontendFactoryQtWebKit.h>
#include <ctkCmdLineModuleBackendLocalProcess.h>
#include <ctkCmdLineModuleBackendFunctionPointer.h>
#include <ctkCmdLineModuleBackendXMLChecker.h>
#include <ctkException.h>
#include <ctkCmdLineModuleXmlException.h>

Expand All @@ -48,8 +49,9 @@
#include <QFutureSynchronizer>
#include <QCloseEvent>
#include <QFileDialog>
#include <QMessageBox>


//-----------------------------------------------------------------------------
ctkCLModuleExplorerMainWindow::ctkCLModuleExplorerMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ctkCmdLineModuleExplorerMainWindow),
Expand Down Expand Up @@ -80,9 +82,13 @@ ctkCLModuleExplorerMainWindow::ctkCLModuleExplorerMainWindow(QWidget *parent) :

// Backends
ctkCmdLineModuleBackendFunctionPointer* backendFunctionPointer = new ctkCmdLineModuleBackendFunctionPointer;
moduleBackends.push_back(backendFunctionPointer);

xmlCheckerBackEnd = new ctkCmdLineModuleBackendXMLChecker;
moduleBackends.push_back(xmlCheckerBackEnd);

moduleBackends.push_back(new ctkCmdLineModuleBackendLocalProcess);
moduleBackends.push_back(backendFunctionPointer);

for(int i = 0; i < moduleBackends.size(); ++i)
{
moduleManager.registerBackend(moduleBackends[i]);
Expand All @@ -104,6 +110,7 @@ ctkCLModuleExplorerMainWindow::ctkCLModuleExplorerMainWindow(QWidget *parent) :
connect(ui->progressListWidget, SIGNAL(progressWidgetClicked(ctkCmdLineModuleFrontend*)), tabList.data(), SLOT(setActiveTab(ctkCmdLineModuleFrontend*)));

connect(ui->ClearButton, SIGNAL(clicked()), ui->progressListWidget, SLOT(clearList()));
connect(ui->m_CheckXMLButton, SIGNAL(pressed()), this, SLOT(checkXMLPressed()));

// Listen to future events for the currently active tab

Expand Down Expand Up @@ -137,6 +144,8 @@ ctkCLModuleExplorerMainWindow::ctkCLModuleExplorerMainWindow(QWidget *parent) :
future.waitForFinished();
}


//-----------------------------------------------------------------------------
ctkCLModuleExplorerMainWindow::~ctkCLModuleExplorerMainWindow()
{
qDeleteAll(moduleBackends);
Expand All @@ -149,11 +158,15 @@ ctkCLModuleExplorerMainWindow::~ctkCLModuleExplorerMainWindow()
}
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::addModule(const QUrl &location)
{
moduleManager.registerModule(location);
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::closeEvent(QCloseEvent *event)
{
QList<ctkCmdLineModuleFrontend*> runningFrontends;
Expand Down Expand Up @@ -198,6 +211,8 @@ void ctkCLModuleExplorerMainWindow::closeEvent(QCloseEvent *event)
event->accept();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionRun_triggered()
{
ctkCmdLineModuleFrontend* moduleFrontend = this->tabList->activeTab();
Expand All @@ -218,16 +233,22 @@ void ctkCLModuleExplorerMainWindow::on_actionRun_triggered()
this->currentFutureWatcher.setFuture(future);
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionPause_toggled(bool toggled)
{
this->currentFutureWatcher.setPaused(toggled);
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionCancel_triggered()
{
this->currentFutureWatcher.cancel();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionOptions_triggered()
{
if (settingsDialog == NULL)
Expand All @@ -244,6 +265,8 @@ void ctkCLModuleExplorerMainWindow::on_actionOptions_triggered()
settingsDialog->exec();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionLoad_triggered()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Load modules..."));
Expand All @@ -257,16 +280,36 @@ void ctkCLModuleExplorerMainWindow::on_actionLoad_triggered()
this->moduleManager.validationMode());
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionQuit_triggered()
{
this->close();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionReset_triggered()
{
this->tabList->activeTab()->resetValues();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionClear_Cache_triggered()
{
moduleManager.clearCache();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::on_actionReload_Modules_triggered()
{
moduleManager.reloadModules();
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::checkModulePaused()
{
if (this->currentFutureWatcher.future().isPaused())
Expand All @@ -285,11 +328,15 @@ void ctkCLModuleExplorerMainWindow::checkModulePaused()
}
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::currentModuleResumed()
{
ui->actionPause->setChecked(false);
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::currentModuleCanceled()
{
ctkCmdLineModuleFrontend* frontend = this->tabList->activeTab();
Expand All @@ -306,6 +353,8 @@ void ctkCLModuleExplorerMainWindow::currentModuleCanceled()
}
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::currentModuleFinished()
{
ctkCmdLineModuleFrontend* frontend = this->tabList->activeTab();
Expand All @@ -322,6 +371,39 @@ void ctkCLModuleExplorerMainWindow::currentModuleFinished()
}
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::checkXMLPressed()
{
xmlCheckerBackEnd->setXML(ui->m_XMLToValidate->toPlainText());
QUrl url(QString("xmlchecker://should call ctkCmdLineModuleBackendXMLChecker"));

qDebug() << "ctkCLModuleExplorerMainWindow::checkXMLPressed validating:\n" << ui->m_XMLToValidate->toPlainText();

ctkCmdLineModuleManager::ValidationMode previousMode = moduleManager.validationMode();

try
{
ctkCmdLineModuleReference ref = moduleManager.moduleReference(url);
if (ref)
{
moduleManager.unregisterModule(ref);
}
moduleManager.setValidationMode(ctkCmdLineModuleManager::STRICT_VALIDATION);
moduleManager.registerModule(url);
moduleManager.setValidationMode(previousMode);

} catch (ctkException& except)
{
moduleManager.setValidationMode(previousMode);
QWidget* widget = QApplication::activeModalWidget();
if (widget == NULL) widget = QApplication::activeWindow();
QMessageBox::critical(widget, QObject::tr("Failed while checking XML:"), except.message());
}
}


//-----------------------------------------------------------------------------
void ctkCLModuleExplorerMainWindow::moduleTabActivated(ctkCmdLineModuleFrontend *module)
{
if (module == NULL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ctkCmdLineModuleExplorerTabList;
class ctkCmdLineModuleReference;
class ctkCmdLineModuleResult;
class ctkSettingsDialog;
class ctkCmdLineModuleBackendXMLChecker;

namespace Ui {
class ctkCmdLineModuleExplorerMainWindow;
Expand Down Expand Up @@ -68,14 +69,17 @@ protected Q_SLOTS:
void on_actionQuit_triggered();

void on_actionReset_triggered();
void on_actionClear_Cache_triggered();
void on_actionReload_Modules_triggered();

void checkModulePaused();
void currentModuleResumed();
void currentModuleCanceled();
void currentModuleFinished();

void moduleTabActivated(ctkCmdLineModuleFrontend* module);

void checkXMLPressed();

private:

QScopedPointer<Ui::ctkCmdLineModuleExplorerMainWindow> ui;
Expand All @@ -95,7 +99,7 @@ protected Q_SLOTS:

ctkSettings settings;
ctkSettingsDialog* settingsDialog;

ctkCmdLineModuleBackendXMLChecker* xmlCheckerBackEnd;
};

#endif // CTKCLIPLUGINEXPLORERMAINWINDOW_H
Loading

0 comments on commit 467359d

Please sign in to comment.