mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
When the `FilteringOptions::SortByScore` flag is set, filtered indices are sorted by match score in descending order, meaning the most relevant results should appear first. The default behavior of FilteringProxyModel is unchanged.
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2022, Valtteri Koskivuori <vkoskiv@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGUI/Model.h>
|
|
|
|
namespace Browser {
|
|
|
|
class StorageModel final : public GUI::Model {
|
|
public:
|
|
enum Column {
|
|
Key,
|
|
Value,
|
|
__Count,
|
|
};
|
|
|
|
void set_items(OrderedHashMap<DeprecatedString, DeprecatedString> map);
|
|
void clear_items();
|
|
virtual int row_count(GUI::ModelIndex const&) const override;
|
|
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
|
|
virtual String column_name(int column) const override;
|
|
virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
|
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
|
|
virtual GUI::Model::MatchResult data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;
|
|
|
|
private:
|
|
OrderedHashMap<DeprecatedString, DeprecatedString> m_local_storage_entries;
|
|
};
|
|
|
|
}
|