Skip to content

Commit

Permalink
Console|Client|UI: Added "packages" command to open the Packages sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Apr 17, 2017
1 parent 6000bd9 commit 9eaefb5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/apps/client/include/ui/clientwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class ClientWindow : public de::BaseWindow

bool hasSidebar(SidebarLocation location = RightEdge) const;

de::GuiWidget &sidebar(SidebarLocation location = RightEdge) const;

/**
* Sets the operating mode of the window. In Busy mode, the normal
* widgets of the window will be replaced with a single BusyWidget.
Expand Down
20 changes: 20 additions & 0 deletions doomsday/apps/client/src/dd_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
# include "ui/inputsystem.h"
# include "ui/busyvisual.h"
# include "ui/sys_input.h"
# include "ui/widgets/sidebarwidget.h"
# include "ui/widgets/taskbarwidget.h"
# include "ui/home/homewidget.h"

Expand Down Expand Up @@ -709,6 +710,24 @@ D_CMD(TaskBar)
return true;
}

D_CMD(PackagesSidebar)
{
DENG2_UNUSED3(src, argc, argv);

if (!DoomsdayApp::isGameLoaded()) return false;

ClientWindow &win = ClientWindow::main();
if (!win.hasSidebar())
{
win.taskBar().openPackagesSidebar();
}
else
{
win.sidebar().as<SidebarWidget>().close();
}
return true;
}

D_CMD(Tutorial)
{
DENG2_UNUSED3(src, argc, argv);
Expand Down Expand Up @@ -2461,6 +2480,7 @@ void DD_ConsoleRegister()
C_CMD_FLAGS("contoggle", "", OpenClose, CMDF_NO_DEDICATED);
C_CMD ("taskbar", "", TaskBar);
C_CMD ("tutorial", "", Tutorial);
C_CMD ("packages", "", PackagesSidebar);

/// @todo Move to UI module.
Con_TransitionRegister();
Expand Down
9 changes: 9 additions & 0 deletions doomsday/apps/client/src/ui/clientwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,15 @@ bool ClientWindow::hasSidebar(SidebarLocation location) const
return d->sidebar != 0;
}

GuiWidget &ClientWindow::sidebar(SidebarLocation location) const
{
DENG2_ASSERT(location == RightEdge);
DENG2_UNUSED(location);
DENG2_ASSERT(d->sidebar != nullptr);

return *d->sidebar;
}

bool ClientWindow::handleFallbackEvent(Event const &event)
{
return d->handleFallbackEvent(event);
Expand Down

0 comments on commit 9eaefb5

Please sign in to comment.