[feat] separate function Run() into several functions

This commit is contained in:
dijunkun
2025-04-09 16:51:33 +08:00
parent badcd6a05c
commit cf078be53f
3 changed files with 312 additions and 320 deletions

View File

@@ -25,8 +25,6 @@
#include "speaker_capturer_factory.h"
#include "thumbnail.h"
extern const Uint32 STREAM_FRASH;
class Render {
public:
struct SubStreamWindowProperties {
@@ -101,6 +99,21 @@ class Render {
public:
int Run();
private:
void InitializeSettings();
void InitializeSDL();
void InitializeModules();
void InitializeMainWindow();
void MainLoop();
void UpdateLabels();
void UpdateInteractions();
void HandleRecentConnections();
void HandleStreamWindow();
void Cleanup();
void CleanupFactories();
void CleanupPeers();
void ProcessSdlEvent();
private:
int CreateStreamRenderWindow();
int TitleBar(bool main_window);
@@ -116,11 +129,9 @@ class Render {
int StatusBar();
int ConnectionStatusWindow(
std::shared_ptr<SubStreamWindowProperties> &properties);
int LoadRecentConnections();
int ShowRecentConnections();
private:
int CreateRtcConnection();
int ConnectTo(const std::string &remote_id, const char *password,
bool remember_password);
int CreateMainWindow();
@@ -239,6 +250,7 @@ class Render {
SDL_Renderer *main_renderer_ = nullptr;
ImGuiContext *main_ctx_ = nullptr;
bool exit_ = false;
char *argb_buffer_ = nullptr;
// main window properties
bool start_mouse_controller_ = false;