void ViewManager::UnhideQuark (QuarkComponent_ptr component, QuarkManager_ptr manager) { if (!manager) return; RemoveFromRemoved (manager->GetID ()); AddComponent (component, manager); }
void ViewManager::AddComponent (QuarkComponent_ptr comp, QuarkManager_ptr mgr) { if (!mgr->IsValidArea ()) return; if (RemovedIDs_.contains (mgr->GetID ())) return; Quark2Manager_ [comp->Url_] = mgr; auto item = new QStandardItem; item->setData (comp->Url_, ViewItemsModel::Role::SourceURL); item->setData (mgr->HasSettings (), ViewItemsModel::Role::QuarkHasSettings); item->setData (mgr->GetID (), ViewItemsModel::Role::QuarkClass); const int pos = PreviousQuarkOrder_.indexOf (mgr->GetID ()); if (pos == -1 || pos == PreviousQuarkOrder_.size () - 1) ViewItemsModel_->appendRow (item); else { bool added = false; for (int i = pos + 1; i < PreviousQuarkOrder_.size (); ++i) { const auto& thatId = PreviousQuarkOrder_.at (i); for (int j = 0; j < ViewItemsModel_->rowCount (); ++j) { if (ViewItemsModel_->item (j)->data (ViewItemsModel::Role::QuarkClass) != thatId) continue; ViewItemsModel_->insertRow (j, item); added = true; break; } if (added) break; } if (!added) ViewItemsModel_->appendRow (item); } }