forked from Green-Sky/tomato
invites
This commit is contained in:
parent
4cd295065b
commit
93e5bb867b
2
external/solanaceae_contact
vendored
2
external/solanaceae_contact
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5397fcc5c24ae7d485fe16311c52703e01f5d69c
|
Subproject commit 65d253afeaf7e39594ecc0a07864a4f4a87086fd
|
2
external/solanaceae_tox
vendored
2
external/solanaceae_tox
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b68ef51d641501763b59c7d8d42296c6aa927aaa
|
Subproject commit a262ab9d3a23cf23169e76dae2c3a3c362285773
|
@ -19,10 +19,11 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
ChatGui4::ChatGui4(
|
ChatGui4::ChatGui4(
|
||||||
|
ConfigModelI& conf,
|
||||||
RegistryMessageModel& rmm,
|
RegistryMessageModel& rmm,
|
||||||
Contact3Registry& cr,
|
Contact3Registry& cr,
|
||||||
TextureUploaderI& tu
|
TextureUploaderI& tu
|
||||||
) : _rmm(rmm), _cr(cr) {
|
) : _conf(conf), _rmm(rmm), _cr(cr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatGui4::render(void) {
|
void ChatGui4::render(void) {
|
||||||
@ -73,6 +74,45 @@ void ChatGui4::render(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool request_incoming = _cr.all_of<Contact::Components::RequestIncoming>(*_selected_contact);
|
||||||
|
const bool request_outgoing = _cr.all_of<Contact::Components::TagRequestOutgoing>(*_selected_contact);
|
||||||
|
if (request_incoming || request_outgoing) {
|
||||||
|
// TODO: theming
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, {0.90f, 0.70f, 0.00f, 0.32f});
|
||||||
|
if (ImGui::BeginChild("request", {0, TEXT_BASE_HEIGHT*6.1f}, true, ImGuiWindowFlags_NoScrollbar)) {
|
||||||
|
if (request_incoming) {
|
||||||
|
const auto& ri = _cr.get<Contact::Components::RequestIncoming>(*_selected_contact);
|
||||||
|
ImGui::TextUnformatted("You got a request to add this contact.");
|
||||||
|
|
||||||
|
static std::string self_name = _conf.get_string("tox", "name").value_or("default_tomato");
|
||||||
|
if (ri.name) {
|
||||||
|
ImGui::InputText("name to join with", &self_name);
|
||||||
|
} else {
|
||||||
|
ImGui::TextUnformatted("");
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string password;
|
||||||
|
if (ri.password) {
|
||||||
|
ImGui::InputText("password to join with", &password);
|
||||||
|
} else {
|
||||||
|
ImGui::TextUnformatted("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Accept")) {
|
||||||
|
_cr.get<Contact::Components::ContactModel>(*_selected_contact)->acceptRequest(*_selected_contact, self_name, password);
|
||||||
|
password.clear();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Decline")) {
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ImGui::TextUnformatted("You sent a reqeust to add this contact.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
ImGui::EndChild();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginChild("message_log", {0, -100}, false, ImGuiWindowFlags_MenuBar)) {
|
if (ImGui::BeginChild("message_log", {0, -100}, false, ImGuiWindowFlags_MenuBar)) {
|
||||||
if (ImGui::BeginMenuBar()) {
|
if (ImGui::BeginMenuBar()) {
|
||||||
ImGui::Checkbox("show extra info", &_show_chat_extra_info);
|
ImGui::Checkbox("show extra info", &_show_chat_extra_info);
|
||||||
@ -411,8 +451,25 @@ bool ChatGui4::renderContactListContactBig(const Contact3 c) {
|
|||||||
|
|
||||||
auto label = "###" + std::to_string(entt::to_integral(c));
|
auto label = "###" + std::to_string(entt::to_integral(c));
|
||||||
|
|
||||||
|
const bool request_incoming = _cr.all_of<Contact::Components::RequestIncoming>(c);
|
||||||
|
const bool request_outgoing = _cr.all_of<Contact::Components::TagRequestOutgoing>(c);
|
||||||
|
|
||||||
ImVec2 orig_curser_pos = ImGui::GetCursorPos();
|
ImVec2 orig_curser_pos = ImGui::GetCursorPos();
|
||||||
bool selected = ImGui::Selectable(label.c_str(), _selected_contact.has_value() && *_selected_contact == c, 0, {0,3*TEXT_BASE_HEIGHT});
|
// HACK: fake selected to make it draw a box for us
|
||||||
|
const bool show_selected = request_incoming || request_outgoing || (_selected_contact.has_value() && *_selected_contact == c);
|
||||||
|
if (request_incoming) {
|
||||||
|
// TODO: theming
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Header, {0.98f, 0.41f, 0.26f, 0.52f});
|
||||||
|
} else if (request_outgoing) {
|
||||||
|
// TODO: theming
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Header, {0.98f, 0.26f, 0.41f, 0.52f});
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool selected = ImGui::Selectable(label.c_str(), show_selected, 0, {0,3*TEXT_BASE_HEIGHT});
|
||||||
|
|
||||||
|
if (request_incoming || request_outgoing) {
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
}
|
||||||
ImVec2 post_curser_pos = ImGui::GetCursorPos();
|
ImVec2 post_curser_pos = ImGui::GetCursorPos();
|
||||||
|
|
||||||
ImVec2 img_curser {
|
ImVec2 img_curser {
|
||||||
@ -458,7 +515,13 @@ bool ChatGui4::renderContactListContactBig(const Contact3 c) {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
{
|
{
|
||||||
|
if (request_incoming) {
|
||||||
|
ImGui::TextUnformatted("Incoming request/invite");
|
||||||
|
} else if (request_outgoing) {
|
||||||
|
ImGui::TextUnformatted("Outgoing request/invite");
|
||||||
|
} else {
|
||||||
ImGui::Text("%s", (_cr.all_of<Contact::Components::Name>(c) ? _cr.get<Contact::Components::Name>(c).name.c_str() : "<unk>"));
|
ImGui::Text("%s", (_cr.all_of<Contact::Components::Name>(c) ? _cr.get<Contact::Components::Name>(c).name.c_str() : "<unk>"));
|
||||||
|
}
|
||||||
//ImGui::Text("status message...");
|
//ImGui::Text("status message...");
|
||||||
//ImGui::TextDisabled("hi");
|
//ImGui::TextDisabled("hi");
|
||||||
//ImGui::RenderTextEllipsis
|
//ImGui::RenderTextEllipsis
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <solanaceae/message3/registry_message_model.hpp>
|
#include <solanaceae/message3/registry_message_model.hpp>
|
||||||
|
#include <solanaceae/util/config_model.hpp>
|
||||||
|
|
||||||
#include "./texture_uploader.hpp"
|
#include "./texture_uploader.hpp"
|
||||||
#include "./file_selector.hpp"
|
#include "./file_selector.hpp"
|
||||||
@ -9,6 +10,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
class ChatGui4 {
|
class ChatGui4 {
|
||||||
|
ConfigModelI& _conf;
|
||||||
RegistryMessageModel& _rmm;
|
RegistryMessageModel& _rmm;
|
||||||
Contact3Registry& _cr;
|
Contact3Registry& _cr;
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ class ChatGui4 {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ChatGui4(
|
ChatGui4(
|
||||||
|
ConfigModelI& conf,
|
||||||
RegistryMessageModel& rmm,
|
RegistryMessageModel& rmm,
|
||||||
Contact3Registry& cr,
|
Contact3Registry& cr,
|
||||||
TextureUploaderI& tu
|
TextureUploaderI& tu
|
||||||
|
@ -14,7 +14,7 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path) :
|
|||||||
tmm(rmm, cr, tcm, tc, tc),
|
tmm(rmm, cr, tcm, tc, tc),
|
||||||
ttm(rmm, cr, tcm, tc, tc),
|
ttm(rmm, cr, tcm, tc, tc),
|
||||||
sdlrtu(renderer_),
|
sdlrtu(renderer_),
|
||||||
cg(rmm, cr, sdlrtu)
|
cg(conf, rmm, cr, sdlrtu)
|
||||||
{
|
{
|
||||||
tel.subscribeAll(tc);
|
tel.subscribeAll(tc);
|
||||||
|
|
||||||
@ -70,6 +70,7 @@ Screen* MainScreen::poll(bool& quit) {
|
|||||||
quit = !open;
|
quit = !open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
{ // texture tests
|
{ // texture tests
|
||||||
const size_t width = 8;
|
const size_t width = 8;
|
||||||
const size_t height = 8;
|
const size_t height = 8;
|
||||||
@ -96,6 +97,7 @@ Screen* MainScreen::poll(bool& quit) {
|
|||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user