79 lines
1.5 KiB
C++
79 lines
1.5 KiB
C++
#ifndef FILECONFIGDECODE_H
|
|
#define FILECONFIGDECODE_H
|
|
|
|
#include <QObject>
|
|
#include <QStandardPaths>
|
|
#include <QFile>
|
|
#include <QSettings>
|
|
#include <QFileInfo>
|
|
#include <QDebug>
|
|
#if (QT_VERSION <= QT_VERSION_CHECK(6, 0, 0))
|
|
#include <QTextCodec>
|
|
#endif
|
|
|
|
typedef enum {
|
|
RENAME_TYPE_NONE = 0,
|
|
RENAME_TYPE_NORMAL,
|
|
RENAME_TYPE_TIME
|
|
} RenameType;
|
|
|
|
class FileConfigDecode
|
|
{
|
|
public:
|
|
static FileConfigDecode* getInstance();
|
|
~FileConfigDecode();
|
|
|
|
QString getAddress();
|
|
quint16 getPort();
|
|
bool getAutoSetup();
|
|
bool getRename();
|
|
bool getTimeRename();
|
|
bool getAutoCopy();
|
|
QString getUserName();
|
|
QString getPassword();
|
|
RenameType getRenameType();
|
|
bool getAutoLogin();
|
|
|
|
void setAddress(QString value);
|
|
void setPort(quint16 value);
|
|
void setAutoSetup(bool value);
|
|
void setRename(bool value);
|
|
void setTimeRename(bool value, int flag);
|
|
void setAutoCopy(bool value);
|
|
void setUserName(QString username);
|
|
void setPassword(QString password);
|
|
void setAutoLogin(bool value);
|
|
|
|
void initFile();
|
|
void updateFile();
|
|
|
|
private:
|
|
QString address;
|
|
quint16 port;
|
|
bool autoSetup;
|
|
bool rename;
|
|
bool timeRename;
|
|
bool autoCopy;
|
|
QString userName;
|
|
QString password;
|
|
bool autoLogin;
|
|
|
|
bool firstCreate;
|
|
|
|
RenameType renameType = RENAME_TYPE_NONE;
|
|
|
|
void fileWrite(QString path);
|
|
|
|
static QScopedPointer<FileConfigDecode> m_instance;
|
|
|
|
private:
|
|
FileConfigDecode();
|
|
|
|
void checkConfig();
|
|
|
|
// void initForm();
|
|
|
|
};
|
|
|
|
#endif // FILECONFIGDECODE_H
|