Skip to content

Commit

Permalink
UI|Resources|Home: Selecting .box add-on contents
Browse files Browse the repository at this point in the history
Added a new popup for selecting which contained add-ons are loaded
when a .box is loaded. The selections are saved in the
`Config.resource.selectedPackages` variable.
  • Loading branch information
skyjake committed Jul 5, 2016
1 parent dc6d6b9 commit fb331a0
Show file tree
Hide file tree
Showing 7 changed files with 512 additions and 19 deletions.
@@ -0,0 +1,38 @@
/** @file packagecontentoptionswidget.h Widget for package content options.
*
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_UI_PACKAGECONTENTOPTIONSWIDGET_H
#define DENG_CLIENT_UI_PACKAGECONTENTOPTIONSWIDGET_H

#include <de/GuiWidget>

/**
* Widget for package content options.
*/
class PackageContentOptionsWidget : public de::GuiWidget
{
public:
PackageContentOptionsWidget(de::String const &packageId,
de::Rule const &maxHeight,
de::String const &name = de::String());

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_UI_PACKAGECONTENTOPTIONSWIDGET_H
4 changes: 4 additions & 0 deletions doomsday/apps/client/include/ui/widgets/packageswidget.h
Expand Up @@ -51,6 +51,8 @@ class PackagesWidget : public de::GuiWidget, public de::IPersistent

void setFilterEditorMinimumY(de::Rule const &minY);

//void setMaximumPanelHeight(de::Rule const &maxHeight);

void setPackageStatus(IPackageStatus const &packageStatus);

/**
Expand Down Expand Up @@ -94,6 +96,8 @@ class PackagesWidget : public de::GuiWidget, public de::IPersistent

de::LineEditWidget &searchTermsEditor();

void openContentOptions(de::ui::Item const &item);

// Events.
void initialize();
void update();
Expand Down
Expand Up @@ -97,6 +97,7 @@ def setDefaults(d)
record d.resource
d.resource.iwadFolder = ''
d.resource.packageFolder = ''
d.resource.selectedPackages = {}

# Renderer settings.
record d.render
Expand Down
6 changes: 5 additions & 1 deletion doomsday/apps/client/src/ui/home/gamecolumnwidget.cpp
Expand Up @@ -289,7 +289,11 @@ DENG_GUI_PIMPL(GameColumnWidget)
b.as<ProfileItem>().game().releaseDate().year();
if (!year)
{
// ...or identifier.
// Playable profiles first.
if (prof1.isPlayable() && !prof2.isPlayable()) return true;
if (!prof1.isPlayable() && prof2.isPlayable()) return false;

// Finally, based on identifier.
return prof1.game().compareWithoutCase(prof2.game()) < 0;
}
return year < 0;
Expand Down
20 changes: 12 additions & 8 deletions doomsday/apps/client/src/ui/home/packagescolumnwidget.cpp
Expand Up @@ -69,17 +69,20 @@ DENG_GUI_PIMPL(PackagesColumnWidget)

auto *popMenu = new PopupMenuWidget;
popMenu->setColorTheme(Inverted);
popMenu->items()
<< new ui::SubwidgetItem(tr("Info"), ui::Down,
[this, packageId] () -> PopupWidget * {
return new PackagePopupWidget(packageId);
});
popMenu->items() << new ui::SubwidgetItem(tr("Info"), ui::Down,
[this, packageId] () -> PopupWidget * {
return new PackagePopupWidget(packageId);
});

if (DataBundle::packageBundleFormat(packageId) == DataBundle::Collection)
{
popMenu->items()
<< new ui::ActionItem(style().images().image("gear"),
tr("Select Packages"));
auto openOpts = [this] () {
packages->openContentOptions(*packages->actionItem());
};
popMenu->items() << new ui::ActionItem(style().images().image("gear"),
tr("Select Packages"), new CallbackAction(openOpts));
}

popMenu->items()
<< new ui::Item(ui::Item::Separator)
<< new ui::ActionItem(style().images().image("close.ring"), tr("Uninstall..."));
Expand All @@ -90,6 +93,7 @@ DENG_GUI_PIMPL(PackagesColumnWidget)

ScrollAreaWidget &area = self.scrollArea();
area.add(packages = new PackagesWidget("home-packages"));
//packages->setMaximumPanelHeight(self.rule().height() - self.margins().height() - rule("gap")*3);
packages->setActionItems(actions);
packages->rule()
.setInput(Rule::Width, area.contentRule().width())
Expand Down

0 comments on commit fb331a0

Please sign in to comment.