12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #include "EXConfig.h"
- #include <QSettings>
- 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);
- }
|