Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4092,6 +4092,12 @@
"color-title": "Wallpaper color",
"filter-placeholder": "Filter…",
"flatten": "Flatten",
"favorite-current": "Add current wallpaper to favorites",
"unfavorite-current": "Remove current wallpaper from favorites",
"choose-color": "Choose wallpaper color",
"close": "Close wallpaper panel",
"navigate-up": "Go to parent folder",
"refresh": "Refresh wallpapers",
"loading": "Loading wallpapers…",
"sort-date-asc": "Sort by date (oldest first)",
"sort-date-desc": "Sort by date (newest first)",
Expand Down
31 changes: 31 additions & 0 deletions src/shell/wallpaper/panel/wallpaper_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ void WallpaperPanel::create() {
.glyph = "arrow-big-up",
.glyphSize = Style::fontSizeBody * scale,
.variant = ButtonVariant::Secondary,
.tooltip = i18n::tr("wallpaper.panel.navigate-up"),
.minWidth = Style::controlHeightSm * scale,
.minHeight = Style::controlHeightSm * scale,
.padding = Style::spaceXs * scale,
Expand Down Expand Up @@ -521,6 +522,7 @@ void WallpaperPanel::create() {
.glyph = "color-picker",
.glyphSize = Style::fontSizeBody * scale,
.variant = ButtonVariant::Default,
.tooltip = i18n::tr("wallpaper.panel.choose-color"),
.minWidth = Style::controlHeightSm * scale,
.minHeight = Style::controlHeightSm * scale,
.padding = Style::spaceXs * scale,
Expand All @@ -535,6 +537,7 @@ void WallpaperPanel::create() {
.glyph = std::string(sortModeGlyph(m_sortMode)),
.glyphSize = Style::fontSizeBody * scale,
.variant = ButtonVariant::Default,
.tooltip = i18n::tr(sortModeTooltipKey(m_sortMode)),
.minWidth = Style::controlHeightSm * scale,
.minHeight = Style::controlHeightSm * scale,
.padding = Style::spaceXs * scale,
Expand All @@ -549,6 +552,7 @@ void WallpaperPanel::create() {
.glyph = "refresh",
.glyphSize = Style::fontSizeBody * scale,
.variant = ButtonVariant::Default,
.tooltip = i18n::tr("wallpaper.panel.refresh"),
.minWidth = Style::controlHeightSm * scale,
.minHeight = Style::controlHeightSm * scale,
.padding = Style::spaceXs * scale,
Expand All @@ -572,6 +576,7 @@ void WallpaperPanel::create() {
.out = &m_closeButton,
.glyph = "close",
.glyphSize = Style::fontSizeBody * scale,
.tooltip = i18n::tr("wallpaper.panel.close"),
.minWidth = Style::controlHeightSm * scale,
.minHeight = Style::controlHeightSm * scale,
.padding = Style::spaceXs * scale,
Expand Down Expand Up @@ -664,6 +669,21 @@ void WallpaperPanel::create() {
})
);

favoritesOptions->addChild(
ui::button({
.out = &m_favoriteCurrentButton,
.glyph = "star",
.glyphSize = Style::fontSizeBody * scale,
.variant = ButtonVariant::Default,
.tooltip = i18n::tr("wallpaper.panel.favorite-current"),
.minWidth = Style::controlHeightSm * scale,
.minHeight = Style::controlHeightSm * scale,
.padding = Style::spaceXs * scale,
.radius = Style::scaledRadiusMd(scale),
.onClick = [this]() { toggleFavoriteForPath(currentWallpaperPathForSelection()); },
})
);

favoritesOptions->addChild(ui::spacer());

favoritesOptions->addChild(
Expand Down Expand Up @@ -901,6 +921,7 @@ void WallpaperPanel::onClose() {
m_title = nullptr;
m_backButton = nullptr;
m_monitorSelect = nullptr;
m_favoriteCurrentButton = nullptr;
m_filterInput = nullptr;
m_flattenToggle = nullptr;
m_flattenLabel = nullptr;
Expand Down Expand Up @@ -1087,6 +1108,15 @@ void WallpaperPanel::syncBrowseChrome() {
if (m_backButton != nullptr) {
m_backButton->setVisible(!m_navStack.empty());
}
if (m_favoriteCurrentButton != nullptr && m_config != nullptr) {
const std::string current = currentWallpaperPathForSelection();
const bool favorite = !current.empty() && m_config->isWallpaperFavorite(current);
m_favoriteCurrentButton->setEnabled(!current.empty());
m_favoriteCurrentButton->setGlyph(favorite ? "star-filled" : "star");
m_favoriteCurrentButton->setTooltip(
i18n::tr(favorite ? "wallpaper.panel.unfavorite-current" : "wallpaper.panel.favorite-current")
);
}
syncThemeControls();
}

Expand Down Expand Up @@ -1409,6 +1439,7 @@ void WallpaperPanel::applyWallpaperPath(const std::string& path, const Wallpaper
choice.connector.empty() ? std::optional<std::string>{} : std::optional<std::string>{choice.connector};
m_config->applyWallpaperSelection(connector, path, applyTheme, allMonitorConnectors());
rebindGrid();
syncBrowseChrome();
}

const WallpaperFavorite* WallpaperPanel::favoriteThemeToApply(std::string_view path) const {
Expand Down
1 change: 1 addition & 0 deletions src/shell/wallpaper/panel/wallpaper_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class WallpaperPanel : public Panel {
Select* m_favoritePaletteDetailSelect = nullptr;
Select* m_monitorSelect = nullptr;
Input* m_filterInput = nullptr;
Button* m_favoriteCurrentButton = nullptr;
Toggle* m_flattenToggle = nullptr;
Label* m_flattenLabel = nullptr;
Button* m_sortButton = nullptr;
Expand Down