Add "[Binding]" config subgroup

Binding specific configuration goes here. It is stored as
a String->Value hash.
This commit is contained in:
Jonas Kulla 2013-09-03 11:07:56 +02:00
parent d151986c72
commit 57c806e9b5
2 changed files with 22 additions and 0 deletions

View File

@ -58,6 +58,22 @@ void Config::read()
QStringList _rtps = confFile.value("RTPs").toStringList(); QStringList _rtps = confFile.value("RTPs").toStringList();
Q_FOREACH(const QString &s, _rtps) Q_FOREACH(const QString &s, _rtps)
rtps << s.toUtf8(); rtps << s.toUtf8();
confFile.beginGroup("Binding");
QStringList bindingKeys = confFile.childKeys();
Q_FOREACH (const QString &key, bindingKeys)
{
QVariant value = confFile.value(key);
/* Convert QString to QByteArray */
if (value.type() == QVariant::String)
value = value.toString().toUtf8();
bindingConf.insert(key.toAscii(), value);
}
confFile.endGroup();
} }
void Config::readGameINI() void Config::readGameINI()

View File

@ -24,6 +24,8 @@
#include <QByteArray> #include <QByteArray>
#include <QVector> #include <QVector>
#include <QHash>
#include <QVariant>
struct Config struct Config
{ {
@ -43,6 +45,10 @@ struct Config
QByteArray customScript; QByteArray customScript;
QVector<QByteArray> rtps; QVector<QByteArray> rtps;
/* Any values in the [Binding]
* group are collected here */
QHash<QByteArray, QVariant> bindingConf;
/* Game INI contents */ /* Game INI contents */
struct { struct {
QByteArray scripts; QByteArray scripts;