some decouplings (#2)
* logger business * code review * rm c-style array * extract image rendering to view * missing view files * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * logger business * code review * rm c-style array * extract image rendering to view * missing view files * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * logger business * code review * rm c-style array * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * logger business * code review * rm c-style array * init view abstractions * leverage concepts and provide a templateized Enumerate function * RVO * get rid of some warnings * Factor out AppGLFW base class The intention here is to get rid of scaffolding in the consumer application class and allow to focus on the "important bits". * Some cleanup * dump unnecessary dependency * link stuff where needed & use only what's needed * remove deprecation warnings * add gallery toggle * make some includes private * add presets * remove dir locals, use presets instead `projectile-configure-project' in conjunction with CMakePresets.json will allow to configure the project. `projectile-compile-project' does sth similar for the compile command. This is equivalent to something like ~cmake --preset clang-debug && cmake --build build --preset clang-debug~ * use presets in pipeline --------- Co-authored-by: m-aXimilian <keuffnermax@gmail.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#include "MyApp.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <memory>
|
||||
|
||||
#include "imaging/PixelariumImage.hpp"
|
||||
#include "imgui.h"
|
||||
#include "portable-file-dialogs.h"
|
||||
#include "app_resources_default.h"
|
||||
#include "app_resources_local.h"
|
||||
#include "utilities/ILog.hpp"
|
||||
|
||||
using namespace pixelarium::imaging;
|
||||
|
||||
void pixelarium::ui::MyApp::MenuBarOptionsColumn1()
|
||||
{
|
||||
ImGui::MenuItem(SHOWIMGUIDEMOS, NULL, &this->demop_);
|
||||
ImGui::MenuItem(SHOWIMAGEGALLERY, NULL, &this->image_listp_);
|
||||
}
|
||||
|
||||
void pixelarium::ui::MyApp::MenuBarOptionsColumn2()
|
||||
{
|
||||
if (ImGui::BeginMenu(FILEMENUNAME))
|
||||
{
|
||||
if (ImGui::MenuItem("Load File"))
|
||||
{
|
||||
this->LoadImageProt();
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
}
|
||||
|
||||
void pixelarium::ui::MyApp::Run()
|
||||
{
|
||||
if (demop_) ImGui::ShowDemoWindow(&this->demop_);
|
||||
if (image_listp_) this->ImageGalleryRender();
|
||||
}
|
||||
|
||||
void pixelarium::ui::MyApp::ImageGalleryRender()
|
||||
{
|
||||
if (ImGui::BeginListBox("ListBox"))
|
||||
{
|
||||
pool_.EnumerateResources([](size_t id, const imaging::PixelariumImage&) -> void
|
||||
{ ImGui::Selectable(std::format("Image {}", id).c_str()); });
|
||||
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
}
|
||||
|
||||
void pixelarium::ui::MyApp::LoadImageProt()
|
||||
{
|
||||
size_t last_id{};
|
||||
auto res{pfd::open_file("Load Inputs", pfd::path::home(), {"All Files", "*"}, pfd::opt::multiselect).result()};
|
||||
for (auto& p : res)
|
||||
{
|
||||
this->logger_.Debug(std::format("{}: Creating image {}", __FUNCTION__, p));
|
||||
|
||||
last_id = image_view_model_->AddImage(std::make_unique<PixelariumImage>(p));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user