From 475ed2961ff01daf72a0247621f7f3967efe41f0 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sun, 26 Jan 2014 21:48:40 +0000 Subject: [PATCH] Started to implement issue #79. Plugins that contain only a TES4 record will show up in the load order confirmation dialog with grey text. Plugins with more than just a TES4 record that have accompanying BSAs will show up with light blue text. --- src/backend/metadata.cpp | 4 ++++ src/backend/metadata.h | 1 + src/gui/main.cpp | 9 +++++++-- src/gui/main.h | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index c0aa917c..e582c47e 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -720,6 +720,10 @@ namespace boss { return issues; } + bool Plugin::HasBSA(const Game& game) const { + return boost::filesystem::exists(game.DataPath() / (name.substr(0, name.length() - 4) + ".bsa")); + } + bool operator == (const File& lhs, const Plugin& rhs) { return boost::iequals(lhs.Name(), rhs.Name()); } diff --git a/src/backend/metadata.h b/src/backend/metadata.h index 699ca21e..e73758b3 100644 --- a/src/backend/metadata.h +++ b/src/backend/metadata.h @@ -190,6 +190,7 @@ namespace boss { void EvalAllConditions(boss::Game& game, const unsigned int language); bool HasNameOnly() const; bool IsRegexPlugin() const; + bool HasBSA(const Game& game) const; //Compare name strings. bool operator == (const Plugin& rhs) const; diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 21942baf..b8c8f623 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -687,7 +687,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { progDia = NULL; BOOST_LOG_TRIVIAL(debug) << "Displaying load order preview."; - LoadOrderPreview preview(this, translate("BOSS: Calculated Load Order"), plugins); + LoadOrderPreview preview(this, translate("BOSS: Calculated Load Order"), plugins, _game); if (preview.ShowModal() == wxID_OK) { BOOST_LOG_TRIVIAL(debug) << "Load order accepted."; @@ -1102,7 +1102,7 @@ void Launcher::OnAbout(wxCommandEvent& event) { wxAboutBox(aboutInfo); } -LoadOrderPreview::LoadOrderPreview(wxWindow *parent, const wxString title, const std::list& plugins) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER), _plugins(plugins) { +LoadOrderPreview::LoadOrderPreview(wxWindow *parent, const wxString title, const std::list& plugins, const boss::Game& game) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), _plugins(plugins), _game(game) { //Init controls. _loadOrder = new wxListView(this, LIST_LoadOrder, wxDefaultPosition, wxDefaultSize, wxLC_REPORT); @@ -1115,6 +1115,11 @@ LoadOrderPreview::LoadOrderPreview(wxWindow *parent, const wxString title, const size_t i=0; for (list::const_iterator it=plugins.begin(), endit=plugins.end(); it != endit; ++it, ++i) { _loadOrder->InsertItem(i, FromUTF8(it->Name())); + if (it->FormIDs().empty()) { + _loadOrder->SetItemTextColour(i, wxColour(122, 122, 122)); + } else if (it->HasBSA(_game)) { + _loadOrder->SetItemTextColour(i, wxColour(0, 142, 219)); + } } _loadOrder->SetColumnWidth(0, wxLIST_AUTOSIZE); diff --git a/src/gui/main.h b/src/gui/main.h index e9611e9d..d79a2720 100644 --- a/src/gui/main.h +++ b/src/gui/main.h @@ -72,7 +72,7 @@ private: class LoadOrderPreview : public wxDialog { public: - LoadOrderPreview(wxWindow *parent, const wxString title, const std::list& plugins); + LoadOrderPreview(wxWindow *parent, const wxString title, const std::list& plugins, const boss::Game& game); void OnPluginSelect(wxListEvent& event); void OnMoveUp(wxCommandEvent& event); @@ -86,6 +86,7 @@ private: const std::list _plugins; std::set _movedPlugins; + const boss::Game& _game; }; #endif