[WASAPI] fix stream types and frequencies enumeration
[xbmc.git] / xbmc / messaging / helpers / DialogHelper.cpp
blobe269c096a23b38c341f50abf7b47c28b2deda691
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "DialogHelper.h"
11 #include "ServiceBroker.h"
12 #include "messaging/ApplicationMessenger.h"
14 #include <cassert>
15 #include <utility>
17 namespace KODI
19 namespace MESSAGING
21 namespace HELPERS
23 DialogResponse ShowYesNoDialogText(CVariant heading, CVariant text, CVariant noLabel, CVariant yesLabel, uint32_t autoCloseTimeout)
25 return ShowYesNoCustomDialog(std::move(heading), std::move(text), std::move(noLabel),
26 std::move(yesLabel), "", autoCloseTimeout);
29 DialogResponse ShowYesNoCustomDialog(CVariant heading, CVariant text, CVariant noLabel, CVariant yesLabel, CVariant customLabel, uint32_t autoCloseTimeout)
31 DialogYesNoMessage options;
32 options.heading = std::move(heading);
33 options.text = std::move(text);
34 options.noLabel = std::move(noLabel);
35 options.yesLabel = std::move(yesLabel);
36 options.customLabel = std::move(customLabel);
37 options.autoclose = autoCloseTimeout;
39 switch (CServiceBroker::GetAppMessenger()->SendMsg(TMSG_GUI_DIALOG_YESNO, -1, -1,
40 static_cast<void*>(&options)))
42 case -1:
43 return DialogResponse::CHOICE_CANCELLED;
44 case 0:
45 return DialogResponse::CHOICE_NO;
46 case 1:
47 return DialogResponse::CHOICE_YES;
48 case 2:
49 return DialogResponse::CHOICE_CUSTOM;
50 default:
51 //If we get here someone changed the return values without updating this code
52 assert(false);
54 //This is unreachable code but we need to return something to suppress warnings about
55 //no return
56 return DialogResponse::CHOICE_CANCELLED;
59 DialogResponse ShowYesNoDialogLines(CVariant heading, CVariant line0, CVariant line1, CVariant line2,
60 CVariant noLabel, CVariant yesLabel, uint32_t autoCloseTimeout)
62 DialogYesNoMessage options;
63 options.heading = std::move(heading);
64 options.lines[0] = std::move(line0);
65 options.lines[1] = std::move(line1);
66 options.lines[2] = std::move(line2);
67 options.noLabel = std::move(noLabel);
68 options.yesLabel = std::move(yesLabel);
69 options.customLabel = "";
70 options.autoclose = autoCloseTimeout;
72 switch (CServiceBroker::GetAppMessenger()->SendMsg(TMSG_GUI_DIALOG_YESNO, -1, -1,
73 static_cast<void*>(&options)))
75 case -1:
76 return DialogResponse::CHOICE_CANCELLED;
77 case 0:
78 return DialogResponse::CHOICE_NO;
79 case 1:
80 return DialogResponse::CHOICE_YES;
81 case 2:
82 return DialogResponse::CHOICE_CUSTOM;
83 default:
84 //If we get here someone changed the return values without updating this code
85 assert(false);
87 //This is unreachable code but we need to return something to suppress warnings about
88 //no return
89 return DialogResponse::CHOICE_CANCELLED;