mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 10:49:48 +01:00
qt: use warnings API
This commit is contained in:
parent
be2b17615c
commit
54e35e0e1c
2 changed files with 15 additions and 10 deletions
|
@ -187,22 +187,17 @@ in {
|
|||
};
|
||||
|
||||
config = let
|
||||
warnGnomeDeprecation = option: name:
|
||||
lib.warnIf (name == "gnome")
|
||||
"The value `gnome` for option `${option}` is deprecated. Use `adwaita` instead."
|
||||
name;
|
||||
|
||||
platformTheme = if (builtins.isString cfg.platformTheme) then {
|
||||
name = lib.warn
|
||||
"The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`."
|
||||
(warnGnomeDeprecation "qt.platformTheme" cfg.platformTheme);
|
||||
option = "qt.platformTheme";
|
||||
name = cfg.platformTheme;
|
||||
package = null;
|
||||
} else if cfg.platformTheme == null then {
|
||||
option = null;
|
||||
name = null;
|
||||
package = null;
|
||||
} else {
|
||||
name =
|
||||
warnGnomeDeprecation "cfg.platformTheme.name" cfg.platformTheme.name;
|
||||
option = "qt.platformTheme.name";
|
||||
name = cfg.platformTheme.name;
|
||||
package = cfg.platformTheme.package;
|
||||
};
|
||||
|
||||
|
@ -238,6 +233,12 @@ in {
|
|||
'';
|
||||
}];
|
||||
|
||||
warnings = (lib.lists.optional (platformTheme.option == "qt.platformTheme")
|
||||
"The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`.")
|
||||
++ (lib.lists.optional
|
||||
(platformTheme.name == "gnome" && platformTheme.package == null)
|
||||
"The value `gnome` for option `${platformTheme.option}` is deprecated. Use `adwaita` instead.");
|
||||
|
||||
qt.style.package = lib.mkIf (cfg.style.name != null)
|
||||
(lib.mkDefault (stylePackages.${lib.toLower cfg.style.name} or null));
|
||||
|
||||
|
|
|
@ -19,5 +19,9 @@
|
|||
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'QML2_IMPORT_PATH'
|
||||
'';
|
||||
test.asserts.warnings.expected = [
|
||||
"The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`."
|
||||
"The value `gnome` for option `qt.platformTheme` is deprecated. Use `adwaita` instead."
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue