summaryrefslogtreecommitdiff
path: root/src/ui/include
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-10-04 14:47:30 +1100
committerjacqueline <me@jacqueline.id.au>2023-10-04 14:47:30 +1100
commit28633e857f86a21d874117fd677de5e8ad21d8d3 (patch)
treed016f7da3b7d5b8ca9c577ea5eaf783a925e418b /src/ui/include
parent7a7fafdd92f8ddc1143a00febf0a540cfefaf099 (diff)
downloadtangara-fw-28633e857f86a21d874117fd677de5e8ad21d8d3.tar.gz
Implement UI for enqueuing instead of replacing the current track
Diffstat (limited to 'src/ui/include')
-rw-r--r--src/ui/include/modal.hpp9
-rw-r--r--src/ui/include/modal_add_to_queue.hpp36
2 files changed, 45 insertions, 0 deletions
diff --git a/src/ui/include/modal.hpp b/src/ui/include/modal.hpp
index a5ac69b8..61e52cdf 100644
--- a/src/ui/include/modal.hpp
+++ b/src/ui/include/modal.hpp
@@ -30,6 +30,15 @@ class Modal {
lv_obj_t* const root_;
lv_group_t* const group_;
+ std::pmr::vector<std::unique_ptr<EventBinding>> event_bindings_;
+
+ template <typename T>
+ auto lv_bind(lv_obj_t* obj, lv_event_code_t ev, T fn) -> void {
+ auto binding = std::make_unique<EventBinding>(obj, ev);
+ binding->signal().connect(fn);
+ event_bindings_.push_back(std::move(binding));
+ }
+
private:
Screen* host_;
};
diff --git a/src/ui/include/modal_add_to_queue.hpp b/src/ui/include/modal_add_to_queue.hpp
new file mode 100644
index 00000000..760a155e
--- /dev/null
+++ b/src/ui/include/modal_add_to_queue.hpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2023 jacqueline <me@jacqueline.id.au>
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#pragma once
+
+#include <memory>
+#include <vector>
+
+#include "database.hpp"
+#include "index.hpp"
+#include "lvgl.h"
+
+#include "modal.hpp"
+#include "source.hpp"
+#include "track_queue.hpp"
+
+namespace ui {
+namespace modals {
+
+class AddToQueue : public Modal {
+ public:
+ AddToQueue(Screen*,
+ audio::TrackQueue&,
+ std::shared_ptr<playlist::IndexRecordSource>);
+
+ private:
+ audio::TrackQueue& queue_;
+ std::shared_ptr<playlist::IndexRecordSource> item_;
+ lv_obj_t* container_;
+};
+
+} // namespace modals
+} // namespace ui