1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:38:10 +00:00

LibGUI: Add 64-bit signed integer support to GVariant

What was previously the "Int" type is now "Int32" and "Int64".
This commit is contained in:
Andreas Kling 2020-01-27 10:55:10 +01:00
parent 137a45dff2
commit 6906edee9a
8 changed files with 120 additions and 64 deletions

View file

@ -431,8 +431,10 @@ void VBForm::write_to_file(const String& path)
widget.for_each_property([&](auto& property) {
if (property.value().is_bool())
widget_object.set(property.name(), property.value().to_bool());
else if (property.value().is_int())
widget_object.set(property.name(), property.value().to_int());
else if (property.value().is_i32())
widget_object.set(property.name(), property.value().to_i32());
else if (property.value().is_i64())
widget_object.set(property.name(), property.value().to_i64());
else
widget_object.set(property.name(), property.value().to_string());
});

View file

@ -95,7 +95,7 @@ VBPropertiesWindow::VBPropertiesWindow()
if (!m_table_view->model())
return nullptr;
auto type_index = m_table_view->model()->index(index.row(), VBWidgetPropertyModel::Column::Type);
auto type = m_table_view->model()->data(type_index, GModel::Role::Custom).to_int();
auto type = m_table_view->model()->data(type_index, GModel::Role::Custom).to_i32();
switch ((GVariant::Type)type) {
case GVariant::Type::Bool:
return make<BoolModelEditingDelegate>();

View file

@ -140,10 +140,10 @@ void VBWidget::setup_properties()
{
VB_ADD_PROPERTY(CObject, "name", name, set_name, string);
VB_ADD_PROPERTY(GWidget, "width", width, set_width, int);
VB_ADD_PROPERTY(GWidget, "height", height, set_height, int);
VB_ADD_PROPERTY(GWidget, "x", x, set_x, int);
VB_ADD_PROPERTY(GWidget, "y", y, set_y, int);
VB_ADD_PROPERTY(GWidget, "width", width, set_width, i32);
VB_ADD_PROPERTY(GWidget, "height", height, set_height, i32);
VB_ADD_PROPERTY(GWidget, "x", x, set_x, i32);
VB_ADD_PROPERTY(GWidget, "y", y, set_y, i32);
VB_ADD_PROPERTY(GWidget, "visible", is_visible, set_visible, bool);
VB_ADD_PROPERTY(GWidget, "enabled", is_enabled, set_enabled, bool);
VB_ADD_PROPERTY(GWidget, "tooltip", tooltip, set_tooltip, string);
@ -164,28 +164,28 @@ void VBWidget::setup_properties()
}
if (m_type == VBWidgetType::GScrollBar) {
VB_ADD_PROPERTY(GScrollBar, "min", min, set_min, int);
VB_ADD_PROPERTY(GScrollBar, "max", max, set_max, int);
VB_ADD_PROPERTY(GScrollBar, "value", value, set_value, int);
VB_ADD_PROPERTY(GScrollBar, "step", step, set_step, int);
VB_ADD_PROPERTY(GScrollBar, "min", min, set_min, i32);
VB_ADD_PROPERTY(GScrollBar, "max", max, set_max, i32);
VB_ADD_PROPERTY(GScrollBar, "value", value, set_value, i32);
VB_ADD_PROPERTY(GScrollBar, "step", step, set_step, i32);
}
if (m_type == VBWidgetType::GSpinBox) {
VB_ADD_PROPERTY(GSpinBox, "min", min, set_min, int);
VB_ADD_PROPERTY(GSpinBox, "max", max, set_max, int);
VB_ADD_PROPERTY(GSpinBox, "value", value, set_value, int);
VB_ADD_PROPERTY(GSpinBox, "min", min, set_min, i32);
VB_ADD_PROPERTY(GSpinBox, "max", max, set_max, i32);
VB_ADD_PROPERTY(GSpinBox, "value", value, set_value, i32);
}
if (m_type == VBWidgetType::GProgressBar) {
VB_ADD_PROPERTY(GProgressBar, "min", min, set_min, int);
VB_ADD_PROPERTY(GProgressBar, "max", max, set_max, int);
VB_ADD_PROPERTY(GProgressBar, "value", value, set_value, int);
VB_ADD_PROPERTY(GProgressBar, "min", min, set_min, i32);
VB_ADD_PROPERTY(GProgressBar, "max", max, set_max, i32);
VB_ADD_PROPERTY(GProgressBar, "value", value, set_value, i32);
}
if (m_type == VBWidgetType::GSlider) {
VB_ADD_PROPERTY(GSlider, "min", min, set_min, int);
VB_ADD_PROPERTY(GSlider, "max", max, set_max, int);
VB_ADD_PROPERTY(GSlider, "value", value, set_value, int);
VB_ADD_PROPERTY(GSlider, "min", min, set_min, i32);
VB_ADD_PROPERTY(GSlider, "max", max, set_max, i32);
VB_ADD_PROPERTY(GSlider, "value", value, set_value, i32);
}
if (m_type == VBWidgetType::GTextEditor) {