2018-06-15 06:35:27 +00:00
|
|
|
#include <QtCore/QtCore>
|
2018-06-01 09:36:01 +00:00
|
|
|
#include "SystemData.h"
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//hash_map<string, string> parameters; //存放参数的hashmap
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//版本号
|
2018-06-15 06:35:27 +00:00
|
|
|
const string cstrVersion = "0.99";
|
|
|
|
const string DB_FILE_NAME = "config.db";
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
string strUserCode;
|
|
|
|
string strUserName;
|
|
|
|
string strUserPassword;
|
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
//参数
|
2018-06-15 06:35:27 +00:00
|
|
|
//Parameters parameters( "config.db" );
|
|
|
|
Parameters* pParameters;
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
//bool checkVersion()
|
|
|
|
//{
|
|
|
|
// bool result = false;
|
2018-06-01 10:21:26 +00:00
|
|
|
// hash_map<string,string>::iterator iter = parameters.find( string("版本号") );
|
2018-06-01 09:36:01 +00:00
|
|
|
//
|
|
|
|
// if ( iter != parameters.end() && iter->second == cstrVersion )
|
|
|
|
// {
|
|
|
|
// result = true;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return result;
|
|
|
|
//}
|
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
void init_parameters()
|
|
|
|
{
|
|
|
|
QString dbFilePath = QCoreApplication::applicationDirPath();
|
|
|
|
|
|
|
|
dbFilePath.append( QString::fromLocal8Bit( "/" ) );
|
|
|
|
dbFilePath.append( QString::fromLocal8Bit( DB_FILE_NAME.c_str() ) );
|
|
|
|
|
|
|
|
pParameters = new Parameters( dbFilePath.toStdString() );
|
|
|
|
}
|
|
|
|
|
2018-06-01 09:36:01 +00:00
|
|
|
string getUserCode()
|
|
|
|
{
|
|
|
|
return strUserCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
string getUserName()
|
|
|
|
{
|
|
|
|
return strUserName;
|
|
|
|
}
|
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
void setUserCode( const string& cstrUserCode )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
|
|
|
strUserCode = cstrUserCode;
|
|
|
|
}
|
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
void setUserName( const string& cstrUserName )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
|
|
|
strUserName = cstrUserName;
|
|
|
|
}
|
|
|
|
|
|
|
|
string getVersion()
|
|
|
|
{
|
2018-06-15 06:35:27 +00:00
|
|
|
return pParameters->getParameter( "version" );
|
|
|
|
}
|