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

Maps: Add show SerenityOS users feature

This commit is contained in:
Bastiaan van der Plaat 2023-09-06 22:17:46 +02:00 committed by Jelle Raaijmakers
parent dfb54083ee
commit d63fb8fa61
5 changed files with 138 additions and 3 deletions

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2023, Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "MapWidget.h"
class UsersMapWidget final : public MapWidget {
C_OBJECT(UsersMapWidget);
public:
bool show_users() const { return m_show_users; }
void set_show_users(bool show_users)
{
m_show_users = show_users;
if (m_show_users) {
if (!m_users.has_value()) {
get_users();
} else {
add_users_to_map();
}
} else {
clear_markers();
clear_panels();
}
}
private:
UsersMapWidget(Options const&);
void get_users();
void add_users_to_map();
RefPtr<Gfx::Bitmap> m_marker_gray_image;
RefPtr<Protocol::Request> m_request;
bool m_show_users { false };
struct User {
String nick;
LatLng coordinates;
bool contributor;
};
Optional<Vector<User>> m_users;
};