ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth) , _hostInput(this, st::connectionHostInputField, lang(lng_connection_host_ph), Global::ConnectionProxy().host) , _portInput(this, st::connectionPortInputField, lang(lng_connection_port_ph), QString::number(Global::ConnectionProxy().port)) , _userInput(this, st::connectionUserInputField, lang(lng_connection_user_ph), Global::ConnectionProxy().user) , _passwordInput(this, st::connectionPasswordInputField, lang(lng_connection_password_ph), Global::ConnectionProxy().password) , _autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (Global::ConnectionType() == dbictAuto)) , _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (Global::ConnectionType() == dbictHttpProxy)) , _tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (Global::ConnectionType() == dbictTcpProxy)) , _tryIPv6(this, lang(lng_connection_try_ipv6), Global::TryIPv6(), st::defaultBoxCheckbox) , _save(this, lang(lng_connection_save), st::defaultBoxButton) , _cancel(this, lang(lng_cancel), st::cancelBoxButton) { connect(&_save, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_autoRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_httpProxyRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_tcpProxyRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_hostInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_portInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_userInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); connect(&_passwordInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit())); prepare(); }
void TrackBar::OnMouseMove( int mX, int mY, bool mouseState ) { if(m_is_readonly || !canChange()) return; const Rect& rect = GetRect(); if(mouseState) { if(m_is_vertical) { int y = clip(rect.h - (mY), m_slider_radius/2, rect.h - m_slider_radius/2); if(y != m_slider_pix) { m_slider_pix = y; onChange(); } } else { int x = clip(mX, m_slider_radius/2, rect.w-m_slider_radius/2); if(x != m_slider_pix) { m_slider_pix = x; onChange(); } } } else { Rect sr = getSliderRect(); int x = mX - (sr.x+sr.w/2); int y = mY - (sr.y+sr.h/2); if(x*x + y*y < m_slider_radius*m_slider_radius) { m_on_it = true; return; } m_on_it = false; } }
LanguageBox::LanguageBox() : _close(this, lang(lng_box_ok), st::defaultBoxButton) { bool haveTestLang = (cLang() == languageTest); int32 y = st::boxTitleHeight + st::boxOptionListPadding.top(); _langs.reserve(languageCount + (haveTestLang ? 1 : 0)); if (haveTestLang) { _langs.push_back(new Radiobutton(this, qsl("lang"), languageTest, qsl("Custom Lang"), (cLang() == languageTest), st::langsButton)); _langs.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y); y += _langs.back()->height() + st::boxOptionListPadding.top(); connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange())); } for (int32 i = 0; i < languageCount; ++i) { LangLoaderResult result; if (i) { LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lng_language_name)); result = loader.found(); } else { result.insert(lng_language_name, langOriginal(lng_language_name)); } _langs.push_back(new Radiobutton(this, qsl("lang"), i, result.value(lng_language_name, LanguageCodes[i] + qsl(" language")), (cLang() == i), st::langsButton)); _langs.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y); y += _langs.back()->height() + st::boxOptionListPadding.top(); connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange())); } resizeMaxHeight(st::langsWidth, st::boxTitleHeight + (languageCount + (haveTestLang ? 1 : 0)) * (st::boxOptionListPadding.top() + st::langsButton.height) + st::boxOptionListPadding.bottom() + st::boxPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom()); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); _close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height()); prepare(); }
ConnectionBox::ConnectionBox() : _saveButton(this, lang(lng_connection_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host), _portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)), _userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user), _passwordInput(this, st::inpConnectionPassword, lang(lng_connection_password_ph), cConnectionProxy().password), _autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (cConnectionType() == dbictAuto)), _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (cConnectionType() == dbictHttpProxy)), _tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)), a_opacity(0, 1), _hiding(false) { _width = st::addContactWidth; connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel())); connect(&_autoRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_httpProxyRadio, SIGNAL(changed()), this, SLOT(onChange())); connect(&_tcpProxyRadio, SIGNAL(changed()), this, SLOT(onChange())); _passwordInput.setEchoMode(QLineEdit::Password); showAll(); _cache = myGrab(this, rect()); hideAll(); }
void ReportBox::prepare() { setTitle(lang(_peer->isUser() ? lng_report_bot_title : (_peer->isMegagroup() ? lng_report_group_title : lng_report_title))); addButton(lang(lng_report_button), [this] { onReport(); }); addButton(lang(lng_cancel), [this] { closeBox(); }); connect(_reasonSpam, SIGNAL(changed()), this, SLOT(onChange())); connect(_reasonViolence, SIGNAL(changed()), this, SLOT(onChange())); connect(_reasonPornography, SIGNAL(changed()), this, SLOT(onChange())); connect(_reasonOther, SIGNAL(changed()), this, SLOT(onChange())); updateMaxHeight(); }
bool ContentModule::clearRows(int first_row, int gap_count) { RowStoreModel *model = this->model(); if(!onChange(first_row, gap_count)) return false; model->clearRowsImpl(first_row, gap_count); return true; }
bool ContentModule::transitionRows ( int first_row, int row_count, ConstRowStoreRange const &new_rows, bool smooth) { RowStoreModel *model = this->model(); if(!onChange(first_row, row_count)) return false; return model->transitionRowsImpl(first_row, row_count, new_rows, smooth); }
bool ContentModule::replaceRow(int row, QStringList const &new_row) { RowStoreModel *model = this->model(); if(!onChange(row, 1)) return false; model->replaceRowImpl(row, new_row); return true; }
bool ContentModule::insertRows(int first_row, ConstRowStoreRange const &new_rows) { RowStoreModel *model = this->model(); if(!onChange(first_row, 0)) return false; model->insertRowsImpl(first_row, new_rows); return true; }
bool ContentModule::removeRows(int first_row, int row_count) { RowStoreModel *model = this->model(); if(!onChange(first_row, row_count)) return false; model->removeRowsImpl(first_row, row_count); return true; }
void DakotaAlgorithm_Impl::reset() { Algorithm_Impl::reset(); m_restartFileReference.reset(); m_outFileReference.reset(); m_job.reset(); onChange(AnalysisObject_Impl::Benign); }
//-------------------------------------------------------------- void mui::TextField::setText( string value ){ if( text.compare( value ) != 0 ){ text = value; commit(); onChange( this, text ); } }
void MeasureGroup_Impl::clearMeasures() { for (Measure& measure : m_measures) { disconnectChild(measure); } m_measures.clear(); onChange(AnalysisObject_Impl::InvalidatesDataPoints); }
bool MeasureGroup_Impl::insert(int index, const Measure& measure) { if ((index < 0) || (index > int(numMeasures(false)))) { return false; } if (index == int(numMeasures(false))) { return push(measure); } // position does not matter for compatibility checking MeasureVector candidates = measures(false); candidates.push_back(measure); if (!measuresAreCompatible(candidates)) { return false; } auto it = m_measures.begin(); for (int count = 0; count < index; ++count, ++it); it = m_measures.insert(it,measure); for (int i = index, n = int(m_measures.size()); i < n; ++i) { m_measures[i].onChange(); } connectChild(m_measures[index],true); onChange(AnalysisObject_Impl::InvalidatesDataPoints); return true; }
void OSObjectListCBDS::initialize() { std::vector<model::ModelObject> modelObjects = m_model.getModelObjects<model::ModelObject>(); for( std::vector<model::ModelObject>::iterator it = modelObjects.begin(); it < modelObjects.end(); it++ ) { if( std::find(m_types.begin(),m_types.end(),it->iddObjectType()) != m_types.end() ) { m_workspaceObjects << *it; connect( it->getImpl<openstudio::model::detail::ModelObject_Impl>().get(), SIGNAL(onChange()), this, SLOT(onObjectChanged()) ); } } connect( m_model.getImpl<openstudio::model::detail::Model_Impl>().get(), SIGNAL(addWorkspaceObject(const WorkspaceObject&, const openstudio::IddObjectType&, const openstudio::UUID&)), this, SLOT(onObjectAdded(const WorkspaceObject&)) ); connect( m_model.getImpl<openstudio::model::detail::Model_Impl>().get(), SIGNAL(removeWorkspaceObject(const WorkspaceObject&, const openstudio::IddObjectType&, const openstudio::UUID&)), this, SLOT(onObjectWillBeRemoved(const WorkspaceObject&)) ); }
PlanarSurfaceGroup_Impl::PlanarSurfaceGroup_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : ParentObject_Impl(idfObject, model, keepHandle) { // connect signals bool connected = connect(this, SIGNAL(onChange()), this, SLOT(clearCachedVariables())); OS_ASSERT(connected); }
void ListBox::selectChild(Widget* item) { for (Widget* child : getChildren()) { if (child->isSelected()) { if (item && child == item) return; child->setSelected(false); } } if (item) { View* view = View::getView(this); item->setSelected(true); if (view) { gfx::Rect vp = view->getViewportBounds(); gfx::Point scroll = view->getViewScroll(); if (item->getBounds().y < vp.y) scroll.y = item->getBounds().y - getBounds().y; else if (item->getBounds().y > vp.y + vp.h - item->getBounds().h) scroll.y = (item->getBounds().y - getBounds().y - vp.h + item->getBounds().h); view->setViewScroll(scroll); } } onChange(); }
bool OSArgument::setMinValue(double minValue) { if (m_type == OSArgumentType::Integer){ int test = floor(minValue); if (test == minValue){ return setMinValue(test); } return false; } else if (m_type != OSArgumentType::Double) { return false; } double maxValue = std::numeric_limits<double>::max(); if (hasDomain() && (m_domainType == OSDomainType::Interval)){ std::vector<double> domain = domainAsDouble(); if (domain.size() == 2){ maxValue = domain[1]; } } m_domainType = OSDomainType::Interval; m_domain.clear(); m_domain.push_back(QVariant(minValue)); m_domain.push_back(QVariant(maxValue)); onChange(); return true; }
bool OSArgument::setMaxValue(int maxValue) { if (m_type == OSArgumentType::Double) { double test = (double)maxValue; return setMaxValue(test); } else if (m_type != OSArgumentType::Integer) { return false; } double minValue = std::numeric_limits<int>::min(); if (hasDomain() && (m_domainType == OSDomainType::Interval)){ std::vector<int> domain = domainAsInteger(); if (domain.size() == 2){ minValue = domain[0]; } } m_domainType = OSDomainType::Interval; m_domain.clear(); m_domain.push_back(QVariant(minValue)); m_domain.push_back(QVariant(maxValue)); onChange(); return true; }
bool Analysis_Impl::setProblem(Problem& problem) { // problem is in charge of making sure it is internally consistent // need problem to be consistent with seed if (problem.inputFileType() && (seed().fileType() != problem.inputFileType().get())) { LOG(Error,"Cannot set problem to '" << problem.name() << "', because its input file type is " << problem.inputFileType().get().valueName() << " and the seed model type is " << seed().fileType().valueName() << "."); return false; } // need problem to be consistent with algorithm if (m_algorithm && !(m_algorithm->isCompatibleProblemType(problem))) { LOG(Error,"Cannot set problem to '" << problem.name() << "', because it is not compatible " << "with Algorithm '" << m_algorithm->name() << "'."); return false; } disconnectChild(m_problem); m_problem = problem; connectChild(m_problem,true); onChange(AnalysisObject_Impl::InvalidatesDataPoints); return true; }
bool OSArgument::setDomainType(const OSDomainType& domainType) { if (domainType != this->domainType()) { // check whether domainType makes sense for type() switch (domainType.value()) { case OSDomainType::Interval : switch (m_type.value()) { case OSArgumentType::Boolean : case OSArgumentType::String : case OSArgumentType::Choice : case OSArgumentType::Path : LOG(Info,"OSDomainType " << domainType.valueName() << " does not make sense for " << "arguments of type " << m_type.valueName() << ", such as " << name() << "."); return false; default: break; } break; case OSDomainType::Enumeration : break; default : OS_ASSERT(false); } // if so, change and clear current domain m_domainType = domainType; m_domain.clear(); onChange(); } return true; }
void Analysis_Impl::clearAlgorithm() { if (m_algorithm) { disconnectChild(*m_algorithm); m_algorithm.reset(); onChange(AnalysisObject_Impl::Benign); } }
void deletePlan(const IMC::PlanDB& req) { if (req.plan_id.empty()) { onFailure(DTR("undefined plan id")); return; } inProgress(); m_db->beginTransaction(); int count = 0; try { *m_delete_plan_stmt << req.plan_id; m_delete_plan_stmt->execute(&count); if (count) onChange(req); } catch (std::runtime_error& e) { onFailure(e.what()); m_db->rollback(); return; } m_db->commit(); if (!count) onFailure(DTR("undefined plan")); else onSuccess(); }
bool OSArgument::setDefaultValue(const std::string& defaultValue) { bool result = setStringInternal(m_defaultValue, defaultValue); if (result) { OS_ASSERT(hasDefaultValue()); onChange(); } return result; }
void ModelObjectVectorController::change() { QObject* sender = this->sender(); model::detail::ModelObject_Impl* impl = qobject_cast<model::detail::ModelObject_Impl*>(sender); if (impl){ onChange(impl->getObject<model::ModelObject>()); } }
bool Analysis_Impl::setWeatherFile(const FileReference& newWeatherFile) { if (newWeatherFile.fileType() != FileReferenceType::EPW) { return false; } m_weatherFile = newWeatherFile; onChange(AnalysisObject_Impl::InvalidatesResults); return true; }
void AntialiasPopup::onValuesChanged(bool dragging) { if (dragging || !m_startRas || !m_viewer->getRaster()) return; onChange(m_startRas, m_viewer->getRaster(), m_thresholdField->getValue(), m_softnessField->getValue()); m_viewer->update(); }
bool ContentModule::insertRow(int row, QStringList const &new_row) { qWarning() << "BEWARE: untested code, exists for completeness"; RowStoreModel *model = this->model(); if(!onChange(row, 0)) return false; model->insertRowImpl(row, new_row); return true; }
void ChangeSoundOptions::_exec(Game& game, unsigned int) { SoundOptions* dialog = new SoundOptions( game.gui()->rootWidget() ); Model* model = new Model(); Engine& ae = Engine::instance(); CONNECT( dialog, onChange(), model, Model::set ) CONNECT( dialog, onClose(), model, Model::restore ) CONNECT( dialog, onChange(), &ae, Engine::setVolume ) dialog->update( audio::ambient, ae.volume( audio::ambient ) ); dialog->update( audio::theme, ae.volume( audio::theme ) ); dialog->update( audio::game, ae.volume( audio::game ) ); dialog->show(); }
void Memory::onClock() { if (in[memWrite]) { memory[in[address]] = in[writeData]; } onChange(); }