From abb4c2aff8cccb7d2e61e9d5d5e0af43aaa6a7f1 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Fri, 9 Aug 2013 07:41:51 +0100 Subject: [PATCH] Issue #39. If there's an error, it actually gets displayed to the user. --- src/gui/main.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/gui/main.cpp b/src/gui/main.cpp index a0c65f81..0dd0840d 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -556,11 +556,15 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(trace) << "Moving masters before non-masters."; plugins.sort(boss::master_sort); + progDia->Pulse(); + //Now build overlap map. BOOST_LOG_TRIVIAL(trace) << "Building plugin overlap map."; boost::unordered_map< string, vector > overlapMap; CalcPluginOverlaps(plugins, overlapMap); + progDia->Pulse(); + BOOST_LOG_TRIVIAL(trace) << "Building the plugin dependency graph..."; bool cyclicDependenciesExist = false; @@ -654,6 +658,8 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { } } + progDia->Pulse(); + } //Just for fun - output the graph as a ".dot" file for external rendering. If I can get this pretty, I might add it to a tab in the BOSS Report - here's a few Javascript libraries for displaying .dot files, but in my test case the graph is too complex and both libraries I found ran out of memory. @@ -661,23 +667,16 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(trace) << "Outputting the graph."; boss::SaveGraph(graph, "output.dot"); - //Check for back-edges. + //Check for back-edges, then perform a topological sort. try { + BOOST_LOG_TRIVIAL(trace) << "Checking to see if the graph is cyclic."; boss::CheckForCycles(graph); - } catch (boss::error& e) { - BOOST_LOG_TRIVIAL(error) << e.what(); - } - //Now perform a topological sort. - BOOST_LOG_TRIVIAL(trace) << "Performing a topological sort on the graph."; - try { + progDia->Pulse(); + + BOOST_LOG_TRIVIAL(trace) << "Performing a topological sort."; boss::Sort(graph, plugins); - } catch (boost::not_a_dag& e) { - BOOST_LOG_TRIVIAL(error) << e.what(); - } - - if (!cyclicDependenciesExist) { progDia->Pulse(); BOOST_LOG_TRIVIAL(debug) << "Displaying load order preview."; @@ -762,13 +761,10 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(trace) << "Load order set:"; for (list::iterator it=plugins.begin(), endIt = plugins.end(); it != endIt; ++it) { BOOST_LOG_TRIVIAL(trace) << '\t' << it->Name(); - /*vector masters = it->Masters(); - if (!masters.empty()) { - out << "\t" << "Masters:" << endl; - for (size_t i=0, max=masters.size(); i < max; ++i) - out << "\t\t" << masters[i] << endl; - }*/ } + } catch (std::exception& e) { + BOOST_LOG_TRIVIAL(error) << "Failed to calculate the load order. Details: " << e.what(); + messages.push_back(boss::Message(boss::g_message_error, (format(loc::translate("Failed to calculate the load order. Details: %1%")) % e.what()).str())); } //Read the details section of the previous report, if it exists.