//=============================Dialog==============================
ThesaurusDialog::ThesaurusDialog(QWidget *parent)
	:QDialog(parent)
{
	replaceBt=new QPushButton(tr("replace"),this);
	lookupBt=new QPushButton(tr("lookup"),this);
	startsWithBt=new QPushButton(tr("starts with ..."),this);
	containsBt=new QPushButton(tr("contains ..."),this);
	cancelBt=new QPushButton(tr("cancel"),this);
	searchWrdLe=new QLineEdit("",this);
	replaceWrdLe=new QLineEdit("",this);

	//replaceWrdLe->setEnabled(false);
	classlistWidget = new QListWidget(this);
	replacelistWidget = new QListWidget(this);
	replacelistWidget->setSortingEnabled(true);

	replacelistWidget->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Expanding);
	classlistWidget->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Expanding);
	searchWrdLe->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed);
	replaceWrdLe->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed);

	QGridLayout *gridLayout=new QGridLayout(this);
	gridLayout->addWidget(searchWrdLe,0,0);
	gridLayout->addWidget(replaceWrdLe,0,1);
	gridLayout->addWidget(replaceBt,0,2,Qt::AlignTop);
	gridLayout->addWidget(classlistWidget,1,0);
	gridLayout->addWidget(replacelistWidget,1,1);
	gridLayout->setColumnStretch(0,10);
	gridLayout->setColumnStretch(1,10);
	gridLayout->setRowStretch(1,10);

	QVBoxLayout *verticalLayout=new QVBoxLayout();
	verticalLayout->addWidget(lookupBt,0,Qt::AlignTop);
	verticalLayout->addWidget(startsWithBt,0,Qt::AlignTop);
	verticalLayout->addWidget(containsBt,0,Qt::AlignTop);
	verticalLayout->addWidget(cancelBt,0,Qt::AlignTop);
	verticalLayout->insertStretch(-1,10);

	gridLayout->addItem(verticalLayout,1,2);

	searchWrdLe->setEnabled(false);

	setLayout(gridLayout);

	setWindowTitle(tr("Thesaurus"));

	connect(replaceBt, SIGNAL(clicked()), this, SLOT(accept()));
	connect(lookupBt, SIGNAL(clicked()), this, SLOT(lookupClicked()));
	connect(startsWithBt, SIGNAL(clicked()), this, SLOT(startsWithClicked()));
	connect(containsBt, SIGNAL(clicked()), this, SLOT(containsClicked()));
	connect(cancelBt, SIGNAL(clicked()), this, SLOT(reject()));
	//connect(classlistWidget, SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(classClicked(QListWidgetItem*)));
	connect(classlistWidget, SIGNAL(currentRowChanged(int)),SLOT(classChanged(int)));
	connect(replacelistWidget, SIGNAL(currentRowChanged(int)),SLOT(wordChanged(int)));

	thesaurus = retrieveDatabase();
}
Beispiel #2
0
// Test on a real local database
int ctkDICOMRetrieveTest2( int argc, char * argv [] )
{
  QCoreApplication app(argc, argv);

  ctkDICOMTester tester;
  tester.startDCMQRSCP();
  
  QStringList arguments = app.arguments();
  arguments.pop_front(); // remove application name
  arguments.pop_front(); // remove test name
  if (!arguments.count())
    {
    ctkDICOMRetrieveTest2PrintUsage();
    return EXIT_FAILURE;
    }
  tester.storeData(arguments);

  ctkDICOMDatabase queryDatabase;

  ctkDICOMQuery query;
  query.setCallingAETitle("CTK_AE");
  query.setCalledAETitle("CTK_AE");
  query.setHost("localhost");
  query.setPort(tester.dcmqrscpPort());

  bool res = query.query(queryDatabase);
  if (!res)
    {
    std::cout << "ctkDICOMQuery::query() failed" << std::endl;
    return EXIT_FAILURE;
    }
  if (query.studyInstanceUIDQueried().count() == 0)
    {
    std::cout << "ctkDICOMQuery::query() failed."
              << "No study instance retrieved" << std::endl;
    return EXIT_FAILURE;
    }

  QSharedPointer<ctkDICOMDatabase> retrieveDatabase(new ctkDICOMDatabase);
  retrieveDatabase->openDatabase( "./ctkDICOM.sql" );

  ctkDICOMRetrieve retrieve;
  retrieve.setCallingAETitle("CTK_AE");
  retrieve.setCalledAETitle("CTK_AE");
  retrieve.setPort(tester.dcmqrscpPort());
  retrieve.setHost("localhost");
  retrieve.setMoveDestinationAETitle("CTK_CLIENT_AE");

  retrieve.setDatabase(retrieveDatabase);

  foreach(const QString& study, query.studyInstanceUIDQueried())
    {
    bool res = retrieve.moveStudy(study);
    if (!res)
      {
      std::cout << "ctkDICOMRetrieve::retrieveStudy() failed. "
                << "Study " << qPrintable(study) << " can't be retrieved"
                << std::endl;
      return EXIT_FAILURE;
      }
    }

  return EXIT_SUCCESS;
}