Skip to content

Commit

Permalink
Fixed #79
Browse files Browse the repository at this point in the history
And updated resource version.
  • Loading branch information
ousnius committed Oct 27, 2015
1 parent d12eaec commit 20fe033
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
Binary file modified BodySlide.rc
Binary file not shown.
28 changes: 15 additions & 13 deletions GroupManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,20 @@ void GroupManager::RefreshUI(const bool& clearGroups) {
}

void GroupManager::OnLoadGroup(wxFileDirPickerEvent& event) {
// Clear and load group file
currentGroupFile.Clear();
currentGroupFile.Open(event.GetPath().ToStdString());
if (currentGroupFile.fail())
// Load group file
SliderSetGroupFile groupFile(event.GetPath().ToStdString());
if (groupFile.fail())
return;

groupMembers.clear();
btRemoveGroup->Enable();

// Fill group member map
vector<string> groupNames;
currentGroupFile.GetGroupNames(groupNames, true, true);
groupFile.GetGroupNames(groupNames, true, true);
for (auto &grp : groupNames) {
SliderSetGroup group;
if (currentGroupFile.GetGroup(grp, group))
if (groupFile.GetGroup(grp, group))
return;

vector<string> members;
Expand All @@ -91,18 +90,20 @@ void GroupManager::OnLoadGroup(wxFileDirPickerEvent& event) {
}

wxFileName fileInfo(event.GetPath());
fileName = fileInfo.GetFullName();
fileName = fileInfo.GetFullPath();
RefreshUI(true);
}

void GroupManager::OnSaveGroup(wxCommandEvent& WXUNUSED(event)) {
SliderSetGroupFile groupFile;
groupFile.New(fileName.ToStdString());
for (auto &grp : groupMembers) {
SliderSetGroup group;
group.SetName(grp.first);
group.AddMembers(grp.second);
currentGroupFile.UpdateGroup(group);
groupFile.UpdateGroup(group);
}
currentGroupFile.Save();
groupFile.Save();

dirty = false;
btSave->Enable(dirty & !fileName.empty());
Expand All @@ -113,16 +114,17 @@ void GroupManager::OnSaveGroupAs(wxCommandEvent& WXUNUSED(event)) {
if (file.ShowModal() != wxID_OK)
return;

currentGroupFile.New(file.GetPath().ToStdString());
SliderSetGroupFile groupFile;
groupFile.New(file.GetPath().ToStdString());
for (auto &grp : groupMembers) {
SliderSetGroup group;
group.SetName(grp.first);
group.AddMembers(grp.second);
currentGroupFile.UpdateGroup(group);
groupFile.UpdateGroup(group);
}

currentGroupFile.Save();
fileName = file.GetFilename();
groupFile.Save();
fileName = file.GetPath();

dirty = false;
btSave->Enable(dirty & !fileName.empty());
Expand Down
1 change: 0 additions & 1 deletion GroupManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class GroupManager : public wxDialog {

bool dirty = false;
wxString fileName;
SliderSetGroupFile currentGroupFile;
map<string, vector<string>> groupMembers;
vector<string> allOutfits;

Expand Down

0 comments on commit 20fe033

Please sign in to comment.