void TBWidgetValue::SetFromWidget(TBWidget *source_widget) { if (m_syncing) return; // We ended up here because syncing is in progress. // Get the value in the format TBStr text; switch (m_value.GetType()) { case TBValue::TYPE_STRING: if (!source_widget->GetText(text)) return; m_value.SetString(text, TBValue::SET_NEW_COPY); break; case TBValue::TYPE_NULL: case TBValue::TYPE_INT: m_value.SetInt(source_widget->GetValue()); break; case TBValue::TYPE_FLOAT: // FIX: TBValue should use double instead of float? m_value.SetFloat((float)source_widget->GetValueDouble()); break; default: assert(!"Unsupported value type!"); } SyncToWidgets(source_widget); }
LayerGroupProperties::LayerGroupProperties( QWidget* parent, const LayerConfig& config) : LayerGroupPropertiesBase(parent, 0, false, 0), WidgetControllerManager(parent), layer_config_(config) { idSpinBox->setValue(layer_config_.channelId); layer_config_.AssignUuidIfEmpty(); uuidEdit->setText(layer_config_.asset_uuid_); isVisibleCheck->setChecked(layer_config_.isVisible); isExpandableCheck->setChecked(layer_config_.isExpandable); isExpandableCheck->setEnabled(layer_config_.isVisible); LocaleDetails::Create(*this, layer_legend, LocaleDetails::FolderMode, &layer_config_.defaultLocale, &layer_config_.locales); TextWidgetMetaFieldController<QTextEdit>::Create(*this, notes_edit, &layer_config_.meta, "notes"); TimestampInserterController<QTextEdit>::Create(*this, timestamp_btn, notes_edit); TextWidgetMetaFieldController<QTextEdit>::Create(*this, tc_notes_edit, &layer_config_.meta, "tc_notes"); if (!Preferences::ExpertMode) { expertBox->hide(); tab_widget->removePage(advanced_tab); assert(advanced_tab->parent() != 0); } if (!Preferences::GoogleInternal) { isVisibleCheck->hide(); tab_widget->removePage(transconsole_tab); assert(transconsole_tab->parent() != 0); } SyncToWidgets(); }
bool TBWidgetValue::SetText(const char *text) { m_value.SetString(text, TBValue::SET_NEW_COPY); return SyncToWidgets(nullptr); }
void TBWidgetValue::SetDouble(double value) { // FIX: TBValue should use double instead of float? m_value.SetFloat((float)value); SyncToWidgets(nullptr); }
void TBWidgetValue::SetInt(int value) { m_value.SetInt(value); SyncToWidgets(nullptr); }