Пример #1
0
void ra_mean::scan()
// Scan function is the class main function
{
  if(!isActive_) { // If it's the first program cycle, activate logging
    
    for(int i = 0; i < nResults_; i++)
      resultsList_[i].clearResult();
    
    time(&oldTime_);
    isActive_ = TRUE;
    nSeconds_ = 0;
    collectValues();
  }
  if(difftime(oldTime_, time(NULL)) != 0) { // Run every second
    time(&oldTime_);
    
    if(nSeconds_ == 60) { // Run every minute
      calculateResults();
      collectValues();
      nSeconds_ = 0;
    }
    else {
      collectValues();
      nSeconds_++;
    }
  }
}
CharTransforms ArtisticTextLoadingContext::yOffsets(int count)
{
    switch(yOffsetType()) {
    case Absolute: {
        const QPointF origin = textPosition();
        CharTransforms offsets = collectValues(count, m_currentAbsolutePosY, m_absolutePosY);
        const int offsetCount = offsets.count();
        for (int i = 0; i < offsetCount; ++i) {
            offsets[i] -= origin.y();
        }
        return offsets;
    }
    case Relative:
        return collectValues(count, m_currentRelativePosY, m_relativePosY);
    default:
        return CharTransforms();
    }
}
Пример #3
0
void ZLWin32Config::load() {
	HKEY root;
	HKEY categoryKey;
	HKEY groupKey;
	std::set<std::string> categories;
	std::set<std::string> groups;
	std::set<std::string> valueNames;
	std::string value;

	RegCreateKeyExA(HKEY_CURRENT_USER, rootKeyName().c_str(), 0, 0, 0, KEY_ENUMERATE_SUB_KEYS, 0, &root, 0);
	collectSubKeys(categories, root);
	for (std::set<std::string>::const_iterator it = categories.begin(); it != categories.end(); ++it) {
		RegCreateKeyExA(root, it->c_str(), 0, 0, 0, KEY_ENUMERATE_SUB_KEYS, 0, &categoryKey, 0);
		groups.clear();
		collectSubKeys(groups, categoryKey);
		for (std::set<std::string>::const_iterator jt = groups.begin(); jt != groups.end(); ++jt) {
			valueNames.clear();
			RegCreateKeyExA(categoryKey, jt->c_str(), 0, 0, 0, KEY_QUERY_VALUE, 0, &groupKey, 0);
			collectValues(valueNames, groupKey);
			std::set<std::string>::iterator nameIt = valueNames.find(REAL_GROUPNAME_KEY);
			std::string groupName = *jt;
			if (nameIt != valueNames.end()) {
				valueNames.erase(nameIt);
				registryGetValue(groupName, groupKey, REAL_GROUPNAME_KEY);
				myGroupAliases[groupName] = *jt;
				myPseudoGroupNameNumber = std::max(myPseudoGroupNameNumber, atoi(jt->substr(4).c_str()) + 1);
			}
			ZLWin32ConfigGroup *group = getGroup(StringEncoder::decode(groupName), true);
			for (std::set<std::string>::const_iterator kt = valueNames.begin(); kt != valueNames.end(); ++kt) {
				if (registryGetValue(value, groupKey, *kt)) {
					group->setValue(StringEncoder::decode(*kt), value, *it);
				}
			}
			RegCloseKey(groupKey);
		}
		RegCloseKey(categoryKey);
	}
	RegCloseKey(root);
}
CharTransforms ArtisticTextLoadingContext::rotations(int count)
{
    return collectValues(count, m_currentRotations, m_rotations);
}