fileconfigdecode.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef FILECONFIGDECODE_H
  2. #define FILECONFIGDECODE_H
  3. #include <QObject>
  4. #include <QStandardPaths>
  5. #include <QFile>
  6. #include <QSettings>
  7. #include <QFileInfo>
  8. #include <QDebug>
  9. #if (QT_VERSION <= QT_VERSION_CHECK(6, 0, 0))
  10. #include <QTextCodec>
  11. #endif
  12. typedef enum {
  13. RENAME_TYPE_NONE = 0,
  14. RENAME_TYPE_NORMAL,
  15. RENAME_TYPE_TIME
  16. } RenameType;
  17. class FileConfigDecode
  18. {
  19. public:
  20. static FileConfigDecode* getInstance();
  21. ~FileConfigDecode();
  22. QString getAddress();
  23. quint16 getPort();
  24. bool getAutoSetup();
  25. bool getRename();
  26. bool getTimeRename();
  27. bool getAutoCopy();
  28. QString getUserName();
  29. QString getPassword();
  30. RenameType getRenameType();
  31. bool getAutoLogin();
  32. void setAddress(QString value);
  33. void setPort(quint16 value);
  34. void setAutoSetup(bool value);
  35. void setRename(bool value);
  36. void setTimeRename(bool value, int flag);
  37. void setAutoCopy(bool value);
  38. void setUserName(QString username);
  39. void setPassword(QString password);
  40. void setAutoLogin(bool value);
  41. void initFile();
  42. void updateFile();
  43. private:
  44. QString address;
  45. quint16 port;
  46. bool autoSetup;
  47. bool rename;
  48. bool timeRename;
  49. bool autoCopy;
  50. QString userName;
  51. QString password;
  52. bool autoLogin;
  53. bool firstCreate;
  54. RenameType renameType = RENAME_TYPE_NONE;
  55. void fileWrite(QString path);
  56. static QScopedPointer<FileConfigDecode> m_instance;
  57. private:
  58. FileConfigDecode();
  59. void checkConfig();
  60. // void initForm();
  61. };
  62. #endif // FILECONFIGDECODE_H