fileconfigdecode.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. void setAddress(QString value);
  32. void setPort(quint16 value);
  33. void setAutoSetup(bool value);
  34. void setRename(bool value);
  35. void setTimeRename(bool value, int flag);
  36. void setAutoCopy(bool value);
  37. void setUserName(QString username);
  38. void setPassword(QString password);
  39. void initFile();
  40. void updateFile();
  41. private:
  42. QString address;
  43. quint16 port;
  44. bool autoSetup;
  45. bool rename;
  46. bool timeRename;
  47. bool autoCopy;
  48. QString userName;
  49. QString password;
  50. bool firstCreate;
  51. RenameType renameType = RENAME_TYPE_NONE;
  52. void fileWrite(QString path, QString address, bool autosetup, bool rename, bool timerename, bool autocopy, QString username, QString password);
  53. static QScopedPointer<FileConfigDecode> m_instance;
  54. private:
  55. FileConfigDecode();
  56. void checkConfig();
  57. // void initForm();
  58. };
  59. #endif // FILECONFIGDECODE_H