forked from Green-Sky/tomato
change some labels and display tox status in main menu bar
based on user feedback
This commit is contained in:
parent
9bf9753bd1
commit
9277ef34f6
@ -846,7 +846,6 @@ float ChatGui4::render(float time_delta) {
|
||||
ImGuiInputTextFlags_CtrlEnterForNewLine;
|
||||
|
||||
if (ImGui::InputTextMultiline("##text_input", &_text_input_buffer, {-0.001f, -0.001f}, input_flags)) {
|
||||
//_mm.sendMessage(*_selected_contact, MessageType::TEXT, text_buffer);
|
||||
_rmm.sendText(*_selected_contact, _text_input_buffer);
|
||||
_text_input_buffer.clear();
|
||||
evil_enter_looses_focus_hack = true;
|
||||
|
@ -46,7 +46,7 @@ MainScreen::MainScreen(SimpleConfigModel&& conf_, SDL_Renderer* renderer_, Theme
|
||||
cg(conf, os, rmm, cr, sdlrtu, contact_tc, msg_tc, theme),
|
||||
sw(conf),
|
||||
osui(os),
|
||||
tuiu(tc, conf),
|
||||
tuiu(tc, conf, &tpi),
|
||||
tdch(tpi),
|
||||
smui(os, sm),
|
||||
dvt(os, sm, sdlrtu)
|
||||
|
@ -168,7 +168,7 @@ StartScreen::StartScreen(const std::vector<std::string_view>& args, SDL_Renderer
|
||||
}
|
||||
|
||||
Screen* StartScreen::render(float, bool&) {
|
||||
const float TEXT_LOAD_WIDTH = ImGui::CalcTextSize("load").x;
|
||||
const float TEXT_PROCEED_WIDTH = ImGui::CalcTextSize("proceed").x;
|
||||
const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
|
||||
|
||||
|
||||
@ -283,7 +283,7 @@ Screen* StartScreen::render(float, bool&) {
|
||||
// load but file missing
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Button("load", {TEXT_LOAD_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f});
|
||||
ImGui::Button("proceed", {TEXT_PROCEED_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f});
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
@ -293,14 +293,14 @@ Screen* StartScreen::render(float, bool&) {
|
||||
// new but file exists
|
||||
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Button("load", {TEXT_LOAD_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f});
|
||||
ImGui::Button("proceed", {TEXT_PROCEED_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f});
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
ImGui::SetTooltip("file already exists");
|
||||
}
|
||||
} else {
|
||||
if (ImGui::Button("load", {TEXT_LOAD_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f})) {
|
||||
if (ImGui::Button("proceed", {TEXT_PROCEED_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f})) {
|
||||
|
||||
auto new_screen = std::make_unique<MainScreen>(std::move(_conf), _renderer, _theme, _tox_profile_path, _password, _user_name, queued_plugin_paths);
|
||||
return new_screen.release();
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "./tox_client.hpp"
|
||||
|
||||
#include <solanaceae/toxcore/tox_private_interface.hpp>
|
||||
|
||||
#include <tox/tox.h>
|
||||
|
||||
#include <solanaceae/util/utils.hpp>
|
||||
@ -13,8 +15,9 @@
|
||||
|
||||
ToxUIUtils::ToxUIUtils(
|
||||
ToxClient& tc,
|
||||
ConfigModelI& conf
|
||||
) : _tc(tc), _conf(conf) {
|
||||
ConfigModelI& conf,
|
||||
ToxPrivateI* tp
|
||||
) : _tc(tc), _conf(conf), _tp(tp) {
|
||||
}
|
||||
|
||||
void ToxUIUtils::render(void) {
|
||||
@ -44,6 +47,30 @@ void ToxUIUtils::render(void) {
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
switch (_tc.toxSelfGetConnectionStatus()) {
|
||||
case TOX_CONNECTION_NONE:
|
||||
ImGui::TextColored({1.0,0.5,0.5,0.8}, "Offline");
|
||||
break;
|
||||
case TOX_CONNECTION_TCP:
|
||||
ImGui::TextColored({0.0,1.0,0.8,0.8}, "Online-TCP");
|
||||
break;
|
||||
case TOX_CONNECTION_UDP:
|
||||
ImGui::TextColored({0.3,1.0,0.0,0.8}, "Online-UDP");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Tox Onion connection status");
|
||||
}
|
||||
|
||||
if (_tp != nullptr) {
|
||||
ImGui::Text("(%d)", _tp->toxDHTGetNumCloselist());
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Number of connected DHT nodes");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
@ -64,6 +91,12 @@ void ToxUIUtils::render(void) {
|
||||
// TODO: add string_view variant to utils
|
||||
auto [_, err_r] = _tc.toxFriendAdd(hex2bin(std::string{tox_id}), message);
|
||||
err = err_r;
|
||||
|
||||
{ // reset everything
|
||||
for (size_t i = 0; i < sizeof(tox_id); i++) {
|
||||
tox_id[i] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (err != Tox_Err_Friend_Add::TOX_ERR_FRIEND_ADD_OK) {
|
||||
ImGui::SameLine();
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
class ToxClient;
|
||||
struct ConfigModelI;
|
||||
struct ToxPrivateI;
|
||||
|
||||
class ToxUIUtils {
|
||||
bool _show_add_friend_window {false};
|
||||
@ -9,11 +10,13 @@ class ToxUIUtils {
|
||||
|
||||
ToxClient& _tc;
|
||||
ConfigModelI& _conf;
|
||||
ToxPrivateI* _tp{nullptr};
|
||||
|
||||
public:
|
||||
ToxUIUtils(
|
||||
ToxClient& tc,
|
||||
ConfigModelI& conf
|
||||
ConfigModelI& conf,
|
||||
ToxPrivateI* tp = nullptr
|
||||
);
|
||||
|
||||
void render(void);
|
||||
|
Loading…
Reference in New Issue
Block a user