diff options
Diffstat (limited to 'xbmc/addons/GUIViewStateAddonBrowser.cpp')
| -rw-r--r-- | xbmc/addons/GUIViewStateAddonBrowser.cpp | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/xbmc/addons/GUIViewStateAddonBrowser.cpp b/xbmc/addons/GUIViewStateAddonBrowser.cpp deleted file mode 100644 index 4f42b2e..0000000 --- a/xbmc/addons/GUIViewStateAddonBrowser.cpp +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2013 Team XBMC | ||
| 3 | * http://xbmc.org | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with XBMC; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include "GUIViewStateAddonBrowser.h" | ||
| 22 | #include "FileItem.h" | ||
| 23 | #include "filesystem/File.h" | ||
| 24 | #include "guilib/GraphicContext.h" | ||
| 25 | #include "guilib/WindowIDs.h" | ||
| 26 | #include "view/ViewState.h" | ||
| 27 | #include "addons/Addon.h" | ||
| 28 | #include "addons/AddonManager.h" | ||
| 29 | #include "addons/AddonInstaller.h" | ||
| 30 | #include "AddonDatabase.h" | ||
| 31 | #include "utils/StringUtils.h" | ||
| 32 | |||
| 33 | using namespace XFILE; | ||
| 34 | using namespace ADDON; | ||
| 35 | |||
| 36 | CGUIViewStateAddonBrowser::CGUIViewStateAddonBrowser(const CFileItemList& items) : CGUIViewState(items) | ||
| 37 | { | ||
| 38 | if (items.IsVirtualDirectoryRoot()) | ||
| 39 | { | ||
| 40 | AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", "%L", "")); | ||
| 41 | SetSortMethod(SortByNone); | ||
| 42 | } | ||
| 43 | else | ||
| 44 | { | ||
| 45 | AddSortMethod(SortByLabel, SortAttributeIgnoreFolders, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | Foldername, empty | ||
| 46 | AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date | ||
| 47 | SetSortMethod(SortByLabel); | ||
| 48 | } | ||
| 49 | SetViewAsControl(DEFAULT_VIEW_AUTO); | ||
| 50 | |||
| 51 | SetSortOrder(SortOrderAscending); | ||
| 52 | LoadViewState(items.GetPath(), WINDOW_ADDON_BROWSER); | ||
| 53 | } | ||
| 54 | |||
| 55 | void CGUIViewStateAddonBrowser::SaveViewState() | ||
| 56 | { | ||
| 57 | SaveViewToDb(m_items.GetPath(), WINDOW_ADDON_BROWSER); | ||
| 58 | } | ||
| 59 | |||
| 60 | std::string CGUIViewStateAddonBrowser::GetExtensions() | ||
| 61 | { | ||
| 62 | return ""; | ||
| 63 | } | ||
| 64 | |||
| 65 | VECSOURCES& CGUIViewStateAddonBrowser::GetSources() | ||
| 66 | { | ||
| 67 | m_sources.clear(); | ||
| 68 | |||
| 69 | { // check for updates | ||
| 70 | CMediaSource share; | ||
| 71 | share.strPath = "addons://check/"; | ||
| 72 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_REMOTE; // hack for sorting | ||
| 73 | share.strName = g_localizeStrings.Get(24055); // "Check for updates" | ||
| 74 | CDateTime lastChecked = CAddonInstaller::Get().LastRepoUpdate(); | ||
| 75 | if (lastChecked.IsValid()) | ||
| 76 | share.strStatus = StringUtils::Format(g_localizeStrings.Get(24056).c_str(), | ||
| 77 | lastChecked.GetAsLocalizedDateTime(false, false).c_str()); | ||
| 78 | m_sources.push_back(share); | ||
| 79 | } | ||
| 80 | if (CAddonMgr::Get().HasOutdatedAddons()) | ||
| 81 | { | ||
| 82 | CMediaSource share; | ||
| 83 | share.strPath = "addons://outdated/"; | ||
| 84 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; | ||
| 85 | share.strName = g_localizeStrings.Get(24043); // "Available updates" | ||
| 86 | m_sources.push_back(share); | ||
| 87 | } | ||
| 88 | CAddonDatabase db; | ||
| 89 | if (db.Open() && db.HasDisabledAddons()) | ||
| 90 | { | ||
| 91 | CMediaSource share; | ||
| 92 | share.strPath = "addons://disabled/"; | ||
| 93 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; | ||
| 94 | share.strName = g_localizeStrings.Get(24039); | ||
| 95 | m_sources.push_back(share); | ||
| 96 | } | ||
| 97 | // we always have some enabled addons | ||
| 98 | { | ||
| 99 | CMediaSource share; | ||
| 100 | share.strPath = "addons://enabled/"; | ||
| 101 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; | ||
| 102 | share.strName = g_localizeStrings.Get(24062); | ||
| 103 | m_sources.push_back(share); | ||
| 104 | } | ||
| 105 | if (CAddonMgr::Get().HasAddons(ADDON_REPOSITORY,true)) | ||
| 106 | { | ||
| 107 | CMediaSource share; | ||
| 108 | share.strPath = "addons://repos/"; | ||
| 109 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; | ||
| 110 | share.strName = g_localizeStrings.Get(24033); | ||
| 111 | m_sources.push_back(share); | ||
| 112 | } | ||
| 113 | // add "install from zip" | ||
| 114 | { | ||
| 115 | CMediaSource share; | ||
| 116 | share.strPath = "addons://install/"; | ||
| 117 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; | ||
| 118 | share.strName = g_localizeStrings.Get(24041); | ||
| 119 | m_sources.push_back(share); | ||
| 120 | } | ||
| 121 | // add "search" | ||
| 122 | { | ||
| 123 | CMediaSource share; | ||
| 124 | share.strPath = "addons://search/"; | ||
| 125 | share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; | ||
| 126 | share.strName = g_localizeStrings.Get(137); | ||
| 127 | m_sources.push_back(share); | ||
| 128 | } | ||
| 129 | |||
| 130 | return CGUIViewState::GetSources(); | ||
| 131 | } | ||
| 132 | |||
