summaryrefslogtreecommitdiff
path: root/src/ui/include/ui_events.hpp
blob: 297370db78feaffab14dd05c1c1b29411d33fc76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#include <memory>
#include "database.hpp"
#include "index.hpp"
#include "screen.hpp"
#include "tinyfsm.hpp"

namespace ui {

// TODO(jacqueline): is this needed? is this good?
/*
 * Event emitted by the main task on heartbeat.
 */
struct OnStorageChange : tinyfsm::Event {
  bool is_mounted;
};

struct OnSystemError : tinyfsm::Event {};

namespace internal {

struct RecordSelected : tinyfsm::Event {
  std::shared_ptr<database::Result<database::IndexRecord>> initial_page;
  std::shared_ptr<database::Result<database::IndexRecord>> page;
  std::size_t record;
};

struct IndexSelected : tinyfsm::Event {
  database::IndexInfo index;
};

struct BackPressed : tinyfsm::Event {};
struct ShowNowPlaying : tinyfsm::Event {};
struct ShowSettingsPage : tinyfsm::Event {
  enum class Page {
    kRoot,
    kBluetooth,
    kHeadphones,
    kAppearance,
    kInput,
    kStorage,
    kFirmwareUpdate,
    kAbout,
  } page;
};

struct ModalConfirmPressed : tinyfsm::Event {};
struct ModalCancelPressed : tinyfsm::Event {};

}  // namespace internal

}  // namespace ui