Skip to content

Commit

Permalink
UI|Client: Removed old Control Panel, settings now in the Appearance …
Browse files Browse the repository at this point in the history
…editor

Added a new panel-derived widget called FoldPanelWidget that supports
embedded, folding groups. This is used for settings groups in the
Renderer Appearance editor.
  • Loading branch information
skyjake committed Sep 7, 2013
1 parent 93839c9 commit b3d328a
Show file tree
Hide file tree
Showing 31 changed files with 1,013 additions and 74 deletions.
5 changes: 5 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -363,6 +363,7 @@ DENG_HEADERS += \
include/ui/dialogs/networksettingsdialog.h \
include/ui/dialogs/renderersettingsdialog.h \
include/ui/dialogs/videosettingsdialog.h \
include/ui/editors/rendererappearanceeditor.h \
include/ui/fi_main.h \
include/ui/finaleinterpreter.h \
include/ui/framework/actionitem.h \
Expand Down Expand Up @@ -411,7 +412,9 @@ DENG_HEADERS += \
include/ui/widgets/cvartogglewidget.h \
include/ui/widgets/dialogwidget.h \
include/ui/widgets/documentwidget.h \
include/ui/widgets/foldpanelwidget.h \
include/ui/widgets/gameselectionwidget.h \
include/ui/widgets/icvarwidget.h \
include/ui/widgets/labelwidget.h \
include/ui/widgets/legacywidget.h \
include/ui/widgets/lineeditwidget.h \
Expand Down Expand Up @@ -700,6 +703,7 @@ SOURCES += \
src/ui/dialogs/messagedialog.cpp \
src/ui/dialogs/networksettingsdialog.cpp \
src/ui/dialogs/videosettingsdialog.cpp \
src/ui/editors/rendererappearanceeditor.cpp \
src/ui/fi_main.cpp \
src/ui/finaleinterpreter.cpp \
src/ui/framework/commandaction.cpp \
Expand Down Expand Up @@ -740,6 +744,7 @@ SOURCES += \
src/ui/widgets/cvartogglewidget.cpp \
src/ui/widgets/dialogwidget.cpp \
src/ui/widgets/documentwidget.cpp \
src/ui/widgets/foldpanelwidget.cpp \
src/ui/widgets/gameselectionwidget.cpp \
src/ui/widgets/labelwidget.cpp \
src/ui/widgets/legacywidget.cpp \
Expand Down
8 changes: 6 additions & 2 deletions doomsday/client/data/defaultstyle.pack/rules.dei
Expand Up @@ -28,7 +28,7 @@ group progress {
}

group slider {
rule width { constant $= UNIT * 50 }
rule width { constant $= UNIT * 55 }
rule label { constant $= UNIT * 9 }
rule editor { constant $= UNIT * 20 }
}
Expand All @@ -41,6 +41,10 @@ group dialog {
rule download.width { constant $= UNIT * 115 }
}

group sidebar {
rule width { constant $= UNIT * 80 }
}

group console {
rule width { constant $= UNIT * 125 }
}
Expand All @@ -51,5 +55,5 @@ group gameselection {
}

group coloradjustment {
rule slider { constant $= slider.width.constant * 1.5 }
rule slider { constant $= slider.width.constant * 1.36 }
}
1 change: 1 addition & 0 deletions doomsday/client/include/clientapp.h
Expand Up @@ -56,6 +56,7 @@ class ClientApp : public de::GuiApp
static ClientApp &app();
static Updater &updater();
static SettingsRegister &rendererSettings(); ///< @todo Belongs in a subsystem.
static SettingsRegister &rendererAppearanceSettings(); ///< @todo Belongs in a subsystem.
static SettingsRegister &audioSettings(); ///< @todo Belongs in AudioSystem.
static ServerLink &serverLink();
static InputSystem &inputSystem();
Expand Down
19 changes: 19 additions & 0 deletions doomsday/client/include/ui/clientwindow.h
Expand Up @@ -63,6 +63,11 @@ class ClientWindow : public de::PersistentCanvasWindow,
Busy
};

enum SidebarLocation
{
RightEdge
};

public:
ClientWindow(de::String const &id = "main");

Expand All @@ -73,6 +78,20 @@ class ClientWindow : public de::PersistentCanvasWindow,
LegacyWidget &game();
BusyWidget &busy();

/**
* Installs a sidebar widget into the window. If there is an existing
* sidebar, it will be deleted. Sidebar widgets are expected to control
* their own width (on the right/left edges) or height (on the top/bottom
* edges).
*
* @param location Location to attach the sidebar. Window takes ownership
* of the widget.
* @param sidebar Widget to install, or @c NULL to remove the sidebar.
*/
void setSidebar(SidebarLocation location, GuiWidget *sidebar);

void unsetSidebar(SidebarLocation location) { setSidebar(location, 0); }

/**
* 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
Expand Up @@ -41,6 +41,7 @@ protected slots:
void renameProfile();
void duplicateProfile();
void deleteProfile();
void showEditor();

private:
DENG2_PRIVATE(d)
Expand Down
49 changes: 49 additions & 0 deletions doomsday/client/include/ui/editors/rendererappearanceeditor.h
@@ -0,0 +1,49 @@
/** @file rendererappearanceeditor.h
*
* @authors Copyright (c) 2013 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_RENDERERAPPEARANCEEDITOR_H
#define DENG_CLIENT_RENDERERAPPEARANCEEDITOR_H

#include "ui/widgets/panelwidget.h"

/**
* Editor for modifying the settings for the renderer's visual appearance.
*
* Automatically installs itself into the main window's right sidebar.
*
* @see ClientApp::rendererAppearanceSettings()
*/
class RendererAppearanceEditor : public PanelWidget
{
Q_OBJECT

public:
RendererAppearanceEditor();

public slots:
void showRendererSettings();

protected:
void preparePanelForOpening();
void panelDismissed();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_RENDERERAPPEARANCEEDITOR_H
6 changes: 1 addition & 5 deletions doomsday/client/include/ui/ui_panel.h
Expand Up @@ -24,18 +24,14 @@
#ifndef LIBDENG_CONTROL_PANEL_H
#define LIBDENG_CONTROL_PANEL_H

#ifdef __cplusplus
extern "C" {
#endif
#if 0

void CP_Register(void);

// Helpful handlers.
void CP_CvarSlider(ui_object_t *ob);
void CP_InitCvarSliders(ui_object_t *ob);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* LIBDENG_CONTROL_PANEL_H */
3 changes: 2 additions & 1 deletion doomsday/client/include/ui/widgets/cvarchoicewidget.h
Expand Up @@ -20,12 +20,13 @@
#define DENG_CLIENT_CVARCHOICEWIDGET_H

#include "choicewidget.h"
#include "icvarwidget.h"

/**
* Console variable choice for integer-type cvars with a limited number of
* valid settings. The choice items' user data is used as the cvar value.
*/
class CVarChoiceWidget : public ChoiceWidget
class CVarChoiceWidget : public ChoiceWidget, public ICVarWidget
{
Q_OBJECT

Expand Down
3 changes: 2 additions & 1 deletion doomsday/client/include/ui/widgets/cvarsliderwidget.h
Expand Up @@ -20,11 +20,12 @@
#define DENG_CLIENT_CVARSLIDERWIDGET_H

#include "sliderwidget.h"
#include "icvarwidget.h"

/**
* Console variable slider.
*/
class CVarSliderWidget : public SliderWidget
class CVarSliderWidget : public SliderWidget, public ICVarWidget
{
Q_OBJECT

Expand Down
3 changes: 2 additions & 1 deletion doomsday/client/include/ui/widgets/cvartogglewidget.h
Expand Up @@ -20,11 +20,12 @@
#define DENG_CLIENT_CVARTOGGLEWIDGET_H

#include "togglewidget.h"
#include "icvarwidget.h"

/**
* Console variable toggle for on/off type of cvars (value 0 or 1).
*/
class CVarToggleWidget : public ToggleWidget
class CVarToggleWidget : public ToggleWidget, public ICVarWidget
{
Q_OBJECT

Expand Down
60 changes: 60 additions & 0 deletions doomsday/client/include/ui/widgets/foldpanelwidget.h
@@ -0,0 +1,60 @@
/** @file foldpanelwidget.h Folding panel.
*
* @authors Copyright (c) 2013 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_FOLDPANELWIDGET_H
#define DENG_CLIENT_FOLDPANELWIDGET_H

#include "panelwidget.h"
#include "buttonwidget.h"

/**
* Folding panel.
*
* You should first set the container of the folding panel with setContent().
* This ensures that widgets added to the panel use the appropriate stylist.
*
* When dismissed, the panel contents are GL-deinitialized and removed from
* the widget tree entirely.
*
* FoldPanelWidget creates a title button for toggling the panel open and
* closed. It is the user's responsibility to lay out this button
* appropriately.
*/
class FoldPanelWidget : public PanelWidget
{
Q_OBJECT

public:
FoldPanelWidget(de::String const &name = "");

ButtonWidget &title();

void setContent(GuiWidget *content);

public slots:
void toggleFold();

protected:
void preparePanelForOpening();
void panelDismissed();

private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_FOLDPANELWIDGET_H
33 changes: 33 additions & 0 deletions doomsday/client/include/ui/widgets/icvarwidget.h
@@ -0,0 +1,33 @@
/** @file icvarwidget.h Interface for console variable widgets.
*
* @authors Copyright (c) 2013 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_ICVARWIDGET_H
#define DENG_CLIENT_ICVARWIDGET_H

/**
* Interface for console variable widgets.
*/
class ICVarWidget
{
public:
virtual ~ICVarWidget() {}

virtual void updateFromCVar() = 0;
};

#endif // DENG_CLIENT_ICVARWIDGET_H
19 changes: 18 additions & 1 deletion doomsday/client/include/ui/widgets/panelwidget.h
Expand Up @@ -30,7 +30,8 @@
* determines the size of the panel. The user must define the position of the
* panel.
*
* Initially panels are in the open state.
* Initially panels are in the closed state. They can be opened once the
* content widget has been set.
*/
class PanelWidget : public GuiWidget
{
Expand All @@ -45,6 +46,20 @@ class PanelWidget : public GuiWidget
public:
PanelWidget(de::String const &name = "");

/**
* Sets the size policy for the secondary dimension. For instance, for a
* panel that opens horizontally, this determines what is done to the
* widget height.
*
* - ui::Expand (the default) means that the widget automatically uses the
* content's size for the secondary dimension.
* - ui::Fixed means that the user is expected to define the panel's secondary
* dimension and the panel does not touch it.
*
* @param policy Size policy.
*/
void setSizePolicy(ui::SizePolicy policy);

/**
* Sets the content widget of the panel. If there is an earlier content
* widget, it will be destroyed.
Expand All @@ -56,6 +71,8 @@ class PanelWidget : public GuiWidget

GuiWidget &content() const;

GuiWidget *takeContent();

/**
* Sets the opening direction of the panel.
*
Expand Down
6 changes: 6 additions & 0 deletions doomsday/client/include/ui/widgets/scrollareawidget.h
Expand Up @@ -23,6 +23,12 @@

/**
* Scrollable area.
*
* ScrollAreaWidget does not control its own position or size. The user
* must define its rectangle. The content rule rectangle is defined in
* relation to the widget's rectangle.
*
* The user must always define the size of the content area.
*/
class ScrollAreaWidget : public GuiWidget
{
Expand Down
5 changes: 4 additions & 1 deletion doomsday/client/include/ui/widgets/sliderwidget.h
Expand Up @@ -35,12 +35,15 @@ class SliderWidget : public GuiWidget
public:
SliderWidget(de::String const &name = "");

void setRange(de::Rangei const &intRange, int step = 0);
void setRange(de::Rangei const &intRange, int step = 1);
void setRange(de::Rangef const &floatRange, float step = 0);
void setRange(de::Ranged const &doubleRange, de::ddouble step = 0);
void setPrecision(int precisionDecimals);
void setValue(de::ddouble value);

void setMinLabel(de::String const &labelText);
void setMaxLabel(de::String const &labelText);

/**
* Displayed values are multiplied by this factor when displayed.
* Does not affect the real value of the slider.
Expand Down

0 comments on commit b3d328a

Please sign in to comment.