Skip to content

Commit

Permalink
UI|Client: Fixed DialogWidget custom actions, ChoiceWidget sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 24, 2013
1 parent e6c3ccf commit 8e9e184
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
6 changes: 0 additions & 6 deletions doomsday/client/src/ui/widgets/choicewidget.cpp
Expand Up @@ -61,8 +61,6 @@ DENG2_OBSERVES(ContextWidgetOrganizer, WidgetCreation)
Instance(Public *i) : Base(i), selected(Context::InvalidPos)
{
self.setFont("choice.selected");
self.setSizePolicy(ui::Fixed, ui::Expand);
//self.setAlignment(ui::AlignLeft);

choices = new PopupMenuWidget;
choices->setAnchorAndOpeningDirection(self.hitRule(), ui::Right);
Expand All @@ -71,10 +69,6 @@ DENG2_OBSERVES(ContextWidgetOrganizer, WidgetCreation)
choices->menu().organizer().audienceForWidgetCreation += this;
self.add(choices);

// The choice button itself has the same width as the choice menu
// (i.e., the longest item's width).
self.rule().setInput(Rule::Width, choices->menu().rule().width());

self.setAction(new SignalAction(thisPublic, SLOT(openPopup())));

updateButtonWithSelection();
Expand Down
21 changes: 10 additions & 11 deletions doomsday/client/src/ui/widgets/dialogwidget.cpp
Expand Up @@ -176,14 +176,16 @@ DENG2_OBSERVES(ui::Context, Removal)
if(ButtonItem const *i = item.maybeAs<ButtonItem>())
{
ButtonWidget &but = widget.as<ButtonWidget>();

if(i->role().testFlag(Accept))
{
but.setAction(new SignalAction(thisPublic, SLOT(accept())));
}
else if(i->role().testFlag(Reject))
if(!i->action())
{
but.setAction(new SignalAction(thisPublic, SLOT(reject())));
if(i->role().testFlag(Accept))
{
but.setAction(new SignalAction(thisPublic, SLOT(accept())));
}
else if(i->role().testFlag(Reject))
{
but.setAction(new SignalAction(thisPublic, SLOT(reject())));
}
}
}
}
Expand Down Expand Up @@ -241,10 +243,7 @@ DENG2_OBSERVES(ui::Context, Removal)
// All label-based widgets should expand on their own.
if(LabelWidget *lab = w.maybeAs<LabelWidget>())
{
if(!w.is<ChoiceWidget>())
{
lab->setSizePolicy(ui::Expand, ui::Expand);
}
lab->setSizePolicy(ui::Expand, ui::Expand);
}

// Toggles should have no background.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/updater/downloaddialog.cpp
@@ -1,4 +1,4 @@
/** @file downloaddialog.cpp Dialog that downloads a distribution package.
/** @file downloaddialog.cpp Dialog that downloads a distribution package.
* @ingroup updater
*
* @authors Copyright © 2012-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/updater/updater.cpp
@@ -1,4 +1,4 @@
/** @file updater.cpp Automatic updater that works with dengine.net.
/** @file updater.cpp Automatic updater that works with dengine.net.
* @ingroup updater
*
* When one of the updater dialogs is shown, the main window is automatically
Expand Down

0 comments on commit 8e9e184

Please sign in to comment.