mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Merge branch 'refs/heads/bsa-indicate'
This commit is contained in:
@@ -621,8 +621,8 @@ namespace boss {
|
||||
|
||||
bool Plugin::operator == (const Plugin& rhs) const {
|
||||
return (boost::iequals(name, rhs.Name())
|
||||
|| (IsRegexPlugin() && boost::regex_match(rhs.Name(), boost::regex(name, boost::regex::extended|boost::regex::icase)))
|
||||
|| (rhs.IsRegexPlugin() && boost::regex_match(name, boost::regex(rhs.Name(), boost::regex::extended|boost::regex::icase))));
|
||||
|| (IsRegexPlugin() && boost::regex_match(rhs.Name(), boost::regex(name, boost::regex::perl|boost::regex::icase)))
|
||||
|| (rhs.IsRegexPlugin() && boost::regex_match(name, boost::regex(rhs.Name(), boost::regex::perl|boost::regex::icase))));
|
||||
}
|
||||
|
||||
bool Plugin::operator != (const Plugin& rhs) const {
|
||||
@@ -720,6 +720,21 @@ namespace boss {
|
||||
return issues;
|
||||
}
|
||||
|
||||
bool Plugin::HasBSA(const Game& game) const {
|
||||
//BSAs must start with the plugin basename and have the extension .bsa.
|
||||
for (boost::filesystem::directory_iterator it(game.DataPath()); it != boost::filesystem::directory_iterator(); ++it) {
|
||||
if (boost::filesystem::is_regular_file(it->status()) && boost::iequals(it->path().extension().string(), ".bsa")) {
|
||||
BOOST_LOG_TRIVIAL(info) << name << " | " << it->path().filename().string();
|
||||
if (!IsRegexPlugin() && boost::istarts_with(it->path().filename().string(), name.substr(0, name.length() - 4)))
|
||||
return true;
|
||||
else if (IsRegexPlugin() && boost::regex_search(it->path().filename().string(), boost::regex(name.substr(0, name.length() - 5), boost::regex::perl | boost::regex::icase), boost::match_continuous)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator == (const File& lhs, const Plugin& rhs) {
|
||||
return boost::iequals(lhs.Name(), rhs.Name());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+4
-1
@@ -106,7 +106,7 @@ wxString MessageList::OnGetItemText(long item, long column) const {
|
||||
}
|
||||
}
|
||||
|
||||
Editor::Editor(wxWindow *parent, const wxString& title, const std::string userlistPath, const std::vector<boss::Plugin>& basePlugins, std::vector<boss::Plugin>& editedPlugins, const unsigned int language) : wxFrame(parent, wxID_ANY, title), _userlistPath(userlistPath), _basePlugins(basePlugins), _editedPlugins(editedPlugins) {
|
||||
Editor::Editor(wxWindow *parent, const wxString& title, const std::string userlistPath, const std::vector<boss::Plugin>& basePlugins, std::vector<boss::Plugin>& editedPlugins, const unsigned int language, const boss::Game& game) : wxFrame(parent, wxID_ANY, title), _userlistPath(userlistPath), _basePlugins(basePlugins), _editedPlugins(editedPlugins), _game(game) {
|
||||
|
||||
//Initialise child windows.
|
||||
listBook = new wxNotebook(this, BOOK_Lists);
|
||||
@@ -265,6 +265,9 @@ Editor::Editor(wxWindow *parent, const wxString& title, const std::string userli
|
||||
//Fill pluginList with the contents of basePlugins.
|
||||
for (int i=0, max=_basePlugins.size(); i < max; ++i) {
|
||||
pluginList->InsertItem(i, FromUTF8(_basePlugins[i].Name()));
|
||||
if (_basePlugins[i].HasBSA(_game)) {
|
||||
pluginList->SetItemTextColour(i, wxColour(0, 142, 219));
|
||||
}
|
||||
}
|
||||
pluginList->SetColumnWidth(0, wxLIST_AUTOSIZE);
|
||||
|
||||
|
||||
+2
-1
@@ -54,7 +54,7 @@ private:
|
||||
|
||||
class Editor : public wxFrame {
|
||||
public:
|
||||
Editor(wxWindow *parent, const wxString& title, const std::string userlistPath, const std::vector<boss::Plugin>& basePlugins, std::vector<boss::Plugin>& editedPlugins, const unsigned int language);
|
||||
Editor(wxWindow *parent, const wxString& title, const std::string userlistPath, const std::vector<boss::Plugin>& basePlugins, std::vector<boss::Plugin>& editedPlugins, const unsigned int language, const boss::Game& game);
|
||||
|
||||
void OnPluginSelect(wxListEvent& event);
|
||||
void OnEnabledToggle(wxCommandEvent& event);
|
||||
@@ -89,6 +89,7 @@ private:
|
||||
|
||||
const std::string _userlistPath;
|
||||
const std::vector<boss::Plugin> _basePlugins;
|
||||
const boss::Game& _game;
|
||||
std::vector<boss::Plugin> _editedPlugins;
|
||||
std::vector<boss::Message> currentMessages;
|
||||
|
||||
|
||||
+9
-4
@@ -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.";
|
||||
@@ -936,7 +936,7 @@ void Launcher::OnEditMetadata(wxCommandEvent& event) {
|
||||
|
||||
//Create editor window.
|
||||
BOOST_LOG_TRIVIAL(debug) << "Opening editor window.";
|
||||
Editor *editor = new Editor(this, translate("BOSS: Metadata Editor"), _game.UserlistPath().string(), installed, ulist_plugins, lang);
|
||||
Editor *editor = new Editor(this, translate("BOSS: Metadata Editor"), _game.UserlistPath().string(), installed, ulist_plugins, lang, _game);
|
||||
|
||||
progDia->Destroy();
|
||||
|
||||
@@ -1023,7 +1023,7 @@ void Launcher::OnOpenSettings(wxCommandEvent& event) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Opening settings window...";
|
||||
SettingsFrame *settings = new SettingsFrame(this, translate("BOSS: Settings"), _settings, _games);
|
||||
settings->ShowModal();
|
||||
BOOST_LOG_TRIVIAL(debug) << "Editor window opened.";
|
||||
BOOST_LOG_TRIVIAL(debug) << "Settings window opened.";
|
||||
}
|
||||
|
||||
void Launcher::OnGameChange(wxCommandEvent& event) {
|
||||
@@ -1102,7 +1102,7 @@ void Launcher::OnAbout(wxCommandEvent& event) {
|
||||
wxAboutBox(aboutInfo);
|
||||
}
|
||||
|
||||
LoadOrderPreview::LoadOrderPreview(wxWindow *parent, const wxString title, const std::list<boss::Plugin>& 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<boss::Plugin>& 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<boss::Plugin>::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);
|
||||
|
||||
|
||||
+2
-1
@@ -72,7 +72,7 @@ private:
|
||||
|
||||
class LoadOrderPreview : public wxDialog {
|
||||
public:
|
||||
LoadOrderPreview(wxWindow *parent, const wxString title, const std::list<boss::Plugin>& plugins);
|
||||
LoadOrderPreview(wxWindow *parent, const wxString title, const std::list<boss::Plugin>& plugins, const boss::Game& game);
|
||||
|
||||
void OnPluginSelect(wxListEvent& event);
|
||||
void OnMoveUp(wxCommandEvent& event);
|
||||
@@ -86,6 +86,7 @@ private:
|
||||
|
||||
const std::list<boss::Plugin> _plugins;
|
||||
std::set<std::string> _movedPlugins;
|
||||
const boss::Game& _game;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user