#include "EXConfig.h" #include QSettings *EXConfig::defaultConfig() { static QSettings *config = nullptr; if (config == nullptr) { config = new QSettings("clientConfig.ini", QSettings::IniFormat); config->setIniCodec("UTF-8"); } return config; } const QString EXConfig::username() { return defaultConfig()->value("USERCONFIG/UserName", "").toString(); } void EXConfig::setUsername(const QString username) { defaultConfig()->setValue("USERCONFIG/UserName", username); } const QString EXConfig::password() { return defaultConfig()->value("USERCONFIG/Password", "").toString(); } void EXConfig::setPassword(const QString password) { defaultConfig()->setValue("USERCONFIG/Password", password); } bool EXConfig::rememberPassword() { return defaultConfig()->value("USERCONFIG/RememberPassword", false).toBool(); } void EXConfig::setRememberPassword(bool rememberPassword) { defaultConfig()->setValue("USERCONFIG/RememberPassword", rememberPassword); if (rememberPassword == false) { setUsername(""); setPassword(""); } } int EXConfig::roleType() { return defaultConfig()->value("USERCONFIG/RoleType", "").toInt(); } void EXConfig::setRoleType(int roleType) { defaultConfig()->setValue("USERCONFIG/RoleType", roleType); } const QString EXConfig::techMessaureConfig() { return defaultConfig()->value("USERCONFIG/TechMessaureConfig", "").toString(); } void EXConfig::setTechMessaureConfig(const QString techMessaureConfig) { defaultConfig()->setValue("USERCONFIG/TechMessaureConfig", techMessaureConfig); } const QString EXConfig::dbPath() { return defaultConfig()->value("USERCONFIG/DbPath", "").toString(); } void EXConfig::setDbPath(const QString dbPath) { defaultConfig()->setValue("USERCONFIG/DbPath", dbPath); } const QString EXConfig::project() { return defaultConfig()->value("USERCONFIG/Project", "").toString(); } void EXConfig::setProject(const QString project) { defaultConfig()->setValue("USERCONFIG/Project", project); } bool EXConfig::passwordModified() { return defaultConfig()->value("USERCONFIG/PasswordModified", false).toBool(); } void EXConfig::setPasswordModified(bool modified) { defaultConfig()->setValue("USERCONFIG/PasswordModified", modified); }