2 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
21 #include "GUIViewStatePictures.h"
23 #include "view/ViewState.h"
24 #include "settings/AdvancedSettings.h"
25 #include "settings/MediaSourceSettings.h"
26 #include "settings/Settings.h"
27 #include "filesystem/Directory.h"
28 #include "filesystem/PluginDirectory.h"
29 #include "guilib/LocalizeStrings.h"
30 #include "guilib/WindowIDs.h"
31 #include "view/ViewStateSettings.h"
33 using namespace XFILE;
34 using namespace ADDON;
36 CGUIViewStateWindowPictures::CGUIViewStateWindowPictures(const CFileItemList& items) : CGUIViewState(items)
38 if (items.IsVirtualDirectoryRoot())
40 AddSortMethod(SortByLabel, 551, LABEL_MASKS());
41 AddSortMethod(SortByDriveType, 564, LABEL_MASKS());
42 SetSortMethod(SortByLabel);
44 SetViewAsControl(DEFAULT_VIEW_LIST);
46 SetSortOrder(SortOrderAscending);
50 AddSortMethod(SortByLabel, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | Foldername, empty
51 AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Filename, Size | Foldername, Size
52 AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date
53 AddSortMethod(SortByDateTaken, 577, LABEL_MASKS("%L", "%t", "%L", "%J")); // Filename, DateTaken | Foldername, Date
54 AddSortMethod(SortByFile, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | FolderName, empty
56 const CViewState *viewState = CViewStateSettings::Get().Get("pictures");
57 SetSortMethod(viewState->m_sortDescription);
58 SetViewAsControl(viewState->m_viewMode);
59 SetSortOrder(viewState->m_sortDescription.sortOrder);
61 LoadViewState(items.GetPath(), WINDOW_PICTURES);
64 void CGUIViewStateWindowPictures::SaveViewState()
66 SaveViewToDb(m_items.GetPath(), WINDOW_PICTURES, CViewStateSettings::Get().Get("pictures"));
69 CStdString CGUIViewStateWindowPictures::GetLockType()
74 CStdString CGUIViewStateWindowPictures::GetExtensions()
76 if (CSettings::Get().GetBool("pictures.showvideos"))
77 return g_advancedSettings.m_pictureExtensions+"|"+g_advancedSettings.m_videoExtensions;
79 return g_advancedSettings.m_pictureExtensions;
82 VECSOURCES& CGUIViewStateWindowPictures::GetSources()
84 VECSOURCES *pictureSources = CMediaSourceSettings::Get().GetSources("pictures");
85 AddAddonsSource("image", g_localizeStrings.Get(1039), "DefaultAddonPicture.png");
86 AddOrReplace(*pictureSources, CGUIViewState::GetSources());
87 return *pictureSources;