diff --git a/Applications/ctkDICOMDemoSCU/Testing/Cpp/ctkDICOMDemoSCUTest1.cpp b/Applications/ctkDICOMDemoSCU/Testing/Cpp/ctkDICOMDemoSCUTest1.cpp index 8a89d0758e..2a2434df16 100644 --- a/Applications/ctkDICOMDemoSCU/Testing/Cpp/ctkDICOMDemoSCUTest1.cpp +++ b/Applications/ctkDICOMDemoSCU/Testing/Cpp/ctkDICOMDemoSCUTest1.cpp @@ -30,7 +30,7 @@ int ctkDICOMDemoSCUTest1(int argc, char * argv []) { QCoreApplication app(argc, argv); QString peer("www.dicomserver.co.uk"); - QString port("11112"); + QString port("104"); QString aeTitle("MOVESCP"); QStringList parameters; parameters << peer << port << aeTitle; diff --git a/Applications/ctkDICOMQuery/ctkDICOMQueryMain.cpp b/Applications/ctkDICOMQuery/ctkDICOMQueryMain.cpp index df5aef9a48..c62e746b37 100644 --- a/Applications/ctkDICOMQuery/ctkDICOMQueryMain.cpp +++ b/Applications/ctkDICOMQuery/ctkDICOMQueryMain.cpp @@ -26,7 +26,7 @@ * * ../CTK-build/bin/ctkDICOMQuery test.db FINDSCU MI2B2 mi2b2.slicer.org 11112 * or this one: - * ../CTK-build/bin/ctkDICOMQuery test.db FINDSCU DICOMSERVER dicomserver.co.uk 11112 + * ../CTK-build/bin/ctkDICOMQuery test.db FINDSCU DICOMSERVER dicomserver.co.uk 104 * * you can get a similar * functionality with this command line: diff --git a/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest2.cpp b/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest2.cpp index c218b69dc2..3e5b7ec294 100644 --- a/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest2.cpp +++ b/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest2.cpp @@ -100,7 +100,7 @@ int ctkDICOMDatabaseTest2( int argc, char * argv [] ) return EXIT_FAILURE; } - if ( database.groupElementToTag(group, element) != tag ) + if ( database.groupElementToTag(group, element) != tag.toUpper() ) { std::cerr << "ctkDICOMDatabase: could not convert a uints to tag string" << std::endl; return EXIT_FAILURE; diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMAppWidgetTest1.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMAppWidgetTest1.cpp index e6d498dea3..1d453f42bf 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMAppWidgetTest1.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMAppWidgetTest1.cpp @@ -20,6 +20,7 @@ // Qt includes #include +#include #include #include #include @@ -43,7 +44,16 @@ int ctkDICOMAppWidgetTest1( int argc, char * argv [] ) { QApplication app(argc, argv); - + + QCommandLineParser parser; + parser.addOption({"I", "Run in interactive mode"}); + parser.addPositionalArgument("directory", "Directory to import"); + parser.process(app); + + QString directoryToImport = parser.positionalArguments().at(0); + + qDebug() << "Importing directory " << directoryToImport; + ctkDICOMAppWidget appWidget; QFileInfo tempFileInfo(QDir::tempPath() + QString("/ctkDICOMAppWidgetTest1-db")); @@ -66,9 +76,9 @@ int ctkDICOMAppWidgetTest1( int argc, char * argv [] ) appWidget.openQueryDialog(); appWidget.openQueryDialog(); - + appWidget.setDisplayImportSummary(false); - appWidget.onImportDirectory(argv[argc -1]); + appWidget.onImportDirectory(directoryToImport); if ( appWidget.patientsAddedDuringImport() != 1 || appWidget.studiesAddedDuringImport() != 1 || appWidget.seriesAddedDuringImport() != 1 @@ -78,7 +88,7 @@ int ctkDICOMAppWidgetTest1( int argc, char * argv [] ) return EXIT_FAILURE; } - if (argc <= 2 || QString(argv[1]) != "-I") + if (!parser.isSet("I")) { QTimer::singleShot(200, &app, SLOT(quit())); } diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp index 93e1bf7690..953a02ffbc 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp @@ -149,13 +149,21 @@ void ctkDICOMBrowserTester::testImportDirectoryMode() browser.setImportDirectoryMode(ctkDICOMBrowser::ImportDirectoryAddLink); QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink); - QComboBox* comboBox = browser.importDialog()->bottomWidget()->findChild(); + bool usingNativeDialog = !browser.importDialog()->testOption(QFileDialog::DontUseNativeDialog); + if (!usingNativeDialog) + { + QComboBox* comboBox = browser.importDialog()->bottomWidget()->findChild(); - comboBox->setCurrentIndex(comboBox->findData(static_cast(ctkDICOMBrowser::ImportDirectoryCopy))); - QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryCopy); + comboBox->setCurrentIndex(comboBox->findData(static_cast(ctkDICOMBrowser::ImportDirectoryCopy))); + QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryCopy); - comboBox->setCurrentIndex(comboBox->findData(static_cast(ctkDICOMBrowser::ImportDirectoryAddLink))); - QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink); + comboBox->setCurrentIndex(comboBox->findData(static_cast(ctkDICOMBrowser::ImportDirectoryAddLink))); + QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink); + } + else + { + QCOMPARE(browser.importDialog()->bottomWidget(), nullptr); + } } // ---------------------------------------------------------------------------- diff --git a/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp index 50a2f961b0..3ed724a07a 100644 --- a/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp @@ -95,6 +95,8 @@ class ctkDICOMAppWidgetPrivate: public Ui_ctkDICOMAppWidget QTimer* AutoPlayTimer; + bool CopyOnImport{false}; + bool IsSearchWidgetPopUpMode; // local count variables to keep track of the number of items @@ -292,8 +294,16 @@ ctkDICOMAppWidget::ctkDICOMAppWidget(QWidget* _parent):Superclass(_parent), //Initialize import widget d->ImportDialog = new ctkFileDialog(); - QCheckBox* importCheckbox = new QCheckBox(tr("Copy on import"), d->ImportDialog); - d->ImportDialog->setBottomWidget(importCheckbox); + bool usingNativeDialog = !d->ImportDialog->testOption(QFileDialog::DontUseNativeDialog); + if (!usingNativeDialog) + { + QCheckBox* importCheckbox = new QCheckBox(tr("Copy on import"), d->ImportDialog); + d->ImportDialog->setBottomWidget(importCheckbox); + + QObject::connect(importCheckbox, &QCheckBox::toggled, [=] (bool checked) { + d->CopyOnImport = checked; + }); + } d->ImportDialog->setFileMode(QFileDialog::Directory); d->ImportDialog->setLabelText(QFileDialog::Accept,tr("Import")); d->ImportDialog->setWindowTitle(tr("Import DICOM files from directory ...")); @@ -649,10 +659,6 @@ void ctkDICOMAppWidget::onImportDirectory(QString directory) Q_D(ctkDICOMAppWidget); if (QDir(directory).exists()) { - QCheckBox* copyOnImport = qobject_cast(d->ImportDialog->bottomWidget()); - QString targetDirectory; - bool copyFiles = (copyOnImport->checkState() == Qt::Checked); - // reset counts d->PatientsAddedDuringImport = 0; d->StudiesAddedDuringImport = 0; @@ -662,7 +668,7 @@ void ctkDICOMAppWidget::onImportDirectory(QString directory) // show progress dialog and perform indexing d->showIndexerDialog(); - d->DICOMIndexer->addDirectory(directory, copyFiles); + d->DICOMIndexer->addDirectory(directory, d->CopyOnImport); // display summary result if (d->DisplayImportSummary) diff --git a/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp index f6e793aa23..9295f0ea05 100644 --- a/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp @@ -210,7 +210,7 @@ void ctkDICOMServerNodeWidget::readSettings() defaultServerNode["CheckState"] = static_cast(Qt::Unchecked); defaultServerNode["AETitle"] = QString("ANYAE"); defaultServerNode["Address"] = QString("dicomserver.co.uk"); - defaultServerNode["Port"] = QString("11112"); + defaultServerNode["Port"] = QString("104"); defaultServerNode["CGET"] = static_cast(Qt::Checked); this->addServerNode(defaultServerNode); diff --git a/Libs/Widgets/ctkFileDialog.cpp b/Libs/Widgets/ctkFileDialog.cpp index 2762cd9eda..40534f6297 100644 --- a/Libs/Widgets/ctkFileDialog.cpp +++ b/Libs/Widgets/ctkFileDialog.cpp @@ -19,6 +19,7 @@ =========================================================================*/ // QT includes +#include #include #include #include @@ -144,6 +145,11 @@ ctkFileDialog::ctkFileDialog(QWidget *parentWidget, { Q_D(ctkFileDialog); + if (QGuiApplication::testAttribute(Qt::AA_DontUseNativeDialogs)) + { + this->setOptions(QFileDialog::DontUseNativeDialog); + } + d->init(); }