Skip to content

Commit

Permalink
[contextmenu] move video info to new system
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Mar 5, 2016
1 parent 89e872f commit e984e95
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 11 deletions.
8 changes: 4 additions & 4 deletions addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -6137,7 +6137,7 @@ msgstr ""

#: xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
#: xbmc/video/windows/GUIWindowVideoBase.cpp
#: xbmc/video/windows/GUIWindowVideoNav.cpp
#: xbmc/video/ContextMenus.h
msgctxt "#13346"
msgid "Movie information"
msgstr ""
Expand Down Expand Up @@ -11453,13 +11453,13 @@ msgid "%.1f (%i votes)"
msgstr ""

#: xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
#: xbmc/video/windows/GUIWindowVideoNav.cpp
#: xbmc/video/ContextMenus.h
msgctxt "#20351"
msgid "TV show information"
msgstr ""

#: xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
#: xbmc/video/windows/GUIWindowVideoNav.cpp
#: xbmc/video/ContextMenus.h
msgctxt "#20352"
msgid "Episode information"
msgstr ""
Expand Down Expand Up @@ -11654,7 +11654,7 @@ msgstr ""

#: xbmc/music/windows/GUIWindowMusicNav.cpp
#: xbmc/video/jobs/VideoLibraryRefreshingJob.cpp
#: xbmc/video/windows/GUIWindowVideoNav.cpp
#: xbmc/video/ContextMenus.h
msgctxt "#20393"
msgid "Music video information"
msgstr ""
Expand Down
1 change: 1 addition & 0 deletions xbmc/ContextMenuItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <map>

#include "addons/IAddon.h"
#include "addons/AddonManager.h"
#include "addons/Repository.h"
Expand Down
5 changes: 5 additions & 0 deletions xbmc/ContextMenuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "addons/ContextMenuAddon.h"
#include "addons/ContextMenus.h"
#include "addons/IAddon.h"
#include "video/ContextMenus.h"
#include "utils/log.h"

using namespace ADDON;
Expand Down Expand Up @@ -58,6 +59,10 @@ void CContextMenuManager::Init()
std::make_shared<CONTEXTMENU::CAddonInfo>(),
std::make_shared<CONTEXTMENU::CAddonSettings>(),
std::make_shared<CONTEXTMENU::CCheckForUpdates>(),
std::make_shared<CONTEXTMENU::CEpisodeInfo>(),
std::make_shared<CONTEXTMENU::CMovieInfo>(),
std::make_shared<CONTEXTMENU::CMusicVideoInfo>(),
std::make_shared<CONTEXTMENU::CTVShowInfo>(),
};
}

Expand Down
1 change: 1 addition & 0 deletions xbmc/video/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(SOURCES Bookmark.cpp
VideoThumbLoader.cpp)

set(HEADERS Bookmark.h
ContextMenus.h
Episode.h
FFmpegVideoDecoder.h
GUIViewStateVideo.h
Expand Down
71 changes: 71 additions & 0 deletions xbmc/video/ContextMenus.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#pragma once
/*
* Copyright (C) 2016 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/

#include "guilib/GUIWindowManager.h"
#include "video/windows/GUIWindowVideoNav.h"

namespace CONTEXTMENU
{

struct CVideoInfo : CStaticContextMenuAction
{
const MediaType m_mediaType;
CVideoInfo(uint32_t label, MediaType mediaType)
: CStaticContextMenuAction(label), m_mediaType(mediaType) {}

bool IsVisible(const CFileItem& item) const override
{
return item.HasVideoInfoTag() && item.GetVideoInfoTag()->m_type == m_mediaType;
}

bool Execute(const CFileItemPtr& item) const override
{
auto window = static_cast<CGUIWindowVideoNav*>(g_windowManager.GetWindow(WINDOW_VIDEO_NAV));
if (window)
{
ADDON::ScraperPtr info;
window->OnItemInfo(item.get(), info);
return true;
}
return false;
}
};

struct CTVShowInfo : CVideoInfo
{
CTVShowInfo() : CVideoInfo(20351, MediaTypeTvShow) {}
};

struct CEpisodeInfo : CVideoInfo
{
CEpisodeInfo() : CVideoInfo(20352, MediaTypeEpisode) {}
};

struct CMusicVideoInfo : CVideoInfo
{
CMusicVideoInfo() : CVideoInfo(20393, MediaTypeMusicVideo) {}
};

struct CMovieInfo : CVideoInfo
{
CMovieInfo() : CVideoInfo(13346, MediaTypeMovie) {}
};
}
7 changes: 0 additions & 7 deletions xbmc/video/windows/GUIWindowVideoNav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,13 +905,6 @@ void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &butt
VIDEO::SScanSettings settings;
GetScraperForItem(item.get(), info, settings);

if (info && info->Content() == CONTENT_TVSHOWS)
buttons.Add(CONTEXT_BUTTON_INFO, item->m_bIsFolder ? 20351 : 20352);
else if (info && info->Content() == CONTENT_MUSICVIDEOS)
buttons.Add(CONTEXT_BUTTON_INFO,20393);
else if (info && info->Content() == CONTENT_MOVIES)
buttons.Add(CONTEXT_BUTTON_INFO, 13346);

// can we update the database?
if (CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
Expand Down

0 comments on commit e984e95

Please sign in to comment.