Skip to content

Commit

Permalink
Merge branch 'fix_annotation_naming_bug'
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertLitjens committed Feb 1, 2017
2 parents abbce30 + 124dbb6 commit 0538414
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 4 additions & 3 deletions ASAP/annotation/AnnotationWorkstationExtensionPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ bool AnnotationWorkstationExtensionPlugin::onSaveButtonPressed() {
else {
basename += QString(".xml");
}
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save annotations"), defaultName.filePath(basename), tr("XML file (*.xml);TIF file (*.tif)"));
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save annotations"), defaultName.filePath(basename), tr("XML file (*.xml);;TIF file (*.tif);;All files (*)"));
if (fileName.endsWith(".tif")) {
if (std::shared_ptr<MultiResolutionImage> local_img = _img.lock()) {
std::vector<std::shared_ptr<AnnotationGroup> > grps = this->_annotationService->getList()->getGroups();
Expand Down Expand Up @@ -619,6 +619,7 @@ void AnnotationWorkstationExtensionPlugin::addAnnotationGroup() {
QIcon color(iconPM);
newAnnotationGroup->setIcon(0, color);
newAnnotationGroup->setData(0, Qt::UserRole, QColor("#64FE2E"));
grp->setColor("#64FE2E");
_treeWidget->resizeColumnToContents(0);
_treeWidget->resizeColumnToContents(1);
}
Expand Down Expand Up @@ -754,7 +755,6 @@ void AnnotationWorkstationExtensionPlugin::finishAnnotation(bool cancel) {
if (!cancel) {
_generatedAnnotation->getAnnotation()->setName("Annotation " + QString::number(_annotationIndex).toStdString());
_annotationIndex += 1;
QString annotUID = QString::fromStdString(_generatedAnnotation->getAnnotation()->getName() + "_annotation");
_qtAnnotations.append(_generatedAnnotation);
_annotationService->getList()->addAnnotation(_generatedAnnotation->getAnnotation());
QTreeWidgetItem* newAnnotation = new QTreeWidgetItem(_treeWidget);
Expand All @@ -769,7 +769,8 @@ void AnnotationWorkstationExtensionPlugin::finishAnnotation(bool cancel) {
iconPM.fill(QColor("yellow"));
QIcon color(iconPM);
newAnnotation->setIcon(0, color);
newAnnotation->setData(0, Qt::UserRole, QColor("yellow"));
newAnnotation->setData(0, Qt::UserRole, QColor("#F4FA58"));
_generatedAnnotation->getAnnotation()->setColor("#F4FA58");
_treeWidget->resizeColumnToContents(0);
_treeWidget->resizeColumnToContents(1);
_activeAnnotation = _generatedAnnotation;
Expand Down
2 changes: 1 addition & 1 deletion ASAP/pathologyworkstation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void PathologyWorkstation::openFile(const QString& fileName) {

void PathologyWorkstation::on_actionOpen_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), _settings->value("lastOpenendPath", QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)).toString(), tr("Slide files (*.lif *.svs *.mrxs *.ndpi *.tif *.tiff);;All files (*.*)"));
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), _settings->value("lastOpenendPath", QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)).toString(), tr("Slide files (*.lif *.svs *.mrxs *.ndpi *.tif *.tiff);;All files (*)"));
openFile(fileName);
}

Expand Down
12 changes: 4 additions & 8 deletions annotation/AnnotationList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,16 @@ void AnnotationList::resetModifiedStatus() {

bool AnnotationList::addGroup(const std::shared_ptr<AnnotationGroup>& group) {
if (group) {
if (!this->getGroup(group->getName())) {
_groups.push_back(group);
return true;
}
_groups.push_back(group);
return true;
}
return false;
}

bool AnnotationList::addAnnotation(const std::shared_ptr<Annotation>& annotation) {
if (annotation) {
if (!this->getAnnotation(annotation->getName())) {
_annotations.push_back(annotation);
return true;
}
_annotations.push_back(annotation);
return true;
}
return false;
}
Expand Down

0 comments on commit 0538414

Please sign in to comment.