Bridge app dialog creation
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "app_core/document_export.h"
|
||||
#include "app_core/document_session.h"
|
||||
#include "legacy_document_canvas_services.h"
|
||||
#include "legacy_app_dialog_services.h"
|
||||
#include "legacy_brush_package_export_services.h"
|
||||
#include "legacy_document_export_services.h"
|
||||
#include "legacy_document_layer_services.h"
|
||||
@@ -124,36 +125,13 @@ void start_document_export_collection(
|
||||
std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title, int total /*= 0*/)
|
||||
{
|
||||
const auto plan = pp::app::plan_app_progress_dialog(title, total);
|
||||
auto pb = std::make_shared<NodeProgressBar>();
|
||||
pb->set_manager(&layout);
|
||||
pb->init();
|
||||
pb->create();
|
||||
pb->loaded();
|
||||
pb->m_progress->SetWidthP(plan.progress_fraction);
|
||||
pb->m_title->set_text(plan.title.c_str());
|
||||
pb->m_total = plan.total;
|
||||
pb->m_count = plan.count;
|
||||
layout[main_id]->add_child(pb);
|
||||
return pb;
|
||||
return pp::panopainter::create_legacy_app_progress_dialog(*this, plan);
|
||||
}
|
||||
|
||||
std::shared_ptr<NodeMessageBox> App::message_box(const std::string &title, const std::string& text, bool cancel_button)
|
||||
{
|
||||
const auto plan = pp::app::plan_app_message_dialog(title, text, cancel_button);
|
||||
auto m = std::make_shared<NodeMessageBox>();
|
||||
m->set_manager(&layout);
|
||||
m->init();
|
||||
m->create();
|
||||
m->loaded();
|
||||
m->m_title->set_text(plan.title.c_str());
|
||||
m->m_message->set_text(plan.message.c_str());
|
||||
m->btn_ok->m_text->set_text(plan.ok_caption.c_str());
|
||||
if (plan.show_cancel)
|
||||
m->btn_cancel->m_text->set_text(plan.cancel_caption.c_str());
|
||||
else
|
||||
m->btn_cancel->destroy();
|
||||
layout[main_id]->add_child(m);
|
||||
return m;
|
||||
return pp::panopainter::create_legacy_app_message_dialog(*this, plan);
|
||||
}
|
||||
|
||||
std::shared_ptr<NodeInputBox> App::input_box(const std::string& title,
|
||||
@@ -164,17 +142,7 @@ std::shared_ptr<NodeInputBox> App::input_box(const std::string& title,
|
||||
LOG("input dialog skipped: %s", plan_result.status().message);
|
||||
return nullptr;
|
||||
}
|
||||
const auto& plan = plan_result.value();
|
||||
auto m = std::make_shared<NodeInputBox>();
|
||||
m->set_manager(&layout);
|
||||
m->init();
|
||||
m->create();
|
||||
m->loaded();
|
||||
m->m_title->set_text(plan.title.c_str());
|
||||
m->m_field_name->set_text(plan.field_name.c_str());
|
||||
m->btn_ok->m_text->set_text(plan.ok_caption.c_str());
|
||||
layout[main_id]->add_child(m);
|
||||
return m;
|
||||
return pp::panopainter::create_legacy_app_input_dialog(*this, plan_result.value());
|
||||
}
|
||||
|
||||
void App::dialog_usermanual()
|
||||
|
||||
64
src/legacy_app_dialog_services.cpp
Normal file
64
src/legacy_app_dialog_services.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#include "pch.h"
|
||||
#include "legacy_app_dialog_services.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "node_input_box.h"
|
||||
#include "node_message_box.h"
|
||||
#include "node_progress_bar.h"
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
std::shared_ptr<NodeProgressBar> create_legacy_app_progress_dialog(
|
||||
App& app,
|
||||
const pp::app::AppProgressDialogPlan& plan)
|
||||
{
|
||||
auto progress = std::make_shared<NodeProgressBar>();
|
||||
progress->set_manager(&app.layout);
|
||||
progress->init();
|
||||
progress->create();
|
||||
progress->loaded();
|
||||
progress->m_progress->SetWidthP(plan.progress_fraction);
|
||||
progress->m_title->set_text(plan.title.c_str());
|
||||
progress->m_total = plan.total;
|
||||
progress->m_count = plan.count;
|
||||
app.layout[app.main_id]->add_child(progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
std::shared_ptr<NodeMessageBox> create_legacy_app_message_dialog(
|
||||
App& app,
|
||||
const pp::app::AppMessageDialogPlan& plan)
|
||||
{
|
||||
auto message = std::make_shared<NodeMessageBox>();
|
||||
message->set_manager(&app.layout);
|
||||
message->init();
|
||||
message->create();
|
||||
message->loaded();
|
||||
message->m_title->set_text(plan.title.c_str());
|
||||
message->m_message->set_text(plan.message.c_str());
|
||||
message->btn_ok->m_text->set_text(plan.ok_caption.c_str());
|
||||
if (plan.show_cancel)
|
||||
message->btn_cancel->m_text->set_text(plan.cancel_caption.c_str());
|
||||
else
|
||||
message->btn_cancel->destroy();
|
||||
app.layout[app.main_id]->add_child(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
std::shared_ptr<NodeInputBox> create_legacy_app_input_dialog(
|
||||
App& app,
|
||||
const pp::app::AppInputDialogPlan& plan)
|
||||
{
|
||||
auto input = std::make_shared<NodeInputBox>();
|
||||
input->set_manager(&app.layout);
|
||||
input->init();
|
||||
input->create();
|
||||
input->loaded();
|
||||
input->m_title->set_text(plan.title.c_str());
|
||||
input->m_field_name->set_text(plan.field_name.c_str());
|
||||
input->btn_ok->m_text->set_text(plan.ok_caption.c_str());
|
||||
app.layout[app.main_id]->add_child(input);
|
||||
return input;
|
||||
}
|
||||
|
||||
} // namespace pp::panopainter
|
||||
26
src/legacy_app_dialog_services.h
Normal file
26
src/legacy_app_dialog_services.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "app_core/app_dialog.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class App;
|
||||
class NodeInputBox;
|
||||
class NodeMessageBox;
|
||||
class NodeProgressBar;
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
std::shared_ptr<NodeProgressBar> create_legacy_app_progress_dialog(
|
||||
App& app,
|
||||
const pp::app::AppProgressDialogPlan& plan);
|
||||
|
||||
std::shared_ptr<NodeMessageBox> create_legacy_app_message_dialog(
|
||||
App& app,
|
||||
const pp::app::AppMessageDialogPlan& plan);
|
||||
|
||||
std::shared_ptr<NodeInputBox> create_legacy_app_input_dialog(
|
||||
App& app,
|
||||
const pp::app::AppInputDialogPlan& plan);
|
||||
|
||||
} // namespace pp::panopainter
|
||||
Reference in New Issue
Block a user