size_t CLoginDlg::write_data(const char * info) { Json::Reader reader; Json::Value json_object; // info = "{\"result\": [{\"room_id\": \"7\"}]}"; const char* json_document = info; if (!reader.parse(json_document, json_object)) return 0; Json::Value error_info = json_object["errno"]; int errno_s = error_info.asInt();//.asString(); if(errno_s == 0) { Json::Value result = json_object["result"]; Json::Value::iterator it = result.begin(); Json::Value room_id; for(;it!=result.end();it++) { Json::Value allInfo = *it; room_id = allInfo["room_id"]; } string s_room_id = room_id.asString(); m_room_id = s_room_id.c_str(); writeConfig(1,m_room_id,_T(""),_T("")); writeConfig(2,m_room_id,_T(""),_T("")); return 1; } else { return 0; } }
void CommHandler::setParityErrorCheckEnable(bool enable) { getCommConfigPtr()->c_iflag = enable ? (INPCK | (getCommConfigPtr()->c_iflag)) : ((~INPCK) & getCommConfigPtr()->c_iflag); writeConfig(); }
void CommHandler::setParityErrorMark(bool mark) { getCommConfigPtr()->c_iflag = mark ? (PARMRK | getCommConfigPtr()->c_iflag) // XXX : ((~PARMRK) & getCommConfigPtr()->c_iflag); writeConfig(); }
void CommHandler::setMapBreakToInterrupt(bool map) { getCommConfigPtr()->c_iflag = map ? (BRKINT | getCommConfigPtr()->c_iflag) : ((~BRKINT) & getCommConfigPtr()->c_iflag); writeConfig(); }
void MusicXMLConfigManager::writeMusicSongsConfig(const MusicSongsList &musics) { if( musics.isEmpty() ) { return; } //Open wirte file if( !writeConfig(MUSICPATH_AL) ) { return; } /////////////////////////////////////////////////////// createProcessingInstruction(); QDomElement musicPlayer = createRoot("TTKMusicPlayer"); //Class A QDomElement fileNormalPath = writeDomElement(musicPlayer, "fileNormalPath", "count", musics[0].count()); QDomElement fileLovestPath = writeDomElement(musicPlayer, "fileLovestPath", "count", musics[1].count()); QDomElement netFilePath = writeDomElement(musicPlayer, "netFilePath", "count", musics[2].count()); //extend playlist init here // for(int i=3; i<fileNamesList.count(); ++i) // { // QDomElement extend = m_ddom->createElement("extend" + QString::number(i - 2)); // extend.setAttribute("count",fileNamesList[i].count()); // TTKMusicPlayer.appendChild(extend); // } //Class B foreach(MusicSong song, musics[0]) { writeDomElementMutilText(fileNormalPath, "value", QStringList() << "name" << "playCount" << "time", QList<QVariant>() << song.getMusicName() << song.getMusicPlayCount() << song.getMusicTime(), song.getMusicPath()); }
void ContactEditorMainWindow::slotQuitApp() { if (saveCurrentProject(SaveAndCloseTheme)) { writeConfig(); qApp->quit(); } }
void JsonTextWriter::writeToStream( const Text & text, std::ostream & os ) { os << "{\n\tconfig: "; writeConfig( text.getConfig(), os ); os << ",\n\tcontent: '" << text.getContent() << "',\n\tnodes: [\n\t\t"; uint nodesCount = text.getNodes().size(); if ( nodesCount > 0 ) { writeNode( *text.getNodes().at( 0 ), os ); for ( uint i = 1; i < nodesCount; ++ i ) { os << ",\n\t\t"; writeNode( *text.getNodes().at( i ), os ); } } os << "\n\t],\n\tannotations: [\n\t\t"; for ( uint i = 0; i < nodesCount; ++ i ) { const Node & node = *text.getNodes().at( i ); for ( uint j = 0; j < node.getTransitionCount(); ++ j ) { if ( i != 0 || j != 0 ) os << ",\n\t\t"; writeAnnotation( *node.getTransition( j ), os ); } } os << "\n\t]\n}"; }
void Mega8Config::saveConfig(const wxString &profile) { if (profile == wxEmptyString) { _currentProfile = wxT("General"); } else { _currentProfile = profile; } saveKeyboard(_currentProfile); writeString(wxT("LastFolder"), _LastFolder); writeBool(wxT("FullScreen"), _FullScreen); writeBool(wxT("SpeedAuto"), _SpeedAuto); writeBool(wxT("DisplayHUD"), _DisplayHUD); writeBool(wxT("Filtered"), _Filtered); writeBool(wxT("SyncClock"), _SyncClock); writeLong(wxT("ColorTheme"), (int)_ColorTheme); writeBool(wxT("InverseColor"), _InverseColor); writeBool(wxT("Sound"), _Sound); writeBool(wxT("UseSleep"), _UseSleep); for (int i = 0; i <= sizeof(Chip8Types); i++) { writeLong(wxT("FrequencyRatio/") + getMachineTypeStr((Chip8Types)i), _FrequencyRatio[i]); } // Really save config if (_config != NULL) { writeConfig(); } }
//--------------------------------------------------------------------- // INITIALIZE //--------------------------------------------------------------------- void PuzzleTV::intialize(bool reset) { LOGI("%s(L=%d)", __func__, __LINE__); super::intialize(reset); // Clear data blockSizeW = 0; blockSizeH = 0; blockW = 0; blockH = 0; blockNum = 0; marginW = 0; marginH = 0; phase = 0; movingBlock = 0; spaceBlock = 0; autoSolveTimer = 0; blocks = NULL; // Set default parameters (no clear) if (reset) { if (readConfig() != CONFIG_SUCCESS) { hint = 0; } } else { writeConfig(); } }
bool OidentdConfigGenerator::init() { _configDir = QDir::homePath(); _configFileName = ".oidentd.conf"; if (Quassel::isOptionSet("oidentd-conffile")) _configPath = Quassel::optionValue("oidentd-conffile"); else _configPath = _configDir.absoluteFilePath(_configFileName); _configTag = " stanza created by Quassel"; _configFile = new QFile(_configPath); // Rx has to match Template in order for cleanup to work. // Template should be enhanced with the "from" parameter as soon as Quassel gains // the ability to bind to an IP on client sockets. _quasselStanzaTemplate = QString("lport %1 { reply \"%2\" } #%3\n"); _quasselStanzaRx = QRegExp(QString("^lport .* \\{ .* \\} #%1\\r?\\n").arg(_configTag)); // initially remove all Quassel stanzas that might be present if (parseConfig(false) && writeConfig()) _initialized = true; return _initialized; }
void CommHandler::setReceiveEnable(bool enable) { getCommConfigPtr()->c_cflag = enable ? (CREAD | getCommConfigPtr()->c_cflag) : ((~CREAD) & getCommConfigPtr()->c_cflag); writeConfig(); }
bool KPBinaryIface::checkDir(const QString& possibleDir) { bool ret = false; QString possiblePath = path(possibleDir); kDebug() << "Testing " << possiblePath << "..."; QProcess process; process.setProcessChannelMode(QProcess::MergedChannels); process.start(possiblePath, m_binaryArguments); bool val = process.waitForFinished(); if (val && (process.error() != QProcess::FailedToStart)) { m_isFound = true; QString stdOut(process.readAllStandardOutput()); if (parseHeader(stdOut)) { m_pathDir = possibleDir; writeConfig(); kDebug() << "Found " << path() << " version: " << version(); ret = true; } else { // TODO: do something if the version is not right or not found } } emit signalBinaryValid(); return ret; }
void KImportDlg::slotOkClicked() { // Save the used options. writeConfig(); // leave dialog directly accept(); }
void readConfig(void) { if(had_used_config_file == NULL) { had_used_config_file = (char*)malloc(1024); if(loadConfig(HAD_CONFIG_FILE)) { g_message("Using config %s",HAD_CONFIG_FILE); strncpy(had_used_config_file, HAD_CONFIG_FILE,1024); } else { if(loadConfig("had.conf")) { g_message("Using config %s","had.conf"); strncpy(had_used_config_file, "had.conf",1024); } else { g_message("Creating new default config %s","had.conf"); strncpy(had_used_config_file, "had.conf",1024); writeConfig(); } } } else { loadConfig(had_used_config_file); } }
void ToolConfig::switchTo(const QString & tool, bool save /* = true */) { //KILE_DEBUG() << "==ToolConfig::switchTo(const QString & tool, bool save /* = true */)====================" << endl; //save config if (save) { writeConfig(); //update the config number QString cf = m_configWidget->m_cbConfig->currentText(); KileTool::setConfigName(m_current, cf, m_config); } m_current = tool; m_map.clear(); if (!m_manager->retrieveEntryMap(m_current, m_map, false, false)) kdWarning() << "no entrymap" << endl; updateConfiglist(); updateGeneral(); updateAdvanced(); //show GUI info m_configWidget->m_cbMenu->setCurrentText(KileTool::menuFor(m_current, m_config)); m_icon=KileTool::iconFor(m_current, m_config); if ( m_icon.isEmpty() ) m_configWidget->m_pshbIcon->setPixmap(QString::null); else m_configWidget->m_pshbIcon->setPixmap(SmallIcon(m_icon)); }
void ConfigDialogImpl::slotOk() { applyConfig(); writeConfig(); emit(newSettings()); delete ui; }
void myClock() { int loop=1; int h,m,s; int color=1, size=1; char symbol='X'; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO consoleInfo; WORD saved_attributes; GetConsoleScreenBufferInfo(hConsole, &consoleInfo); saved_attributes = consoleInfo.wAttributes; while(loop) { if(GetAsyncKeyState(VK_ESCAPE)) { break; } if(GetAsyncKeyState('C')) { writeConfig(color, size, symbol, hConsole, saved_attributes); GetAsyncKeyState(VK_SPACE); //Clear GetAsyncKeyState('C');//Clear } readConfig(&color, &size, &symbol); initClock(&h,&m,&s); char f[17]= {}; initText(f,h,m,s,symbol); system("cls"); digitalClock(h,m,s); printClock(f,color,size,hConsole,saved_attributes); sleep(1); } }
TPV::~TPV() { applEnding = True; // destroyHelp(); writeConfig(); if( listWindow ) { deskTop->remove( (TView *)listWindow ); destroy( (TObject *)listWindow ); } destroy( (TObject *)formDef ); destroy( (TObject *)aboutDlg ); remove( clock ); destroy( clock ); if( heap ) { remove( heap ); destroy( heap ); } }
bool CMMDVMCal::setTXLevel(int incr) { if (incr > 0 && m_txLevel < 99U) { m_txLevel++; ::fprintf(stdout, "TX Level: %u%%" EOL, m_txLevel); return writeConfig(); } if (incr < 0 && m_txLevel > 0U) { m_txLevel--; ::fprintf(stdout, "TX Level: %u%%" EOL, m_txLevel); return writeConfig(); } return true; }
void CommHandler::setStopBitsCount(int count) { getCommConfigPtr()->c_cflag = !(count - 2) ? (CSTOPB | getCommConfigPtr()->c_cflag) : ((~CSTOPB) & getCommConfigPtr()->c_cflag); writeConfig(); }
/* write the IP address to /etc/config/config so the user can tell what * IP address the NETtel got. * * Secondly, launch dhcpcd-change, but only if it is not a DISKTEL */ int ipfwadm_rules(char *ifname, u_int32_t yiaddr) { char buf[32]; FILE *in; pid_t pid; char tmp[MAX_CONFIG_LINE_SIZE]; struct in_addr inp; struct stat st; inp.s_addr = yiaddr; /* No need to write this config to flash because it is dynamic * information. */ sprintf(buf, "ip%s\0", ifname); writeConfig("/etc/config/config", buf, (char *) inet_ntoa(inp)); #ifndef CONFIG_DEFAULTS_LINEO_DISKTEL if (stat("/etc/config/dhcpcd-change", &st) == 0) { launch_script("/etc/config/dhcpcd-change"); } else { launch_script("/etc/config/ipfwrules"); } #endif return 0; }
void CommHandler::setParityErrorIgnore(bool ignore) { getCommConfigPtr()->c_iflag = ignore ? (IGNPAR | getCommConfigPtr()->c_iflag) : ((~IGNPAR) & getCommConfigPtr()->c_iflag); writeConfig(); }
AbstractScopeWidget::~AbstractScopeWidget() { writeConfig(); delete m_menu; delete m_aAutoRefresh; delete m_aRealtime; }
AudioSpectrum::~AudioSpectrum() { writeConfig(); delete m_aResetHz; delete m_aTrackMouse; delete ui; }
bool CMMDVMCal::setPTTInvert() { m_pttInvert = !m_pttInvert; ::fprintf(stdout, "PTT Invert: %s" EOL, m_pttInvert ? "On" : "Off"); return writeConfig(); }
void CommHandler::setPlatformCompatibilityFlags() { /* Here I put all those flags that completely differ from platform to platform */ getCommConfigPtr()->c_cc[VTIME] = 50; // 5 sec timeout getCommConfigPtr()->c_cc[VMIN] = 0; // no minimum getCommConfigPtr()->c_cflag |= CLOCAL | CCTS_OFLOW; getCommConfigPtr()->c_iflag &= ~IGNBRK; writeConfig(); }
void saveSettingsConfig() { // Save settings config file writeConfig("ux0:VitaShell/settings.txt", settings_entries, sizeof(settings_entries) / sizeof(ConfigEntry)); if (sceKernelGetModel() == SCE_KERNEL_MODEL_VITATV) { vitashell_config.select_button = SELECT_BUTTON_MODE_FTP; } }
Config::Config() { const QString FileName = "Config"; confFile = new QFile(FileName); //default settings default_alertTime = 50; default_restTime = 3; default_start_with_system = false; default_playSound = true; default_show_startup = false; default_language = QString("zh_CN"); alertTime = default_alertTime; restTime = default_restTime; // default background color RGB(72, 118, 255)); // Mac蓝色 RGB(61, 108, 239) // Facebook蓝色 RGB(59, 89, 153) // YAHOO!紫色 RGB(63, OA, 6E) default_bg_colorR = 61; default_bg_colorG = 108; default_bg_colorB = 239; //default foreground color RGB(173, 255, 47) default_fg_colorR = 173; default_fg_colorG = 255; default_fg_colorB = 47; //custome configuration bg_colorR = default_bg_colorR; bg_colorG = default_bg_colorG; bg_colorB = default_bg_colorB; fg_colorR = default_fg_colorR; fg_colorG = default_fg_colorG; fg_colorB = default_fg_colorB; start_with_system = default_start_with_system; playSound = default_playSound; show_startup = default_show_startup; language = default_language; version = QString("510"); if (QFileInfo(FileName).exists() == false) { //first create #ifdef DEBUG qDebug() << "not exists"; #endif language = QLocale::system().name(); writeConfig(); } else { //read exist config #ifdef DEBUG qDebug() << "exists"; #endif readConfig(); } }
void ContactEditorMainWindow::closeEvent(QCloseEvent *e) { if (!saveCurrentProject(SaveAndCloseTheme)) { e->ignore(); } else { writeConfig(); e->accept(); } }
void GuiInputConfig::onInput(InputManager::InputButton button, bool keyDown) { if(mDone) { if(InputManager::lastEvent->type == SDL_KEYUP) { writeConfig(); if(mJoystick) SDL_JoystickClose(mJoystick); InputManager::loadConfig(); delete this; GuiGameList::create(); } return; } SDL_Event* event = InputManager::lastEvent; if(event->type == SDL_JOYBUTTONDOWN) { mButtonMap[event->jbutton.button] = (InputManager::InputButton)mInputNum; std::cout << " Mapping " << sInputs[mInputNum] << " to button " << (int)event->jbutton.button << "\n"; mInputNum++; } if(event->type == SDL_JOYAXISMOTION) { //std::cout << "motion on axis " << event->jaxis.axis << " to value " << event->jaxis.value << "\n"; if(event->jaxis.axis == mLastAxis) { if(event->jaxis.value < InputManager::deadzone && event->jaxis.value > -InputManager::deadzone) mLastAxis = -1; return; } if(event->jaxis.value > InputManager::deadzone) { mAxisPosMap[event->jaxis.axis] = (InputManager::InputButton)mInputNum; mInputNum++; mLastAxis = event->jaxis.axis; std::cout << " Mapping " << sInputs[mInputNum - 1] << " to axis+ " << mLastAxis << "\n"; }else if(event->jaxis.value < -InputManager::deadzone) { mAxisNegMap[event->jaxis.axis] = (InputManager::InputButton)mInputNum; mInputNum++; mLastAxis = event->jaxis.axis; std::cout << " Mapping " << sInputs[mInputNum - 1] << " to axis- " << mLastAxis << "\n"; } } if(mInputNum >= sInputCount) { mDone = true; return; } }