diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-06-22 09:43:14 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-06-22 09:43:14 +0000 |
commit | 68e2af3033c7fdebe1a24d3454de9add88175c02 (patch) | |
tree | 759c4b196d355c3db543d3fe14a85e521c10274b | |
parent | 7863b0e30a707cabf1339983b32404244a85b0c4 (diff) |
cleanup: Remove the files as well
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31300 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/GUIViewStateScripts.cpp | 72 | ||||
-rw-r--r-- | xbmc/GUIViewStateScripts.h | 36 | ||||
-rw-r--r-- | xbmc/GUIWindowScripts.cpp | 261 | ||||
-rw-r--r-- | xbmc/GUIWindowScripts.h | 47 |
4 files changed, 0 insertions, 416 deletions
diff --git a/xbmc/GUIViewStateScripts.cpp b/xbmc/GUIViewStateScripts.cpp deleted file mode 100644 index 62e2b6b61b..0000000000 --- a/xbmc/GUIViewStateScripts.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * 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, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "GUIViewStateScripts.h" -#include "GUIBaseContainer.h" -#include "FileItem.h" -#include "Key.h" -#include "ViewState.h" -#include "Settings.h" -#include "FileSystem/Directory.h" - -using namespace XFILE; - -CGUIViewStateWindowScripts::CGUIViewStateWindowScripts(const CFileItemList& items) : CGUIViewState(items) -{ - AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | Foldername, empty - AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date - AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Filename, Size | Foldername, Size - AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | FolderName, empty - SetSortMethod(SORT_METHOD_LABEL); - - SetViewAsControl(DEFAULT_VIEW_LIST); - - SetSortOrder(SORT_ORDER_ASC); - LoadViewState(items.m_strPath, WINDOW_SCRIPTS); -} - -void CGUIViewStateWindowScripts::SaveViewState() -{ - SaveViewToDb(m_items.m_strPath, WINDOW_SCRIPTS); -} - -CStdString CGUIViewStateWindowScripts::GetExtensions() -{ -#if defined(__APPLE__) - return ".py|.applescript"; -#else -// return ".py"; - return ""; -#endif -} - -VECSOURCES& CGUIViewStateWindowScripts::GetSources() -{ - m_sources.clear(); - - CMediaSource share; - share.strPath = "special://xbmc/scripts"; - share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; - m_sources.push_back(share); - - return CGUIViewState::GetSources(); -} - diff --git a/xbmc/GUIViewStateScripts.h b/xbmc/GUIViewStateScripts.h deleted file mode 100644 index ad2774b85c..0000000000 --- a/xbmc/GUIViewStateScripts.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * 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, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "GUIViewState.h" - -class CGUIViewStateWindowScripts : public CGUIViewState -{ -public: - CGUIViewStateWindowScripts(const CFileItemList& items); - -protected: - virtual void SaveViewState(); - virtual CStdString GetExtensions(); - virtual VECSOURCES& GetSources(); -}; - diff --git a/xbmc/GUIWindowScripts.cpp b/xbmc/GUIWindowScripts.cpp deleted file mode 100644 index 3915156eeb..0000000000 --- a/xbmc/GUIWindowScripts.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * 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, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "system.h" -#include "GUIWindowScripts.h" -#include "Util.h" -#ifdef HAS_PYTHON -#include "lib/libPython/XBPython.h" -#endif -#include "GUIDialogTextViewer.h" -#include "GUIWindowManager.h" -#include "FileSystem/File.h" -#include "FileItem.h" -#include "addons/AddonManager.h" -#include "GUIDialogAddonSettings.h" -#include "GUIUserMessages.h" -#include "Settings.h" -#include "LocalizeStrings.h" -#if defined(__APPLE__) -#include "SpecialProtocol.h" -#include "CocoaInterface.h" -#endif -#include "utils/FileUtils.h" -#include "AddonDatabase.h" - -using namespace XFILE; -using namespace ADDON; - -#define CONTROL_BTNVIEWASICONS 2 -#define CONTROL_BTNSORTBY 3 -#define CONTROL_BTNSORTASC 4 -#define CONTROL_LABELFILES 12 - -CGUIWindowScripts::CGUIWindowScripts() - : CGUIMediaWindow(WINDOW_SCRIPTS, "MyScripts.xml") -{ - m_bViewOutput = false; - m_scriptSize = 0; -} - -CGUIWindowScripts::~CGUIWindowScripts() -{ -} - -bool CGUIWindowScripts::OnAction(const CAction &action) -{ - if (action.GetID() == ACTION_SHOW_INFO) - { - OnInfo(); - return true; - } - return CGUIMediaWindow::OnAction(action); -} - -bool CGUIWindowScripts::OnMessage(CGUIMessage& message) -{ - switch ( message.GetMessage() ) - { - case GUI_MSG_WINDOW_INIT: - { - if (m_vecItems->m_strPath == "?") - m_vecItems->m_strPath = ""; - return CGUIMediaWindow::OnMessage(message); - } - break; - case GUI_MSG_USER: - m_debug += message.GetLabel(); - if (m_bViewOutput) - { - CGUIDialogTextViewer* pDlgInfo = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER); - pDlgInfo->SetText(m_debug); - CGUIMessage msg(GUI_MSG_NOTIFY_ALL, WINDOW_DIALOG_TEXT_VIEWER, 0, GUI_MSG_UPDATE); - g_windowManager.SendThreadMessage(msg); - } - break; - default: - break; - } - return CGUIMediaWindow::OnMessage(message); -} - -bool CGUIWindowScripts::Update(const CStdString &strDirectory) -{ - // Look if baseclass can handle it - if (!CGUIMediaWindow::Update(strDirectory)) - return false; - -#ifdef HAS_PYTHON - /* check if any python scripts are running. If true, place "(Running)" after the item. - * since stopping a script can take up to 10 seconds or more,we display 'stopping' - * after the filename for now. - */ - int iSize = g_pythonParser.ScriptsSize(); - for (int i = 0; i < iSize; i++) - { - int id = g_pythonParser.GetPythonScriptId(i); - if (g_pythonParser.isRunning(id)) - { - const char* filename = g_pythonParser.getFileName(id); - - for (int i = 0; i < m_vecItems->Size(); i++) - { - CFileItemPtr pItem = m_vecItems->Get(i); - if (pItem->m_strPath == filename) - { - CStdString runningLabel = pItem->GetLabel() + " ("; - if (g_pythonParser.isStopping(id)) - runningLabel += g_localizeStrings.Get(23053) + ")"; - else - runningLabel += g_localizeStrings.Get(23054) + ")"; - pItem->SetLabel(runningLabel); - } - } - } - } -#endif - - return true; -} - -bool CGUIWindowScripts::OnPlayMedia(int iItem) -{ - CFileItemPtr pItem=m_vecItems->Get(iItem); - CStdString strPath = pItem->m_strPath; - -#if defined(__APPLE__) - if (CUtil::GetExtension(pItem->m_strPath) == ".applescript") - { - CStdString osxPath = CSpecialProtocol::TranslatePath(pItem->m_strPath); - Cocoa_DoAppleScriptFile(osxPath.c_str()); - return true; - } -#endif - -#ifdef HAS_PYTHON - if (g_pythonParser.StopScript(strPath)) - { // update items - int selectedItem = m_viewControl.GetSelectedItem(); - Update(m_vecItems->m_strPath); - m_viewControl.SetSelectedItem(selectedItem); - return true; - } - g_pythonParser.evalFile(strPath); -#endif - - return true; -} - -void CGUIWindowScripts::OnInfo() -{ - CGUIDialogTextViewer* pDlgInfo = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER); - if (pDlgInfo) - { - pDlgInfo->SetHeading(g_localizeStrings.Get(262)); - pDlgInfo->SetText(m_debug); - m_bViewOutput = true; - pDlgInfo->DoModal(); - m_bViewOutput = false; - } -} - -void CGUIWindowScripts::FrameMove() -{ -#ifdef HAS_PYTHON - // update control_list / control_thumbs if one or more scripts have stopped / started - if (g_pythonParser.ScriptsSize() != m_scriptSize) - { - int selectedItem = m_viewControl.GetSelectedItem(); - Update(m_vecItems->m_strPath); - m_viewControl.SetSelectedItem(selectedItem); - m_scriptSize = g_pythonParser.ScriptsSize(); - } -#endif - - CGUIWindow::FrameMove(); -} - -bool CGUIWindowScripts::GetDirectory(const CStdString& strDirectory, CFileItemList& items) -{ - VECADDONS addons; - CAddonMgr::Get().GetAddons(ADDON_SCRIPT,addons); - - items.ClearItems(); - for (unsigned i=0; i < addons.size(); i++) - { - AddonPtr addon = addons[i]; - CFileItemPtr pItem(new CFileItem(addon->LibPath(),false)); - pItem->SetLabel(addon->Name()); - pItem->SetLabel2(addon->Summary()); - pItem->SetThumbnailImage(addon->Icon()); - CAddonDatabase::SetPropertiesFromAddon(addon,pItem); - items.Add(pItem); - } - - return true; -} - -void CGUIWindowScripts::GetContextButtons(int itemNumber, CContextButtons &buttons) -{ - CGUIMediaWindow::GetContextButtons(itemNumber, buttons); - - // add script settings item - CFileItemPtr item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : CFileItemPtr(); - if (item && item->IsPythonScript()) - { - CStdString path, filename; - CUtil::Split(item->m_strPath, path, filename); - ADDON::AddonPtr script; - if (ADDON::CAddonMgr::Get().GetAddon(item->m_strPath, script, ADDON::ADDON_SCRIPT)) - { - if (script->HasSettings()) - { - buttons.Add(CONTEXT_BUTTON_SCRIPT_SETTINGS, 1049); - } - } - } - - buttons.Add(CONTEXT_BUTTON_INFO, 654); -} - -bool CGUIWindowScripts::OnContextButton(int itemNumber, CONTEXT_BUTTON button) -{ - if (button == CONTEXT_BUTTON_INFO) - { - OnInfo(); - return true; - } - else if (button == CONTEXT_BUTTON_SCRIPT_SETTINGS) - { - CStdString path, filename; - CUtil::Split(m_vecItems->Get(itemNumber)->m_strPath, path, filename); - ADDON::AddonPtr script; - if (ADDON::CAddonMgr::Get().GetAddon(m_vecItems->Get(itemNumber)->m_strPath, script, ADDON::ADDON_SCRIPT)) - { - if (CGUIDialogAddonSettings::ShowAndGetInput(script)) - Update(m_vecItems->m_strPath); - } - return true; - } - - return CGUIMediaWindow::OnContextButton(itemNumber, button); -} - diff --git a/xbmc/GUIWindowScripts.h b/xbmc/GUIWindowScripts.h deleted file mode 100644 index 6e532d66b0..0000000000 --- a/xbmc/GUIWindowScripts.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * 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, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "GUIMediaWindow.h" - -class CGUIWindowScripts : public CGUIMediaWindow -{ -public: - CGUIWindowScripts(void); - virtual ~CGUIWindowScripts(void); - virtual bool OnMessage(CGUIMessage& message); - virtual bool OnAction(const CAction &action); - virtual void FrameMove(); - -protected: - virtual bool Update(const CStdString &strDirectory); - virtual bool OnPlayMedia(int iItem); - virtual bool GetDirectory(const CStdString& strDirectory, CFileItemList& items); - virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); - virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); - void OnInfo(); - - bool m_bViewOutput; - int m_scriptSize; - VECSOURCES m_shares; - CStdString m_debug; -}; |