Import infpnt files to android version

This commit is contained in:
Yousef Khadadeh 2026-06-01 15:42:33 +03:00
parent cde106eba7
commit 0da317e87c
17 changed files with 135 additions and 9 deletions

View file

@ -70,7 +70,7 @@ MainProgram::MainProgram():
Logger::get().set_log_function(Logger::LogType::WORLDFATAL, [&](const std::string& text) {
*logFile << "[WORLDFATAL] " << text << std::endl;
std::cout << "[WORLDFATAL] " << text << std::endl;
logMessages.emplace_front(UserLogMessage{text, UserLogMessage::COLOR_ERROR, UserLogMessage::DISPLAY_DESKTOP_ONLY});
logMessages.emplace_front(UserLogMessage{text, UserLogMessage::COLOR_ERROR, UserLogMessage::DISPLAY_FOR_ALL});
if(logMessages.size() == LOG_SIZE)
logMessages.pop_back();
g.gui.set_to_layout();
@ -345,7 +345,11 @@ void MainProgram::create_new_tab(const CustomEvents::OpenInfiniPaintFileEvent& o
newWorld = std::make_shared<World>(*this, openFile);
}
catch(const std::runtime_error& e) {
#ifdef __ANDROID__
Logger::get().log(Logger::LogType::WORLDFATAL, std::string("Failed to open canvas: ") + e.what());
#else
Logger::get().log(Logger::LogType::WORLDFATAL, "Failed to open canvas: " + (openFile.filePathSource.has_value() ? openFile.filePathSource.value().string() : "NO PATH") + " with error: " + e.what());
#endif
return;
}
worlds.emplace_back(newWorld);
@ -390,6 +394,12 @@ void MainProgram::input_open_infinipaint_file_callback(const CustomEvents::OpenI
post_callback();
}
void MainProgram::input_mobile_import_canvas_callback(const CustomEvents::MobileImportCanvasEvent& mobileImport) {
screen->input_mobile_import_canvas_callback(mobileImport);
g.gui.set_to_layout();
post_callback();
}
void MainProgram::input_paste_callback(const CustomEvents::PasteEvent& paste) {
g.input_paste_callback(paste);
screen->input_paste_callback(paste);