Extract app status planning into app core

This commit is contained in:
2026-06-03 09:45:12 +02:00
parent a64a63def7
commit 4d06608cc9
9 changed files with 385 additions and 21 deletions

View File

@@ -5,6 +5,7 @@
#include "node_dialog_open.h"
#include "node_progress_bar.h"
#include "mp4enc.h"
#include "app_core/app_status.h"
#include "app_core/document_recording.h"
#include "app_core/document_route.h"
#include "app_core/document_session.h"
@@ -682,9 +683,8 @@ void App::update_memory_usage(size_t bytes)
{
if (auto txt = layout[main_id]->find<NodeText>("txt-memory"))
{
static char buffer[128];
sprintf(buffer, "History memory: %.2f Mb", bytes / 1024.f / 1024.f);
txt->set_text(buffer);
const auto label = pp::app::make_history_memory_label(bytes);
txt->set_text(label.c_str());
}
}
@@ -692,32 +692,30 @@ void App::update_rec_frames()
{
if (auto txt = layout[main_id]->find<NodeText>("txt-rec"))
{
if (rec_running && Canvas::I->m_encoder)
{
static char buffer[128];
sprintf(buffer, "Recorded %d frames", Canvas::I->m_encoder->frames_count());
txt->set_text(buffer);
}
else
{
txt->set_text("");
}
const auto label = pp::app::make_recording_frame_label(
rec_running,
Canvas::I->m_encoder != nullptr,
Canvas::I->m_encoder ? Canvas::I->m_encoder->frames_count() : 0);
txt->set_text(label.text.c_str());
}
}
int App::res_from_index(int i)
{
return res_map[i];
const auto resolution = pp::app::display_resolution_from_index(i);
return resolution ? resolution.value() : pp::app::document_resolution_values.front();
}
int App::res_to_index(int res)
{
return (int)std::distance(res_map.begin(), std::find(res_map.begin(), res_map.end(), res));
const auto index = pp::app::document_resolution_to_index(res);
return index ? static_cast<int>(index.value()) : static_cast<int>(pp::app::document_resolution_values.size());
}
std::string App::res_to_string(int res)
{
return res_map_str[res_to_index(res)];
const auto label = pp::app::document_resolution_label(res);
return label ? std::string(label.value()) : std::string("unknown");
}
void App::renderdoc_frame_start()