void ViewManager::MoveQuark (int from, int to) { if (from < to) --to; ViewItemsModel_->insertRow (to, ViewItemsModel_->takeRow (from)); SaveQuarkOrder (); }
void ViewManager::UnhideQuark (QuarkComponent_ptr component, QuarkManager_ptr manager) { if (!manager) return; RemoveFromRemoved (manager->GetManifest ().GetID ()); AddComponent (component, manager, true); SaveQuarkOrder (); }
void ViewManager::RemoveQuark (const QUrl& url) { for (int i = 0; i < ViewItemsModel_->rowCount (); ++i) { auto item = ViewItemsModel_->item (i); if (item->data (ViewItemsModel::Role::SourceURL) != url) continue; ViewItemsModel_->removeRow (i); } auto mgr = Quark2Manager_.take (url); AddToRemoved (mgr->GetManifest ().GetID ()); SaveQuarkOrder (); }
void ViewManager::SecondInit () { for (const auto& component : FindAllQuarks ()) AddComponent (component, false); auto watcher = new DirWatcher (Util::CreateIfNotExists ("data/quarks"), this); connect (watcher, SIGNAL (quarksAdded (QList<QUrl>)), this, SLOT (handleQuarksAdded (QList<QUrl>))); connect (watcher, SIGNAL (quarksRemoved (QList<QUrl>)), this, SLOT (handleQuarksRemoved (QList<QUrl>))); SaveQuarkOrder (); }