Skip to content

Commit

Permalink
Merge pull request xbmc#24444 from ksooo/video-remove-new-version-button
Browse files Browse the repository at this point in the history
[video] Remove item 'New version...' from node 'Movies/Versions'. …
  • Loading branch information
ksooo authored Jan 7, 2024
2 parents b079f9d + 87c99f4 commit 47cbc96
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 58 deletions.
1 change: 0 additions & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -23766,7 +23766,6 @@ msgstr ""
#. New video version dialog button
#: xbmc/video/dialogs/GUIDialogVideoManager.cpp
#: xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp
#: xbmc/video/windows/GUIWindowVideoNav.cpp
msgctxt "#40004"
msgid "New version..."
msgstr ""
Expand Down
1 change: 0 additions & 1 deletion xbmc/ContextMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ bool CAddRemoveFavourite::IsVisible(const CFileItem& item) const
!item.IsPath("newplaylist://") && !URIUtils::IsProtocol(item.GetPath(), "favourites") &&
!URIUtils::IsProtocol(item.GetPath(), "newsmartplaylist") &&
!URIUtils::IsProtocol(item.GetPath(), "newtag") &&
!URIUtils::IsProtocol(item.GetPath(), "newvideoversion") &&
!URIUtils::IsProtocol(item.GetPath(), "musicsearch") &&
// Hide this item for all PVR EPG/timers/search except EPG/timer/timer rules/search root
// folders.
Expand Down
3 changes: 1 addition & 2 deletions xbmc/video/VideoUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,7 @@ bool IsItemPlayable(const CFileItem& item)
// Exclude special items
if (StringUtils::StartsWithNoCase(item.GetPath(), "newsmartplaylist://") ||
StringUtils::StartsWithNoCase(item.GetPath(), "newplaylist://") ||
StringUtils::StartsWithNoCase(item.GetPath(), "newtag://") ||
StringUtils::StartsWithNoCase(item.GetPath(), "newvideoversion://"))
StringUtils::StartsWithNoCase(item.GetPath(), "newtag://"))
return false;

// Include playlists located at one of the possible video/mixed playlist locations
Expand Down
23 changes: 0 additions & 23 deletions xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "dialogs/GUIDialogSelect.h"
#include "dialogs/GUIDialogYesNo.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIKeyboardFactory.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "settings/MediaSourceSettings.h"
Expand Down Expand Up @@ -296,28 +295,6 @@ bool CGUIDialogVideoManagerVersions::AddVideoVersion()
return false;
}

std::tuple<int, std::string> CGUIDialogVideoManagerVersions::NewVideoVersion()
{
std::string typeVideoVersion;

// prompt for the new video version
if (!CGUIKeyboardFactory::ShowAndGetInput(typeVideoVersion, CVariant{40004}, false))
return std::make_tuple(-1, "");

CVideoDatabase videodb;
if (!videodb.Open())
{
CLog::LogF(LOGERROR, "Failed to open video database!");
return std::make_tuple(-1, "");
}

typeVideoVersion = StringUtils::Trim(typeVideoVersion);
const int idVideoVersion{videodb.AddVideoVersionType(typeVideoVersion, VideoAssetTypeOwner::USER,
VideoAssetType::VERSION)};

return std::make_tuple(idVideoVersion, typeVideoVersion);
}

bool CGUIDialogVideoManagerVersions::ManageVideoVersions(const std::shared_ptr<CFileItem>& item)
{
CGUIDialogVideoManagerVersions* dialog{
Expand Down
1 change: 0 additions & 1 deletion xbmc/video/dialogs/GUIDialogVideoManagerVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class CGUIDialogVideoManagerVersions : public CGUIDialogVideoManager

void SetVideoAsset(const std::shared_ptr<CFileItem>& item) override;

static std::tuple<int, std::string> NewVideoVersion();
static bool ProcessVideoVersion(VideoDbContentType itemType, int dbId);
/*!
* \brief Open the Manage Versions dialog for a video
Expand Down
4 changes: 1 addition & 3 deletions xbmc/video/windows/GUIWindowVideoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,7 @@ bool CGUIWindowVideoBase::OnSelect(int iItem)
if (!item->m_bIsFolder && path != "add" &&
!StringUtils::StartsWith(path, "newsmartplaylist://") &&
!StringUtils::StartsWith(path, "newplaylist://") &&
!StringUtils::StartsWith(path, "newtag://") &&
!StringUtils::StartsWith(path, "newvideoversion://") &&
!StringUtils::StartsWith(path, "script://"))
!StringUtils::StartsWith(path, "newtag://") && !StringUtils::StartsWith(path, "script://"))
return OnFileAction(iItem, CVideoSelectActionProcessorBase::GetDefaultSelectAction(), "");

return CGUIMediaWindow::OnSelect(iItem);
Expand Down
28 changes: 1 addition & 27 deletions xbmc/video/windows/GUIWindowVideoNav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,6 @@ bool CGUIWindowVideoNav::GetDirectory(const std::string &strDirectory, CFileItem
newTag->SetSpecialSort(SortSpecialOnTop);
items.Add(newTag);
}
else if (items.GetContent() == "videoversions" &&
!items.Contains("newvideoversion://" + videoUrl.GetType()))
{
const auto newVideoVersion{
std::make_shared<CFileItem>("newvideoversion://" + videoUrl.GetType(), false)};
newVideoVersion->SetLabel(g_localizeStrings.Get(40004));
newVideoVersion->SetLabelPreformatted(true);
newVideoVersion->SetSpecialSort(SortSpecialOnTop);
newVideoVersion->SetProperty("IsPlayable", false);
items.Add(newVideoVersion);
}
}
}
return bResult;
Expand Down Expand Up @@ -685,8 +674,7 @@ void CGUIWindowVideoNav::OnDeleteItem(const CFileItemPtr& pItem)
if (!m_vecItems->IsVideoDb() && !pItem->IsVideoDb())
{
if (!pItem->IsPath("newsmartplaylist://video") && !pItem->IsPath("special://videoplaylists/") &&
!pItem->IsPath("sources://video/") && !URIUtils::IsProtocol(pItem->GetPath(), "newtag") &&
!URIUtils::IsProtocol(pItem->GetPath(), "newvideoversion"))
!pItem->IsPath("sources://video/") && !URIUtils::IsProtocol(pItem->GetPath(), "newtag"))
CGUIWindowVideoBase::OnDeleteItem(pItem);
}
else if (StringUtils::StartsWithNoCase(pItem->GetPath(), "videodb://movies/sets/") &&
Expand Down Expand Up @@ -1050,20 +1038,6 @@ bool CGUIWindowVideoNav::OnClick(int iItem, const std::string &player)
Refresh(true);
return true;
}
else if (StringUtils::StartsWithNoCase(item->GetPath(), "newvideoversion://"))
{
// dont allow update while scanning
if (CVideoLibraryQueue::GetInstance().IsScanningLibrary())
{
HELPERS::ShowOKDialogText(CVariant{257}, CVariant{14057});
return true;
}

CGUIDialogVideoManagerVersions::NewVideoVersion();

Refresh(true);
return true;
}

return CGUIWindowVideoBase::OnClick(iItem, player);
}
Expand Down

0 comments on commit 47cbc96

Please sign in to comment.