Loading editor/documentmanager.cpp +7 −2 Changes for editor/documentmanager.cpp: 7 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ QString DocumentManager::renderToHtml() { wrapper.appendChild(globalStyle); } try { const EditPlugin *el = _docRoot; while (el) { el->Render(wrapper); Loading @@ -173,8 +174,12 @@ QString DocumentManager::renderToHtml() { } libhtmlpp::HtmlString htmlOut; libhtmlpp::print(wrapper, htmlOut, true); return QString::fromStdString(htmlOut.str()); libhtmlpp::print(&wrapper, htmlOut, true); return QString::fromStdString(htmlOut.c_str()); } catch (libhtmlpp::HTMLException &e) { return QString("<div style=\"color: red; border: 1px solid red; padding: 10px; margin: 10px; background: #ffeeee;\">" "<b>Render Error:</b><br/>%1</div>").arg(e.what()); } } /* ---- Plugin info ---- */ Loading src/plugin.cpp +24 −8 Changes for src/plugin.cpp: 24 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -337,6 +337,14 @@ blogi::webedit::EditPluginLoad::EditPluginLoad(const std::vector<std::string> &p throw std::runtime_error("Cannot load symbol 'destroy'. Error code: " + std::to_string(lastError)); } ldplg->create_func = create_plugin; ldplg->destroy_func = destroy_plugin; } catch (const std::exception& e) { std::cerr << "Windows dll error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; continue; } } #else // Linux/Unix if (entry.path().extension() == ".so") { try{ Loading Loading @@ -364,11 +372,22 @@ blogi::webedit::EditPluginLoad::EditPluginLoad(const std::vector<std::string> &p throw err; } destroy_t* destroy_plugin = (destroy_t*) dlsym(ldplg->pldata, "destroy"); #endif EditPlugin *plg=create_plugin(); ldplg->create_func = create_plugin; ldplg->destroy_func = destroy_plugin; ldplg->ins=std::unique_ptr<EditPlugin, EditPluginDeleter>(plg, EditPluginDeleter(destroy_plugin,ldplg->pldata)); } catch (const std::exception& e) { std::cerr << "Linux so error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; continue; } catch(libhttppp::HTTPException &e){ std::cerr << "Linux so error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; continue; } } #endif if (ldplg->create_func && ldplg->destroy_func) { try { EditPlugin *plg = ldplg->create_func(); ldplg->ins=std::unique_ptr<EditPlugin, EditPluginDeleter>(plg, EditPluginDeleter(ldplg->destroy_func,ldplg->pldata)); if(_lastPlugin){ _lastPlugin->next=std::move(ldplg); Loading @@ -377,11 +396,8 @@ blogi::webedit::EditPluginLoad::EditPluginLoad(const std::vector<std::string> &p _firstPlugin=std::move(ldplg); _lastPlugin = _firstPlugin.get(); } } catch (const std::exception& e) { std::cerr << "Error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; }catch(libhttppp::HTTPException &e){ std::cerr << "Error processing file " << e.what() << ": " << e.what() << std::endl; } catch (...) { std::cerr << "Failed to initialize." << std::endl; } } } Loading Loading
editor/documentmanager.cpp +7 −2 Changes for editor/documentmanager.cpp: 7 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ QString DocumentManager::renderToHtml() { wrapper.appendChild(globalStyle); } try { const EditPlugin *el = _docRoot; while (el) { el->Render(wrapper); Loading @@ -173,8 +174,12 @@ QString DocumentManager::renderToHtml() { } libhtmlpp::HtmlString htmlOut; libhtmlpp::print(wrapper, htmlOut, true); return QString::fromStdString(htmlOut.str()); libhtmlpp::print(&wrapper, htmlOut, true); return QString::fromStdString(htmlOut.c_str()); } catch (libhtmlpp::HTMLException &e) { return QString("<div style=\"color: red; border: 1px solid red; padding: 10px; margin: 10px; background: #ffeeee;\">" "<b>Render Error:</b><br/>%1</div>").arg(e.what()); } } /* ---- Plugin info ---- */ Loading
src/plugin.cpp +24 −8 Changes for src/plugin.cpp: 24 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -337,6 +337,14 @@ blogi::webedit::EditPluginLoad::EditPluginLoad(const std::vector<std::string> &p throw std::runtime_error("Cannot load symbol 'destroy'. Error code: " + std::to_string(lastError)); } ldplg->create_func = create_plugin; ldplg->destroy_func = destroy_plugin; } catch (const std::exception& e) { std::cerr << "Windows dll error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; continue; } } #else // Linux/Unix if (entry.path().extension() == ".so") { try{ Loading Loading @@ -364,11 +372,22 @@ blogi::webedit::EditPluginLoad::EditPluginLoad(const std::vector<std::string> &p throw err; } destroy_t* destroy_plugin = (destroy_t*) dlsym(ldplg->pldata, "destroy"); #endif EditPlugin *plg=create_plugin(); ldplg->create_func = create_plugin; ldplg->destroy_func = destroy_plugin; ldplg->ins=std::unique_ptr<EditPlugin, EditPluginDeleter>(plg, EditPluginDeleter(destroy_plugin,ldplg->pldata)); } catch (const std::exception& e) { std::cerr << "Linux so error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; continue; } catch(libhttppp::HTTPException &e){ std::cerr << "Linux so error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; continue; } } #endif if (ldplg->create_func && ldplg->destroy_func) { try { EditPlugin *plg = ldplg->create_func(); ldplg->ins=std::unique_ptr<EditPlugin, EditPluginDeleter>(plg, EditPluginDeleter(ldplg->destroy_func,ldplg->pldata)); if(_lastPlugin){ _lastPlugin->next=std::move(ldplg); Loading @@ -377,11 +396,8 @@ blogi::webedit::EditPluginLoad::EditPluginLoad(const std::vector<std::string> &p _firstPlugin=std::move(ldplg); _lastPlugin = _firstPlugin.get(); } } catch (const std::exception& e) { std::cerr << "Error processing file " << entry.path().filename().string() << ": " << e.what() << std::endl; }catch(libhttppp::HTTPException &e){ std::cerr << "Error processing file " << e.what() << ": " << e.what() << std::endl; } catch (...) { std::cerr << "Failed to initialize." << std::endl; } } } Loading