QValueList<int> ClusterPalette::selectedClusters() { //Get the list of clusters with their color ItemColors& clusterColors = doc->clusterColors(); QValueList<int> selectedClusters; ClusterPaletteIconViewItem* clusterPaletteItem; for(QIconViewItem* item = iconView->firstItem(); item; item = item->nextItem()) { clusterPaletteItem = static_cast<ClusterPaletteIconViewItem*>(item); if(item->isSelected()) { selectedClusters.append(clusterColors.itemId(item->index())); } } //Selection has just changed isUpToDate = false; return selectedClusters; }
void ClusterPalette::hideUserClusterInformation() { //update the flag isInUserClusterInfoMode = false; iconView->setItemTextPos(QIconView::Bottom); //Let's go back to normal QFontInfo fontInfo = QFontInfo(QFont()); iconView->setGridX(fontInfo.pixelSize() * 2); iconView->setGridY(15); iconView->arrangeItemsInGrid(); ItemColors& clusterColors = doc->clusterColors(); int clusterId; for(QIconViewItem* item = iconView->firstItem(); item; item = item->nextItem()) { clusterId = clusterColors.itemId(item->index()); item->setText(QString("%1").arg(clusterId)); } iconView->setWordWrapIconText(true); iconView->resize(this->width(),this->height()); }
void ClusterPalette::showUserClusterInformation(int electrodeGroupId) { //update the flag isInUserClusterInfoMode = true; iconView->setItemTextPos(QIconView::Right); iconView->setGridX(2500); iconView->arrangeItemsInGrid(); QMap<int,ClusterUserInformation> clusterUserInformationMap = QMap<int,ClusterUserInformation>(); doc->data().getClusterUserInformation(electrodeGroupId,clusterUserInformationMap); ItemColors& clusterColors = doc->clusterColors(); int clusterId; ClusterUserInformation currentClusterInformation; for(QIconViewItem* item = iconView->firstItem(); item; item = item->nextItem()) { clusterId = clusterColors.itemId(item->index()); QString clusterText = item->text(); if(clusterId == 0) { clusterText.append(" - ").append("artefact"); } else if(clusterId == 1) { clusterText.append(" - ").append("noise"); } else { currentClusterInformation = clusterUserInformationMap[clusterId]; bool first = true; if(currentClusterInformation.getStructure() != "") { first = false; clusterText.append(" - ").append(currentClusterInformation.getStructure()); } if(currentClusterInformation.getType() != "") { if(!first) { clusterText.append(", ").append(currentClusterInformation.getType()); } else { clusterText.append(" - ").append(currentClusterInformation.getType()); first = false; } } if(currentClusterInformation.getId() != "") { if(!first) { clusterText.append(", ").append(currentClusterInformation.getId()); } else { clusterText.append(" - ").append(currentClusterInformation.getId()); first = false; } } if(currentClusterInformation.getQuality() != "") { if(!first) { clusterText.append(", ").append(currentClusterInformation.getQuality()); } else { clusterText.append(" - ").append(currentClusterInformation.getQuality()); first = false; } } if(currentClusterInformation.getNotes() != "") { if(!first) { clusterText.append(", ").append(currentClusterInformation.getNotes()); } else { clusterText.append(" - ").append(currentClusterInformation.getNotes()); first = false; } } } item->setText(clusterText); } iconView->setWordWrapIconText(false); iconView->adjustSize(); }