change some labels and display tox status in main menu bar
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled

based on user feedback
This commit is contained in:
Green Sky 2024-11-15 00:07:15 +01:00
parent 9bf9753bd1
commit 9277ef34f6
No known key found for this signature in database
5 changed files with 44 additions and 9 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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();

View File

@ -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();

View File

@ -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);