void ImageTags::showTagsFilter() { static bool busy = false; if (busy) return; busy = true; setActiveViewMode(FolderTagsDisplay); QTreeWidgetItemIterator it(tagsTree); while (*it) { QString tagName = (*it)->text(0); (*it)->setFlags((*it)->flags() | Qt::ItemIsUserCheckable); if (imageFilteringTags.contains(tagName)) { (*it)->setCheckState(0, Qt::Checked); setTagIcon(*it, negateFilterEnabled? TagIconFilterNegate : TagIconFilterEnabled); } else { (*it)->setCheckState(0, Qt::Unchecked); setTagIcon(*it, TagIconFilterDisabled); } ++it; } redrawTree(); busy = false; }
void ImageTags::addNewTag() { bool ok; QString title = tr("Add a new tag"); QString newTagName = QInputDialog::getText(this, title, tr("Enter new tag name"), QLineEdit::Normal, "", &ok); if (!ok) { return; } if(newTagName.isEmpty()) { QMessageBox msgBox; msgBox.critical(this, tr("Error"), tr("No name entered")); return; } QSetIterator<QString> knownTagsIt(GData::knownTags); while (knownTagsIt.hasNext()) { QString tag = knownTagsIt.next(); if (newTagName == tag) { QMessageBox msgBox; msgBox.critical(this, tr("Error"), tr("Tag ") + newTagName + tr(" already exists")); return; } } addTag(newTagName, false); GData::knownTags.insert(newTagName); redrawTree(); }
void ImageTags::populateTagsTree() { tagsTree->clear(); QSetIterator<QString> knownTagsIt(GData::knownTags); while (knownTagsIt.hasNext()) { QString tag = knownTagsIt.next(); addTag(tag, false); } redrawTree(); }
void ImageTags::showSelectedImagesTags() { static bool busy = false; if (busy) return; busy = true; QStringList selectedThumbs = thumbView->getSelectedThumbsList(); setActiveViewMode(SelectionTagsDisplay); int selectedThumbsNum = selectedThumbs.size(); QMap<QString, int> tagsCount; for (int i = 0; i < selectedThumbsNum; ++i) { QSetIterator<QString> imageTagsIter(mdCache->getImageTags(selectedThumbs[i])); while (imageTagsIter.hasNext()) { QString imageTag = imageTagsIter.next(); tagsCount[imageTag]++; if (!GData::knownTags.contains(imageTag)) { addTag(imageTag, true); GData::knownTags.insert(imageTag); } } } bool imagesTagged = false, imagesTaggedMixed = false; QTreeWidgetItemIterator it(tagsTree); while (*it) { QString tagName = (*it)->text(0); int tagCountTotal = tagsCount[tagName]; if (selectedThumbsNum == 0) { (*it)->setCheckState(0, Qt::Unchecked); (*it)->setFlags((*it)->flags() & ~Qt::ItemIsUserCheckable); setTagIcon(*it, TagIconDisabled); } else if (tagCountTotal == selectedThumbsNum) { (*it)->setCheckState(0, Qt::Checked); (*it)->setFlags((*it)->flags() | Qt::ItemIsUserCheckable); setTagIcon(*it, TagIconEnabled); imagesTagged = true; } else if (tagCountTotal) { (*it)->setCheckState(0, Qt::PartiallyChecked); (*it)->setFlags((*it)->flags() | Qt::ItemIsUserCheckable); setTagIcon(*it, TagIconMultiple); imagesTaggedMixed = true; } else { (*it)->setCheckState(0, Qt::Unchecked); (*it)->setFlags((*it)->flags() | Qt::ItemIsUserCheckable); setTagIcon(*it, TagIconDisabled); } ++it; } if (imagesTagged) { tabs->setTabIcon(0, QIcon(":/images/tag_yellow.png")); } else if (imagesTaggedMixed) { tabs->setTabIcon(0, QIcon(":/images/tag_multi.png")); } else { tabs->setTabIcon(0, QIcon(":/images/tag_grey.png")); } addToSelectionAction->setEnabled(selectedThumbsNum? true : false); removeFromSelectionAction->setEnabled(selectedThumbsNum? true : false); redrawTree(); busy = false; }
void setAlphaOccupiedLevel(double alpha_level) {this->alpha_level = alpha_level; redrawTree();}
void setShowFreespace(bool b) {show_freespace = b; emit propertyChanged("ShowFreespace"); redrawTree();}
void setShowOccupied(bool b) {show_occupied = b; emit propertyChanged("ShowOccupied"); redrawTree();}