void Settings::useSettings(const TestSetting& setting) { threadGroupSize = setting.threads; local2D = cl::NDRange(32, threadGroupSize / 32); linearLocalSize = cl::NDRange(threadGroupSize); updateSetting("Local2DSize", std::to_string(local2D[0]) + "x" + std::to_string(local2D[1])); updateSetting("LocalLinearSize", std::to_string(linearLocalSize[0])); windowWidth = setting.width; windowHeight = setting.height; shouldChangeWindowSize = true; numBounces = setting.bounces; updateSetting("NumBounces", std::to_string(numBounces)); numLights = setting.lights; updateSetting("NumLights", std::to_string(numLights)); const bool* modelSetup = modelSetups[setting.triangles]; for (unsigned int i = 0; i < NUM_MODELS; ++i) { showModels[i] = modelSetup[i]; } updateModelCount(); }
void Settings::decreaseThreadGroupSize() { static const unsigned int minThreadGroupSize = 32; if (threadGroupSize > minThreadGroupSize) { threadGroupSize /= 2; local2D = cl::NDRange(32, threadGroupSize / 32); linearLocalSize = cl::NDRange(threadGroupSize); updateSetting("Local2DSize", std::to_string(local2D[0]) + "x" + std::to_string(local2D[1])); updateSetting("LocalLinearSize", std::to_string(linearLocalSize[0])); } }
void Settings::decreaseBounces() { if (numBounces > 1) numBounces--; updateSetting("NumBounces", std::to_string(numBounces)); }
void saveGeneralSettings(str_map &GET, IDatabase *db) { IQuery *q_get=db->Prepare("SELECT value FROM settings_db.settings WHERE clientid=0 AND key=?"); IQuery *q_update=db->Prepare("UPDATE settings_db.settings SET value=? WHERE key=? AND clientid=0"); IQuery *q_insert=db->Prepare("INSERT INTO settings_db.settings (key, value, clientid) VALUES (?,?,0)"); std::vector<std::wstring> settings=getGlobalSettingsList(); for(size_t i=0;i<settings.size();++i) { str_map::iterator it=GET.find(settings[i]); if(it!=GET.end()) { updateSetting(settings[i], it->second, q_get, q_update, q_insert); } } #ifdef _WIN32 std::wstring tmpdir=GET[L"tmpdir"]; if(!tmpdir.empty()) { os_create_dir(tmpdir+os_file_sep()+L"urbackup_tmp"); Server->setTemporaryDirectory(tmpdir+os_file_sep()+L"urbackup_tmp"); } #endif }
LRESULT CMainDlg::OnBnClickedSettingbutton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { // TODO: 在此添加控件通知处理程序代码 m_settingDlg->DoModal(); updateSetting(); return 0; }
void Settings::increaseLights() { numLights++; if (numLights > MAX_LIGHTS) numLights = MAX_LIGHTS; updateSetting("NumLights", std::to_string(numLights)); }
void saveClientSettings(SClientSettings settings, IDatabase *db, int clientid) { IQuery *q_get=db->Prepare("SELECT value FROM settings_db.settings WHERE clientid="+nconvert(clientid)+" AND key=?"); IQuery *q_update=db->Prepare("UPDATE settings_db.settings SET value=? WHERE key=? AND clientid="+nconvert(clientid)); IQuery *q_insert=db->Prepare("INSERT INTO settings_db.settings (key, value, clientid) VALUES (?,?,"+nconvert(clientid)+")"); updateSetting(L"overwrite", settings.overwrite?L"true":L"false", q_get, q_update, q_insert); }
void Settings::updateModelCount() { unsigned int numModels = 0; unsigned int numTriangles = 0; for (unsigned int i = 0; i < NUM_MODELS; i++) { if (showModels[i]) { numModels++; numTriangles += modelTriangleCount[i]; } } updateSetting("NumModels", std::to_string(numModels)); updateSetting("NumTriangles", std::to_string(numTriangles)); }
void Settings::decreaseLights() { numLights--; if (numLights < 1) numLights = 1; updateSetting("NumLights", std::to_string(numLights)); }
void updateArchiveSettings(int clientid, str_map &GET, IDatabase *db) { int i=0; IQuery *q=db->Prepare("DELETE FROM settings_db.automatic_archival WHERE clientid=?"); q->Bind(clientid); q->Write(); q=db->Prepare("INSERT INTO settings_db.automatic_archival (next_archival, interval, interval_unit, length, length_unit, backup_types, clientid, archive_window) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); while(GET.find(L"archive_every_"+convert(i))!=GET.end()) { _i64 archive_next=watoi64(GET[L"archive_next_"+convert(i)]); int archive_every=watoi(GET[L"archive_every_"+convert(i)]); int archive_for=watoi(GET[L"archive_for_"+convert(i)]); std::wstring backup_type_str=GET[L"archive_backup_type_"+convert(i)]; int backup_types=ServerAutomaticArchive::getBackupTypes(backup_type_str); if(archive_next<0) { if(clientid==0) { q->Bind(0); } else { q->Bind(Server->getTimeSeconds()); } } else { q->Bind(archive_next); } q->Bind(archive_every); q->Bind(GET[L"archive_every_unit_"+convert(i)]); q->Bind(archive_for); q->Bind(GET[L"archive_for_unit_"+convert(i)]); q->Bind(backup_types); q->Bind(clientid); q->Bind(GET[L"archive_window_"+convert(i)]); q->Write(); q->Reset(); ++i; } IQuery *q_get=db->Prepare("SELECT value FROM settings_db.settings WHERE clientid="+nconvert(clientid)+" AND key=?"); if(clientid!=0) { IQuery *q_update=db->Prepare("UPDATE settings_db.settings SET value=? WHERE key=? AND clientid="+nconvert(clientid)); IQuery *q_insert=db->Prepare("INSERT INTO settings_db.settings (key, value, clientid) VALUES (?,?,"+nconvert(clientid)+")"); updateSetting(L"overwrite_archive_settings", L"true", q_get, q_update, q_insert); } else { db->Write("DELETE FROM settings_db.settings WHERE key='archive_settings_copied'"); } }
SerialMonitor::SerialMonitor(const QString& portName, QWidget *parent) : QFrame(parent), mPortName(portName) { setupUi(this); sendHexEdit = new QHexEdit(); gridLayoutSend->addWidget(sendHexEdit, 1, 0, 1, 1); recvHexEdit = new QHexEdit(); gridLayoutRecv->addWidget(recvHexEdit, 1, 0, 1, 1); recvHexEdit->setAddressArea(false); recvHexEdit->setOverwriteMode(false); recvHexEdit->setReadOnly(true); sendHexEdit->setAddressArea(false); sendHexEdit->setAsciiArea(false); sendHexEdit->setOverwriteMode(false); settingMenu = 0; serialPort = new QextSerialPort(portName, QextSerialPort::EventDriven); connect(btnConnect, SIGNAL(clicked()), this, SLOT(openDevice())); connect(serialPort, SIGNAL(readyRead()), this, SLOT(onReadyRead())); connect(btnSendData, SIGNAL(clicked()), this, SLOT(wirteData())); settingMapper = new QSignalMapper(); connect(settingMapper, SIGNAL(mapped(QString)), this, SLOT(updateSetting(QString))); connect(btnSendFile, SIGNAL(clicked()),this, SLOT(sendFile())); connect(btnClearRecv, SIGNAL(clicked()), textRecv, SLOT(clear())); connect(btnClearRecv, SIGNAL(clicked()), recvHexEdit, SLOT(clear())); connect(btnRecvTextMode, SIGNAL(clicked()), this, SLOT(switchRecvTextMode())); connect(btnSendTextMode, SIGNAL(clicked()), this, SLOT(switchSendTextMode())); recvTextModeHex = false; sendTextModeHex = false; updateUI(); updateTextMode(); }
//------------------------------------------------------------------------------------- bool LogWatcher::createFromStream(MemoryStream * s) { bool ret = updateSetting(s); bool isfind = false; (*s) >> isfind; if(isfind) state_ = STATE_FINDING; else state_ = STATE_AUTO; return ret; }
void updateMailSettings(str_map &GET, IDatabase *db) { IQuery *q_get=db->Prepare("SELECT value FROM settings_db.settings WHERE clientid=0 AND key=?"); IQuery *q_update=db->Prepare("UPDATE settings_db.settings SET value=? WHERE key=? AND clientid=0"); IQuery *q_insert=db->Prepare("INSERT INTO settings_db.settings (key, value, clientid) VALUES (?,?,0)"); std::vector<std::wstring> settings=getMailSettingsList(); for(size_t i=0;i<settings.size();++i) { str_map::iterator it=GET.find(settings[i]); if(it!=GET.end()) { updateSetting(settings[i], it->second, q_get, q_update, q_insert); } } }
void updateClientSettings(int t_clientid, str_map &GET, IDatabase *db) { IQuery *q_get=db->Prepare("SELECT value FROM settings_db.settings WHERE key=? AND clientid="+nconvert(t_clientid)); IQuery *q_update=db->Prepare("UPDATE settings_db.settings SET value=? WHERE key=? AND clientid="+nconvert(t_clientid)); IQuery *q_insert=db->Prepare("INSERT INTO settings_db.settings (key, value, clientid) VALUES (?,?,"+nconvert(t_clientid)+")"); std::vector<std::wstring> sset=getSettingsList(); sset.push_back(L"allow_overwrite"); for(size_t i=0;i<sset.size();++i) { str_map::iterator it=GET.find(sset[i]); if(it!=GET.end()) { updateSetting(sset[i], it->second, q_get, q_update, q_insert); } } }
// -------------------------------------------------------------------------- void ctkSettingsPanel::registerProperty(const QString& key, QObject* object, const QString& property, const char* signal, const QString& label, ctkSettingsPanel::SettingOptions options, QSettings* settings) { Q_D(ctkSettingsPanel); PropertyType prop; prop.Object = object; prop.Property = property; prop.DefaultValue = prop.PreviousValue = prop.value(); prop.Label = label; prop.Options = options; if (d->Settings != settings) { prop.Settings = settings; } QSettings* propSettings = settings ? settings : d->Settings; if (propSettings && propSettings->contains(key)) { QVariant val = propSettings->value(key); prop.setValue(val); prop.PreviousValue = val; } d->Properties[key] = prop; // Create a signal mapper per property to be able to support // multiple signals from the same sender. QSignalMapper* signalMapper = new QSignalMapper(this); QObject::connect(signalMapper, SIGNAL(mapped(QString)), this, SLOT(updateSetting(QString))); signalMapper->setMapping(object, key); this->connect(object, signal, signalMapper, SLOT(map())); if (d->SaveToSettingsWhenRegister) { this->updateSetting(key); } }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // set icons HICON hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(hIcon, TRUE); HICON hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(hIconSmall, FALSE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); initValue(); LoadSetting(); InitDB(); initPreviewDlg(); initDH(); initBottomButton(); initTimeLabel(); initSlide(); initCradleButton(); //默认选中channel 0 FocusChannel(0); //默认布局 SetPreviewDlgLayout(PREVIEWLAYOUT4,0); //计时器 时钟 SetTimer(1,1000); //录像 SetTimer(2,1000); SetWindowPos(NULL,0,0,1000,700,SWP_SHOWWINDOW); CenterWindow(); RegisterStreamDirectReadCallback(StreamDirectReadCallback, this); updateSetting(); return TRUE; }
void VisualizerSetting::commitViewSetting(STACCATO_FieldProperty_type _property) { switch (_property) { case STACCATO_FieldProperty_Surface: myFieldDataSetting = new SurfaceSetting(); std::cout << ">> Visualizer Setting set as: Surface.\n"; break; case STACCATO_FieldProperty_SurfaceWithEdges: myFieldDataSetting = new SurfaceWithEdgesSetting(); std::cout << ">> Visualizer Setting set as: SurfaceWithEdges.\n"; break; case STACCATO_FieldProperty_Wireframe: myFieldDataSetting = new WireFrameSetting(); std::cout << ">> Visualizer Setting set as: Wireframe.\n"; break; default: std::cerr << "Unidentified VisualizerSetting.\n"; break; } updateSetting(); }
void SliderGenerator::saveConfig() { libconfig::Config cfg; try { cfg.readFile(parentWindow->modulesConfigFile().c_str()); libconfig::Setting& root = cfg.getRoot(); if (!root.exists(configGroupName)) addSetting(cfg); else { libconfig::Setting& setting = root[configGroupName]; if (!setting.isGroup()) { root.remove(configGroupName); addSetting(cfg); } else updateSetting(setting); } cfg.writeFile(parentWindow->modulesConfigFile().c_str()); } catch (libconfig::FileIOException& e) { addSetting(cfg); cfg.writeFile(parentWindow->modulesConfigFile().c_str()); } catch (libconfig::ParseException& e) { std::string message = "Parsing error alla linea " + std::to_string(e.getLine()) + ":\n" + e.getError() + "\n(" + e.what() + ")."; QMessageBox::warning(this, "Parsing error", QString::fromStdString(message), QMessageBox::Ok); } }
void Sword25FileProxy::writeSettings() { // Loop through the setting lines const char *pSrc = _settings.c_str(); while (*pSrc) { if ((*pSrc != '\r') && (*pSrc != '\n')) { const char *p = strchr(pSrc, '='); assert(p); // Get the setting name const char *pEnd = p - 1; while (*pEnd == ' ') --pEnd; Common::String settingName(pSrc, pEnd - pSrc + 1); // Get the setting value const char *pStart = p + 1; while (*pStart == ' ') ++pStart; pEnd = pStart + 1; while ((*pEnd != '\r') && (*pEnd != '\n') && (*pEnd != '\0')) ++pEnd; Common::String value(pStart + (*pStart == '"' ? 1 : 0), pEnd - pStart - (*pStart == '"' ? 2 : 0)); // Update the setting updateSetting(settingName, value); pSrc = pEnd; } // Move to next line while ((*pSrc == '\r') || (*pSrc == '\n')) ++pSrc; } ConfMan.flushToDisk(); }
QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting) { // value display QWidget* value = NULL; switch(setting->type()) { case EncTtsSetting::eDOUBLE: { QDoubleSpinBox *spinBox = new QDoubleSpinBox(this); spinBox->setAccessibleName(setting->name()); spinBox->setMinimum(setting->min().toDouble()); spinBox->setMaximum(setting->max().toDouble()); spinBox->setSingleStep(0.01); spinBox->setValue(setting->current().toDouble()); connect(spinBox,SIGNAL(valueChanged(double)),this,SLOT(updateSetting())); value = spinBox; break; } case EncTtsSetting::eINT: { QSpinBox *spinBox = new QSpinBox(this); spinBox->setAccessibleName(setting->name()); spinBox->setMinimum(setting->min().toInt()); spinBox->setMaximum(setting->max().toInt()); spinBox->setValue(setting->current().toInt()); connect(spinBox,SIGNAL(valueChanged(int)),this,SLOT(updateSetting())); value = spinBox; break; } case EncTtsSetting::eSTRING: { QLineEdit *lineEdit = new QLineEdit(this); lineEdit->setAccessibleName(setting->name()); lineEdit->setText(setting->current().toString()); connect(lineEdit,SIGNAL(textChanged(QString)),this,SLOT(updateSetting())); value = lineEdit; break; } case EncTtsSetting::eREADONLYSTRING: { value = new QLabel(setting->current().toString(),this); break; } case EncTtsSetting::eSTRINGLIST: { QComboBox *comboBox = new QComboBox(this); comboBox->setAccessibleName(setting->name()); comboBox->addItems(setting->list()); int index = comboBox->findText(setting->current().toString()); comboBox->setCurrentIndex(index); connect(comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateSetting())); value = comboBox; break; } case EncTtsSetting::eBOOL: { QCheckBox *checkbox = new QCheckBox(this); checkbox->setAccessibleName(setting->name()); checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked); connect(checkbox,SIGNAL(stateChanged(int)),this,SLOT(updateSetting())); value = checkbox; break; } default: { LOG_WARNING() << "Warning: unknown EncTTsSetting type" << setting->type(); break; } } // remember widget if(value != NULL) { m_settingsWidgetsMap.insert(setting,value); connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget())); } return value; }
void Settings::increaseBounces() { numBounces++; updateSetting("NumBounces", std::to_string(numBounces)); }
void Settings::updateSetting(const std::string& _name, float _value) { updateSetting(_name, std::to_string(_value)); }
void CamView::changeCam(const CamDeviceSetting& s) { setting = s; cam->change(s); updateSetting(); }
void CamView::setCam(const CamDeviceSetting& s) { setting = s; cam->init(s); updateSetting(); }
BOOL CschedulerDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here //mutex m_mutex = OpenMutex(MUTEX_ALL_ACCESS ,FALSE,_T("herb")); if (m_mutex==0) { CreateMutex(NULL,FALSE,_T("herb")); } else { EndDialog(1); return 0; } m_app=AfxGetApp(); //set min size CRect temprect(0,0,300,200); setMinRect(temprect); m_pData=(ITEMDATA**)calloc(KS_MAX_ITIMES,sizeof(ITEMDATA*)); for(int i=0;i<KS_MAX_ITIMES;i++) m_pData[i]=0; m_now.SetFormat(_T("dd HH:mm:ss")); m_list.SetExtendedStyle(LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT); m_hours.SetFormat(_T("HH:mm:ss")); COleDateTime mytime; /*mytime.Format(_T("dd HH:MM"));*/ mytime.SetTime(0,0,0); m_hours.SetTime(mytime); //m_list.InsertColumn(0,_T("Time"),0,LVCF_DEFAULTWIDTH); m_list.InsertColumn(1,_T("Sub"),0,LVCF_DEFAULTWIDTH); m_list.InsertColumn(2,_T("Note"),0,LVCF_DEFAULTWIDTH); m_list.InsertColumn(0,_T("Date"),0,LVCF_DEFAULTWIDTH); SetTimer(1,KS_DELAY,0); SetTimer(2,1000,0); SetTimer(3,KS_STORE_TIMER,0); m_timeSyn=m_app->GetProfileInt(_T("KScheduler"),_T("update_time"),0); m_nowChk.SetCheck(m_timeSyn); restoreNote(); updatePosition(KS_SETPOS); updateSetting(); return TRUE; // return TRUE unless you set the focus to a control }