Compare commits
5 Commits
e27276bf65
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
c7ae6490cc | ||
|
5041cfa6fa | ||
|
2353d57dd3 | ||
|
8e805522d5 | ||
|
5978a14224 |
116
.github/workflows/cd.yml
vendored
116
.github/workflows/cd.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
linux-ubuntu:
|
||||
timeout-minutes: 10
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -47,14 +47,14 @@ jobs:
|
||||
- name: Compress artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu24.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu24.04-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64.tar.gz
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu24.04-x86_64.tar.gz
|
||||
|
||||
android:
|
||||
timeout-minutes: 30
|
||||
@@ -165,7 +165,12 @@ jobs:
|
||||
windows:
|
||||
timeout-minutes: 15
|
||||
|
||||
runs-on: windows-2022
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
type: ['', 'asan']
|
||||
os: ['windows-2022']
|
||||
|
||||
permissions:
|
||||
# vcpkg caching action
|
||||
@@ -199,7 +204,8 @@ jobs:
|
||||
#- uses: ilammy/setup-nasm@v1
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_BREAKPAD=ON -DTOMATO_TOX_AV=ON
|
||||
# TODO: og asan had this -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_BREAKPAD=ON -DTOMATO_TOX_AV=ON -DTOMATO_ASAN=${{matrix.type == 'asan' && 'ON' || 'OFF'}}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t tomato
|
||||
@@ -223,82 +229,8 @@ jobs:
|
||||
run: |
|
||||
Remove-Item "${{github.workspace}}/build/bin/*.ilk"
|
||||
|
||||
- name: Compress artifacts
|
||||
shell: powershell
|
||||
run: |
|
||||
Compress-Archive -Path ${{github.workspace}}/build/bin/* -Destination ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{github.event.repository.name}}-${{steps.tag.outputs.name}}-${{runner.os}}-msvc-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64.zip
|
||||
|
||||
|
||||
windows-asan:
|
||||
timeout-minutes: 15
|
||||
|
||||
runs-on: windows-2022
|
||||
|
||||
permissions:
|
||||
# vcpkg caching action
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Restore vcpkg cache
|
||||
id: vcpkg-cache
|
||||
uses: TAServers/vcpkg-cache@v3
|
||||
with:
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: Install Dependencies
|
||||
env:
|
||||
VCPKG_FEATURE_FLAGS: "binarycaching"
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{steps.vcpkg-cache.outputs.path}},readwrite"
|
||||
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static zstd:x64-windows-static libwebp:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static freetype:x64-windows-static
|
||||
|
||||
|
||||
# setup vs env
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: amd64
|
||||
|
||||
## sdl_image vendored needs nasm for dav1d
|
||||
#- uses: ilammy/setup-nasm@v1
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_ASAN=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_TOX_AV=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
|
||||
|
||||
- name: Determine tag name
|
||||
id: tag
|
||||
shell: bash
|
||||
# taken from llama.cpp
|
||||
run: |
|
||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Clean temporary artifacts
|
||||
# msvc sometimes produces .ilk files, which are used for linking only
|
||||
shell: powershell
|
||||
run: |
|
||||
Remove-Item "${{github.workspace}}/build/bin/*.ilk"
|
||||
|
||||
- name: Add asan runtime deps
|
||||
if: ${{matrix.type == 'asan'}}
|
||||
# msvc redist does not ship them
|
||||
shell: powershell
|
||||
run: |
|
||||
@@ -307,14 +239,18 @@ jobs:
|
||||
- name: Compress artifacts
|
||||
shell: powershell
|
||||
run: |
|
||||
Compress-Archive -Path ${{github.workspace}}/build/bin/* -Destination ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-asan-x86_64.zip
|
||||
Compress-Archive -Path ${{github.workspace}}/build/bin/* -Destination ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc${{matrix.type == 'asan' && '-asan' || ''}}-x86_64.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-asan-x86_64
|
||||
name: ${{github.event.repository.name}}-${{steps.tag.outputs.name}}-${{runner.os}}-msvc${{matrix.type == 'asan' && '-asan' || ''}}-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-asan-x86_64.zip
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc${{matrix.type == 'asan' && '-asan' || ''}}-x86_64.zip
|
||||
|
||||
# - name: Configure CMake
|
||||
# run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_ASAN=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_TOX_AV=ON
|
||||
|
||||
|
||||
dumpsyms:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -323,7 +259,7 @@ jobs:
|
||||
- linux-ubuntu
|
||||
- android
|
||||
- windows
|
||||
- windows-asan
|
||||
#- windows-asan
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -364,8 +300,8 @@ jobs:
|
||||
run: |
|
||||
mkdir ./artifacts/extract
|
||||
|
||||
echo $(unar -D -o ./artifacts/extract/ ./artifacts/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Linux-ubuntu22.04-x86_64/*)
|
||||
dump_syms -s tomato-dev-ubuntu22.04-x86_64-sym ./artifacts/extract/tomato
|
||||
echo $(unar -D -o ./artifacts/extract/ ./artifacts/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Linux-ubuntu24.04-x86_64/*)
|
||||
dump_syms -s tomato-dev-ubuntu24.04-x86_64-sym ./artifacts/extract/tomato
|
||||
rm -rf ./artifacts/extract/*
|
||||
|
||||
echo $(unar -D -o ./artifacts/extract/ ./artifacts/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Windows-msvc-x86_64/*)
|
||||
@@ -375,14 +311,14 @@ jobs:
|
||||
- name: Compress symbol stores
|
||||
shell: bash
|
||||
run: |
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Linux-ubuntu22.04-x86_64-symbol_store.tar.gz -C ./tomato-dev-ubuntu22.04-x86_64-sym .
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Linux-ubuntu24.04-x86_64-symbol_store.tar.gz -C ./tomato-dev-ubuntu24.04-x86_64-sym .
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Windows-msvc-x86_64-symbol_store.tar.gz -C ./tomato-dev-Windows-msvc-x86_64-sym .
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-symbol_stores
|
||||
path: |
|
||||
${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Linux-ubuntu22.04-x86_64-symbol_store.tar.gz
|
||||
${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Linux-ubuntu24.04-x86_64-symbol_store.tar.gz
|
||||
${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-Windows-msvc-x86_64-symbol_store.tar.gz
|
||||
|
||||
release:
|
||||
@@ -394,7 +330,7 @@ jobs:
|
||||
- linux-ubuntu
|
||||
- android
|
||||
- windows
|
||||
- windows-asan
|
||||
#- windows-asan
|
||||
- dumpsyms
|
||||
|
||||
permissions:
|
||||
|
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
@@ -7,13 +7,21 @@ on:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
# maybe pull into matrix?
|
||||
BUILD_TYPE: Debug
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
timeout-minutes: 10
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{matrix.os}}
|
||||
name: ${{matrix.type}} on ${{matrix.os}}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
type: ['', 'asan']
|
||||
os: ['ubuntu-latest', 'ubuntu-24.04-arm']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -21,39 +29,15 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt update && sudo apt -y install libsodium-dev cmake libx11-dev libxext-dev libxrandr-dev
|
||||
run: sudo apt update && sudo apt -y install libsodium-dev cmake libx11-dev libxext-dev libxrandr-dev
|
||||
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{github.event.repository.name}}-${{github.job}}
|
||||
key: ${{github.event.repository.name}}-${{github.job}}-${{matrix.os}}-${{matrix.type}}
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
|
||||
|
||||
linux-arm:
|
||||
timeout-minutes: 10
|
||||
|
||||
runs-on: ubuntu-24.04-arm
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt update && sudo apt -y install libsodium-dev cmake libx11-dev libxext-dev libxrandr-dev
|
||||
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{github.event.repository.name}}-${{github.job}}
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DTOMATO_ASAN=${{matrix.type == 'asan' && 'ON' || 'OFF'}}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
|
||||
@@ -194,15 +178,6 @@ jobs:
|
||||
with:
|
||||
arch: amd64
|
||||
|
||||
## sdl_image vendored needs nasm for dav1d
|
||||
#- uses: ilammy/setup-nasm@v1
|
||||
|
||||
#- name: ccache
|
||||
# uses: hendrikmuhs/ccache-action@v1.2
|
||||
# with:
|
||||
# variant: sccache
|
||||
# key: ${{github.event.repository.name}}-${{github.job}}
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe
|
||||
|
||||
|
@@ -82,6 +82,8 @@ target_sources(tomato PUBLIC
|
||||
./sys_tray.cpp
|
||||
|
||||
./string_formatter_utils.hpp
|
||||
./chat_gui/about.hpp
|
||||
./chat_gui/about.cpp
|
||||
./chat_gui/theme.hpp
|
||||
./chat_gui/theme.cpp
|
||||
./chat_gui/icons/direct.hpp
|
||||
|
54
src/chat_gui/about.cpp
Normal file
54
src/chat_gui/about.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "./about.hpp"
|
||||
|
||||
#include "./version.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
void ImGuiTomatoAbout(void) {
|
||||
if (ImGui::BeginTabBar("about")) {
|
||||
if (ImGui::BeginTabItem("tomato")) {
|
||||
std::string tomato_version_string {"tomato " TOMATO_VERSION_STR};
|
||||
if (TOMATO_GIT_DEPTH != 0) {
|
||||
tomato_version_string += "-" + std::to_string(TOMATO_GIT_DEPTH);
|
||||
}
|
||||
if (std::string_view{TOMATO_GIT_COMMIT} != "UNK") {
|
||||
tomato_version_string += "+git.";
|
||||
tomato_version_string += TOMATO_GIT_COMMIT;
|
||||
}
|
||||
|
||||
ImGui::TextUnformatted(tomato_version_string.c_str());
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::SmallButton("click to copy")) {
|
||||
ImGui::SetClipboardText(tomato_version_string.c_str());
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::TextUnformatted("TODO: tomato license");
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("imgui")) {
|
||||
ImGui::ShowAboutWindow();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("others")) {
|
||||
ImGui::TextUnformatted("TODO: list all the other libs and their licenses");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("funding")) {
|
||||
ImGui::TextWrapped("Your Help is needed, to keep the project alive, expand it's features and to inspire new features!");
|
||||
ImGui::TextLinkOpenURL("https://github.com/sponsors/Green-Sky");
|
||||
ImGui::TextUnformatted("Contact Me for more ways to help the project. :)");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
5
src/chat_gui/about.hpp
Normal file
5
src/chat_gui/about.hpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// not a window, just the content
|
||||
void ImGuiTomatoAbout(void);
|
||||
|
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <solanaceae/contact/components.hpp>
|
||||
|
||||
#include "./chat_gui/about.hpp"
|
||||
|
||||
#include "./frame_streams/sdl/sdl_audio2_frame_stream2.hpp"
|
||||
#include "./frame_streams/sdl/sdl_video_frame_stream2.hpp"
|
||||
|
||||
@@ -433,6 +435,9 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::MenuItem("About", nullptr, _show_about)) {
|
||||
_show_about = !_show_about;
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
@@ -467,6 +472,13 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
ImGui::ShowDemoWindow(&_show_tool_demo);
|
||||
}
|
||||
|
||||
if (_show_about) {
|
||||
if (ImGui::Begin("About", &_show_about, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGuiTomatoAbout();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
_compute_lower_limit_hit_rendered = true;
|
||||
|
||||
float tc_unfinished_queue_interval;
|
||||
|
@@ -117,6 +117,7 @@ struct MainScreen final : public Screen {
|
||||
bool _show_tool_debug_log {false};
|
||||
bool _show_tool_id_stack {false};
|
||||
bool _show_tool_demo {false};
|
||||
bool _show_about {false};
|
||||
|
||||
bool _window_focused {true};
|
||||
bool _window_hidden {false};
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "./json_to_config.hpp"
|
||||
|
||||
#include "./chat_gui/about.hpp"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
@@ -182,265 +184,281 @@ Screen* StartScreen::render(float, bool&) {
|
||||
const float TEXT_PROCEED_WIDTH = ImGui::CalcTextSize("proceed").x;
|
||||
const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
|
||||
|
||||
ImGui::SetNextWindowSize({656,334}, ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("start screen");
|
||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
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;
|
||||
|
||||
// +----------------------------
|
||||
// | |*tox profile*| plugins | toxcore config |
|
||||
// | +------+ +--------
|
||||
// | | ICON | | fileselector/dropdown?
|
||||
// | | | | password input
|
||||
// | +------+ +--------
|
||||
// | [proceed]
|
||||
// +----------------------------
|
||||
if (ImGui::Begin("start screen", nullptr, bg_window_flags)) {
|
||||
// TODO: imgui tox profile selector?
|
||||
|
||||
if (ImGui::BeginChild("conf", {0, ImGui::GetContentRegionAvail().y - TEXT_BASE_HEIGHT*2.f})) {
|
||||
if (ImGui::BeginTabBar("view")) {
|
||||
if (ImGui::BeginTabItem("load profile")) {
|
||||
_new_save = false;
|
||||
// +----------------------------
|
||||
// | |*tox profile*| plugins | toxcore config |
|
||||
// | +------+ +--------
|
||||
// | | ICON | | fileselector/dropdown?
|
||||
// | | | | password input
|
||||
// | +------+ +--------
|
||||
// | [proceed]
|
||||
// +----------------------------
|
||||
|
||||
ImGui::TextUnformatted("profile :");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("select")) {
|
||||
_fss.requestFile(
|
||||
[](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());
|
||||
if (ImGui::BeginChild("conf", {0, ImGui::GetContentRegionAvail().y - TEXT_BASE_HEIGHT*2.f})) {
|
||||
if (ImGui::BeginTabBar("view")) {
|
||||
if (ImGui::BeginTabItem("load profile")) {
|
||||
_new_save = false;
|
||||
|
||||
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::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::TextUnformatted("profile :");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("select")) {
|
||||
_fss.requestFile(
|
||||
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
|
||||
[this](const auto& path) {
|
||||
_tox_profile_path = path.string();
|
||||
},
|
||||
[](){}
|
||||
);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextUnformatted(it->c_str());
|
||||
ImGui::TextUnformatted(_tox_profile_path.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::TextUnformatted("password:");
|
||||
ImGui::SameLine();
|
||||
if (_show_password) {
|
||||
ImGui::InputText("##password", &_password);
|
||||
} else {
|
||||
ImGui::InputText("##password", &_password, ImGuiInputTextFlags_Password);
|
||||
}
|
||||
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");
|
||||
|
||||
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::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 = '_';
|
||||
}
|
||||
}
|
||||
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};
|
||||
if (ImGui::InputScalar("port", ImGuiDataType_U16, &value)) {
|
||||
_conf.set("tox", "proxy_port", int64_t(value));
|
||||
if (ImGui::InputScalar("start port", ImGuiDataType_U16, &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();
|
||||
|
||||
ImGui::SeparatorText("IP connectivity");
|
||||
|
||||
{
|
||||
static bool value {true};
|
||||
if (ImGui::Checkbox("ipv6", &value)) {
|
||||
_conf.set("tox", "ipv6_enabled", value);
|
||||
{
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
static bool value {true};
|
||||
if (ImGui::Checkbox("udp", &value)) {
|
||||
_conf.set("tox", "udp_enabled", value);
|
||||
ImGui::SeparatorText("local discovery");
|
||||
{
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
static bool value {true};
|
||||
if (ImGui::Checkbox("hole punching", &value)) {
|
||||
_conf.set("tox", "hole_punching_enabled", value);
|
||||
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::SetItemTooltip("Perform NAT hole punching.\nOnly meaningful if udp is enabled.");
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
{
|
||||
static uint16_t value {0};
|
||||
if (ImGui::InputScalar("start port", ImGuiDataType_U16, &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.");
|
||||
}
|
||||
{
|
||||
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.");
|
||||
if (ImGui::BeginTabItem("about")) {
|
||||
ImGuiTomatoAbout();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("local discovery");
|
||||
{
|
||||
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();
|
||||
}
|
||||
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::EndTabBar();
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
if (!_error_string.empty()) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored({1.f, 0.5f, 0.5f, 1.f}, "%s", _error_string.c_str());
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
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