当前位置: 首页>>代码示例>>C++>>正文


C++ Registry::getWatchletPlugin方法代码示例

本文整理汇总了C++中Registry::getWatchletPlugin方法的典型用法代码示例。如果您正苦于以下问题:C++ Registry::getWatchletPlugin方法的具体用法?C++ Registry::getWatchletPlugin怎么用?C++ Registry::getWatchletPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Registry的用法示例。


在下文中一共展示了Registry::getWatchletPlugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addFoundWatch

void WatchesModel::addFoundWatch(const QVariantMap &info)
{
	QStringList existing = _config->dirs();
	QString base = "watch%1";
	QString name = base.arg("");
	int num = 1;

	// Create the setting keys in numerical order
	// e.g. if watch1 is already existing, use watch2, etc.
	while (existing.contains(name)) {
		num++;
		name = base.arg(num);
	}

	// Load the autodetected settings into the new key
	ConfigKey* newkey = _config->getSubkey(name);
	foreach (const QString& key, info.keys()) {
		newkey->set(key, info[key]);
	}

	// Set some defaults
	const QString watchModel = info["model"].toString();
	Registry *registry = Registry::registry();

	newkey->set("providers", registry->allNotificationProviders());

	QStringList allWatchlets = registry->allWatchlets();
	QStringList configuredWatchlets;
	foreach(const QString& watchletId, allWatchlets) {
		WatchletPluginInterface *plugin = registry->getWatchletPlugin(watchletId);
		if (plugin) {
			WatchletPluginInterface::WatchletInfo info = plugin->describeWatchlet(watchletId, watchModel);
			if (info.visible) {
				configuredWatchlets += watchletId;
			}
		}
	}
开发者ID:dm8tbr,项目名称:sowatch,代码行数:37,代码来源:watchesmodel.cpp

示例2: reload

void ConfiguredWatchletsModel::reload()
{
	Registry *registry = Registry::registry();
	Q_ASSERT(_config);
	beginResetModel();
	_list.clear();
	_info.clear();
	_enabled.clear();

	qDebug() << "Reloading watchlets";

	QString watchModel = _config->value("driver").toString();

	QStringList all = registry->allWatchlets();
	foreach (const QString& s, all) {
		WatchletPluginInterface *plugin = registry->getWatchletPlugin(s);
		if (plugin) {
			_info[s] = plugin->describeWatchlet(s, watchModel);
		} else {
			WatchletPluginInterface::WatchletInfo info;
			info.name = s;
			_info[s] = info;
		}
	}
开发者ID:dm8tbr,项目名称:sowatch,代码行数:24,代码来源:configuredwatchletsmodel.cpp


注:本文中的Registry::getWatchletPlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。