Beispiel #1
0
void ViewManager::AddComponent (QuarkComponent_ptr comp)
{
    QuarkManager_ptr mgr;
    try
    {
        mgr.reset (new QuarkManager (comp, this, Proxy_));
    }
    catch (const std::exception& e)
    {
        qWarning () << Q_FUNC_INFO
                    << e.what ();
        return;
    }

    AddComponent (comp, mgr);
}
	QuarkUnhideListView::QuarkUnhideListView (const QuarkComponents_t& components,
			ViewManager *viewMgr, ICoreProxy_ptr proxy, QWidget *parent)
	: Util::UnhideListViewBase (proxy, parent)
	, ViewManager_ (viewMgr)
	{
		QList<QStandardItem*> items;
		for (const auto& comp : components)
		{
			QuarkManager_ptr manager;
			try
			{
				manager.reset (new QuarkManager (comp, ViewManager_, proxy));
			}
			catch (const std::exception& e)
			{
				qWarning () << Q_FUNC_INFO
						<< "error creating manager for quark"
						<< comp->Url_;
				continue;
			}

			const auto& manifest = manager->GetManifest ();

			auto item = new QStandardItem;

			item->setData (manifest.GetID (), Util::UnhideListModel::Roles::ItemClass);
			item->setData (manifest.GetName (), Util::UnhideListModel::Roles::ItemName);
			item->setData (manifest.GetDescription (), Util::UnhideListModel::Roles::ItemDescription);
			item->setData (Util::GetAsBase64Src (manifest.GetIcon ().pixmap (32, 32).toImage ()),
					Util::UnhideListModel::Roles::ItemIcon);
			items << item;

			ID2Component_ [manifest.GetID ()] = { comp, manager };
		}

		Model_->invisibleRootItem ()->appendRows (items);

		connect (rootObject (),
				SIGNAL (itemUnhideRequested (QString)),
				this,
				SLOT (unhide (QString)),
				Qt::QueuedConnection);
	}