Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
UI|Client: Keep the select mods up-to-date
When reconfiguring Data Files within the mods selection dialog, update the list contents after mods have been refreshed.
  • Loading branch information
skyjake committed Oct 21, 2018
1 parent 1a780aa commit 6c52a50
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 25 additions & 4 deletions doomsday/apps/client/src/ui/dialogs/packagesdialog.cpp
Expand Up @@ -29,7 +29,9 @@

#include <doomsday/Games>
#include <doomsday/LumpCatalog>
#include <doomsday/res/Bundles>

#include <de/charsymbols.h>
#include <de/CallbackAction>
#include <de/ChildWidgetOrganizer>
#include <de/DocumentPopupWidget>
Expand Down Expand Up @@ -65,18 +67,28 @@ DENG_GUI_PIMPL(PackagesDialog)
* Information about a selected package. If the package file is not found, only
* the ID is known.
*/
class SelectedPackageItem : public ui::Item
class SelectedPackageItem
: public ui::Item
, DENG2_OBSERVES(res::Bundles, Identify)
{
public:
SelectedPackageItem(String const &packageId)
{
setData(packageId);
updatePackageInfo();
DoomsdayApp::bundles().audienceForIdentify() += this;
}

_file = App::packageLoader().select(packageId);
if (_file)
void updatePackageInfo()
{
if ((_file = App::packageLoader().select(packageId())) != nullptr)
{
_info = &_file->objectNamespace().subrecord(Package::VAR_PACKAGE);
}
else
{
_info = nullptr;
}
}

String packageId() const
Expand All @@ -94,6 +106,14 @@ DENG_GUI_PIMPL(PackagesDialog)
return _file;
}

void dataBundlesIdentified() override
{
Loop::mainCall([this]() {
updatePackageInfo();
notifyChange();
});
}

private:
File const *_file = nullptr;
Record const *_info = nullptr;
Expand Down Expand Up @@ -142,7 +162,8 @@ DENG_GUI_PIMPL(PackagesDialog)
}
else
{
label().setText(_item->packageId());
label().setText(Package::splitToHumanReadable(_item->packageId()) +
" " _E(D) DENG2_CHAR_MDASH " Missing");
}
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/ui/widgets/packageswidget.cpp
Expand Up @@ -1091,5 +1091,5 @@ void PackagesWidget::operator<<(PersistentState const &fromState)
void PackagesWidget::refreshPackages()
{
d->showProgressIndicator(true);
App::fileSystem().refreshAsync();
FS::get().refreshAsync();
}

0 comments on commit 6c52a50

Please sign in to comment.