tomato/src/tox_client.hpp
Green Sky bfbeafddf7
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 / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
load toxcore settings from conf like totato does
add ui in startup to configure the core for this run
other start screen improvements
2025-02-06 19:47:48 +01:00

55 lines
1.4 KiB
C++

#pragma once
#include <solanaceae/util/config_model.hpp>
#include <solanaceae/toxcore/tox_default_impl.hpp>
#include <solanaceae/toxcore/tox_event_interface.hpp>
#include <solanaceae/toxcore/tox_event_provider_base.hpp>
#include <string>
#include <string_view>
#include <vector>
#include <functional>
struct ToxEventI;
class ToxClient : public ToxDefaultImpl, public ToxEventProviderBase {
private:
bool _should_stop {false};
std::function<void(const Tox_Events*)> _subscriber_raw {[](const auto*) {}}; // only 1?
std::string _self_name;
std::string _tox_profile_path;
std::string _tox_profile_password;
bool _tox_profile_dirty {true}; // set in callbacks
float _save_heat {0.f};
public:
//ToxClient(/*const CommandLine& cl*/);
ToxClient(ConfigModelI& conf, std::string_view save_path, std::string_view save_password);
~ToxClient(void);
public: // tox stuff
Tox* getTox(void) { return _tox; }
void setDirty(void) { _tox_profile_dirty = true; }
// returns false when we shoul stop the program
bool iterate(float time_delta);
void stop(void); // let it know it should exit
void setToxProfilePath(const std::string& new_path) { _tox_profile_path = new_path; }
void setSelfName(std::string_view new_name) { _self_name = new_name; toxSelfSetName(new_name); }
void runBootstrap(void);
public: // raw events
void subscribeRaw(std::function<void(const Tox_Events*)> fn);
private:
void saveToxProfile(void);
};