From 534bfccf2330bb85a19d0a3bb6d90df3c4d9d83a Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sun, 1 Nov 2020 02:53:37 -0500 Subject: add set status for funsies --- dialogs/setstatus.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 dialogs/setstatus.cpp (limited to 'dialogs/setstatus.cpp') diff --git a/dialogs/setstatus.cpp b/dialogs/setstatus.cpp new file mode 100644 index 0000000..cbd42ff --- /dev/null +++ b/dialogs/setstatus.cpp @@ -0,0 +1,61 @@ +#include "setstatus.hpp" + +SetStatusDialog::SetStatusDialog(Gtk::Window &parent) + : Gtk::Dialog("Set Status", parent, true) + , m_layout(Gtk::ORIENTATION_VERTICAL) + , m_bbox(Gtk::ORIENTATION_HORIZONTAL) + , m_bottom(Gtk::ORIENTATION_HORIZONTAL) + , m_ok("OK") + , m_cancel("Cancel") { + set_default_size(300, 50); + + m_text.set_placeholder_text("Status text"); + + m_status_combo.append("online", "Online"); + m_status_combo.append("dnd", "Do Not Disturb"); + m_status_combo.append("idle", "Away"); + m_status_combo.append("invisible", "Invisible"); + m_status_combo.set_active_text("Online"); + + m_type_combo.append("0", "Playing"); + m_type_combo.append("1", "Streaming"); + m_type_combo.append("2", "Listening to"); + m_type_combo.append("3", "Watching"); + m_type_combo.append("4", "Custom"); + m_type_combo.append("5", "Competing in"); + m_type_combo.set_active_text("Custom"); + + m_ok.signal_clicked().connect([this]() { + response(Gtk::RESPONSE_OK); + }); + + m_cancel.signal_clicked().connect([this]() { + response(Gtk::RESPONSE_CANCEL); + }); + + m_bbox.pack_start(m_ok, Gtk::PACK_SHRINK); + m_bbox.pack_start(m_cancel, Gtk::PACK_SHRINK); + m_bbox.set_layout(Gtk::BUTTONBOX_END); + + m_bottom.add(m_status_combo); + m_bottom.add(m_type_combo); + m_bottom.add(m_bbox); + m_layout.add(m_text); + m_layout.add(m_bottom); + get_content_area()->add(m_layout); + + show_all_children(); +} + +ActivityType SetStatusDialog::GetActivityType() const { + const auto x = m_type_combo.get_active_id(); + return static_cast(std::stoul(x)); +} + +std::string SetStatusDialog::GetStatusType() const { + return m_status_combo.get_active_id(); +} + +std::string SetStatusDialog::GetActivityName() const { + return m_text.get_text(); +} -- cgit v1.2.3