mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
Calendar: Implement saving, loading, and displaying of calendars
The user can now save, load, and view calendars. A calendar is made up of an array of events which are saved in a JSON file. In the future we should implement the iCalendar standard instead of using a custom format.
This commit is contained in:
parent
db3e1b128c
commit
1b5b1e4153
17 changed files with 696 additions and 176 deletions
34
Userland/Applications/Calendar/EventCalendar.h
Normal file
34
Userland/Applications/Calendar/EventCalendar.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2023, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "EventManager.h"
|
||||
#include <LibFileSystemAccessClient/Client.h>
|
||||
#include <LibGUI/Calendar.h>
|
||||
|
||||
namespace Calendar {
|
||||
|
||||
class EventCalendar final : public GUI::Calendar {
|
||||
C_OBJECT(EventCalendar);
|
||||
|
||||
public:
|
||||
virtual ~EventCalendar() override = default;
|
||||
|
||||
EventManager& event_manager() const { return *m_event_manager; }
|
||||
|
||||
private:
|
||||
EventCalendar(Core::DateTime date_time = Core::DateTime::now(), Mode mode = Month);
|
||||
|
||||
ErrorOr<void> save(FileSystemAccessClient::File& file);
|
||||
ErrorOr<void> load_file(FileSystemAccessClient::File& file);
|
||||
|
||||
virtual void paint_tile(GUI::Painter&, GUI::Calendar::Tile&, Gfx::IntRect&, int x_offset, int y_offset, int day_offset) override;
|
||||
|
||||
OwnPtr<EventManager> m_event_manager;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue