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