Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start working on variable expander; move config section parsing there
- Loading branch information
Bernd Wachter
committed
Mar 19, 2013
1 parent
b28e7f8
commit a9249fe
Showing
4 changed files
with
65 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @file ssuvariables.cpp | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Bernd Wachter <bwachter@lart.info> | ||
* @date 2013 | ||
*/ | ||
|
||
#include <QStringList> | ||
|
||
#include "ssuvariables.h" | ||
|
||
// TODO: Add a simple variable parser to allow variable substitution; it should | ||
// get called in the resolve sections | ||
SsuVariables::SsuVariables(): QObject() { | ||
|
||
} | ||
|
||
void SsuVariables::resolveSection(QSettings *settings, QString section, QHash<QString, QString> *storageHash){ | ||
QStringList repoVariables; | ||
|
||
settings->beginGroup(section); | ||
repoVariables = settings->allKeys(); | ||
foreach (const QString &key, repoVariables){ | ||
storageHash->insert(key, settings->value(key).toString()); | ||
} | ||
settings->endGroup(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @file ssuvariables.h | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Bernd Wachter <bwachter@lart.info> | ||
* @date 2013 | ||
*/ | ||
|
||
#ifndef _SSUVARIABLES_H | ||
#define _SSUVARIABLES_H | ||
|
||
#include <QObject> | ||
#include <QSettings> | ||
#include <QHash> | ||
|
||
class SsuVariables: public QObject { | ||
Q_OBJECT | ||
|
||
public: | ||
SsuVariables(); | ||
/** | ||
* Look up all variables in the specified configuration file section, | ||
* run them through the variable expander, and add them to the supplied | ||
* QHash | ||
*/ | ||
void resolveSection(QSettings *settings, QString section, QHash<QString, QString> *storageHash); | ||
}; | ||
|
||
#endif |