void Interface::getStatus(StatusType &status)
{
  DEB_MEMBER_FUNCT();

  if(m_acq_mode == Normal)
    {
      status.set(m_acq_started ? 
	     HwInterface::StatusType::Exposure : HwInterface::StatusType::Ready);
    }
  else
    {
      status.set(m_acq_started ?
		 HwInterface::StatusType::Config : HwInterface::StatusType::Ready);
    }

  DEB_RETURN() << DEB_VAR1(status);
}
Esempio n. 2
0
void
StatusType::add( const StatusType&         cType
               , std::vector<std::string>& saStatus
               , size_t&                   nCount )
{
    if ( nCount >= saStatus.size() )
        saStatus.resize( saStatus.size() << 1 );

    saStatus[nCount++]  = cType.getName();
}
Esempio n. 3
0
void Status::setType(const QString& type)
{
	Group = "Offline";
	DisplayName = "Offline";

	Type = type;

	StatusType *statusType = StatusTypeManager::instance()->statusType(Type);
	if (!statusType)
	{
		Type = "Offline";
		return;
	}
	else
		DisplayName = statusType->displayName();

	StatusGroup *statusGroup = statusType->statusGroup();
	if (statusGroup)
		Group = statusGroup->name();
}
Esempio n. 4
0
void StatusActions::createActions()
{
	createBasicActions();
	createStatusActions();

	QList<StatusType *> statusTypes = MyStatusContainer->supportedStatusTypes();
	if (statusTypes.isEmpty())
		return;

	StatusType *statusType = statusTypes.at(0);
	if (0 == statusType)
		return;

	StatusGroup *currentGroup = statusType->statusGroup();
	bool setDescriptionAdded = false;

	foreach (StatusType *statusType, statusTypes)
	{
		if (0 == statusType)
			continue;

		if (!setDescriptionAdded && statusType->statusGroup() &&
				statusType->statusGroup()->sortIndex() >= StatusGroup::StatusGroupSortIndexAfterSetDescription)
		{
			Actions.append(createSeparator());
			Actions.append(ChangeDescription);
		}

		if (statusType->statusGroup() != currentGroup)
		{
			Actions.append(createSeparator());
			currentGroup = statusType->statusGroup();
		}

		Actions.append(StatusTypeActions[statusType]);
	}

	Actions.append(createSeparator());
}
Esempio n. 5
0
void Interface::getStatus(StatusType& status)
{
  status.set(m_simu.getStatus());
}
Esempio n. 6
0
QString Parser::parse(const QString &s, BuddyOrContact buddyOrContact, const QObject * const object, bool escape)
{
    Buddy buddy = buddyOrContact.buddy();
    Contact contact = buddyOrContact.contact();

    kdebugmf(KDEBUG_DUMP, "%s escape=%i\n", qPrintable(s), escape);
    int index = 0, i, len = s.length();
    QList<ParserToken> parseStack;

    static QHash<QChar, bool> searchChars;

    if (!searchChars.value('%', false))
    {
        searchChars['%'] = true;
        searchChars['['] = true;
        searchChars['{'] = true;
        searchChars['\\'] = true;
        searchChars['$'] = true;
        searchChars['@'] = true;
        searchChars['#'] = true;
        searchChars['}'] = true;
        searchChars[']'] = true;
    }

    bool allowExec = config_file.readBoolEntry("General", "AllowExecutingFromParser", false);
    searchChars['`'] = allowExec;
    searchChars['\''] = allowExec;

    while (index < len)
    {
        ParserToken pe1, pe;

        for(i = index; i < len; ++i)
            if (searchChars.value(s.at(i), false))
                break;

//		this is the same, but code above is muuuuch faster
//		i=s.find(QRegExp("%|`|\\{|\\[|'|\\}|\\]"), index);

        if (i != index)
        {
            pe1.type = ParserToken::PT_STRING;
            pe1.content = s.mid(index, i - index);
            parseStack.push_back(pe1);

            if (i == len)
                break;
        }

        char c = s.at(i).toAscii();
        if (c == '%')
        {
            ++i;
            if (i == len)
                break;
            pe.type = ParserToken::PT_STRING;

            switch (s.at(i).toAscii())
            {
            case 's':
                ++i;
                if (contact)
                {
                    StatusType *type = StatusTypeManager::instance()->statusType(contact.currentStatus().type());
                    if (type)
                        pe.content = type->displayName();
                }
                break; // TODO: 't' removed
            case 'q':
                ++i;
                if (contact)
                {
                    StatusContainer *container = contact.contactAccount().statusContainer();
                    if (container)
                        pe.content = container->statusIconPath(contact.currentStatus().type());
                }
                break;
            case 'd':
                ++i;
                if (contact)
                    pe.content = contact.currentStatus().description();

                if (escape)
                    HtmlDocument::escapeText(pe.content);
                if (config_file.readBoolEntry("Look", "ShowMultilineDesc"))
                {
                    pe.content.replace('\n', QLatin1String("<br/>"));
                    pe.content.replace(QRegExp("\\s\\s"), QString(" &nbsp;"));
                }
                break;
            case 'i':
                ++i;
                if (contact)
                    pe.content = contact.address().toString();
                break;
            case 'v':
                ++i;
                if (contact)
                    pe.content = contact.dnsName();
                break;
            case 'o':
                ++i;
                if (contact && contact.port() == 2)
                    pe.content = ' ';
                break;
            case 'p':
                ++i;
                if (contact && contact.port())
                    pe.content = QString::number(contact.port());
                break;
            case 'u':
                ++i;
                if (contact)
                    pe.content = contact.id();
                else if (buddy)
                    pe.content = buddy.mobile().isEmpty() ? buddy.email() : buddy.mobile();
                break;
            case 'h':
                ++i;
                if (contact && !contact.currentStatus().isDisconnected())
                    pe.content = contact.protocolVersion();
                break;
            case 'n':
                ++i;
                pe.content = buddy.nickName();
                if (escape)
                    HtmlDocument::escapeText(pe.content);
                break;
            case 'a':
                ++i;
                pe.content = buddy.display();
                if (escape)
                    HtmlDocument::escapeText(pe.content);
                break;
            case 'f':
                ++i;
                pe.content = buddy.firstName();
                if (escape)
                    HtmlDocument::escapeText(pe.content);
                break;
            case 'r':
                ++i;
                pe.content = buddy.lastName();
                if (escape)
                    HtmlDocument::escapeText(pe.content);
                break;
            case 'm':
                ++i;
                pe.content = buddy.mobile();
                break;
            case 'g':
            {
                ++i;
                QStringList groups;
                foreach (const Group &group, buddy.groups())
                    groups << group.name();
                pe.content = groups.join(",");
                break;
            }
            case 'e':
                ++i;
                pe.content = buddy.email();
                break;
            case 'x':
                ++i;
                if (contact)
                    pe.content = contact.maximumImageSize();
                break;
            case 'z':
                ++i;
                if (buddy)
                    pe.content = QString::number(buddy.gender());
                break;
            case '%':
                ++i;
            default:
                pe.content = '%';
            }
            parseStack.push_back(pe);
        }
        else if (c == '[')