void QConfMainApp::load() { m_mainWidget = NULL; m_closing = false; LOAD_CONFIG(initWithoutWindow, "0"); // QDBMgr LOAD_CONFIG(pichist_max_num, "100"); // QWallMgr LOAD_CONFIG(wall_timer_sec, "5"); LOAD_CONFIG(max_cache_image, "5"); LOAD_CONFIG(disable_cache_warning, "0"); LOAD_CONFIG(still_run_when_fullscreen, "0"); LOAD_CONFIG(wall_resize_policy, "0"); // QPicFinder m_closingPicfinder = false; LOAD_CONFIG(picfinder_refresh_msec, "1000"); LOAD_CONFIG(ignoreImageFormatSupportWarning, "0"); #ifdef Q_WS_X11 LOAD_CONFIG(wm, WM_UNKNOWN); if (m_wm == WM_UNKNOWN) { autoDetectWM(); } #endif//Q_WS_X11 m_db = new QDBMgr(this); m_wallmgr = new QWallMgr(this); m_picfinder = new QPicFinder(this); m_desk = new QDesktopWidget(); }
bool ServerConfig::parse() { Json::Value value; LOAD_CONFIG(ConfigFile::ServerConfig, value); phpServerAddress = value["global"]["php_server_address"].asString(); Json::Value& gameServiceValue = value["server"]["game_service"]; if (gameServiceValue != Json::nullValue) { serviceName = gameServiceValue["service_name"].asString(); listenAddress = gameServiceValue["listen_address"].asString(); maxQueued = gameServiceValue["max_queued"].asInt(); maxThreads = gameServiceValue["max_threads"].asInt(); sqlite3File = gameServiceValue["sqlite3_file"].asString(); mysql_host = gameServiceValue["mysql_host"].asString(); mysql_port = gameServiceValue["mysql_port"].asString(); mysql_database = gameServiceValue["mysql_database"].asString(); mysql_user = gameServiceValue["mysql_user"].asString(); mysql_password = gameServiceValue["mysql_password"].asString(); } else { return false; } return true; }
bool ImgConfig::parse() { Json::Value value; LOAD_CONFIG(ConfigFile::ImgConfigPath, value); Json::Value jsonRoot = value["resimg"]; if (jsonRoot == Json::nullValue) { return false; } csResPath = CA2W(jsonRoot["res_path"].asCString(), CP_UTF8).m_psz; // CStringA strPath; // int nImgId = 0; // int nSize = jsonRoot.size(); // // for (int nIndex = 0; nIndex < nSize; ++nIndex) // { // Json::Value jsonIndexValue = jsonRoot[nIndex]; // // if (jsonIndexValue == Json::nullValue) // { // continue; // } // // nImgId = jsonIndexValue["img_id"].asInt(); // strPath = jsonIndexValue["img_path"].asCString(); // mapResImg[nImgId] = CA2W(strPath, CP_UTF8).m_psz; // nImgId = 0; // } return true; }