Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Numeric.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/gui/dialogs/numeric.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace dialogs
21{
22
23//==============================================================================
38namespace Numeric
39{
40//==============================================================================
50inline bool ATTR_DLL_LOCAL ShowAndVerifyNewPassword(std::string& newPassword)
51{
52 using namespace ::kodi::addon;
53 char* pw = nullptr;
54 bool ret =
55 CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_new_password(
56 CPrivateBase::m_interface->toKodi->kodiBase, &pw);
57 if (pw != nullptr)
58 {
59 newPassword = pw;
60 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase, pw);
61 }
62 return ret;
63}
64//------------------------------------------------------------------------------
65
66//==============================================================================
125inline int ATTR_DLL_LOCAL ShowAndVerifyPassword(const std::string& password,
126 const std::string& heading,
127 int retries)
128{
129 using namespace ::kodi::addon;
130 return CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_password(
131 CPrivateBase::m_interface->toKodi->kodiBase, password.c_str(), heading.c_str(), retries);
132}
133//------------------------------------------------------------------------------
134
135//==============================================================================
146inline bool ATTR_DLL_LOCAL ShowAndVerifyInput(std::string& toVerify,
147 const std::string& heading,
148 bool verifyInput)
149{
150 using namespace ::kodi::addon;
151 char* retString = nullptr;
152 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_input(
153 CPrivateBase::m_interface->toKodi->kodiBase, toVerify.c_str(), &retString, heading.c_str(),
154 verifyInput);
155 if (retString != nullptr)
156 {
157 toVerify = retString;
158 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
159 retString);
160 }
161 return ret;
162}
163//------------------------------------------------------------------------------
164
165//==============================================================================
195inline bool ATTR_DLL_LOCAL ShowAndGetTime(tm& time, const std::string& heading)
196{
197 using namespace ::kodi::addon;
198 return CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_time(
199 CPrivateBase::m_interface->toKodi->kodiBase, &time, heading.c_str());
200}
201//------------------------------------------------------------------------------
202
203//==============================================================================
233inline bool ATTR_DLL_LOCAL ShowAndGetDate(tm& date, const std::string& heading)
234{
235 using namespace ::kodi::addon;
236 return CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_date(
237 CPrivateBase::m_interface->toKodi->kodiBase, &date, heading.c_str());
238}
239//------------------------------------------------------------------------------
240
241//==============================================================================
251inline bool ATTR_DLL_LOCAL ShowAndGetIPAddress(std::string& ipAddress, const std::string& heading)
252{
253 using namespace ::kodi::addon;
254 char* retString = nullptr;
255 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_ip_address(
256 CPrivateBase::m_interface->toKodi->kodiBase, ipAddress.c_str(), &retString, heading.c_str());
257 if (retString != nullptr)
258 {
259 ipAddress = retString;
260 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
261 retString);
262 }
263 return ret;
264}
265//------------------------------------------------------------------------------
266
267//==============================================================================
296inline bool ATTR_DLL_LOCAL ShowAndGetNumber(std::string& input,
297 const std::string& heading,
298 unsigned int autoCloseTimeoutMs = 0)
299{
300 using namespace ::kodi::addon;
301 char* retString = nullptr;
302 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_number(
303 CPrivateBase::m_interface->toKodi->kodiBase, input.c_str(), &retString, heading.c_str(),
304 autoCloseTimeoutMs);
305 if (retString != nullptr)
306 {
307 input = retString;
308 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
309 retString);
310 }
311 return ret;
312}
313//------------------------------------------------------------------------------
314
315//==============================================================================
325inline bool ATTR_DLL_LOCAL ShowAndGetSeconds(std::string& time, const std::string& heading)
326{
327 using namespace ::kodi::addon;
328 char* retString = nullptr;
329 bool ret = CPrivateBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_seconds(
330 CPrivateBase::m_interface->toKodi->kodiBase, time.c_str(), &retString, heading.c_str());
331 if (retString != nullptr)
332 {
333 time = retString;
334 CPrivateBase::m_interface->toKodi->free_string(CPrivateBase::m_interface->toKodi->kodiBase,
335 retString);
336 }
337 return ret;
338}
339//------------------------------------------------------------------------------
340}; // namespace Numeric
342
343} /* namespace dialogs */
344} /* namespace gui */
345} /* namespace kodi */
346
347#endif /* __cplusplus */
int ATTR_DLL_LOCAL ShowAndVerifyPassword(const std::string &password, const std::string &heading, int retries)
Use dialog to verify numeric password.
Definition Numeric.h:125
bool ATTR_DLL_LOCAL ShowAndGetNumber(std::string &input, const std::string &heading, unsigned int autoCloseTimeoutMs=0)
Use dialog to get normal number.
Definition Numeric.h:296
bool ATTR_DLL_LOCAL ShowAndGetSeconds(std::string &time, const std::string &heading)
Show numeric keypad to get seconds.
Definition Numeric.h:325
bool ATTR_DLL_LOCAL ShowAndVerifyNewPassword(std::string &newPassword)
Use dialog to get numeric new password.
Definition Numeric.h:50
bool ATTR_DLL_LOCAL ShowAndGetTime(tm &time, const std::string &heading)
Use dialog to get time value.
Definition Numeric.h:195
bool ATTR_DLL_LOCAL ShowAndVerifyInput(std::string &toVerify, const std::string &heading, bool verifyInput)
Use dialog to verify numeric password.
Definition Numeric.h:146
bool ATTR_DLL_LOCAL ShowAndGetIPAddress(std::string &ipAddress, const std::string &heading)
Use dialog to get a IP.
Definition Numeric.h:251
bool ATTR_DLL_LOCAL ShowAndGetDate(tm &date, const std::string &heading)
Use dialog to get date value.
Definition Numeric.h:233