mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
Maps: Add favorites panel with favorite places management
This commit is contained in:
parent
3acbffabf9
commit
5a7f43ad38
10 changed files with 421 additions and 13 deletions
50
Userland/Applications/Maps/FavoritesPanel.h
Normal file
50
Userland/Applications/Maps/FavoritesPanel.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MapWidget.h"
|
||||
#include <LibGUI/Dialog.h>
|
||||
#include <LibGUI/ItemListModel.h>
|
||||
#include <LibGUI/ListView.h>
|
||||
|
||||
namespace Maps {
|
||||
|
||||
class FavoritesPanel final : public GUI::Widget {
|
||||
C_OBJECT(FavoritesPanel)
|
||||
|
||||
public:
|
||||
struct Favorite {
|
||||
String name;
|
||||
MapWidget::LatLng latlng;
|
||||
int zoom;
|
||||
};
|
||||
static ErrorOr<NonnullRefPtr<FavoritesPanel>> create();
|
||||
|
||||
void load_favorites();
|
||||
void reset();
|
||||
ErrorOr<void> add_favorite(Favorite const& favorite);
|
||||
|
||||
Function<void(Vector<Favorite> const&)> on_favorites_change;
|
||||
Function<void(Favorite const&)> on_selected_favorite_change;
|
||||
|
||||
protected:
|
||||
FavoritesPanel() = default;
|
||||
|
||||
static ErrorOr<NonnullRefPtr<FavoritesPanel>> try_create();
|
||||
|
||||
ErrorOr<void> setup();
|
||||
|
||||
private:
|
||||
ErrorOr<void> edit_favorite(int row);
|
||||
void favorites_changed();
|
||||
|
||||
RefPtr<GUI::Frame> m_empty_container;
|
||||
RefPtr<GUI::ListView> m_favorites_list;
|
||||
RefPtr<GUI::Menu> m_context_menu;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue