Commit 298a7734 authored by Riccardo Degli Esposti's avatar Riccardo Degli Esposti 🍌 Committed by Tomaz Canabrava
Browse files

Disable setting if wallpaper not set

parent bc9a77d8
Pipeline #115740 passed with stage
in 1 minute and 53 seconds
......@@ -202,11 +202,13 @@ void ColorSchemeEditor::wallpaperPathChanged(const QString &path)
{
if (path.isEmpty()) {
_colors->setWallpaper(path, _colors->wallpaper()->style(), _colors->wallpaper()->anchor(), _colors->wallpaper()->opacity());
enableWallpaperSettings(false);
} else {
QFileInfo i(path);
if (i.exists() && i.isFile() && i.isReadable()) {
_colors->setWallpaper(path, _colors->wallpaper()->style(), _colors->wallpaper()->anchor(), _colors->wallpaper()->opacity());
enableWallpaperSettings(true);
}
}
}
......@@ -321,6 +323,7 @@ void ColorSchemeEditor::setup(const std::shared_ptr<const ColorScheme> &scheme,
_ui->wallpaperScalingType->setCurrentIndex(scheme->wallpaper()->style());
_ui->wallpaperHorizontalAnchorSlider->setValue(ax);
_ui->wallpaperVerticalAnchorSlider->setValue(ay);
enableWallpaperSettings(!scheme->wallpaper()->isNull());
}
void ColorSchemeEditor::setupColorTable(const std::shared_ptr<ColorScheme> &colors)
......@@ -370,3 +373,11 @@ void ColorSchemeEditor::saveColorScheme()
{
Q_EMIT colorSchemeSaveRequested(colorScheme(), _isNewScheme);
}
void ColorSchemeEditor::enableWallpaperSettings(bool enable)
{
_ui->wallpaperHorizontalAnchorSlider->setEnabled(enable);
_ui->wallpaperVerticalAnchorSlider->setEnabled(enable);
_ui->wallpaperTransparencySlider->setEnabled(enable);
_ui->wallpaperScalingType->setEnabled(enable);
}
......@@ -81,6 +81,7 @@ private:
Q_DISABLE_COPY(ColorSchemeEditor)
void setupColorTable(const std::shared_ptr<ColorScheme> &table);
void enableWallpaperSettings(bool enable);
bool _isNewScheme;
Ui::ColorSchemeEditor *_ui;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment