Skip to content

Commit

Permalink
ENH: Add operation status icon for patient widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed May 20, 2024
1 parent 6dc3159 commit a7aa8c1
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 27 deletions.
42 changes: 42 additions & 0 deletions Libs/DICOM/Widgets/Resources/UI/Icons/patient_failed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions Libs/DICOM/Widgets/Resources/UI/Icons/patient_pending.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions Libs/DICOM/Widgets/Resources/UI/Icons/patient_success.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Libs/DICOM/Widgets/Resources/UI/ctkDICOMWidget.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
<file>Icons/search_local.svg</file>
<file>Icons/query.svg</file>
<file>Icons/wait.svg</file>
<file>Icons/patient_failed.svg</file>
<file>Icons/patient_pending.svg</file>
<file>Icons/patient_success.svg</file>
</qresource>
</RCC>
8 changes: 7 additions & 1 deletion Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class ctkDICOMPatientItemWidgetPrivate : public Ui_ctkDICOMPatientItemWidget
QMap<QString, QMetaObject::Connection> StudyItemWidgetsConnectionMap;
QSpacerItem* StudiesListVerticalSpacer;

QStringList AllowedServers = QStringList();
QStringList AllowedServers;
ctkDICOMPatientItemWidget::OperationStatus Status;

bool IsGUIUpdating;
bool QueryOn;
Expand Down Expand Up @@ -131,6 +132,9 @@ ctkDICOMPatientItemWidgetPrivate::ctkDICOMPatientItemWidgetPrivate(ctkDICOMPatie

this->StudiesListVerticalSpacer = new QSpacerItem(0, 5, QSizePolicy::Fixed, QSizePolicy::Expanding);

this->AllowedServers = QStringList();
this->Status = ctkDICOMPatientItemWidget::NoOperation;

this->IsGUIUpdating = false;
this->QueryOn = true;
this->RetrieveOn = true;
Expand Down Expand Up @@ -580,6 +584,8 @@ ctkDICOMPatientItemWidget::~ctkDICOMPatientItemWidget()
//------------------------------------------------------------------------------
CTK_SET_CPP(ctkDICOMPatientItemWidget, const QStringList&, setAllowedServers, AllowedServers);
CTK_GET_CPP(ctkDICOMPatientItemWidget, QStringList, allowedServers, AllowedServers);
CTK_SET_CPP(ctkDICOMPatientItemWidget, const OperationStatus&, setOperationStatus, Status);
CTK_GET_CPP(ctkDICOMPatientItemWidget, ctkDICOMPatientItemWidget::OperationStatus, operationStatus, Status);
CTK_GET_CPP(ctkDICOMPatientItemWidget, QString, patientItem, PatientItem);
CTK_SET_CPP(ctkDICOMPatientItemWidget, const QString&, setPatientID, PatientID);
CTK_GET_CPP(ctkDICOMPatientItemWidget, QString, patientID, PatientID);
Expand Down
16 changes: 16 additions & 0 deletions Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMPatientItemWidget : public QWidget
Q_PROPERTY(int numberOfStudiesPerPatient READ numberOfStudiesPerPatient WRITE setNumberOfStudiesPerPatient);
Q_PROPERTY(ctkDICOMStudyItemWidget::ThumbnailSizeOption thumbnailSize READ thumbnailSize WRITE setThumbnailSize);
Q_PROPERTY(QStringList allowedServers READ allowedServers WRITE setAllowedServers);
Q_PROPERTY(OperationStatus operationStatus READ operationStatus WRITE setOperationStatus);

public:
typedef QWidget Superclass;
Expand Down Expand Up @@ -189,6 +190,21 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMPatientItemWidget : public QWidget
Q_INVOKABLE void updateAllowedServersUIFromDB();
///@}

enum OperationStatus
{
NoOperation = 0,
InProgress,
Completed,
Failed,
};

///@{
/// Set the operation status
/// NoOperation by default
void setOperationStatus(const OperationStatus& status);
OperationStatus operationStatus() const;
///@}

public Q_SLOTS:
void generateStudies(bool query = true, bool retrieve = true);
void generateSeriesAtToggle(bool toggled = true, const QString& studyItem = "");
Expand Down
4 changes: 2 additions & 2 deletions Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ void ctkDICOMSeriesItemWidget::onJobUserStopped(const QVariant &data)
td.SeriesInstanceUID == d->SeriesInstanceUID)
{
d->SeriesThumbnail->setOperationStatus(ctkThumbnailLabel::Failed);
d->SeriesThumbnail->setStatusIcon(QIcon(":/Icons/error.svg"));
d->SeriesThumbnail->setStatusIcon(QIcon(":/Icons/error_red.svg"));

if (td.JobType == ctkDICOMJobResponseSet::JobType::RetrieveSOPInstance)
{
Expand Down Expand Up @@ -1015,7 +1015,7 @@ void ctkDICOMSeriesItemWidget::onJobFailed(const QVariant &data)
td.SeriesInstanceUID == d->SeriesInstanceUID)
{
d->SeriesThumbnail->setOperationStatus(ctkThumbnailLabel::Failed);
d->SeriesThumbnail->setStatusIcon(QIcon(":/Icons/error.svg"));
d->SeriesThumbnail->setStatusIcon(QIcon(":/Icons/error_red.svg"));

if (td.JobType == ctkDICOMJobResponseSet::JobType::RetrieveSOPInstance)
{
Expand Down
4 changes: 2 additions & 2 deletions Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ void ctkDICOMStudyItemWidget::onJobUserStopped(const QVariant &data)
td.StudyInstanceUID == d->StudyInstanceUID)
{
d->Status = ctkDICOMStudyItemWidget::Failed;
d->OperationStatusPushButton->setIcon(QIcon(":/Icons/error.svg"));
d->OperationStatusPushButton->setIcon(QIcon(":/Icons/error_red.svg"));
}
}

Expand All @@ -829,7 +829,7 @@ void ctkDICOMStudyItemWidget::onJobFailed(const QVariant &data)
td.StudyInstanceUID == d->StudyInstanceUID)
{
d->Status = ctkDICOMStudyItemWidget::Failed;
d->OperationStatusPushButton->setIcon(QIcon(":/Icons/error.svg"));
d->OperationStatusPushButton->setIcon(QIcon(":/Icons/error_red.svg"));
}
}

Expand Down
Loading

0 comments on commit a7aa8c1

Please sign in to comment.