Skip to content

Commit

Permalink
Fixed|UI|Updater|libappfw: Updater Settings dialog position while clo…
Browse files Browse the repository at this point in the history
…sing

In the Update Available dialog, the anchor where the Updater Settings
was attached (the Gear button) was deleted, which caused the Settings
dialog to be incorrectly positioned while being closed.
  • Loading branch information
skyjake committed Feb 28, 2014
1 parent 0a4a162 commit a34fdda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
18 changes: 4 additions & 14 deletions doomsday/client/src/updater/updateavailabledialog.cpp
Expand Up @@ -90,19 +90,6 @@ DENG2_OBSERVES(ToggleWidget, Toggle)
checking->rule().setRect(self.rule());
self.add(checking);

//settings = new ButtonWidget;
//self.add(settings);

/// @todo The dialog buttons should support a opposite-aligned button.
/*settings->setSizePolicy(ui::Filled, ui::Filled);
settings->setImage(self.style().images().image("gear"));
settings->rule()
.setInput(Rule::Left, self.area().contentRule().left())
.setInput(Rule::Bottom, self.buttons().contentRule().bottom())
.setInput(Rule::Height, self.buttons().contentRule().height())
.setInput(Rule::Width, settings->rule().height());
settings->setAction()));*/

autoCheck = new ToggleWidget;
self.area().add(autoCheck);
autoCheck->setAlignment(ui::AlignLeft);
Expand Down Expand Up @@ -225,7 +212,10 @@ void UpdateAvailableDialog::editSettings()
st->setAnchorAndOpeningDirection(buttonWidget(DialogWidget::Id1)->rule(), ui::Up);
st->setDeleteAfterDismissed(true);
if(st->exec(root()))
{
{
// The Gear button will soon be deleted, so we'll need to detach from it.
st->detachAnchor();

d->autoCheck->setInactive(UpdaterSettings().onlyCheckManually());
d->showProgress(true, SHOW_ANIM_SPAN);
emit checkAgain();
Expand Down
5 changes: 5 additions & 0 deletions doomsday/libappfw/include/de/widgets/popupwidget.h
Expand Up @@ -57,6 +57,11 @@ class LIBAPPFW_PUBLIC PopupWidget : public PanelWidget
Rule const &anchorX() const;
Rule const &anchorY() const;

/**
* Replace the anchor with rules of matching constant value.
*/
void detachAnchor();

/**
* Tells the popup to delete itself after being dismissed. The default is that
* the popup does not get deleted.
Expand Down
7 changes: 7 additions & 0 deletions doomsday/libappfw/src/widgets/popupwidget.cpp
Expand Up @@ -244,6 +244,13 @@ Rule const &PopupWidget::anchorY() const
return *d->anchorY;
}

void PopupWidget::detachAnchor()
{
setAnchorX(Constf(anchorX().value()));
setAnchorY(Constf(anchorY().value()));
d->updateLayout();
}

void PopupWidget::setDeleteAfterDismissed(bool deleteAfterDismiss)
{
d->deleteAfterDismiss = deleteAfterDismiss;
Expand Down

0 comments on commit a34fdda

Please sign in to comment.