Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into savegame-re…
Browse files Browse the repository at this point in the history
…factor
  • Loading branch information
danij-deng committed Mar 10, 2014
2 parents a2db2fb + 9381265 commit f17f521
Show file tree
Hide file tree
Showing 33 changed files with 953 additions and 34 deletions.
4 changes: 4 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -398,11 +398,13 @@ DENG_HEADERS += \
include/ui/widgets/gameuiwidget.h \
include/ui/widgets/gamewidget.h \
include/ui/widgets/icvarwidget.h \
include/ui/widgets/inputbindingwidget.h \
include/ui/widgets/keygrabberwidget.h \
include/ui/widgets/mpselectionwidget.h \
include/ui/widgets/multiplayermenuwidget.h \
include/ui/widgets/profilepickerwidget.h \
include/ui/widgets/taskbarwidget.h \
include/ui/widgets/tutorialwidget.h \
include/ui/fi_main.h \
include/ui/finaleinterpreter.h \
include/ui/inputsystem.h \
Expand Down Expand Up @@ -732,11 +734,13 @@ SOURCES += \
src/ui/widgets/gamesessionwidget.cpp \
src/ui/widgets/gamewidget.cpp \
src/ui/widgets/gameuiwidget.cpp \
src/ui/widgets/inputbindingwidget.cpp \
src/ui/widgets/keygrabberwidget.cpp \
src/ui/widgets/mpselectionwidget.cpp \
src/ui/widgets/multiplayermenuwidget.cpp \
src/ui/widgets/profilepickerwidget.cpp \
src/ui/widgets/taskbarwidget.cpp \
src/ui/widgets/tutorialwidget.cpp \
src/ui/zonedebug.cpp \
src/updater/downloaddialog.cpp \
src/updater/processcheckdialog.cpp \
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/b_command.h
Expand Up @@ -52,6 +52,8 @@ evbinding_t* B_NewCommandBinding(evbinding_t* listRoot, const char* desc, const
void B_DestroyCommandBinding(evbinding_t* eb);
void B_EventBindingToString(const evbinding_t* eb, ddstring_t* str);

evbinding_t *B_FindCommandBinding(evbinding_t const *listRoot, char const *command, uint device);

/**
* Checks if the event matches the binding's conditions, and if so, returns an
* action with the bound command.
Expand Down
9 changes: 7 additions & 2 deletions doomsday/client/include/ui/b_context.h
Expand Up @@ -98,8 +98,13 @@ de::Action *B_ActionForEvent(ddevent_t const *event);
*/
de::Action *BindContext_ActionForEvent(bcontext_t *bc, ddevent_t const *event, bool respectHigherAssociatedContexts);

dd_bool B_FindMatchingBinding(bcontext_t* bc, evbinding_t* match1, dbinding_t* match2,
evbinding_t** evResult, dbinding_t** dResult);
/**
* Looks through context @a bc and looks for a binding that matches either
* @a match1 or @a match2.
*/
dd_bool B_FindMatchingBinding(bcontext_t* bc, evbinding_t* match1, dbinding_t* match2,
evbinding_t** evResult, dbinding_t** dResult);

void B_PrintContexts(void);
void B_PrintAllBindings(void);
void B_WriteContextToFile(const bcontext_t* bc, FILE* file);
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/b_main.h
Expand Up @@ -57,6 +57,8 @@ struct evbinding_s* B_BindCommand(const char* eventDesc, const char* command);
struct dbinding_s* B_BindControl(const char* controlDesc, const char* device);
struct dbinding_s* B_GetControlDeviceBindings(int localNum, int control, struct bcontext_s** bContext);

bool B_UnbindCommand(char const *command);

// Utils
/// @todo: move to b_util.h
int B_NewIdentifier(void);
Expand Down
62 changes: 62 additions & 0 deletions doomsday/client/include/ui/widgets/inputbindingwidget.h
@@ -0,0 +1,62 @@
/** @file inputbindingwidget.h Widget for creating input bindings.
*
* @authors Copyright (c) 2014 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_INPUTBINDINGWIDGET_H
#define DENG_CLIENT_INPUTBINDINGWIDGET_H

#include <de/AuxButtonWidget>

/**
* Widget for viewing and changing an input binding.
*/
class InputBindingWidget : public de::AuxButtonWidget
{
public:
InputBindingWidget();

void setDefaultBinding(de::String const &eventDesc);

void setCommand(de::String const &command);

/**
* Enables or disables explicitly specified modifier conditions. Bindings can be
* specified with or without modifiers -- if modifiers are not specified, the binding
* can be triggered regardless of modifier state.
*
* @param mods @c true to includes modifiers in the binding. If @c false, modifiers
* can be bound like any other input.
*/
void enableModifiers(bool mods);

void setContext(QString const &bindingContext) {
setContexts(QStringList() << bindingContext);
}

void setContexts(QStringList const &contexts);

// Events.
bool handleEvent(de::Event const &event);

public:
static InputBindingWidget *newTaskBarShortcut();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_INPUTBINDINGWIDGET_H
1 change: 1 addition & 0 deletions doomsday/client/include/ui/widgets/taskbarwidget.h
Expand Up @@ -66,6 +66,7 @@ public slots:
void switchGame();
void showMultiplayer();
void connectToServerManually();
void showTutorial();

protected slots:
void updateCommandLineLayout();
Expand Down
46 changes: 46 additions & 0 deletions doomsday/client/include/ui/widgets/tutorialwidget.h
@@ -0,0 +1,46 @@
/** @file tutorialwidget.h Introduction to the Doomsday UI.
*
* @authors Copyright (c) 2014 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_TUTORIALWIDGET_H
#define DENG_CLIENT_TUTORIALWIDGET_H

#include <de/GuiWidget>

class TutorialWidget : public de::GuiWidget
{
Q_OBJECT

public:
TutorialWidget();

void start();

// Events.
bool handleEvent(de::Event const &event);

public slots:
void continueToNextStep();
void stop();
void dismiss();
void flashHighlight();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_TUTORIALWIDGET_H
13 changes: 13 additions & 0 deletions doomsday/client/src/ui/b_command.cpp
Expand Up @@ -514,3 +514,16 @@ void B_EventBindingToString(const evbinding_t* eb, ddstring_t* str)
B_AppendConditionToString(&eb->conds[i], str);
}
}

evbinding_t *B_FindCommandBinding(evbinding_t const *listRoot, char const *command, uint device)
{
for(evbinding_t *i = listRoot->next; i != listRoot; i = i->next)
{
if(!qstricmp(i->command, command) &&
(device >= NUM_INPUT_DEVICES || i->device == device))
{
return i;
}
}
return 0;
}
8 changes: 1 addition & 7 deletions doomsday/client/src/ui/b_context.cpp
Expand Up @@ -404,11 +404,9 @@ void B_ReorderContext(bcontext_t* bc, int pos)

controlbinding_t* B_NewControlBinding(bcontext_t* bc)
{
int i;

controlbinding_t* conBin = (controlbinding_t *) M_Calloc(sizeof(controlbinding_t));
conBin->bid = B_NewIdentifier();
for(i = 0; i < DDMAXPLAYERS; ++i)
for(int i = 0; i < DDMAXPLAYERS; ++i)
{
B_InitDeviceBindingList(&conBin->deviceBinds[i]);
}
Expand Down Expand Up @@ -724,10 +722,6 @@ dd_bool B_AreConditionsEqual(int count1, const statecondition_t* conds1,
return true;
}

/**
* Looks through context @a bc and looks for a binding that matches either
* @a match1 or @a match2.
*/
dd_bool B_FindMatchingBinding(bcontext_t* bc, evbinding_t* match1,
dbinding_t* match2, evbinding_t** evResult,
dbinding_t** dResult)
Expand Down
14 changes: 14 additions & 0 deletions doomsday/client/src/ui/b_main.cpp
Expand Up @@ -725,3 +725,17 @@ DENG_EXTERN_C int DD_GetKeyCode(const char* key)
int code = B_KeyForShortName(key);
return (code ? code : key[0]);
}

bool B_UnbindCommand(const char *command)
{
bool deleted = false;
for(int i = 0; i < B_ContextCount(); ++i)
{
bcontext_t *bc = B_ContextByPos(i);
while(evbinding_t *ev = B_FindCommandBinding(&bc->commandBinds, command, NUM_INPUT_DEVICES))
{
deleted |= B_DeleteBinding(bc, ev->bid);
}
}
return deleted;
}
6 changes: 3 additions & 3 deletions doomsday/client/src/ui/clientwindow.cpp
Expand Up @@ -61,9 +61,9 @@ using namespace de;

DENG2_PIMPL(ClientWindow)
, DENG2_OBSERVES(MouseEventSource, MouseStateChange)
, DENG2_OBSERVES(Canvas, FocusChange)
, DENG2_OBSERVES(App, GameChange)
, DENG2_OBSERVES(App, StartupComplete)
, DENG2_OBSERVES(Canvas, FocusChange)
, DENG2_OBSERVES(App, GameChange)
, DENG2_OBSERVES(App, StartupComplete)
{
bool needMainInit;
bool needRecreateCanvas;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/dialogs/logsettingsdialog.cpp
Expand Up @@ -74,7 +74,7 @@ DENG2_PIMPL(LogSettingsDialog)
App::config()["log.filterBySubsystem"]));

self.area().add(metadata =
new VariableToggleWidget(tr("Show Metadata"),
new VariableToggleWidget(tr("Show Metadata in Log"),
App::config()["log.showMetadata"]));

levels << new ChoiceItem( tr("1 - X.Verbose"), LogEntry::XVerbose)
Expand Down
23 changes: 23 additions & 0 deletions doomsday/client/src/ui/widgets/consolewidget.cpp
Expand Up @@ -19,6 +19,7 @@
#include "ui/widgets/consolewidget.h"
#include "CommandAction"
#include "ui/widgets/consolecommandwidget.h"
#include "ui/widgets/inputbindingwidget.h"
#include "ui/dialogs/logsettingsdialog.h"
#include "ui/clientwindow.h"
#include "ui/styledlogsinkformatter.h"
Expand Down Expand Up @@ -234,6 +235,27 @@ DENG2_OBSERVES(Variable, Change)
}
};

static PopupWidget *consoleShortcutPopup()
{
PopupWidget *pop = new PopupWidget;
// The 'padding' widget will provide empty margins around the content.
// Popups normally do not provide any margins.
GuiWidget *padding = new GuiWidget;
padding->margins().set("dialog.gap");
InputBindingWidget *bind = InputBindingWidget::newTaskBarShortcut();
bind->setSizePolicy(ui::Expand, ui::Expand);
padding->add(bind);
// Place the binding inside the padding.
bind->rule()
.setLeftTop(padding->rule().left() + padding->margins().left(),
padding->rule().top() + padding->margins().top());
padding->rule()
.setInput(Rule::Width, bind->rule().width() + padding->margins().width())
.setInput(Rule::Height, bind->rule().height() + padding->margins().height());
pop->setContent(padding);
return pop;
}

ConsoleWidget::ConsoleWidget() : GuiWidget("console"), d(new Instance(this))
{
d->button = new ButtonWidget;
Expand Down Expand Up @@ -284,6 +306,7 @@ ConsoleWidget::ConsoleWidget() : GuiWidget("console"), d(new Instance(this))
<< new ui::VariableToggleItem(tr("Go to Bottom on Enter"), App::config()["console.snap"])
<< new ui::Item(ui::Item::Separator)
<< new ui::SubwidgetItem(tr("Log Filter & Alerts..."), ui::Right, makePopup<LogSettingsDialog>)
<< new ui::SubwidgetItem(tr("Shortcut Key"), ui::Right, consoleShortcutPopup)
<< new ui::Item(ui::Item::Separator)
<< new ui::VariableToggleItem(tr("Doomsday Script"), App::config()["console.script"]);

Expand Down

0 comments on commit f17f521

Please sign in to comment.