Exemple #1
0
void readShortCuts(Xml& xml)
{
    for (;;)
    {
        Xml::Token token = xml.parse();
        if (token == Xml::Error || token == Xml::End)
            break;

        const QString& tag = xml.s1();
        switch (token)
        {
            case Xml::TagStart:
            {
                if (tag.length())
                {
                    int index = getShrtByTag(tag.toUtf8().constData());
                    if (index != -1)
                    {
                        //printf("Index: %d\n",index);
                        shortcuts[index].key = xml.parseInt();
                        //printf("shortcuts[%d].key = %d, %s\n",index, shortcuts[index].key, shortcuts[index].descr);
                    }
                    else
                        xml.skip(tag);
                }
            }
            case Xml::TagEnd:
                if (tag == "shortcuts")
                    return;
            default:
                break;
        }
    }
}
Exemple #2
0
void readShortCuts(Xml& xml)
{
	for (;;)
	{
		Xml::Token token = xml.parse();
		if (token == Xml::Error || token == Xml::End)
			break;

		const QString& tag = xml.s1();
		switch (token)
		{
			case Xml::TagStart:
			{
				if (tag.length())
				{
					int index = getShrtByTag(tag.toAscii().constData());
					if (index == -1) //No such tag found
						printf("Config file might be corrupted. Unknown shortcut: %s\n", tag.toLatin1().constData());
					else
					{
						//printf("Index: %d\n",index);
						shortcuts[index].key = xml.parseInt();
						//printf("shortcuts[%d].key = %d, %s\n",index, shortcuts[index].key, shortcuts[index].descr);
					}
				}
			}
			case Xml::TagEnd:
				if (tag == "shortcuts")
					return;
			default:
				break;
		}
	}
}