mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 20:35:06 +00:00
Make it possible to sort a GTableModel by column+order.
This is accomplished by putting a GSortingProxyTableModel between the model and the view. It's pretty simplistic but it works for this use case. :^)
This commit is contained in:
parent
0680fe2383
commit
7d1142c7d9
16 changed files with 278 additions and 40 deletions
|
@ -48,6 +48,49 @@ GVariant::GVariant(const GraphicsBitmap& value)
|
|||
AK::retain_if_not_null(m_value.as_bitmap);
|
||||
}
|
||||
|
||||
bool GVariant::operator==(const GVariant& other) const
|
||||
{
|
||||
if (m_type != other.m_type)
|
||||
return to_string() == other.to_string();
|
||||
switch (m_type) {
|
||||
case Type::Bool:
|
||||
return as_bool() == other.as_bool();
|
||||
case Type::Int:
|
||||
return as_int() == other.as_int();
|
||||
case Type::Float:
|
||||
return as_float() == other.as_float();
|
||||
case Type::String:
|
||||
return as_string() == other.as_string();
|
||||
case Type::Bitmap:
|
||||
return m_value.as_bitmap == other.m_value.as_bitmap;
|
||||
case Type::Invalid:
|
||||
break;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool GVariant::operator<(const GVariant& other) const
|
||||
{
|
||||
if (m_type != other.m_type)
|
||||
return to_string() < other.to_string();
|
||||
switch (m_type) {
|
||||
case Type::Bool:
|
||||
return as_bool() < other.as_bool();
|
||||
case Type::Int:
|
||||
return as_int() < other.as_int();
|
||||
case Type::Float:
|
||||
return as_float() < other.as_float();
|
||||
case Type::String:
|
||||
return as_string() < other.as_string();
|
||||
case Type::Bitmap:
|
||||
// FIXME: Maybe compare bitmaps somehow differently?
|
||||
return m_value.as_bitmap < other.m_value.as_bitmap;
|
||||
case Type::Invalid:
|
||||
break;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
String GVariant::to_string() const
|
||||
{
|
||||
switch (m_type) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue