// Now check with the player if action can be handled.
if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
- (g_windowManager.GetActiveWindow() == WINDOW_DIALOG_VIDEO_OSD && (action.GetID() == ACTION_NEXT_ITEM || action.GetID() == ACTION_PREV_ITEM || action.GetID() == ACTION_CHANNEL_UP || action.GetID() == ACTION_CHANNEL_DOWN)))
+ (g_windowManager.GetActiveWindow() == WINDOW_DIALOG_VIDEO_OSD && (action.GetID() == ACTION_NEXT_ITEM || action.GetID() == ACTION_PREV_ITEM || action.GetID() == ACTION_CHANNEL_UP || action.GetID() == ACTION_CHANNEL_DOWN)) ||
+ action.GetID() == ACTION_STOP)
{
if (m_pPlayer->OnAction(action))
return true;
CApplicationMessenger::Get().Cleanup();
+ CLog::Log(LOGNOTICE, "stop player");
+ m_pPlayer->ClosePlayer();
+
StopPVRManager();
StopServices();
//Sleep(5000);
- CLog::Log(LOGNOTICE, "stop player");
- m_pPlayer->ClosePlayer();
-
#if HAS_FILESYTEM_DAAP
CLog::Log(LOGNOTICE, "stop daap clients");
g_DaapClient.Release();
m_iScreenSaveLock = 0;
ResetScreenSaverTimer();
- if (m_screenSaver->ID() == "screensaver.xbmc.builtin.dim" || m_screenSaver->ID() == "screensaver.xbmc.builtin.black" || m_screenSaver->ID().empty())
+ if (m_screenSaver->ID() == "visualization")
+ {
+ // we can just continue as usual from vis mode
+ return false;
+ }
+ else if (m_screenSaver->ID() == "screensaver.xbmc.builtin.dim" || m_screenSaver->ID() == "screensaver.xbmc.builtin.black" || m_screenSaver->ID().empty())
return true;
else if (!m_screenSaver->ID().empty())
{ // we're in screensaver window
- if (g_windowManager.GetActiveWindow() == WINDOW_SCREENSAVER
- || g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
+ if (g_windowManager.GetActiveWindow() == WINDOW_SCREENSAVER)
g_windowManager.PreviousWindow(); // show the previous window
-
if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW)
CApplicationMessenger::Get().SendAction(CAction(ACTION_STOP), WINDOW_SLIDESHOW);
}
// the type of screensaver displayed
void CApplication::ActivateScreenSaver(bool forceType /*= false */)
{
+ if (m_pPlayer->IsPlayingAudio() && CSettings::Get().GetBool("screensaver.usemusicvisinstead") && !CSettings::Get().GetString("musicplayer.visualisation").empty())
+ { // just activate the visualisation if user toggled the usemusicvisinstead option
+ g_windowManager.ActivateWindow(WINDOW_VISUALISATION);
+ return;
+ }
+
m_bScreenSave = true;
// Get Screensaver Mode
if (!CAddonMgr::Get().GetAddon("screensaver.xbmc.builtin.dim", m_screenSaver))
m_screenSaver.reset(new CScreenSaver(""));
}
- // Check if we are Playing Audio and Vis instead Screensaver!
- else if (m_pPlayer->IsPlayingAudio() && CSettings::Get().GetBool("screensaver.usemusicvisinstead") && !CSettings::Get().GetString("musicplayer.visualisation").empty())
- { // activate the visualisation
- m_screenSaver.reset(new CScreenSaver("visualization"));
- // prevent music info popup if vis is already running
- if (g_windowManager.GetActiveWindow() != WINDOW_VISUALISATION)
- g_windowManager.ActivateWindow(WINDOW_VISUALISATION);
- return;
- }
}
if (m_screenSaver->ID() == "screensaver.xbmc.builtin.dim" || m_screenSaver->ID().empty())
return;
CAddonInstaller::Get().UpdateRepos();
CAEFactory::GarbageCollect();
+
}
// Global Idle Time in Seconds
return *m_itemCurrentFile;
}
+ CFileItem& CApplication::CurrentUnstackedItem()
+ {
+ if (m_itemCurrentFile->IsStack() && m_currentStack->Size() > 0)
+ return *(*m_currentStack)[m_currentStackPosition];
+ else
+ return *m_itemCurrentFile;
+ }
+
void CApplication::ShowVolumeBar(const CAction *action)
{
CGUIDialog *volumeBar = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VOLUME_BAR);
#include "filesystem/PluginDirectory.h"
#include "filesystem/SpecialProtocol.h"
#include "guilib/GUIImage.h"
+#include "guilib/GUIKeyboardFactory.h"
+#include "guilib/Key.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "settings/VideoSettings.h"
#define CONTROL_SUBSEXIST 130
#define CONTROL_SUBSTATUS 140
#define CONTROL_SERVICELIST 150
+#define CONTROL_MANUALSEARCH 160
/*! \brief simple job to retrieve a directory and store a string (language)
*/
bool CGUIDialogSubtitles::OnMessage(CGUIMessage& message)
{
- if (message.GetMessage() == GUI_MSG_CLICKED)
+ if (message.GetMessage() == GUI_MSG_CLICKED &&
+ (message.GetParam1() == ACTION_SELECT_ITEM ||
+ message.GetParam1() == ACTION_MOUSE_LEFT_CLICK))
{
int iControl = message.GetSenderId();
return true;
}
+ else if (iControl == CONTROL_MANUALSEARCH)
+ {
+ //manual search
+ if (CGUIKeyboardFactory::ShowAndGetInput(m_strManualSearch, g_localizeStrings.Get(24121), true))
+ {
+ Search(m_strManualSearch);
+ return true;
+ }
+ }
}
else if (message.GetMessage() == GUI_MSG_WINDOW_DEINIT)
{
std::string status;
CFileItemList subs;
{
- CSingleLock lock(m_section);
+ CSingleLock lock(m_critsection);
status = m_status;
subs.Assign(*m_subtitles);
}
}
std::string defaultService;
- const CFileItem &item = g_application.CurrentFileItem();
+ const CFileItem &item = g_application.CurrentUnstackedItem();
if (item.GetVideoContentType() == VIDEODB_CONTENT_TVSHOWS ||
item.GetVideoContentType() == VIDEODB_CONTENT_EPISODES)
// Set default service for tv shows
return CFileItemPtr();
}
-void CGUIDialogSubtitles::Search()
+void CGUIDialogSubtitles::Search(const std::string &search/*=""*/)
{
if (m_currentService.empty())
return; // no services available
ClearSubtitles();
CURL url("plugin://" + m_currentService + "/");
- url.SetOption("action", "search");
+ if (!search.empty())
+ {
+ url.SetOption("action", "manualsearch");
+ url.SetOption("searchstring", search);
+ }
+ else
+ url.SetOption("action", "search");
const CSetting *setting = CSettings::Get().GetSetting("subtitles.languages");
if (setting)
const CURL &url = ((CSubtitlesJob *)job)->GetURL();
const CFileItemList *items = ((CSubtitlesJob *)job)->GetItems();
const std::string &language = ((CSubtitlesJob *)job)->GetLanguage();
- if (url.GetOption("action") == "search")
+ if (url.GetOption("action") == "search" || url.GetOption("action") == "manualsearch")
OnSearchComplete(items);
else
OnDownloadComplete(items, language);
void CGUIDialogSubtitles::OnSearchComplete(const CFileItemList *items)
{
- CSingleLock lock(m_section);
+ CSingleLock lock(m_critsection);
m_subtitles->Assign(*items);
UpdateStatus(SEARCH_COMPLETE);
m_updateSubsList = true;
void CGUIDialogSubtitles::UpdateStatus(STATUS status)
{
- CSingleLock lock(m_section);
+ CSingleLock lock(m_critsection);
std::string label;
switch (status)
{
CStdString strFileName;
CStdString strDestPath;
+ #if 0
+ // TODO: Code to download all subtitles for all stack items in one run
if (g_application.CurrentFileItem().IsStack())
{
for (int i = 0; i < items->Size(); i++)
// CLog::Log(LOGDEBUG, "Stack Subs [%s} Found", vecItems[i]->GetLabel().c_str());
}
}
- else if (StringUtils::StartsWith(g_application.CurrentFile(), "http://"))
+ #endif
+
+ // Get (unstacked) path
+ const CStdString &strCurrentFile = g_application.CurrentUnstackedItem().GetPath();
+
+ if (StringUtils::StartsWith(strCurrentFile, "http://"))
{
strFileName = "TemporarySubs";
strDestPath = "special://temp/";
}
else
{
- strFileName = URIUtils::GetFileName(g_application.CurrentFile());
+ strFileName = URIUtils::GetFileName(strCurrentFile);
if (CSettings::Get().GetBool("subtitles.savetomoviefolder"))
{
- strDestPath = URIUtils::GetDirectory(g_application.CurrentFile());
+ strDestPath = URIUtils::GetDirectory(strCurrentFile);
if (!CUtil::SupportsWriteFileOperations(strDestPath))
strDestPath.clear();
}
{
CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_SUBLIST);
OnMessage(msg);
- CSingleLock lock(m_section);
+ CSingleLock lock(m_critsection);
m_subtitles->Clear();
}