mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Fix depreciation -> deprecation.
This commit is contained in:
@@ -658,7 +658,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
|
||||
// Kept but deprecated for backward compatibility:
|
||||
.def("onModStateChanged", +[](IModList* modList, const std::function<void(const QString&, IModList::ModStates)>& fn) {
|
||||
utils::show_depreciation_warning("onModStateChanged",
|
||||
utils::show_deprecation_warning("onModStateChanged",
|
||||
"onModStateChanged(Callable[[str, IModList.ModStates], None]) is deprecated, "
|
||||
"use onModStateChanged(Callable[[Dict[str, IModList.ModStates], None]) instead.");
|
||||
return modList->onModStateChanged([fn](auto const& map) {
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
void show_depreciation_warning(std::string_view name, std::string_view message, bool show_once) {
|
||||
void show_deprecation_warning(std::string_view name, std::string_view message, bool show_once) {
|
||||
|
||||
// Contains the list of filename / line number for which a depreciation warning has already been shown.
|
||||
// Contains the list of filename / line number for which a deprecation warning has already been shown.
|
||||
static std::set<std::pair<std::string, int>> DeprecatedLines;
|
||||
|
||||
// Find the caller:
|
||||
@@ -27,7 +27,7 @@ namespace utils {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the depreciation:
|
||||
// Register the deprecation:
|
||||
DeprecatedLines.emplace(filename, lineno);
|
||||
|
||||
auto path = relative(std::filesystem::path(filename), QCoreApplication::applicationDirPath().toStdWString());
|
||||
|
||||
@@ -199,15 +199,17 @@ namespace utils {
|
||||
|
||||
|
||||
/**
|
||||
* @brief Show a depreciation warning.
|
||||
* @brief Show a deprecation warning.
|
||||
*
|
||||
* This methods will print a warning in MO2 log containing the location of the call to
|
||||
* the deprecated function. If show_once is true, the deprecation warning will only be
|
||||
* logged the first time the function is called at this location.
|
||||
*
|
||||
* @param name Name of the deprecated function.
|
||||
* @param message Depreciation message.
|
||||
* @param show_once Only show the message once.
|
||||
*
|
||||
* @return a depreciation object.
|
||||
* @param message Deprecation message.
|
||||
* @param show_once Only show the message once per call location.
|
||||
*/
|
||||
void show_depreciation_warning(std::string_view name, std::string_view message = "", bool show_once = true);
|
||||
void show_deprecation_warning(std::string_view name, std::string_view message = "", bool show_once = true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user