Extract cloud browser item creation helper
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -119,6 +119,11 @@ The cloud-browser file-list request/response handling in
|
||||
helper in `src/node_dialog_cloud.*`, so the remaining cloud bridge debt is
|
||||
further concentrated on prompt/progress lifetime, OpenGL context guarding,
|
||||
`NodeDialogCloud` thumbnail execution, and transfer-thread execution.
|
||||
The cloud-browser slot creation and selection wiring in
|
||||
`NodeDialogCloud::load_thumbs_thread()` now also route through a focused
|
||||
helper in `src/node_dialog_cloud.*`, so the remaining cloud bridge debt is
|
||||
further concentrated on prompt/progress lifetime, OpenGL context guarding,
|
||||
`NodeDialogCloud` thumbnail execution, and transfer-thread execution.
|
||||
|
||||
Recent 2026-06-13 retained preview reductions continue to narrow DEBT-0036:
|
||||
`NodeStrokePreview::draw_stroke_immediate()` now also routes
|
||||
|
||||
@@ -625,6 +625,41 @@ Completed Task Log:
|
||||
| --- | --- | ---: | --- | --- |
|
||||
| 2026-06-15 | ADP-015 | no score movement | `MSBuild.exe out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64`; `ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure` | `b06211fa` |
|
||||
|
||||
### ADP-016 - Extract Cloud Browser Item Creation Helper
|
||||
|
||||
Status: Done
|
||||
Score: no score movement
|
||||
Debt: `DEBT-0038`
|
||||
Scope: `src/node_dialog_cloud.*` only
|
||||
|
||||
Goal:
|
||||
|
||||
Reduce the inline retained cloud-browser loader surface in
|
||||
`NodeDialogCloud::load_thumbs_thread()` by extracting the slot-creation and
|
||||
selection-wiring loop into a focused helper while preserving current behavior.
|
||||
|
||||
Done Checks:
|
||||
|
||||
- The cloud-browser slot-creation and selection-wiring loop no longer lives
|
||||
inline in `NodeDialogCloud::load_thumbs_thread()`.
|
||||
- The retained cloud-browser item creation path now routes through a focused
|
||||
helper in `src/node_dialog_cloud.*`.
|
||||
- `DEBT-0038` and the roadmap note the reduced remaining `NodeDialogCloud`
|
||||
surface.
|
||||
|
||||
Validation:
|
||||
|
||||
```powershell
|
||||
& 'C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe' out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64
|
||||
ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure
|
||||
```
|
||||
|
||||
Completed Task Log:
|
||||
|
||||
| Date | Task | Score | Validation | Commit |
|
||||
| --- | --- | ---: | --- | --- |
|
||||
| 2026-06-15 | ADP-016 | no score movement | `MSBuild.exe out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64`; `ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure` | `(pending)` |
|
||||
|
||||
Completed Task Log:
|
||||
|
||||
| Date | Task | Score | Validation | Commit |
|
||||
|
||||
@@ -78,6 +78,36 @@ bool NodeDialogCloud::load_cloud_file_list(CURL* curl, std::string& response, No
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<NodeDialogCloudItem*> NodeDialogCloud::create_cloud_file_items(const std::vector<std::string>& names)
|
||||
{
|
||||
std::vector<NodeDialogCloudItem*> nodes;
|
||||
nodes.reserve(names.size());
|
||||
|
||||
for (const auto& name : names)
|
||||
{
|
||||
auto node = new NodeDialogCloudItem;
|
||||
node->set_manager(m_manager);
|
||||
node->init();
|
||||
node->m_text->set_text(name.c_str());
|
||||
node->m_path = App::I->work_path + "/" + name;
|
||||
node->m_file_name = name;
|
||||
container->add_child(node);
|
||||
node->on_selected = [&](NodeDialogCloudItem* target) {
|
||||
if (target == current)
|
||||
return;
|
||||
selected_path = target->m_path;
|
||||
selected_file = target->m_file_name;
|
||||
selected_name = selected_file.substr(0, selected_file.length() - strlen(".ppi"));
|
||||
if (current)
|
||||
current->m_selected = false;
|
||||
current = target;
|
||||
};
|
||||
nodes.push_back(node);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
void NodeDialogCloud::load_thumbs_thread()
|
||||
{
|
||||
#if WITH_CURL
|
||||
@@ -99,30 +129,7 @@ void NodeDialogCloud::load_thumbs_thread()
|
||||
LOG("CLOUD LIST: %s", res.c_str());
|
||||
|
||||
auto names = split(res, ',');
|
||||
std::vector<NodeDialogCloudItem*> nodes;
|
||||
|
||||
// create slots with name
|
||||
for (const auto& n : names)
|
||||
{
|
||||
auto node = new NodeDialogCloudItem;
|
||||
node->set_manager(m_manager);
|
||||
node->init();
|
||||
node->m_text->set_text(n.c_str());
|
||||
node->m_path = App::I->work_path + "/" + n;
|
||||
node->m_file_name = n;
|
||||
container->add_child(node);
|
||||
node->on_selected = [&](NodeDialogCloudItem* target) {
|
||||
if (target == current)
|
||||
return;
|
||||
selected_path = target->m_path;
|
||||
selected_file = target->m_file_name;
|
||||
selected_name = selected_file.substr(0, selected_file.length() - strlen(".ppi"));
|
||||
if (current)
|
||||
current->m_selected = false;
|
||||
current = target;
|
||||
};
|
||||
nodes.push_back(node);
|
||||
}
|
||||
auto nodes = create_cloud_file_items(names);
|
||||
|
||||
// load the icons
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "node_text.h"
|
||||
#include "node_text_input.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class NodeDialogCloudItem : public NodeBorder
|
||||
{
|
||||
public:
|
||||
@@ -47,4 +49,5 @@ public:
|
||||
void load_thumbs_thread();
|
||||
NodeText* create_loading_status_text();
|
||||
bool load_cloud_file_list(CURL* curl, std::string& response, NodeText& status_text);
|
||||
std::vector<NodeDialogCloudItem*> create_cloud_file_items(const std::vector<std::string>& names);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user