qt: use warnings API

This commit is contained in:
tschai-yim 2024-03-24 15:52:14 +01:00 committed by Robert Helgesson
parent be2b17615c
commit 54e35e0e1c
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
2 changed files with 15 additions and 10 deletions

View file

@ -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));

View file

@ -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."
];
};
}