direcs
2012-09-30
|
Handles the access to the global ini-file. More...
#include <inifile.h>
Public Member Functions | |
bool | checkFiles () |
QString | checkPath () |
QString | getInifileName () |
Inifile () | |
float | readFloat (QString group, QString name) |
int | readSetting (QString group, QString name) |
QString | readString (QString group, QString name) |
void | setFilename (QString filename) |
void | sync (void) |
void | writeSetting (QString group, QString name, int value) |
void | writeSetting (QString group, QString name, QString value) |
~Inifile () |
Private Attributes | |
QString | mainIniFilename |
QString | programPath |
QSettings * | settings |
Inifile::Inifile | ( | ) |
Definition at line 23 of file inifile.cpp.
Inifile::~Inifile | ( | ) |
Definition at line 50 of file inifile.cpp.
bool Inifile::checkFiles | ( | ) |
Checks if the needed ini-file exists in the current path.
Definition at line 68 of file inifile.cpp.
QString Inifile::checkPath | ( | ) |
Checks the current path from which the program started.
Definition at line 55 of file inifile.cpp.
QString Inifile::getInifileName | ( | ) |
Definition at line 102 of file inifile.cpp.
float Inifile::readFloat | ( | QString | group, |
QString | name | ||
) |
Reads a float value from an ini-file. The settings are read in the typical ini-file-format.
Example ini-file:
[Config]
laserscannerResolutionFront=0.1
group | is the group area in the file (e.g. Config). |
name | is the object to read (e.g. laserscannerResolutionFront). |
Definition at line 163 of file inifile.cpp.
int Inifile::readSetting | ( | QString | group, |
QString | name | ||
) |
Reads an integer setting from an ini-file. The settings are read in the typical ini-file-format.
Example ini-file:
[Config]
motor1Speed=23
group | is the group area in the file (e.g. Config). |
name | is the object to read (e.g. motor1speed). |
Definition at line 130 of file inifile.cpp.
QString Inifile::readString | ( | QString | group, |
QString | name | ||
) |
Reads a string from an ini-file. The settings are read in the typical ini-file-format.
Example ini-file:
[Config]
serialPortMicrocontroller=/dev/ttyUSB1
group | is the group area in the file (e.g. Config). |
name | is the object to read (e.g. serialPortMicrocontroller). |
Definition at line 141 of file inifile.cpp.
void Inifile::setFilename | ( | QString | filename | ) |
Seta the name of the ini-file where all the settings are stored.
filename |
Definition at line 486 of file inifile.cpp.
void Inifile::sync | ( | void | ) |
Forces the ini.file to be written immediately. For example at program end.
Definition at line 480 of file inifile.cpp.
void Inifile::writeSetting | ( | QString | group, |
QString | name, | ||
int | value | ||
) |
Stores a settings in an ini-file. The settings are stored in the typical ini-file-format.
Example ini-file:
[Config]
motor1Speed=23
group | is the group area in the file (e.g. Config). |
name | is the name of the parameter (e.g. motor1speed). |
value | is the (int) value of the parameter (e.g. 23). |
Definition at line 108 of file inifile.cpp.
void Inifile::writeSetting | ( | QString | group, |
QString | name, | ||
QString | value | ||
) |
Stores a settings in an ini-file. The settings are stored in the typical ini-file-format.
Example ini-file:
[Config]
setting23=hello
group | is the group area in the file (e.g. Config). |
name | is the name of the parameter (e.g. setting23). |
value | is the (string) value of the parameter (e.g. "hello"). |
Definition at line 119 of file inifile.cpp.