Skip to content

Commit

Permalink
UI|Default Style|libappfw: Added missing UI images (corners, dot)
Browse files Browse the repository at this point in the history
These were previously generated programmatically.
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent a4718db commit c605353
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 30 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -2,13 +2,32 @@

script { import gui, DisplayMode }

#----------------------------------------------------------------------------
# Widgets

window {
image background { path = "graphics/background.jpg" }
image borderglow { path = "graphics/borderglow.png" }
image icon { path = "graphics/window.png" }
image cursor { path = "graphics/mouse.png" }
}

widget {
image dot { path $= gui.dpiScaledImagePath("graphics/dot.png") }

image corners.thin { path $= gui.dpiScaledImagePath("graphics/corners-thin.png") }
image corners.bold { path $= gui.dpiScaledImagePath("graphics/corners-bold.png") }
image corners.solid { path $= gui.dpiScaledImagePath("graphics/corners-solid.png") }

image toggle.onoff { path $= gui.dpiScaledImagePath("graphics/toggle-onoff.png") }

progress {
image wheel { path = "graphics/progress-wheel.png" }
image gear { path = "graphics/progress-gear.png" }
image mini { path = "graphics/progress-mini.png" }
}
}

logo {
image px128 { path = "graphics/deng-logo-128.png" }
image px256 { path = "graphics/deng-logo-256.png" }
Expand All @@ -31,7 +50,9 @@ logo {
}
}

# Generic:
#----------------------------------------------------------------------------
# Symbols

image refresh { path = "graphics/refresh.png" }
image fold { path = "graphics/fold.png" }
image gauge { path = "graphics/gauge.png" }
Expand All @@ -49,7 +70,9 @@ image create { path = "graphics/create.png" }
image alert { path = "graphics/alert.png" }
image play { path = "graphics/play.png" }

# Subsystems:
#----------------------------------------------------------------------------
# Subsystems

image log { path = "graphics/log.png" }
image display { path = "graphics/display.png" }
image network { path = "graphics/network.png" }
Expand All @@ -59,18 +82,9 @@ image input { path = "graphics/input.png" }
image audio { path = "graphics/audio.png" }
image updater { path = "graphics/updater.png" }

# Widgets:
image toggle.onoff {
path $= gui.dpiScaledImagePath("graphics/toggle-onoff.png")
}

progress {
image wheel { path = "graphics/progress-wheel.png" }
image gear { path = "graphics/progress-gear.png" }
image mini { path = "graphics/progress-mini.png" }
}
#----------------------------------------------------------------------------
# Home

# Home:
home {
image icon { path = "graphics/home.png" }
background {
Expand Down
26 changes: 14 additions & 12 deletions doomsday/libs/appfw/src/guirootwidget.cpp
Expand Up @@ -35,10 +35,10 @@ namespace de {

// Identifiers for images generated by GuiRootWidget.
static DotPath const ID_SOLID_WHITE = "GuiRootWidget.solid.white";
static DotPath const ID_SOLID_ROUND_CORNERS = "GuiRootWidget.solid.roundCorners";
static DotPath const ID_THIN_ROUND_CORNERS = "GuiRootWidget.frame.thin";
static DotPath const ID_BOLD_ROUND_CORNERS = "GuiRootWidget.frame.bold";
static DotPath const ID_DOT = "GuiRootWidget.dot";
//static DotPath const ID_SOLID_ROUND_CORNERS = "GuiRootWidget.solid.roundCorners";
//static DotPath const ID_THIN_ROUND_CORNERS = "GuiRootWidget.frame.thin";
//static DotPath const ID_BOLD_ROUND_CORNERS = "GuiRootWidget.frame.bold";
//static DotPath const ID_DOT = "GuiRootWidget.dot";

#ifdef DE_QT_5_0_OR_NEWER
# define DPI_SCALED(x) ((x) * DE_BASE_GUI_APP->pixelRatio().value())
Expand All @@ -60,6 +60,7 @@ DE_PIMPL(GuiRootWidget)
Image::Size(1, 1));
}
};
#if 0
struct ThinCornersImage : public TextureBank::ImageSource {
Image load() const {
Image img(Image::Size(DPI_SCALED_INT(15), DPI_SCALED_INT(15)), Image::RGBA_8888);
Expand Down Expand Up @@ -116,6 +117,7 @@ DE_PIMPL(GuiRootWidget)
return img;
}
};
#endif
struct StyleImage : public TextureBank::ImageSource {
StyleImage(DotPath const &sourcePath) : ImageSource(sourcePath) {}
Image load() const {
Expand Down Expand Up @@ -186,10 +188,10 @@ DE_PIMPL(GuiRootWidget)
{
// Built-in images.
texBank.add(ID_SOLID_WHITE, new SolidWhiteImage);
texBank.add(ID_SOLID_ROUND_CORNERS, new SolidRoundedImage);
texBank.add(ID_THIN_ROUND_CORNERS, new ThinCornersImage);
texBank.add(ID_BOLD_ROUND_CORNERS, new BoldCornersImage);
texBank.add(ID_DOT, new TinyDotImage);
// texBank.add(ID_SOLID_ROUND_CORNERS, new SolidRoundedImage);
// texBank.add(ID_THIN_ROUND_CORNERS, new ThinCornersImage);
// texBank.add(ID_BOLD_ROUND_CORNERS, new BoldCornersImage);
// texBank.add(ID_DOT, new TinyDotImage);

// All style images.
Style const &st = Style::get();
Expand Down Expand Up @@ -279,19 +281,19 @@ Id GuiRootWidget::solidWhitePixel() const
Id GuiRootWidget::solidRoundCorners() const
{
d->initAtlas();
return d->texBank.texture(ID_SOLID_ROUND_CORNERS);
return d->texBank.texture(DE_STR("Style.widget.corners.solid"));
}

Id GuiRootWidget::roundCorners() const
{
d->initAtlas();
return d->texBank.texture(ID_THIN_ROUND_CORNERS);
return d->texBank.texture(DE_STR("Style.widget.corners.thin"));
}

Id GuiRootWidget::boldRoundCorners() const
{
d->initAtlas();
return d->texBank.texture(ID_BOLD_ROUND_CORNERS);
return d->texBank.texture(DE_STR("Style.widget.corners.bold"));
}

Id GuiRootWidget::borderGlow() const
Expand All @@ -303,7 +305,7 @@ Id GuiRootWidget::borderGlow() const
Id GuiRootWidget::tinyDot() const
{
d->initAtlas();
return d->texBank.texture(ID_DOT);
return d->texBank.texture(DE_STR("Style.widget.dot"));
}

Id GuiRootWidget::styleTexture(DotPath const &styleImagePath) const
Expand Down
6 changes: 3 additions & 3 deletions doomsday/libs/appfw/src/widgets/progresswidget.cpp
Expand Up @@ -37,7 +37,7 @@ DE_GUI_PIMPL(ProgressWidget), public Lockable
Id gearTex;
DotPath colorId { "progress.light.wheel" };
DotPath shadowColorId { "progress.light.shadow" };
DotPath gearId { "progress.gear" };
DotPath gearId { DE_STR("widget.progress.gear") };
Time updateAt { Time::invalidTime() };

int framesWhileAnimDone = 0; ///< # of frames drawn while animation was already done.
Expand Down Expand Up @@ -173,7 +173,7 @@ ProgressWidget::ProgressWidget(String const &name)
setSizePolicy(ui::Filled, ui::Filled);

// Set up the static progress ring image.
setStyleImage("progress.wheel");
setStyleImage(DE_STR("widget.progress.wheel"));
setImageFit(ui::FitToSize | ui::OriginalAspectRatio);
setImageScale(.6f);

Expand All @@ -186,7 +186,7 @@ void ProgressWidget::useMiniStyle(DotPath const &colorId)
{
d->mini = true;
d->colorId = colorId;
d->gearId = "progress.mini";
d->gearId = DE_STR("widget.progress.mini");
setTextColor(colorId);
setRotationSpeed(40);
setImageScale(1);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/appfw/src/widgets/togglewidget.cpp
Expand Up @@ -39,7 +39,7 @@ DE_PIMPL(ToggleWidget)
, _pos(0, Animation::EaseBoth)
, _animating(false)
{
const Image &img = style().images().image("toggle.onoff");
const Image &img = style().images().image(DE_STR("widget.toggle.onoff"));
setPointSize(img.size() * img.pointRatio());
updateStyle();
}
Expand Down Expand Up @@ -80,7 +80,7 @@ DE_PIMPL(ToggleWidget)
verts.makeQuad(recti, (_accentColor * p + _textColor * (1-p)) * Vec4f(c, c, c, 1),
atlas().imageRectf(_owner.root().solidWhitePixel()).middle());

Id onOff = _owner.root().styleTexture("toggle.onoff");
Id onOff = _owner.root().styleTexture(DE_STR("widget.toggle.onoff"));

// The on/off graphic.
verts.makeQuad(recti, _accentColor * p + _textColor * (1-p) * .8f, atlas().imageRectf(onOff));
Expand Down

0 comments on commit c605353

Please sign in to comment.