Skip to content

Commit

Permalink
Fixed|UI|Client: Closed fold panel content; read-only appearance prof…
Browse files Browse the repository at this point in the history
…iles in editor

When a fold panel is closed, its content is removed from the widget
tree entirely.

The editor prevents modifying read-only profiles via the GUI
(although the cvars can still be edited).
  • Loading branch information
skyjake committed Sep 21, 2013
1 parent c72e0f0 commit 6c186bc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/widgets/foldpanelwidget.h
Expand Up @@ -46,6 +46,8 @@ class FoldPanelWidget : public PanelWidget

void setContent(GuiWidget *content);

GuiWidget &content() const;

public slots:
void toggleFold();

Expand Down
26 changes: 5 additions & 21 deletions doomsday/client/src/ui/editors/rendererappearanceeditor.cpp
Expand Up @@ -103,7 +103,10 @@ DENG2_OBSERVES(App, GameChange)
void preparePanelForOpening()
{
FoldPanelWidget::preparePanelForOpening();
_resetButton->enable();
if(!d->settings.isReadOnlyProfile(d->settings.currentProfile()))
{
_resetButton->enable();
}
}

void panelClosing()
Expand Down Expand Up @@ -210,7 +213,6 @@ DENG2_OBSERVES(App, GameChange)
DialogContentStylist stylist;
ScrollAreaWidget *container;
IndirectRule *firstColumnWidth; ///< Shared by all groups.
//ButtonWidget *conf;
ButtonWidget *close;
ProfilePickerWidget *profile;

Expand Down Expand Up @@ -241,15 +243,9 @@ DENG2_OBSERVES(App, GameChange)
container->enableIndicatorDraw(true);
stylist.setContainer(*container);

//container->add(conf = new ButtonWidget);
container->add(close = new ButtonWidget);
container->add(profile = new ProfilePickerWidget(settings, tr("appearance")));

// Button for showing renderer settings.
//conf->setImage(style().images().image("gear"));
//conf->setOverrideImageSize(style().fonts().font("default").height().value());
//conf->setAction(new SignalAction(thisPublic, SLOT(showRendererSettings())));

close->setText(tr("Close"));
close->setAction(new SignalAction(thisPublic, SLOT(close())));

Expand Down Expand Up @@ -588,13 +584,8 @@ DENG2_OBSERVES(App, GameChange)
{
g->fetch();

qDebug() << "Group" << g;
qDebug() << "content:" << &g->content();
g->resetButton().enable(!isReadOnly && g->isOpen());

g->resetButton().enable(!isReadOnly);
g->content().enable(!isReadOnly);

/*
// Enable or disable settings based on read-onlyness.
foreach(Widget *w, g->content().childWidgets())
{
Expand All @@ -603,7 +594,6 @@ DENG2_OBSERVES(App, GameChange)
st->enable(!isReadOnly);
}
}
*/
}
}
}
Expand Down Expand Up @@ -633,12 +623,6 @@ RendererAppearanceEditor::RendererAppearanceEditor()
d->close->rule()
.setInput(Rule::Right, area.right())
.setInput(Rule::Top, area.top());
/*d->conf->rule()
.setInput(Rule::Right, d->close->rule().left())
.setInput(Rule::Top, d->close->rule().top());*/

//d->current->setWidthPolicy(ui::Fixed);
//d->current->rule().setInput(Rule::Width, area.width());

SequentialLayout layout(area.left(), title->rule().bottom(), Down);

Expand Down
9 changes: 9 additions & 0 deletions doomsday/client/src/ui/widgets/foldpanelwidget.cpp
Expand Up @@ -105,6 +105,15 @@ void FoldPanelWidget::setContent(GuiWidget *content)
PanelWidget::setContent(content);
}

GuiWidget &FoldPanelWidget::content() const
{
if(d->container)
{
return *d->container;
}
return PanelWidget::content();
}

void FoldPanelWidget::toggleFold()
{
if(!isOpen())
Expand Down

0 comments on commit 6c186bc

Please sign in to comment.