#include "Preferences.h" #include "ConfigUtils.h" QString QPreferences::m_strProjectPath = DEFAULT_PROJECT_PATH; //项目路径 QString QPreferences::m_strProjectName = DEFAULT_PROJECT_NAME; //项目名称 QString QPreferences::m_strProjectInfo = "This Project Info"; //项目的描述 QString QPreferences::m_strHdwConfigID = ""; //项目的硬件组态ID QString QPreferences::m_strLiveTime = ""; //运行时长 QString QPreferences::m_strSystemTime = ""; //系统时间 QString QPreferences::m_strCurr_UserName = ("admin"); //用户名 QString QPreferences::m_strCurr_PassWord = ("admin"); //密码 QString QPreferences::m_strCurr_UserType = "User"; QString QPreferences::m_strDefaultDocument = (""); QString QPreferences::m_strConfigPath = ""; //配置信息目录 QString QPreferences::m_strProductName = "VisionPlus v3"; //产品名称 QString QPreferences::m_strMessage = ("Message"); bool QPreferences::m_bEnableDebugView = false; bool QPreferences::m_bEnableRunningMode = false; bool QPreferences::m_bEnablePreventStandby = false; bool QPreferences::m_bEnableAutoRun = false; bool QPreferences::m_bEnableAutoStart = false; bool QPreferences::m_bEnableAlone = false; bool QPreferences::m_bEnableAutoLodin = false; bool QPreferences::m_bEnableAutoSave = false; bool QPreferences::m_bEnableRibbonBar = false; bool QPreferences::m_bCleanState = false; bool QPreferences::m_bCleanDATA = false; bool QPreferences::m_bWriteProtection = false; bool QPreferences::m_bSystemIsRunning = false; //系统运行中 QString QPreferences::m_strExeDir; QString QPreferences::m_strBuildInfo; QString QPreferences::m_strTitle; QString QPreferences::m_strPhine; QString QPreferences::m_strMailbox; QString QPreferences::m_strURL; QString QPreferences::m_strCompanyName; QString QPreferences::m_strAuthorizeInfo; int QPreferences::m_nRunningCount = 0; //运行计数 int QPreferences::m_nTotalRunningCount = 0; //总运行计数 int QPreferences::m_nRunningTime = 0; //运行计数 int QPreferences::m_nTotalRunningTime = 0; //总运行计数 int QPreferences::m_nDocVersion = 0; // 当前加载的工程文件版本号 int QPreferences::m_nHdwVersion = 0; // 当前加载的工程文件版本号 //// 设置UI界面的默认初始值 //int QPreferences::m_nUiViewWidth = DEFAULT_UIVIEW_WIDTH; //int QPreferences::m_nUiViewHeight = DEFAULT_UIVIEW_HEIGHT; // //// UiFrame各个窗体的拉伸尺寸 //QList QPreferences::listUiStretchFactors; //// PouFrame各个窗体的拉伸尺寸 //QList QPreferences::listPouStretchFactors; QPreferences::QPreferences() { //// 初始化UiFrame各个窗体的拉伸尺寸 //listUiStretchFactors.push_back(4); //listUiStretchFactors.push_back(2); // PouFrame各个窗体的拉伸尺寸 } QPreferences::~QPreferences() { Uninit(); } void QPreferences::Init() { QString runPath = QCoreApplication::applicationDirPath(); //获取exe路径 m_strProjectPath = runPath + "//..//Project"; m_strConfigPath = runPath + "/Config/Preferences.ini"; /// System m_nTotalRunningCount = ConfigUtils::getCfgInt(m_strConfigPath, "System", "RunningCount", 0); /// OEM m_strProductName = ConfigUtils::getCfgStr(m_strConfigPath, "OEM", "ProductName", m_strProductName); } void QPreferences::Uninit() { // 计数总运行计数。 m_nTotalRunningCount = m_nTotalRunningCount + m_nRunningCount; /// System ConfigUtils::setCfgInt(m_strConfigPath, "System", "RunningCount", m_nTotalRunningCount); /// OEM ConfigUtils::setCfgStr(m_strConfigPath, "OEM", "ProductName", m_strProductName); }