summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/gui/GUIHelpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/gui/GUIHelpers.cpp')
-rw-r--r--xbmc/addons/gui/GUIHelpers.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/xbmc/addons/gui/GUIHelpers.cpp b/xbmc/addons/gui/GUIHelpers.cpp
new file mode 100644
index 0000000..62fb9d3
--- /dev/null
+++ b/xbmc/addons/gui/GUIHelpers.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2005-2020 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "GUIHelpers.h"
+
+#include "addons/IAddon.h"
+#include "addons/addoninfo/AddonInfo.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
+
+using namespace ADDON;
+using namespace ADDON::GUI;
+
+bool CHelpers::DialogAddonLifecycleUseAsk(const std::shared_ptr<const IAddon>& addon)
+{
+ int header_nr;
+ int text_nr;
+ switch (addon->LifecycleState())
+ {
+ case AddonLifecycleState::BROKEN:
+ header_nr = 24164;
+ text_nr = 24165;
+ break;
+ case AddonLifecycleState::DEPRECATED:
+ header_nr = 24166;
+ text_nr = 24167;
+ break;
+ default:
+ header_nr = 0;
+ text_nr = 0;
+ break;
+ }
+ if (header_nr > 0)
+ {
+ std::string header = StringUtils::Format(g_localizeStrings.Get(header_nr), addon->ID());
+ std::string text =
+ StringUtils::Format(g_localizeStrings.Get(text_nr), addon->LifecycleStateDescription());
+ if (!CGUIDialogYesNo::ShowAndGetInput(header, text))
+ return false;
+ }
+
+ return true;
+}