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 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 { platformTheme = if (builtins.isString cfg.platformTheme) then {
name = lib.warn option = "qt.platformTheme";
"The option `qt.platformTheme` has been renamed to `qt.platformTheme.name`." name = cfg.platformTheme;
(warnGnomeDeprecation "qt.platformTheme" cfg.platformTheme);
package = null; package = null;
} else if cfg.platformTheme == null then { } else if cfg.platformTheme == null then {
option = null;
name = null; name = null;
package = null; package = null;
} else { } else {
name = option = "qt.platformTheme.name";
warnGnomeDeprecation "cfg.platformTheme.name" cfg.platformTheme.name; name = cfg.platformTheme.name;
package = cfg.platformTheme.package; 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) qt.style.package = lib.mkIf (cfg.style.name != null)
(lib.mkDefault (stylePackages.${lib.toLower cfg.style.name} or 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 \ assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
'QML2_IMPORT_PATH' '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."
];
}; };
} }