Skip to content

Commit

Permalink
UI|Home: Usability improvements
Browse files Browse the repository at this point in the history
Show a different message when user-selected packages are missing
vs. when the game IWAD files are missing.

Re-filter savegames for a profile after the selected packages have
been changed.

Double-clicking saves is no longer possible, as it was a little
cumbersome.
  • Loading branch information
skyjake committed Mar 5, 2017
1 parent 361a2e5 commit a20b92d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
11 changes: 9 additions & 2 deletions doomsday/apps/client/src/ui/dialogs/packagesdialog.cpp
Expand Up @@ -297,8 +297,15 @@ DENG_GUI_PIMPL(PackagesDialog)
}
}
}
gameDataFiles->setText(_E(l) + String::format("Data file%s: ", dataFiles.size() != 1? "s" : "") +
_E(.) + String::join(dataFiles, _E(l) " and " _E(.)));
if (!dataFiles.isEmpty())
{
gameDataFiles->setText(_E(l) + String::format("Data file%s: ", dataFiles.size() != 1? "s" : "") +
_E(.) + String::join(dataFiles, _E(l) " and " _E(.)));
}
else
{
gameDataFiles->setText(_E(D) + tr("Locate data file in Data Files settings"));
}
}
}

Expand Down
29 changes: 16 additions & 13 deletions doomsday/apps/client/src/ui/home/gamepanelbuttonwidget.cpp
Expand Up @@ -68,6 +68,8 @@ DENG_GUI_PIMPL(GamePanelButtonWidget)
return false;
}

if (!gameProfile.isPlayable()) return false;

StringList const savePacks = item.loadedPackages();

// Fallback for older saves without package metadata.
Expand Down Expand Up @@ -109,15 +111,8 @@ DENG_GUI_PIMPL(GamePanelButtonWidget)
&PackagesButtonWidget::packageSelectionChanged,
[this] (QStringList ids)
{
StringList pkgs;
for (auto const &i : ids) pkgs << i;
gameProfile.setPackages(pkgs);
updatePackagesIndicator();
if (catalog.setPackages(gameProfile.allRequiredPackages()))
{
updateGameTitleImage();
}
savedItems.refilter();
gameProfile.setPackages(toStringList(ids));
self().updateContent();
});

playButton = new ButtonWidget;
Expand Down Expand Up @@ -274,18 +269,21 @@ void GamePanelButtonWidget::setSelected(bool selected)

void GamePanelButtonWidget::updateContent()
{
bool const isPlayable = d->game().isPlayable();
bool const isPlayable = d->gameProfile.isPlayable();
bool const isGamePlayable = d->game().isPlayableWithDefaultPackages();

playButton().enable(isPlayable);
d->problemIcon->show(!isPlayable);
playButton().show(isPlayable);
updateButtonLayout();
d->problemIcon->show(!isGamePlayable);
d->updatePackagesIndicator();

String meta = !d->gameProfile.isUserCreated()? String::number(d->game().releaseDate().year())
: d->game().title();

if (isSelected())
{
if (!d->game().isPlayable())
if (!isGamePlayable)
{
meta = _E(D) + tr("Missing data files") + _E(.);
}
Expand All @@ -299,6 +297,11 @@ void GamePanelButtonWidget::updateContent()
}
}

if (!isPlayable && isGamePlayable)
{
meta = _E(D) + tr("Selected packages missing") + _E(.);
}

label().setText(String(_E(b) "%1\n" _E(l) "%2")
.arg(d->gameProfile.name())
.arg(meta));
Expand All @@ -309,6 +312,7 @@ void GamePanelButtonWidget::updateContent()
{
d->updateGameTitleImage();
}
d->savedItems.refilter();
}

void GamePanelButtonWidget::unselectSave()
Expand Down Expand Up @@ -356,7 +360,6 @@ void GamePanelButtonWidget::selectPackages()
void GamePanelButtonWidget::clearPackages()
{
d->gameProfile.setPackages(StringList());
d->savedItems.refilter();
updateContent();
}

Expand Down
9 changes: 7 additions & 2 deletions doomsday/apps/client/src/ui/home/packagescolumnwidget.cpp
Expand Up @@ -101,8 +101,13 @@ DENG_GUI_PIMPL(PackagesColumnWidget)
menu->items()
<< new ui::ActionItem(/*style().images().image("refresh"), */tr("Refresh"),
new CallbackAction([this] () { packages->refreshPackages(); }))
<< new ui::SubwidgetItem(tr("Folders"), ui::Left, makePackageFoldersDialog);
return menu;
<< new ui::SubwidgetItem(tr("Folders"), ui::Left, [menu] () -> PopupWidget *
{
auto *pop = makePackageFoldersDialog();
QObject::connect(pop, SIGNAL(closed()), menu, SLOT(close()));
return pop;
});
return menu;
}, ui::Down);
}
};
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/client/src/ui/home/savelistwidget.cpp
Expand Up @@ -35,11 +35,11 @@ DENG_GUI_PIMPL(SaveListWidget)
/**
* Handles mouse button doubleclicks on the save items.
*/
struct DoubleClickHandler : public GuiWidget::IEventHandler
struct ClickHandler : public GuiWidget::IEventHandler
{
SaveListWidget::Impl *d;

DoubleClickHandler(SaveListWidget::Impl *d) : d(d) {}
ClickHandler(SaveListWidget::Impl *d) : d(d) {}

bool handleEvent(GuiWidget &button, Event const &event)
{
Expand Down Expand Up @@ -67,12 +67,12 @@ DENG_GUI_PIMPL(SaveListWidget)
}
}

if (button.hitTest(mouse) && mouse.state() == MouseEvent::DoubleClick)
/*if (button.hitTest(mouse) && mouse.state() == MouseEvent::DoubleClick)
{
emit d->self().doubleClicked(d->self().items().find(
*d->self().organizer().findItemForWidget(button)));
return true;
}
}*/
}
return false;
}
Expand Down Expand Up @@ -118,7 +118,7 @@ DENG_GUI_PIMPL(SaveListWidget)
toggleSelectedItem(button);
emit owner.mouseActivity();
});
button.addEventHandler(new DoubleClickHandler(this));
button.addEventHandler(new ClickHandler(this));

auto const &saveItem = item.as<SaveListData::SaveItem>();
button.setImage(style().images().image(Game::logoImageForId(saveItem.gameId())));
Expand Down

0 comments on commit a20b92d

Please sign in to comment.