2023-07-26 12:24:18 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "./screen.hpp"
|
|
|
|
|
2024-04-12 13:34:20 +02:00
|
|
|
#include <solanaceae/object_store/object_store.hpp>
|
2023-07-26 12:55:50 +02:00
|
|
|
#include <solanaceae/util/simple_config_model.hpp>
|
|
|
|
#include <solanaceae/contact/contact_model3.hpp>
|
|
|
|
#include <solanaceae/message3/registry_message_model.hpp>
|
2023-07-29 20:51:32 +02:00
|
|
|
#include <solanaceae/message3/message_time_sort.hpp>
|
2024-04-14 13:58:31 +02:00
|
|
|
#include <solanaceae/message3/message_serializer.hpp>
|
2023-07-26 12:55:50 +02:00
|
|
|
#include <solanaceae/plugin/plugin_manager.hpp>
|
|
|
|
#include <solanaceae/toxcore/tox_event_logger.hpp>
|
2023-11-13 15:14:30 +01:00
|
|
|
#include "./tox_private_impl.hpp"
|
2023-07-26 12:55:50 +02:00
|
|
|
|
2023-07-26 20:09:57 +02:00
|
|
|
#include <solanaceae/tox_contacts/tox_contact_model2.hpp>
|
|
|
|
#include <solanaceae/tox_messages/tox_message_manager.hpp>
|
|
|
|
#include <solanaceae/tox_messages/tox_transfer_manager.hpp>
|
|
|
|
|
2023-07-26 12:55:50 +02:00
|
|
|
#include "./tox_client.hpp"
|
2023-07-29 20:39:31 +02:00
|
|
|
#include "./auto_dirty.hpp"
|
2023-07-26 12:55:50 +02:00
|
|
|
|
2023-08-02 19:24:51 +02:00
|
|
|
#include "./media_meta_info_loader.hpp"
|
2023-10-14 15:59:32 +02:00
|
|
|
#include "./tox_avatar_manager.hpp"
|
2023-08-02 19:24:51 +02:00
|
|
|
|
2023-07-26 20:09:57 +02:00
|
|
|
#include "./sdlrenderer_texture_uploader.hpp"
|
2024-02-05 16:05:45 +01:00
|
|
|
#include "./texture_cache.hpp"
|
|
|
|
#include "./tox_avatar_loader.hpp"
|
|
|
|
#include "./message_image_loader.hpp"
|
|
|
|
|
2023-07-28 18:03:45 +02:00
|
|
|
#include "./chat_gui4.hpp"
|
2024-04-20 17:57:11 +02:00
|
|
|
#include "./chat_gui/settings_window.hpp"
|
2024-07-16 15:02:52 +02:00
|
|
|
#include "./object_store_ui.hpp"
|
2023-10-20 21:40:45 +02:00
|
|
|
#include "./tox_ui_utils.hpp"
|
2023-11-13 16:23:49 +01:00
|
|
|
#include "./tox_dht_cap_histo.hpp"
|
2024-02-02 20:26:50 +01:00
|
|
|
#include "./tox_friend_faux_offline_messaging.hpp"
|
2023-07-26 20:09:57 +02:00
|
|
|
|
2024-07-20 13:46:41 +02:00
|
|
|
#if TOMATO_TOX_AV
|
|
|
|
#include "./tox_av.hpp"
|
|
|
|
#endif
|
|
|
|
|
2023-07-26 12:24:18 +02:00
|
|
|
#include <string>
|
2023-07-26 12:55:50 +02:00
|
|
|
#include <iostream>
|
|
|
|
#include <chrono>
|
2023-07-26 12:24:18 +02:00
|
|
|
|
2023-07-26 20:09:57 +02:00
|
|
|
// fwd
|
|
|
|
extern "C" {
|
|
|
|
struct SDL_Renderer;
|
|
|
|
} // C
|
|
|
|
|
2023-07-26 12:24:18 +02:00
|
|
|
struct MainScreen final : public Screen {
|
2023-07-26 20:09:57 +02:00
|
|
|
SDL_Renderer* renderer;
|
|
|
|
|
2024-04-11 11:54:00 +02:00
|
|
|
ObjectStore2 os;
|
2024-02-13 12:30:29 +01:00
|
|
|
|
2023-07-26 12:55:50 +02:00
|
|
|
SimpleConfigModel conf;
|
|
|
|
Contact3Registry cr;
|
|
|
|
RegistryMessageModel rmm;
|
2024-04-14 13:58:31 +02:00
|
|
|
MessageSerializerNJ msnj;
|
2023-07-29 20:51:32 +02:00
|
|
|
MessageTimeSort mts;
|
2023-07-26 12:55:50 +02:00
|
|
|
|
|
|
|
ToxEventLogger tel{std::cout};
|
|
|
|
ToxClient tc;
|
2023-11-13 15:14:30 +01:00
|
|
|
ToxPrivateImpl tpi;
|
2023-07-29 20:39:31 +02:00
|
|
|
AutoDirty ad;
|
2024-07-20 13:46:41 +02:00
|
|
|
#if TOMATO_TOX_AV
|
|
|
|
ToxAV tav;
|
|
|
|
#endif
|
2023-07-26 20:09:57 +02:00
|
|
|
ToxContactModel2 tcm;
|
|
|
|
ToxMessageManager tmm;
|
|
|
|
ToxTransferManager ttm;
|
2024-02-02 20:26:50 +01:00
|
|
|
ToxFriendFauxOfflineMessaging tffom;
|
2023-07-26 12:55:50 +02:00
|
|
|
|
2024-04-21 14:17:50 +02:00
|
|
|
Theme& theme;
|
|
|
|
|
2023-08-02 19:24:51 +02:00
|
|
|
MediaMetaInfoLoader mmil;
|
2023-10-14 15:59:32 +02:00
|
|
|
ToxAvatarManager tam;
|
2023-08-02 19:24:51 +02:00
|
|
|
|
2023-07-26 20:09:57 +02:00
|
|
|
SDLRendererTextureUploader sdlrtu;
|
2023-07-26 12:55:50 +02:00
|
|
|
//OpenGLTextureUploader ogltu;
|
|
|
|
|
2024-02-05 16:05:45 +01:00
|
|
|
ToxAvatarLoader tal;
|
|
|
|
TextureCache<void*, Contact3, ToxAvatarLoader> contact_tc;
|
|
|
|
MessageImageLoader mil;
|
|
|
|
TextureCache<void*, Message3Handle, MessageImageLoader> msg_tc;
|
|
|
|
|
2023-07-28 18:03:45 +02:00
|
|
|
ChatGui4 cg;
|
2023-10-19 17:21:45 +02:00
|
|
|
SettingsWindow sw;
|
2024-07-16 15:02:52 +02:00
|
|
|
ObjectStoreUI osui;
|
2023-10-20 21:40:45 +02:00
|
|
|
ToxUIUtils tuiu;
|
2023-11-13 16:23:49 +01:00
|
|
|
ToxDHTCapHisto tdch;
|
2023-07-26 12:55:50 +02:00
|
|
|
|
2024-04-06 11:56:18 +02:00
|
|
|
PluginManager pm; // last, so it gets destroyed first
|
|
|
|
|
2024-01-21 20:20:32 +01:00
|
|
|
bool _show_tool_style_editor {false};
|
2024-03-15 13:01:14 +01:00
|
|
|
bool _show_tool_metrics {false};
|
|
|
|
bool _show_tool_debug_log {false};
|
|
|
|
bool _show_tool_id_stack {false};
|
2024-09-22 12:35:19 +02:00
|
|
|
bool _show_tool_demo {false};
|
2024-01-21 20:20:32 +01:00
|
|
|
|
2024-01-06 14:38:21 +01:00
|
|
|
bool _window_hidden {false};
|
2024-02-02 20:55:20 +01:00
|
|
|
uint64_t _window_hidden_ts {0};
|
2024-01-07 22:20:40 +01:00
|
|
|
float _time_since_event {0.f};
|
2024-01-06 14:38:21 +01:00
|
|
|
|
2024-08-13 16:17:25 +02:00
|
|
|
std::vector<std::string> _dopped_files;
|
|
|
|
|
2024-05-30 11:46:58 +02:00
|
|
|
MainScreen(SimpleConfigModel&& conf_, SDL_Renderer* renderer_, Theme& theme_, std::string save_path, std::string save_password, std::string new_username, std::vector<std::string> plugins);
|
2023-07-26 20:09:57 +02:00
|
|
|
~MainScreen(void);
|
2023-07-26 12:24:18 +02:00
|
|
|
|
2023-07-30 15:10:26 +02:00
|
|
|
bool handleEvent(SDL_Event& e) override;
|
|
|
|
|
2023-07-26 12:24:18 +02:00
|
|
|
// return nullptr if not next
|
|
|
|
// sets bool quit to true if exit
|
2024-01-05 14:47:08 +01:00
|
|
|
Screen* render(float time_delta, bool&) override;
|
|
|
|
Screen* tick(float time_delta, bool&) override;
|
|
|
|
|
2024-01-09 15:57:20 +01:00
|
|
|
// 0 - normal
|
|
|
|
// 1 - reduced
|
|
|
|
// 2 - power save
|
2024-02-05 16:10:30 +01:00
|
|
|
int _fps_perf_mode {0};
|
2024-01-06 14:38:21 +01:00
|
|
|
// 0 - normal
|
|
|
|
// 1 - power save
|
|
|
|
int _compute_perf_mode {0};
|
|
|
|
|
2024-01-05 14:47:08 +01:00
|
|
|
float _render_interval {1.f/60.f};
|
|
|
|
float _min_tick_interval {0.f};
|
|
|
|
|
|
|
|
float nextRender(void) override { return _render_interval; }
|
|
|
|
float nextTick(void) override { return _min_tick_interval; }
|
2023-07-26 12:24:18 +02:00
|
|
|
};
|
|
|
|
|