Hello,
I wrote a little central repository wrapper for Qt based apps.
1. Preconditions:a) in your .pro file:
- link against centralrepository via:
LIBS += -lcentralrepository
depending on the cenrep keys you're reading/writing you have to modify the capabilities of your app.
- add QCenRep.cpp to SOURCES +=
- add QCenRep.h to HEADERS +=
b) in your implementation include the wrapper via
#include "QCenRep.h"
2. How to use it: - all calls are static
- to get a CenRep key's value use this format:
getCenrep(int iUID, int iKey);
getCenrep(QString iUID, QString iKey);
getCenrep(char *iUID, char *iKey);
it always will return a QString, you don't have to care about the original format (int or string). If the key doesn't exist you will get "Missing key!"
- to set a new value:
setCenrep(int iUID, int iKey, QString qValue);
setCenrep(int iUID, int iKey, const char *qValue);
setCenrep(QString iUID, QString iKey, QString qValue);
setCenrep(const char *iUID, const char *iKey, const char *qValue);
the type of the value (string or int) gets detected, you don't have to worry about it.
Example code:
get the current product improvment status:
qDebug() << QCenRep::getCenrep(0x2003e081, 0x1);
qDebug() << QCenRep::getCenrep(QString("0x2003e081"), QString("0x1"));
qDebug() << QCenRep::getCenrep("0x2003e081", "0x1");
disable product improvment:
QCenRep::setCenrep(0x2003e081, 0x1, QString("0"));
QCenRep::setCenrep(0x2003e081, 0x1, "0");
QCenRep::setCenrep(QString("0x2003e081"), QString("0x1"), QString("0"));
QCenRep::setCenrep("0x2003e081", "0x1", "0");
maybe something is buggy, doesn't work or causes problems I didn't test it very much and it's a bit old.
thanks faenil for his cenrep example code from:
https://github.com/faenil/i8910tuning/blob/master/i8910tuning.cppGitHub repo:
https://github.com/huellif/QCenRep