Skip to content

Commit

Permalink
UI|Client: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 16, 2013
1 parent 87108cd commit f5e1fe5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 37 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/widgets/contextwidgetorganizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class ContextWidgetOrganizer

ui::Context const &context() const;

GuiWidget *itemWidget(ui::Context::Pos pos) const;

GuiWidget *itemWidget(ui::Item const &item) const;

private:
Expand Down
5 changes: 5 additions & 0 deletions doomsday/client/src/ui/widgets/contextwidgetorganizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ ui::Context const &ContextWidgetOrganizer::context() const
return *d->context;
}

GuiWidget *ContextWidgetOrganizer::itemWidget(ui::Context::Pos pos) const
{
return itemWidget(context().at(pos));
}

void ContextWidgetOrganizer::setWidgetFactory(IWidgetFactory &factory)
{
d->factory = &factory;
Expand Down
39 changes: 2 additions & 37 deletions doomsday/client/src/ui/widgets/taskbarwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public IGameChangeObserver
ButtonWidget *logo;
LabelWidget *status;
PopupMenuWidget *mainMenu;
//PopupMenuWidget *unloadMenu;
ScalarRule *vertShift;

QScopedPointer<Action> openAction;
Expand Down Expand Up @@ -129,7 +128,7 @@ public IGameChangeObserver

GuiWidget &itemWidget(uint pos) const
{
return *mainMenu->menu().organizer().itemWidget(mainMenu->menu().items().at(pos));
return *mainMenu->menu().organizer().itemWidget(pos);
}

void currentGameChanged(Game &newGame)
Expand Down Expand Up @@ -242,7 +241,7 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))
<< new ui::ActionItem(tr("Unload") + " " _E(b) + tr("(discard progress)"), new SignalAction(this, SLOT(unloadGame())))
<< new ui::ActionItem(tr("Cancel"), new SignalAction(d->mainMenu, SLOT(dismissPopups())));

/**
/*
* Set up items for the DE menu. Some of these are shown/hidden
* depending on whether a game is loaded.
*/
Expand All @@ -259,23 +258,6 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))

add(d->mainMenu);

// Confirmation for unloading game.
/*
d->unloadMenu = new PopupMenuWidget("unload-menu");
d->unloadMenu->setOpeningDirection(ui::Left);
d->unloadMenu->setAnchor(d->mainMenu->rule().left(),
d->itemWidget(POS_UNLOAD).rule().top() +
d->itemWidget(POS_UNLOAD).rule().height() / 2);
d->unloadMenu->menu().items()
<< new ui::Item(ui::Item::Separator, tr("Really unload the game?"))
<< new ui::ActionItem(tr("Unload") + " " _E(b) + tr("(discard progress)"), new SignalAction(this, SLOT(unloadGame())))
<< new ui::ActionItem(tr("Cancel"));
add(d->unloadMenu);
*/


d->itemWidget(POS_PANEL).hide();
d->itemWidget(POS_UNLOAD).hide();

Expand Down Expand Up @@ -336,7 +318,6 @@ void TaskBarWidget::viewResized()
void TaskBarWidget::drawContent()
{
d->updateGeometry();
//d->drawable.draw();
}

bool TaskBarWidget::handleEvent(Event const &event)
Expand Down Expand Up @@ -375,15 +356,6 @@ bool TaskBarWidget::handleEvent(Event const &event)
// Shift-Esc opens and closes the task bar.
if(key.ddKey() == DDKEY_ESCAPE)
{
#if 0
// Shift-Esc opens the console.
if()
{
root().setFocus(&d->console->commandLine());
if(!isOpen()) open(false /* no action */);
return true;
}
#endif
if(isOpen())
{
// First press of Esc will just dismiss the console.
Expand Down Expand Up @@ -503,13 +475,6 @@ void TaskBarWidget::openMainMenu()
d->mainMenu->open();
}

/*
void TaskBarWidget::confirmUnloadGame()
{
d->unloadMenu->open();
}
*/

void TaskBarWidget::unloadGame()
{
Con_Execute(CMDS_DDAY, "unload", false, false);
Expand Down

0 comments on commit f5e1fe5

Please sign in to comment.