2014-06-18 23:44:46 +00:00
|
|
|
#ifndef SAVEDATA_H
|
|
|
|
#define SAVEDATA_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SaveData Class
|
|
|
|
* --------------------------------------
|
|
|
|
*
|
|
|
|
* all functions in this class are static!
|
|
|
|
* no need to create an object!
|
|
|
|
*
|
|
|
|
* provides all the needed functions
|
|
|
|
* for saving user data for JCE login.
|
|
|
|
*
|
|
|
|
* the class will enteract with a file formated by tags for storing the valus.
|
|
|
|
* the file format is as sutch:
|
|
|
|
*
|
|
|
|
* [status]Status Value[/]
|
|
|
|
* [username]usernaem vale[/]
|
|
|
|
* [password]hashed(not really) password vale[/]
|
|
|
|
*
|
|
|
|
* the class will create a file if not exists by calling Save Data::init() function.
|
|
|
|
*
|
|
|
|
* for more info about functions - see implantation
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* QT libs */
|
|
|
|
#include <QString>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
2014-08-31 18:39:43 +00:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QMap>
|
2014-09-07 20:44:27 +00:00
|
|
|
#include "simplecrypt.h"
|
2014-06-18 23:44:46 +00:00
|
|
|
|
|
|
|
#define FILE_NAME "JAC_DB.dat"
|
|
|
|
|
|
|
|
class SaveData
|
|
|
|
{
|
|
|
|
public:
|
2014-08-31 21:27:15 +00:00
|
|
|
SaveData();
|
|
|
|
bool isSaved();
|
|
|
|
void reset();
|
|
|
|
void setUsername(QString username);
|
|
|
|
void setPassword(QString password);
|
|
|
|
void setCal(QString cal);
|
|
|
|
void setLocal(QString local);
|
|
|
|
QString getUsername();
|
|
|
|
QString getPassword();
|
|
|
|
QString getCal();
|
|
|
|
QString getLocal();
|
2014-08-31 18:39:43 +00:00
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
private:
|
2014-08-31 18:39:43 +00:00
|
|
|
QMap<QString, QString> DB;
|
2014-08-31 21:27:15 +00:00
|
|
|
void load();
|
|
|
|
void save();
|
|
|
|
void createDB();
|
2014-09-07 20:44:27 +00:00
|
|
|
QString encrypt(QString pass);
|
|
|
|
QString decrypte(QString pass);
|
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SAVEDATA_H
|
2014-08-31 17:54:33 +00:00
|
|
|
|