make start screen fill up full window
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, ) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, asan) (push) Has been cancelled
ContinuousIntegration / on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, ) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, asan) (push) Has been cancelled
ContinuousIntegration / on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
/become the window/
This commit is contained in:
@@ -184,271 +184,281 @@ Screen* StartScreen::render(float, bool&) {
|
|||||||
const float TEXT_PROCEED_WIDTH = ImGui::CalcTextSize("proceed").x;
|
const float TEXT_PROCEED_WIDTH = ImGui::CalcTextSize("proceed").x;
|
||||||
const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
|
const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
|
||||||
|
|
||||||
ImGui::SetNextWindowSize({656,334}, ImGuiCond_FirstUseEver);
|
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||||
ImGui::Begin("start screen");
|
ImGui::SetNextWindowPos(viewport->WorkPos);
|
||||||
|
ImGui::SetNextWindowSize(viewport->WorkSize);
|
||||||
|
|
||||||
// TODO: imgui tox profile selector?
|
constexpr auto bg_window_flags =
|
||||||
|
ImGuiWindowFlags_NoDecoration |
|
||||||
|
ImGuiWindowFlags_NoMove |
|
||||||
|
ImGuiWindowFlags_NoResize |
|
||||||
|
ImGuiWindowFlags_NoSavedSettings |
|
||||||
|
ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||||
|
|
||||||
// +----------------------------
|
if (ImGui::Begin("start screen", nullptr, bg_window_flags)) {
|
||||||
// | |*tox profile*| plugins | toxcore config |
|
// TODO: imgui tox profile selector?
|
||||||
// | +------+ +--------
|
|
||||||
// | | ICON | | fileselector/dropdown?
|
|
||||||
// | | | | password input
|
|
||||||
// | +------+ +--------
|
|
||||||
// | [proceed]
|
|
||||||
// +----------------------------
|
|
||||||
|
|
||||||
if (ImGui::BeginChild("conf", {0, ImGui::GetContentRegionAvail().y - TEXT_BASE_HEIGHT*2.f})) {
|
// +----------------------------
|
||||||
if (ImGui::BeginTabBar("view")) {
|
// | |*tox profile*| plugins | toxcore config |
|
||||||
if (ImGui::BeginTabItem("load profile")) {
|
// | +------+ +--------
|
||||||
_new_save = false;
|
// | | ICON | | fileselector/dropdown?
|
||||||
|
// | | | | password input
|
||||||
|
// | +------+ +--------
|
||||||
|
// | [proceed]
|
||||||
|
// +----------------------------
|
||||||
|
|
||||||
ImGui::TextUnformatted("profile :");
|
if (ImGui::BeginChild("conf", {0, ImGui::GetContentRegionAvail().y - TEXT_BASE_HEIGHT*2.f})) {
|
||||||
ImGui::SameLine();
|
if (ImGui::BeginTabBar("view")) {
|
||||||
if (ImGui::Button("select")) {
|
if (ImGui::BeginTabItem("load profile")) {
|
||||||
_fss.requestFile(
|
_new_save = false;
|
||||||
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
|
|
||||||
[this](const auto& path) {
|
|
||||||
_tox_profile_path = path.string();
|
|
||||||
},
|
|
||||||
[](){}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextUnformatted(_tox_profile_path.c_str());
|
|
||||||
|
|
||||||
ImGui::TextUnformatted("password:");
|
ImGui::TextUnformatted("profile :");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (_show_password) {
|
if (ImGui::Button("select")) {
|
||||||
ImGui::InputText("##password", &_password);
|
_fss.requestFile(
|
||||||
} else {
|
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
|
||||||
ImGui::InputText("##password", &_password, ImGuiInputTextFlags_Password);
|
[this](const auto& path) {
|
||||||
}
|
_tox_profile_path = path.string();
|
||||||
ImGui::SameLine();
|
},
|
||||||
ImGui::Checkbox("show password", &_show_password);
|
[](){}
|
||||||
|
);
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
if (ImGui::BeginTabItem("create profile")) {
|
|
||||||
_new_save = true;
|
|
||||||
|
|
||||||
ImGui::TextUnformatted("username:");
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::InputText("##user_name", &_user_name)) {
|
|
||||||
std::string tmp_copy = _user_name;
|
|
||||||
for (auto& c : tmp_copy) {
|
|
||||||
if (!std::isalnum(static_cast<unsigned char>(c)) && c != '-' && c != '.') {
|
|
||||||
c = '_';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmp_copy.empty()) {
|
|
||||||
tmp_copy = "unnamed-tomato";
|
|
||||||
}
|
|
||||||
|
|
||||||
_tox_profile_path = tmp_copy + ".tox";
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TextUnformatted("password:");
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (_show_password) {
|
|
||||||
ImGui::InputText("##password", &_password);
|
|
||||||
} else {
|
|
||||||
ImGui::InputText("##password", &_password, ImGuiInputTextFlags_Password);
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Checkbox("show password", &_show_password);
|
|
||||||
|
|
||||||
ImGui::TextUnformatted("TODO: profile path (current path for now)");
|
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
if (ImGui::BeginTabItem("plugins")) {
|
|
||||||
// list of selected plugins (in order)
|
|
||||||
for (auto it = queued_plugin_paths.begin(); it != queued_plugin_paths.end();) {
|
|
||||||
ImGui::PushID(it->c_str());
|
|
||||||
if (ImGui::SmallButton("-")) {
|
|
||||||
it = queued_plugin_paths.erase(it);
|
|
||||||
ImGui::PopID();
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextUnformatted(it->c_str());
|
ImGui::TextUnformatted(_tox_profile_path.c_str());
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::TextUnformatted("password:");
|
||||||
it++;
|
ImGui::SameLine();
|
||||||
}
|
if (_show_password) {
|
||||||
|
ImGui::InputText("##password", &_password);
|
||||||
if (ImGui::Button("+")) {
|
} else {
|
||||||
_fss.requestFile(
|
ImGui::InputText("##password", &_password, ImGuiInputTextFlags_Password);
|
||||||
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
|
|
||||||
[this](const auto& path) {
|
|
||||||
queued_plugin_paths.push_back(path.string());
|
|
||||||
},
|
|
||||||
[](){}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
if (ImGui::BeginTabItem("toxcore")) {
|
|
||||||
ImGui::TextDisabled("Be advised that no settings are written to disk.\nUse a config file if you don't want to set these values every start.");
|
|
||||||
|
|
||||||
ImGui::SeparatorText("DNS");
|
|
||||||
|
|
||||||
{
|
|
||||||
static bool value {true};
|
|
||||||
if (ImGui::Checkbox("DNS lookups", &value)) {
|
|
||||||
_conf.set("tox", "dns", value);
|
|
||||||
}
|
}
|
||||||
ImGui::SetItemTooltip("Allow toxcore to use your systems name resolver.");
|
ImGui::SameLine();
|
||||||
|
ImGui::Checkbox("show password", &_show_password);
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
if (ImGui::BeginTabItem("create profile")) {
|
||||||
|
_new_save = true;
|
||||||
|
|
||||||
ImGui::SeparatorText("Proxy");
|
ImGui::TextUnformatted("username:");
|
||||||
|
ImGui::SameLine();
|
||||||
static int proxy_type {0};
|
if (ImGui::InputText("##user_name", &_user_name)) {
|
||||||
if (ImGui::Combo("proxy type", &proxy_type, "NONE\0HTTP\0SOCKS5\0")) {
|
std::string tmp_copy = _user_name;
|
||||||
if (proxy_type == 0) {
|
for (auto& c : tmp_copy) {
|
||||||
_conf.set("tox", "proxy_type", std::string_view{"NONE"});
|
if (!std::isalnum(static_cast<unsigned char>(c)) && c != '-' && c != '.') {
|
||||||
} else if (proxy_type == 1) {
|
c = '_';
|
||||||
_conf.set("tox", "proxy_type", std::string_view{"HTTP"});
|
}
|
||||||
} else if (proxy_type == 2) {
|
|
||||||
_conf.set("tox", "proxy_type", std::string_view{"SOCKS5"});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::BeginDisabled(proxy_type == 0);
|
|
||||||
{
|
|
||||||
{
|
|
||||||
static std::string value;
|
|
||||||
if (ImGui::InputText("host", &value)) {
|
|
||||||
_conf.set("tox", "proxy_host", value);
|
|
||||||
}
|
}
|
||||||
ImGui::SetItemTooltip("toxcore does not currently support authentication.");
|
|
||||||
|
if (tmp_copy.empty()) {
|
||||||
|
tmp_copy = "unnamed-tomato";
|
||||||
|
}
|
||||||
|
|
||||||
|
_tox_profile_path = tmp_copy + ".tox";
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TextUnformatted("password:");
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (_show_password) {
|
||||||
|
ImGui::InputText("##password", &_password);
|
||||||
|
} else {
|
||||||
|
ImGui::InputText("##password", &_password, ImGuiInputTextFlags_Password);
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Checkbox("show password", &_show_password);
|
||||||
|
|
||||||
|
ImGui::TextUnformatted("TODO: profile path (current path for now)");
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginTabItem("plugins")) {
|
||||||
|
// list of selected plugins (in order)
|
||||||
|
for (auto it = queued_plugin_paths.begin(); it != queued_plugin_paths.end();) {
|
||||||
|
ImGui::PushID(it->c_str());
|
||||||
|
if (ImGui::SmallButton("-")) {
|
||||||
|
it = queued_plugin_paths.erase(it);
|
||||||
|
ImGui::PopID();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextUnformatted(it->c_str());
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("+")) {
|
||||||
|
_fss.requestFile(
|
||||||
|
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
|
||||||
|
[this](const auto& path) {
|
||||||
|
queued_plugin_paths.push_back(path.string());
|
||||||
|
},
|
||||||
|
[](){}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginTabItem("toxcore")) {
|
||||||
|
ImGui::TextDisabled("Be advised that no settings are written to disk.\nUse a config file if you don't want to set these values every start.");
|
||||||
|
|
||||||
|
ImGui::SeparatorText("DNS");
|
||||||
|
|
||||||
|
{
|
||||||
|
static bool value {true};
|
||||||
|
if (ImGui::Checkbox("DNS lookups", &value)) {
|
||||||
|
_conf.set("tox", "dns", value);
|
||||||
|
}
|
||||||
|
ImGui::SetItemTooltip("Allow toxcore to use your systems name resolver.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SeparatorText("Proxy");
|
||||||
|
|
||||||
|
static int proxy_type {0};
|
||||||
|
if (ImGui::Combo("proxy type", &proxy_type, "NONE\0HTTP\0SOCKS5\0")) {
|
||||||
|
if (proxy_type == 0) {
|
||||||
|
_conf.set("tox", "proxy_type", std::string_view{"NONE"});
|
||||||
|
} else if (proxy_type == 1) {
|
||||||
|
_conf.set("tox", "proxy_type", std::string_view{"HTTP"});
|
||||||
|
} else if (proxy_type == 2) {
|
||||||
|
_conf.set("tox", "proxy_type", std::string_view{"SOCKS5"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::BeginDisabled(proxy_type == 0);
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static std::string value;
|
||||||
|
if (ImGui::InputText("host", &value)) {
|
||||||
|
_conf.set("tox", "proxy_host", value);
|
||||||
|
}
|
||||||
|
ImGui::SetItemTooltip("toxcore does not currently support authentication.");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
static uint16_t value {0};
|
||||||
|
if (ImGui::InputScalar("port", ImGuiDataType_U16, &value)) {
|
||||||
|
_conf.set("tox", "proxy_port", int64_t(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
ImGui::SeparatorText("IP connectivity");
|
||||||
|
|
||||||
|
{
|
||||||
|
static bool value {true};
|
||||||
|
if (ImGui::Checkbox("ipv6", &value)) {
|
||||||
|
_conf.set("tox", "ipv6_enabled", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
static bool value {true};
|
||||||
|
if (ImGui::Checkbox("udp", &value)) {
|
||||||
|
_conf.set("tox", "udp_enabled", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
static bool value {true};
|
||||||
|
if (ImGui::Checkbox("hole punching", &value)) {
|
||||||
|
_conf.set("tox", "hole_punching_enabled", value);
|
||||||
|
}
|
||||||
|
ImGui::SetItemTooltip("Perform NAT hole punching.\nOnly meaningful if udp is enabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static uint16_t value {0};
|
static uint16_t value {0};
|
||||||
if (ImGui::InputScalar("port", ImGuiDataType_U16, &value)) {
|
if (ImGui::InputScalar("start port", ImGuiDataType_U16, &value)) {
|
||||||
_conf.set("tox", "proxy_port", int64_t(value));
|
_conf.set("tox", "start_port", int64_t(value));
|
||||||
}
|
}
|
||||||
|
ImGui::SetItemTooltip("The range in which toxcore finds a free port.\nOnly meaningful if udp is enabled.");
|
||||||
}
|
}
|
||||||
}
|
{
|
||||||
ImGui::EndDisabled();
|
static uint16_t value {0};
|
||||||
|
if (ImGui::InputScalar("end port", ImGuiDataType_U16, &value)) {
|
||||||
ImGui::SeparatorText("IP connectivity");
|
_conf.set("tox", "end_port", int64_t(value));
|
||||||
|
}
|
||||||
{
|
ImGui::SetItemTooltip("The range in which toxcore finds a free port.\nOnly meaningful if udp is enabled.");
|
||||||
static bool value {true};
|
|
||||||
if (ImGui::Checkbox("ipv6", &value)) {
|
|
||||||
_conf.set("tox", "ipv6_enabled", value);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
ImGui::SeparatorText("local discovery");
|
||||||
static bool value {true};
|
{
|
||||||
if (ImGui::Checkbox("udp", &value)) {
|
static bool value {true};
|
||||||
_conf.set("tox", "udp_enabled", value);
|
if (ImGui::Checkbox("local discovery", &value)) {
|
||||||
|
_conf.set("tox", "local_discovery_enabled", value);
|
||||||
|
}
|
||||||
|
ImGui::SetItemTooltip("Perform broadcasts in your local networks to find other peers.\nOnly meaningful if udp is enabled.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
ImGui::SeparatorText("tcp relay server");
|
||||||
static bool value {true};
|
{
|
||||||
if (ImGui::Checkbox("hole punching", &value)) {
|
static uint16_t value {0};
|
||||||
_conf.set("tox", "hole_punching_enabled", value);
|
if (ImGui::InputScalar("server port", ImGuiDataType_U16, &value)) {
|
||||||
|
_conf.set("tox", "tcp_port", int64_t(value));
|
||||||
|
}
|
||||||
|
ImGui::SetItemTooltip("Run a tcp relay server in your client, aiding the network with another relay node.\n!! Check local juristiction and law to not get in trouble.\n0 is disabled");
|
||||||
}
|
}
|
||||||
ImGui::SetItemTooltip("Perform NAT hole punching.\nOnly meaningful if udp is enabled.");
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if (ImGui::BeginTabItem("about")) {
|
||||||
static uint16_t value {0};
|
ImGuiTomatoAbout();
|
||||||
if (ImGui::InputScalar("start port", ImGuiDataType_U16, &value)) {
|
ImGui::EndTabItem();
|
||||||
_conf.set("tox", "start_port", int64_t(value));
|
|
||||||
}
|
|
||||||
ImGui::SetItemTooltip("The range in which toxcore finds a free port.\nOnly meaningful if udp is enabled.");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
static uint16_t value {0};
|
|
||||||
if (ImGui::InputScalar("end port", ImGuiDataType_U16, &value)) {
|
|
||||||
_conf.set("tox", "end_port", int64_t(value));
|
|
||||||
}
|
|
||||||
ImGui::SetItemTooltip("The range in which toxcore finds a free port.\nOnly meaningful if udp is enabled.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SeparatorText("local discovery");
|
ImGui::EndTabBar();
|
||||||
{
|
|
||||||
static bool value {true};
|
|
||||||
if (ImGui::Checkbox("local discovery", &value)) {
|
|
||||||
_conf.set("tox", "local_discovery_enabled", value);
|
|
||||||
}
|
|
||||||
ImGui::SetItemTooltip("Perform broadcasts in your local networks to find other peers.\nOnly meaningful if udp is enabled.");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SeparatorText("tcp relay server");
|
|
||||||
{
|
|
||||||
static uint16_t value {0};
|
|
||||||
if (ImGui::InputScalar("server port", ImGuiDataType_U16, &value)) {
|
|
||||||
_conf.set("tox", "tcp_port", int64_t(value));
|
|
||||||
}
|
|
||||||
ImGui::SetItemTooltip("Run a tcp relay server in your client, aiding the network with another relay node.\n!! Check local juristiction and law to not get in trouble.\n0 is disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("about")) {
|
|
||||||
ImGuiTomatoAbout();
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTabBar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndChild();
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
if (!_new_save && !std::filesystem::is_regular_file(_tox_profile_path)) {
|
|
||||||
// load but file missing
|
|
||||||
|
|
||||||
ImGui::BeginDisabled();
|
|
||||||
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 does not exist");
|
|
||||||
}
|
|
||||||
} else if (_new_save && std::filesystem::exists(_tox_profile_path)) {
|
|
||||||
// new but file exists
|
|
||||||
|
|
||||||
ImGui::BeginDisabled();
|
|
||||||
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("proceed", {TEXT_PROCEED_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f})) {
|
|
||||||
_error_string.clear();
|
|
||||||
|
|
||||||
try {
|
|
||||||
auto new_screen = std::make_unique<MainScreen>(_conf, _renderer, _theme, _tox_profile_path, _password, _user_name, queued_plugin_paths);
|
|
||||||
if (!new_screen) {
|
|
||||||
throw std::runtime_error("failed to init main screen.");
|
|
||||||
}
|
|
||||||
ImGui::End(); // start screen
|
|
||||||
return new_screen.release();
|
|
||||||
} catch (const std::exception& e) {
|
|
||||||
_error_string = std::string{"ToxCore/MainScreen creation failed with: "} + e.what();
|
|
||||||
} catch (...) {
|
|
||||||
_error_string = "ToxCore/MainScreen creation failed with unknown error";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
if (!_error_string.empty()) {
|
ImGui::Separator();
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored({1.f, 0.5f, 0.5f, 1.f}, "%s", _error_string.c_str());
|
if (!_new_save && !std::filesystem::is_regular_file(_tox_profile_path)) {
|
||||||
|
// load but file missing
|
||||||
|
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
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 does not exist");
|
||||||
|
}
|
||||||
|
} else if (_new_save && std::filesystem::exists(_tox_profile_path)) {
|
||||||
|
// new but file exists
|
||||||
|
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
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("proceed", {TEXT_PROCEED_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f})) {
|
||||||
|
_error_string.clear();
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto new_screen = std::make_unique<MainScreen>(_conf, _renderer, _theme, _tox_profile_path, _password, _user_name, queued_plugin_paths);
|
||||||
|
if (!new_screen) {
|
||||||
|
throw std::runtime_error("failed to init main screen.");
|
||||||
|
}
|
||||||
|
ImGui::End(); // start screen
|
||||||
|
return new_screen.release();
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
_error_string = std::string{"ToxCore/MainScreen creation failed with: "} + e.what();
|
||||||
|
} catch (...) {
|
||||||
|
_error_string = "ToxCore/MainScreen creation failed with unknown error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_error_string.empty()) {
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextColored({1.f, 0.5f, 0.5f, 1.f}, "%s", _error_string.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user