4
0
mirror of https://github.com/QuasarApp/Hanoi-Towers.git synced 2025-05-04 13:39:33 +00:00

95 lines
1.9 KiB
C
Raw Normal View History

2018-01-20 17:44:28 +03:00
#ifndef SAVER_H
#define SAVER_H
#include <QObject>
#include <QFile>
2018-04-13 22:24:52 +03:00
#define SAVE "data"
2018-04-11 20:27:22 +03:00
class BackEnd: public QObject
2018-01-20 17:44:28 +03:00
{
Q_OBJECT
Q_PROPERTY(short reed READ read WRITE save)
2018-07-03 17:45:02 +03:00
Q_PROPERTY(bool isFirst READ isFirst WRITE setShowHelp NOTIFY firstChanged)
Q_PROPERTY(bool randomColor READ randomColor WRITE setRandomColor NOTIFY randomColorChanged)
Q_PROPERTY(bool animation READ animation WRITE setAnimation NOTIFY animationChanged)
2018-04-11 22:13:34 +03:00
2018-04-11 20:27:22 +03:00
private:
2018-04-11 22:13:34 +03:00
void readCnfig();
void writeConfig()const;
bool isFirstStart;
unsigned short lvl;
2018-07-03 17:45:02 +03:00
bool _animation;
bool _randomColor;
2018-01-20 17:44:28 +03:00
public:
2018-04-11 20:27:22 +03:00
BackEnd();
2018-04-11 22:13:34 +03:00
~BackEnd();
2018-01-20 17:44:28 +03:00
public slots:
2018-04-11 22:13:34 +03:00
/**
* @brief save new lvl
* @param lvl
*/
void save(const short &lvl);
/**
* @brief getMinSteps
* @param lvl
* @return minimum step of current lvl
*/
unsigned short getMinSteps(const unsigned short lvl) const;
/**
* @brief isFirst
* @return true if is first start
*/
bool isFirst()const;
/**
* @brief setShowHelp set new state for show help message
* @param state - a new state of show help message
*/
void setShowHelp(bool state);
2018-07-03 17:45:02 +03:00
/**
* @brief reset all config to default values.
*/
void reset();
/**
* @brief randomColor
* @return return true if enable random color of plate;
*/
bool randomColor()const;
/**
* @brief animation
* @return name of render animation;
*/
bool animation() const;
/**
* @brief setAnimation
* @param name of new animation;
*/
void setAnimation(bool name);
/**
* @brief setRandomColor
* enabfle or disable random colors.
*/
void setRandomColor(bool );
2018-04-11 22:13:34 +03:00
/**
* @brief read
* @return curent lvl
*/
2018-01-20 17:44:28 +03:00
short read()const;
2018-04-11 22:13:34 +03:00
signals:
2018-07-03 17:45:02 +03:00
void firstChanged();
void animationChanged();
void randomColorChanged();
2018-01-20 17:44:28 +03:00
};
#endif // SAVER_H