Skip to content

Commit

Permalink
Tutorial|Client: New visual appearance
Browse files Browse the repository at this point in the history
Background is blurred instead of darkened, and the tutorial popups
use the informational (inverted) style to stand out.

Added a special blurring widget behind the task bar that can be
shown to blur the entire view when needed.
  • Loading branch information
skyjake committed Mar 10, 2014
1 parent e4ce3fe commit 3a688de
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions doomsday/client/include/ui/clientwindow.h
Expand Up @@ -75,6 +75,7 @@ class ClientWindow : public de::BaseWindow,

ClientRootWidget &root();
TaskBarWidget &taskBar();
de::GuiWidget &taskBarBlur();
ConsoleWidget &console();
de::NotificationWidget &notifications();
GameWidget &game();
Expand Down
16 changes: 16 additions & 0 deletions doomsday/client/src/ui/clientwindow.cpp
Expand Up @@ -77,6 +77,7 @@ DENG2_PIMPL(ClientWindow)
GameWidget *game;
GameUIWidget *gameUI;
TaskBarWidget *taskBar;
LabelWidget *taskBarBlur; ///< Blur everything below the task bar.
NotificationWidget *notifications;
AlertDialog *alerts;
ColorAdjustmentDialog *colorAdjust;
Expand Down Expand Up @@ -107,6 +108,7 @@ DENG2_PIMPL(ClientWindow)
, game(0)
, gameUI(0)
, taskBar(0)
, taskBarBlur(0)
, notifications(0)
, alerts(0)
, colorAdjust(0)
Expand Down Expand Up @@ -216,6 +218,13 @@ DENG2_PIMPL(ClientWindow)
fpsCounter->setSizePolicy(ui::Expand, ui::Expand);
fpsCounter->setAlignment(ui::AlignRight);

// Everything behind the task bar can be blurred with this widget.
taskBarBlur = new LabelWidget("taskbar-blur");
taskBarBlur->set(GuiWidget::Background(Vector4f(1, 1, 1, 1), GuiWidget::Background::Blurred));
taskBarBlur->rule().setRect(root.viewRule());
taskBarBlur->hide(); // must be explicitly shown if needed
container().add(taskBarBlur);

// Taskbar is over almost everything else.
taskBar = new TaskBarWidget;
taskBar->rule()
Expand Down Expand Up @@ -547,6 +556,7 @@ DENG2_PIMPL(ClientWindow)
container().remove(*gameSelMenu);
if(sidebar) container().remove(*sidebar);
container().remove(*notifications);
container().remove(*taskBarBlur);
container().remove(*taskBar);
container().remove(*cursor);

Expand Down Expand Up @@ -593,6 +603,7 @@ DENG2_PIMPL(ClientWindow)
container().add(gameSelMenu);
if(sidebar) container().add(sidebar);
container().add(notifications);
container().add(taskBarBlur);
container().add(taskBar);

// Also the other widgets.
Expand Down Expand Up @@ -687,6 +698,11 @@ TaskBarWidget &ClientWindow::taskBar()
return *d->taskBar;
}

GuiWidget &ClientWindow::taskBarBlur()
{
return *d->taskBarBlur;
}

ConsoleWidget &ClientWindow::console()
{
return d->taskBar->console();
Expand Down
31 changes: 19 additions & 12 deletions doomsday/client/src/ui/widgets/tutorialwidget.cpp
Expand Up @@ -43,7 +43,7 @@ DENG_GUI_PIMPL(TutorialWidget)
};

Step current;
LabelWidget *darken;
//LabelWidget *darken;
MessageDialog *dlg;
LabelWidget *highlight;
QTimer flashing;
Expand All @@ -56,11 +56,11 @@ DENG_GUI_PIMPL(TutorialWidget)
, dlg(0)
, taskBarInitiallyOpen(ClientWindow::main().taskBar().isOpen())
, untrapper(ClientWindow::main())
{
{/*
self.add(darken = new LabelWidget);
darken->set(Background(style().colors().colorf("altaccent") *
Vector4f(.3f, .3f, .3f, .55f)));
darken->setOpacity(0);
darken->setOpacity(0);*/

self.add(highlight = new LabelWidget);
/*highlight->set(Background(Background::BorderGlow,
Expand Down Expand Up @@ -139,6 +139,7 @@ DENG_GUI_PIMPL(TutorialWidget)

current = s;
dlg = new MessageDialog;
dlg->useInfoStyle();
dlg->setDeleteAfterDismissed(true);
dlg->setClickToClose(false);
QObject::connect(dlg, SIGNAL(accepted(int)), thisPublic, SLOT(continueToNextStep()));
Expand Down Expand Up @@ -169,7 +170,7 @@ DENG_GUI_PIMPL(TutorialWidget)
"configuration settings, "
"and a console command line for advanced users.\n\n"
"Press %1 at any time to access the task bar.")
.arg(_E(b)_E(D) "Shift-Esc" _E(.)_E(.)));
.arg(_E(b) "Shift-Esc" _E(.)));

win.taskBar().open();
win.taskBar().closeMainMenu();
Expand Down Expand Up @@ -207,7 +208,9 @@ DENG_GUI_PIMPL(TutorialWidget)
msg += "\n\nHere you can set a keyboard shortcut for accessing the console quickly. "
"Click in the box below and then press the key or key combination you "
"want to assign as the shortcut.";
dlg->area().add(InputBindingWidget::newTaskBarShortcut());
InputBindingWidget *bind = InputBindingWidget::newTaskBarShortcut();
bind->useInfoStyle();
dlg->area().add(bind);
}
dlg->message().setText(msg);
dlg->setAnchor(win.taskBar().console().commandLine().rule().left() +
Expand All @@ -223,9 +226,9 @@ DENG_GUI_PIMPL(TutorialWidget)
}

// Keep the tutorial on top so any popup menus opened will stay darkened.
GuiRootWidget &r = self.root();
r.remove(self);
r.addOnTop(thisPublic);
//GuiRootWidget &r = self.root();
//r.remove(self);
//r.addOnTop(thisPublic);

self.root().addOnTop(dlg);
dlg->open();
Expand All @@ -240,9 +243,11 @@ TutorialWidget::TutorialWidget()

void TutorialWidget::start()
{
// Darken the entire view.
d->darken->rule().setRect(rule());
d->darken->setOpacity(1, 0.5);
// Blur the rest of the view.
GuiWidget &blur = ClientWindow::main().taskBarBlur();
blur.show();
blur.setOpacity(0);
blur.setOpacity(1, .5);

d->initStep(Instance::Welcome);
}
Expand All @@ -257,12 +262,14 @@ void TutorialWidget::stop()
d->deinitStep();

// Animate away and unfade darkening.
d->darken->setOpacity(0, 0.5);
ClientWindow::main().taskBarBlur().setOpacity(0, .5);

QTimer::singleShot(500, this, SLOT(dismiss()));
}

void TutorialWidget::dismiss()
{
ClientWindow::main().taskBarBlur().hide();
hide();
guiDeleteLater();
}
Expand Down

0 comments on commit 3a688de

Please sign in to comment.