<commit_before>
// Qt include
#include <QGridLayout>
#include <QResizeEvent>
#include <QPushButton>
#include <QPixmap>

// ctkWidgets includes
#include "ctkFlowLayout.h"

// ctkDICOMWidgets includes
#include "ctkDICOMThumbnailListWidget.h"
#include "ui_ctkDICOMThumbnailListWidget.h"
#include "ctkDICOMThumbnailWidget.h"

// STD includes
#include <iostream>

//----------------------------------------------------------------------------
class ctkDICOMThumbnailListWidgetPrivate: public Ui_ctkDICOMThumbnailListWidget
{
public:
  ctkDICOMThumbnailListWidgetPrivate(ctkDICOMThumbnailListWidget* parent): q_ptr(parent){
    
  }

  QList<ctkDICOMThumbnailWidget*> thumbnailList;

  ctkDICOMThumbnailListWidget* const q_ptr;
  Q_DECLARE_PUBLIC(ctkDICOMThumbnailListWidget);
};

//----------------------------------------------------------------------------
// ctkDICOMThumbnailListWidgetPrivate methods


//----------------------------------------------------------------------------
// ctkDICOMThumbnailListWidget methods

//----------------------------------------------------------------------------
ctkDICOMThumbnailListWidget::ctkDICOMThumbnailListWidget(QWidget* _parent):Superclass(_parent), 
									   d_ptr(new ctkDICOMThumbnailListWidgetPrivate(this))
{
  Q_D(ctkDICOMThumbnailListWidget);
  
  d->setupUi(this);

  ctkFlowLayout* flowLayout = new ctkFlowLayout();
  d->scrollAreaContentWidget->setLayout(flowLayout);

}

//----------------------------------------------------------------------------
ctkDICOMThumbnailListWidget::~ctkDICOMThumbnailListWidget()
{
  
}

void ctkDICOMThumbnailListWidget::setThumbnailFiles(const QStringList thumbnailList)
{
  Q_D(ctkDICOMThumbnailListWidget);

  int index 0;
  foreach (QString thumbnailFile, thumbnailList)
  {
    ctkDICOMThumbnailWidget* widget = new ctkDICOMThumbnailWidget(d->scrollAreaContentWidget);
    widget->setText( QString("Image %1").arg(index++) );
    QPixmap pix(thumbnailFile);
    widget->setPixmap(pix);
    flowLayout->addWidget(widget);
  }
}<commit_msg>Enhanced thumbnail functionality<commit_after>
// Qt include
#include <QGridLayout>
#include <QResizeEvent>
#include <QPushButton>
#include <QPixmap>

// ctk includes
#include "ctkLogger.h"

// ctkWidgets includes
#include "ctkFlowLayout.h"

// ctkDICOMWidgets includes
#include "ctkDICOMThumbnailListWidget.h"
#include "ui_ctkDICOMThumbnailListWidget.h"
#include "ctkDICOMThumbnailWidget.h"

// STD includes
#include <iostream>

static ctkLogger logger("org.commontk.DICOM.Widgets.ctkDICOMThumbnailListWidget");

//----------------------------------------------------------------------------
class ctkDICOMThumbnailListWidgetPrivate: public Ui_ctkDICOMThumbnailListWidget
{
public:
  ctkDICOMThumbnailListWidgetPrivate(ctkDICOMThumbnailListWidget* parent): q_ptr(parent){
    
  }

  QList<ctkDICOMThumbnailWidget*> thumbnailList;

  ctkDICOMThumbnailListWidget* const q_ptr;
  Q_DECLARE_PUBLIC(ctkDICOMThumbnailListWidget);
};

//----------------------------------------------------------------------------
// ctkDICOMThumbnailListWidgetPrivate methods


//----------------------------------------------------------------------------
// ctkDICOMThumbnailListWidget methods

//----------------------------------------------------------------------------
ctkDICOMThumbnailListWidget::ctkDICOMThumbnailListWidget(QWidget* _parent):Superclass(_parent), 
									   d_ptr(new ctkDICOMThumbnailListWidgetPrivate(this))
{
  Q_D(ctkDICOMThumbnailListWidget);
  
  d->setupUi(this);


}

//----------------------------------------------------------------------------
ctkDICOMThumbnailListWidget::~ctkDICOMThumbnailListWidget()
{
  
}

void ctkDICOMThumbnailListWidget::setThumbnailFiles(const QStringList& thumbnailList)
{
  Q_D(ctkDICOMThumbnailListWidget);

  if (d->scrollAreaContentWidget->layout())
  {
    delete d->scrollAreaContentWidget->layout();
  }

  ctkFlowLayout* flowLayout = new ctkFlowLayout();
  d->scrollAreaContentWidget->setLayout(flowLayout);

  int i = 0;
  foreach (QString thumbnailFile, thumbnailList)
  {
    ctkDICOMThumbnailWidget* widget = new ctkDICOMThumbnailWidget(d->scrollAreaContentWidget);
    QString widgetLabel = QString("Image %1").arg(i++);
    widget->setText( widgetLabel );
    QPixmap pix(thumbnailFile);
    logger.debug("Setting pixmap to " + thumbnailFile);
    widget->setPixmap(pix);
    flowLayout->addWidget(widget);
  }
}
{'fraction_non_alphanumeric': 0.2595367847411444, 'fraction_numerical': 0.0009082652134423251, 'mean_word_length': 2.463050314465409, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2553141', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1353, 'n_words': 180}