36 return QList<DataPtr>();
83 mStorage(new
PatientStorage(sessionStorageService,
"ActiveData", true)),
84 mPatientModelService(patientModelService)
86 mStorage->storeVariable(
"activeUids",
87 boost::bind(&ActiveData::getStringToSave,
this),
88 boost::bind(&ActiveData::loadFromString,
this, _1));
91 QString ActiveData::getStringToSave()
const
93 return this->getActiveDataStringList().join(
" ");
96 QStringList ActiveData::getActiveDataStringList()
const
99 if(!mActiveData.isEmpty())
100 for(
int i = 0; i < mActiveData.size(); ++i)
101 retval << mActiveData.at(i)->getUid();
105 void ActiveData::loadFromString(
const QString activeDatas)
108 QStringList activeDataList = activeDatas.split(
" ");
109 for(
int i = 0; i < activeDataList.size(); ++i)
111 DataPtr data = mPatientModelService->getData(activeDataList.at(i));
123 if(mActiveData.isEmpty())
125 return mActiveData.last();
133 if(!activeDatas.isEmpty())
134 activeData = activeDatas.last();
143 TrackedStreamPtr stream = boost::dynamic_pointer_cast<TrackedStream>(activeData);
145 retval = stream->getChangingImage();
147 retval = boost::dynamic_pointer_cast<Image>(activeData);
153 QRegExp reg(typeRegexp);
155 QList<DataPtr> retval;
157 for(
int i = 0; i < active.size(); ++i)
160 if(current->getType().contains(reg))
161 retval.push_back(current);
171 if (!mActiveData.empty() && mActiveData.last() == activeData)
174 mActiveData.removeAll(activeData);
175 mActiveData.append(activeData);
177 this->emitSignals(activeData);
182 DataPtr dataToSet = mPatientModelService->getData(uid);
188 ImagePtr image = this->getActive<Image>();
190 return image->getUid();
195 void ActiveData::emitSignals(
DataPtr activeData)
197 this->emitActiveDataChanged();
199 this->emitActiveImageChanged();
202 void ActiveData::emitActiveImageChanged()
204 DataPtr activeData = ActiveData::getActive<Image>();
205 QString uid = getChangedUid(activeData);
209 void ActiveData::emitActiveDataChanged()
212 QString uid = getChangedUid(activeData);
216 QString ActiveData::getChangedUid(
DataPtr activeData)
const
220 uid = activeData->getUid();
228 if(!mActiveData.contains(dataToBeRemoved))
231 bool resendActiveImage =
false;
232 bool resendActiveData =
false;
233 if (this->getActive<Image>() == dataToBeRemoved)
234 resendActiveImage =
true;
236 resendActiveData =
true;
238 mActiveData.removeAll(dataToBeRemoved);
240 if(resendActiveImage)
241 emitActiveImageChanged();
243 emitActiveDataChanged();