void CategoryFilterWidget::addSubcategory() { const QString subcat = askCategoryName(); if (subcat.isEmpty()) return; const QString category = QString(QStringLiteral("%1/%2")).arg(currentCategory()).arg(subcat); if (BitTorrent::Session::instance()->categories().contains(category)) QMessageBox::warning(this, tr("Category exists") , tr("Subcategory name already exists in selected category.")); else BitTorrent::Session::instance()->addCategory(category); }
void QgsCategorizedSymbolRendererV2Widget::deleteCategory() { QVariant k = currentCategory(); if ( !k.isValid() ) return; int idx = mRenderer->categoryIndexForValue( k ); if ( idx < 0 ) return; mRenderer->deleteCategory( idx ); populateCategories(); }
void QgsCategorizedSymbolRendererV2Widget::changeCategorySymbol() { QVariant k = currentCategory(); if ( !k.isValid() ) return; int catIdx = mRenderer->categoryIndexForValue( k ); QgsSymbolV2* newSymbol = mRenderer->categories()[catIdx].symbol()->clone(); QgsSymbolV2SelectorDialog dlg( newSymbol, mStyle, mLayer, this ); if ( !dlg.exec() ) { delete newSymbol; return; } mRenderer->updateCategorySymbol( catIdx, newSymbol ); populateCategories(); }
void ModuleInterface::updateWorksModel() { m_worksModel.clear(); m_modules.clear(); QString currentLang = currentLanguage(); QString currentCat = currentCategory(); QHash<int, QByteArray> roleNames; roleNames[TextRole] = "modelText"; m_worksModel.setRoleNames(roleNames); BtBookshelfModel* bookshelfModel = CSwordBackend::instance()->model(); if (bookshelfModel == 0) return; int count = bookshelfModel->rowCount(); for (int row=0; row<count; ++row) { QModelIndex index = bookshelfModel->index(row); CSwordModuleInfo* module = getModule(bookshelfModel, index); CSwordModuleInfo::Category category = module->category(); QString categoryName = module->categoryName(category); const CLanguageMgr::Language* language = module->language(); QString languageName = language->translatedName(); if (languageName == currentLang && categoryName == currentCat) { m_modules << module; QString moduleName = module->name(); QStandardItem* item = new QStandardItem(); item->setData(moduleName, TextRole); m_worksModel.appendRow(item); } } QQuickItem* object = findQmlObject("moduleChooser"); if (object == 0) return; object->setProperty("worksModel", QVariant::fromValue(&m_worksModel)); }
void CategoryFilterWidget::editCategory() { TorrentCategoryDialog::editCategory(this, currentCategory()); }
void CategoryFilterWidget::addSubcategory() { TorrentCategoryDialog::createCategory(this, currentCategory()); }