34 lines
908 B
C++
34 lines
908 B
C++
/**
|
||
* @file PaiSettings.cpp
|
||
* @brief 用来替代QSettings,他可以自动按登录用户区分组,
|
||
* 相应的存储文件名为applicationName_userID.conf,
|
||
* Linux存储路径:~/.config/organizationName/
|
||
* @date 2013-05-16
|
||
*/
|
||
#include <QCoreApplication>
|
||
|
||
#include "PaiSettings.h"
|
||
|
||
using namespace pai::gui;
|
||
|
||
QString PaiSettings::m_NameSuffix;
|
||
|
||
PaiSettings::PaiSettings(bool share, QObject *pParent) :
|
||
QSettings(QCoreApplication::organizationName(),
|
||
share ? QCoreApplication::applicationName() : (QString("%1%2%3")
|
||
.arg(QCoreApplication::applicationName())
|
||
.arg(m_NameSuffix.isEmpty() ? "": "_")
|
||
.arg(m_NameSuffix)),
|
||
pParent)
|
||
{
|
||
}
|
||
|
||
PaiSettings::~PaiSettings()
|
||
{
|
||
}
|
||
|
||
void PaiSettings::SetNameSuffix(const QString & nameSuffix)
|
||
{
|
||
m_NameSuffix = nameSuffix;
|
||
}
|