Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xbmc][appmessenger] Add the ability to open dialogyesno by sending a threadmessage. #7800

Merged
merged 2 commits into from
Sep 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Kodi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@
39B4F3701B96F845009B2D88 /* RepositoryUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39B4F36E1B96F845009B2D88 /* RepositoryUpdater.cpp */; };
39B4F3711B96F845009B2D88 /* RepositoryUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39B4F36E1B96F845009B2D88 /* RepositoryUpdater.cpp */; };
39B4F3721B96F845009B2D88 /* RepositoryUpdater.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39B4F36E1B96F845009B2D88 /* RepositoryUpdater.cpp */; };
39BD2AD81B845D40004A5A15 /* DialogHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39BD2AD71B845D40004A5A15 /* DialogHelper.cpp */; };
39BD2AD91B845D40004A5A15 /* DialogHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39BD2AD71B845D40004A5A15 /* DialogHelper.cpp */; };
39BD2ADA1B845D40004A5A15 /* DialogHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39BD2AD71B845D40004A5A15 /* DialogHelper.cpp */; };
4260D5C71B67BB8F003F6F2D /* GUIWindowSplash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4260D5C51B67BB8F003F6F2D /* GUIWindowSplash.cpp */; };
4260D5C81B67BB8F003F6F2D /* GUIWindowSplash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4260D5C51B67BB8F003F6F2D /* GUIWindowSplash.cpp */; };
4260D5C91B67BB8F003F6F2D /* GUIWindowSplash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4260D5C51B67BB8F003F6F2D /* GUIWindowSplash.cpp */; };
Expand Down Expand Up @@ -3652,6 +3655,8 @@
3994427E1A8DD96F006C39E9 /* VideoLibraryQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoLibraryQueue.h; sourceTree = "<group>"; };
39B4F36E1B96F845009B2D88 /* RepositoryUpdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RepositoryUpdater.cpp; sourceTree = "<group>"; };
39B4F36F1B96F845009B2D88 /* RepositoryUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RepositoryUpdater.h; sourceTree = "<group>"; };
39BD2AD61B845D40004A5A15 /* DialogHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DialogHelper.h; path = helpers/DialogHelper.h; sourceTree = "<group>"; };
39BD2AD71B845D40004A5A15 /* DialogHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DialogHelper.cpp; path = helpers/DialogHelper.cpp; sourceTree = "<group>"; };
4260D5C51B67BB8F003F6F2D /* GUIWindowSplash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSplash.cpp; sourceTree = "<group>"; };
4260D5C61B67BB8F003F6F2D /* GUIWindowSplash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSplash.h; sourceTree = "<group>"; };
42DAC16B1A6E780C0066B4C8 /* IActionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IActionListener.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6453,6 +6458,15 @@
path = jobs;
sourceTree = "<group>";
};
39BD2AD51B845D1E004A5A15 /* helpers */ = {
isa = PBXGroup;
children = (
39BD2AD71B845D40004A5A15 /* DialogHelper.cpp */,
39BD2AD61B845D40004A5A15 /* DialogHelper.h */,
);
name = helpers;
sourceTree = "<group>";
};
430C880812D649B10098821A /* powermanagement */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -7966,6 +7980,7 @@
DF4A3BAC1B4B0FC100F9CDC0 /* messaging */ = {
isa = PBXGroup;
children = (
39BD2AD51B845D1E004A5A15 /* helpers */,
DF4A3BAD1B4B0FC100F9CDC0 /* ApplicationMessenger.cpp */,
DF4A3BAE1B4B0FC100F9CDC0 /* ApplicationMessenger.h */,
DF4A3BAF1B4B0FC100F9CDC0 /* IMessageTarget.h */,
Expand Down Expand Up @@ -10744,6 +10759,7 @@
18B7C3841294203F009E7A26 /* AddonDatabase.cpp in Sources */,
18B7C38A12942090009E7A26 /* GUIDialogAddonInfo.cpp in Sources */,
18B7C38B12942090009E7A26 /* GUIViewStateAddonBrowser.cpp in Sources */,
39BD2AD81B845D40004A5A15 /* DialogHelper.cpp in Sources */,
18B7C392129420E5009E7A26 /* Settings.cpp in Sources */,
18B7C3A812942132009E7A26 /* AdvancedSettings.cpp in Sources */,
395C29DB1A98A11C00EBC7AD /* WsgiResponse.cpp in Sources */,
Expand Down Expand Up @@ -11514,6 +11530,7 @@
B5011E4319AF3B56005ADF89 /* PosixFile.cpp in Sources */,
DFF0F19E17528350002DA3A4 /* Edl.cpp in Sources */,
DFF0F19F17528350002DA3A4 /* ExternalPlayer.cpp in Sources */,
39BD2ADA1B845D40004A5A15 /* DialogHelper.cpp in Sources */,
DFF0F1A217528350002DA3A4 /* AudioDecoder.cpp in Sources */,
DFF0F1A317528350002DA3A4 /* CodecFactory.cpp in Sources */,
DFF0F1A417528350002DA3A4 /* DVDPlayerCodec.cpp in Sources */,
Expand Down Expand Up @@ -12967,6 +12984,7 @@
E49913B6174E5F3C00741B6D /* AirPlayServer.cpp in Sources */,
E49913B7174E5F3C00741B6D /* AirTunesServer.cpp in Sources */,
E49913B8174E5F3C00741B6D /* cddb.cpp in Sources */,
39BD2AD91B845D40004A5A15 /* DialogHelper.cpp in Sources */,
E49913B9174E5F3C00741B6D /* DNSNameCache.cpp in Sources */,
E49913BA174E5F3C00741B6D /* EventClient.cpp in Sources */,
E49913BB174E5F3C00741B6D /* EventPacket.cpp in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \
xbmc/main/posix/MessagePrinter.a \
xbmc/media/media.a \
xbmc/messaging/messaging.a \
xbmc/messaging/helpers/messagingHelpers.a \
xbmc/music/dialogs/musicdialogs.a \
xbmc/music/infoscanner/musicscanner.a \
xbmc/music/karaoke/karaoke.a \
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,7 @@ OUTPUT_FILES="Makefile \
xbmc/cores/omxplayer/Makefile \
xbmc/cores/playercorefactory/Makefile \
xbmc/messaging/Makefile \
xbmc/messaging/helpers/Makefile \
xbmc/music/karaoke/Makefile \
xbmc/osx/Makefile \
xbmc/guilib/Makefile \
Expand Down
2 changes: 2 additions & 0 deletions project/VS2010Express/XBMC.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@
<ClCompile Include="..\..\xbmc\MediaSource.cpp" />
<ClCompile Include="..\..\xbmc\media\MediaType.cpp" />
<ClCompile Include="..\..\xbmc\messaging\ApplicationMessenger.cpp" />
<ClCompile Include="..\..\xbmc\messaging\helpers\DialogHelper.cpp" />
<ClCompile Include="..\..\xbmc\music\Album.cpp" />
<ClCompile Include="..\..\xbmc\music\Artist.cpp" />
<ClCompile Include="..\..\xbmc\music\CueInfoLoader.cpp" />
Expand Down Expand Up @@ -1045,6 +1046,7 @@
<ClInclude Include="..\..\xbmc\main\win32\MessagePrinter.h" />
<ClInclude Include="..\..\xbmc\media\MediaType.h" />
<ClInclude Include="..\..\xbmc\messaging\ApplicationMessenger.h" />
<ClInclude Include="..\..\xbmc\messaging\helpers\DialogHelper.h" />
<ClInclude Include="..\..\xbmc\messaging\IMessageTarget.h" />
<ClInclude Include="..\..\xbmc\messaging\ThreadMessage.h" />
<ClInclude Include="..\..\xbmc\music\CueInfoLoader.h" />
Expand Down
9 changes: 9 additions & 0 deletions project/VS2010Express/XBMC.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@
<Filter Include="events\windows">
<UniqueIdentifier>{87d4e872-1a96-49a2-9ef0-78dd9fc30da9}</UniqueIdentifier>
</Filter>
<Filter Include="messaging\helpers">
<UniqueIdentifier>{b0eadc46-feeb-4aca-9898-590e6b8d29b3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\xbmc\win32\pch.cpp">
Expand Down Expand Up @@ -3192,6 +3195,9 @@
<ClCompile Include="..\..\xbmc\guilib\Gif.cpp">
<Filter>guilib</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\messaging\helpers\DialogHelper.cpp">
<Filter>messaging\helpers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
Expand Down Expand Up @@ -6190,6 +6196,9 @@
<ClInclude Include="..\..\xbmc\guilib\Gif.h">
<Filter>guilib</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\messaging\helpers\DialogHelper.h">
<Filter>messaging\helpers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
Expand Down
8 changes: 5 additions & 3 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "input/InertialScrollingHandler.h"
#include "messaging/ThreadMessage.h"
#include "messaging/ApplicationMessenger.h"
#include "messaging/helpers/DialogHelper.h"
#include "SectionLoader.h"
#include "cores/DllLoader/DllLoaderContainer.h"
#include "GUIUserMessages.h"
Expand Down Expand Up @@ -149,7 +150,6 @@

// Dialog includes
#include "video/dialogs/GUIDialogVideoBookmarks.h"
#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "dialogs/GUIDialogSubMenu.h"
Expand Down Expand Up @@ -251,6 +251,8 @@ using namespace ActiveAE;

using namespace XbmcThreads;

using KODI::MESSAGING::HELPERS::DialogResponse;

// uncomment this if you want to use release libs in the debug build.
// Atm this saves you 7 mb of memory
#define USE_RELEASE_LIBS
Expand Down Expand Up @@ -1569,8 +1571,8 @@ void CApplication::ReloadSkin(bool confirm/*=false*/)
user as to whether they want to keep the current skin. */
if (confirm && !m_skinReverting)
{
bool cancelled;
if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{13123}, CVariant{13111}, cancelled, CVariant{""}, CVariant{""}, 10000))
if (HELPERS::ShowYesNoDialogText(CVariant{13123}, CVariant{13111}, CVariant{""}, CVariant{""}, 10000) !=
DialogResponse::YES)
{
m_skinReverting = true;
if (oldSkin.empty())
Expand Down
10 changes: 8 additions & 2 deletions xbmc/Autorun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
#include "filesystem/Directory.h"
#include "filesystem/DirectoryFactory.h"
#include "filesystem/File.h"
#include "messaging/ApplicationMessenger.h"
#include "messaging/helpers/DialogHelper.h"
#include "profiles/ProfilesManager.h"
#include "settings/Settings.h"
#include "playlists/PlayList.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "storage/MediaManager.h"
#include "video/VideoDatabase.h"
#include "dialogs/GUIDialogYesNo.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
Expand All @@ -52,6 +53,9 @@
using namespace XFILE;
using namespace PLAYLIST;
using namespace MEDIA_DETECT;
using namespace KODI::MESSAGING;

using KODI::MESSAGING::HELPERS::DialogResponse;

CAutorun::CAutorun()
{
Expand Down Expand Up @@ -491,7 +495,9 @@ bool CAutorun::IsEnabled() const

bool CAutorun::PlayDiscAskResume(const std::string& path)
{
return PlayDisc(path, true, !CanResumePlayDVD(path) || CGUIDialogYesNo::ShowAndGetInput(CVariant{341}, CVariant{""}, CVariant{""}, CVariant{""}, CVariant{13404}, CVariant{12021}));
return PlayDisc(path, true, !CanResumePlayDVD(path) ||
HELPERS::ShowYesNoDialogText(CVariant{341}, CVariant{""}, CVariant{13404}, CVariant{12021}) ==
DialogResponse::YES);
}

bool CAutorun::CanResumePlayDVD(const std::string& path)
Expand Down
14 changes: 10 additions & 4 deletions xbmc/addons/AddonCallbacksGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "Application.h"
#include "messaging/ApplicationMessenger.h"
#include "messaging/helpers/DialogHelper.h"
#include "Addon.h"
#include "AddonCallbacksGUI.h"
#include "utils/log.h"
Expand All @@ -40,7 +41,6 @@
#include "guilib/GUIKeyboardFactory.h"
#include "dialogs/GUIDialogNumeric.h"
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogFileBrowser.h"
#include "dialogs/GUIDialogTextViewer.h"
#include "dialogs/GUIDialogSelect.h"
Expand All @@ -51,6 +51,7 @@
#define CONTROL_LABELFILES 12

using namespace KODI::MESSAGING;
using KODI::MESSAGING::HELPERS::DialogResponse;

namespace ADDON
{
Expand Down Expand Up @@ -1862,17 +1863,22 @@ void CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputLineText(const char *heading,
//@{
bool CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputSingleText(const char *heading, const char *text, bool& bCanceled, const char *noLabel, const char *yesLabel)
{
return CGUIDialogYesNo::ShowAndGetInput(CVariant{heading}, CVariant{text}, CVariant{bCanceled}, CVariant{noLabel}, CVariant{yesLabel});
DialogResponse result = HELPERS::ShowYesNoDialogText(heading, text, noLabel, yesLabel);
bCanceled = result == DialogResponse::CANCELLED;
return result == DialogResponse::YES;
}

bool CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputLineText(const char *heading, const char *line0, const char *line1, const char *line2, const char *noLabel, const char *yesLabel)
{
return CGUIDialogYesNo::ShowAndGetInput(CVariant{heading}, CVariant{line0}, CVariant{line1}, CVariant{line2}, CVariant{noLabel}, CVariant{yesLabel});
return HELPERS::ShowYesNoDialogLines(heading, line0, line1, line2, noLabel, yesLabel) ==
DialogResponse::YES;
}

bool CAddonCallbacksGUI::Dialog_YesNo_ShowAndGetInputLineButtonText(const char *heading, const char *line0, const char *line1, const char *line2, bool &bCanceled, const char *noLabel, const char *yesLabel)
{
return CGUIDialogYesNo::ShowAndGetInput(CVariant{heading}, CVariant{line0}, CVariant{line1}, CVariant{line2}, bCanceled, CVariant{noLabel}, CVariant{yesLabel}, CGUIDialogYesNo::NO_TIMEOUT);
DialogResponse result = HELPERS::ShowYesNoDialogLines(heading, line0, line1, line2, noLabel, yesLabel);
bCanceled = result == DialogResponse::CANCELLED;
return result == DialogResponse::YES;
}
//@}

Expand Down
15 changes: 11 additions & 4 deletions xbmc/addons/AddonInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "messaging/ApplicationMessenger.h"
#include "messaging/helpers/DialogHelper.h"
#include "filesystem/FavouritesDirectory.h"
#include "utils/JobManager.h"
#include "dialogs/GUIDialogYesNo.h"
#include "addons/AddonManager.h"
#include "addons/Repository.h"
#include "guilib/GUIWindowManager.h" // for callback
Expand All @@ -50,6 +50,8 @@ using namespace XFILE;
using namespace ADDON;
using namespace KODI::MESSAGING;

using KODI::MESSAGING::HELPERS::DialogResponse;

struct find_map : public std::binary_function<CAddonInstaller::JobMap::value_type, unsigned int, bool>
{
bool operator() (CAddonInstaller::JobMap::value_type t, unsigned int id) const
Expand Down Expand Up @@ -172,9 +174,14 @@ bool CAddonInstaller::InstallModal(const std::string &addonID, ADDON::AddonPtr &
return false;

// if specified ask the user if he wants it installed
if (promptForInstall &&
!CGUIDialogYesNo::ShowAndGetInput(CVariant{24076}, CVariant{24100}, CVariant{addon->Name()}, CVariant{24101}))
return false;
if (promptForInstall)
{
if (HELPERS::ShowYesNoDialogLines(CVariant{24076}, CVariant{24100}, CVariant{addon->Name()}, CVariant{24101}) !=
DialogResponse::YES)
{
return false;
}
}

if (!InstallOrUpdate(addonID, "", false, true))
return false;
Expand Down
9 changes: 7 additions & 2 deletions xbmc/addons/LanguageResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
#include "LangInfo.h"
#include "addons/AddonManager.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "dialogs/GUIDialogYesNo.h"
#include "guilib/GUIWindowManager.h"
#include "settings/Settings.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"
#include "messaging/helpers/DialogHelper.h"

using namespace KODI::MESSAGING;

using KODI::MESSAGING::HELPERS::DialogResponse;

#define LANGUAGE_ADDON_PREFIX "resource.language."

Expand Down Expand Up @@ -109,7 +113,8 @@ bool CLanguageResource::IsInUse() const
void CLanguageResource::OnPostInstall(bool update, bool modal)
{
if (IsInUse() ||
(!update && !modal && CGUIDialogYesNo::ShowAndGetInput(CVariant{Name()}, CVariant{24132})))
(!update && !modal &&
(HELPERS::ShowYesNoDialogText(CVariant{Name()}, CVariant{24132}) == DialogResponse::YES)))
{
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
Expand Down
Loading