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/GUISettings.h"
25 #include "settings/AdvancedSettings.h"
26 #include "settings/Settings.h"
27 #include "filesystem/Directory.h"
28 #include "filesystem/PluginDirectory.h"
29 #include "guilib/LocalizeStrings.h"
30 #include "guilib/Key.h"
32 using namespace XFILE;
33 using namespace ADDON;
35 CGUIViewStateWindowPictures::CGUIViewStateWindowPictures(const CFileItemList& items) : CGUIViewState(items)
37 if (items.IsVirtualDirectoryRoot())
39 AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS());
40 AddSortMethod(SORT_METHOD_DRIVE_TYPE, 564, LABEL_MASKS());
41 SetSortMethod(SORT_METHOD_LABEL);
43 SetViewAsControl(DEFAULT_VIEW_LIST);
45 SetSortOrder(SortOrderAscending);
49 AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | Foldername, empty
50 AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Filename, Size | Foldername, Size
51 AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date
52 AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | FolderName, empty
54 SetSortMethod(g_settings.m_viewStatePictures.m_sortMethod);
55 SetViewAsControl(g_settings.m_viewStatePictures.m_viewMode);
56 SetSortOrder(g_settings.m_viewStatePictures.m_sortOrder);
58 LoadViewState(items.GetPath(), WINDOW_PICTURES);
61 void CGUIViewStateWindowPictures::SaveViewState()
63 SaveViewToDb(m_items.GetPath(), WINDOW_PICTURES, &g_settings.m_viewStatePictures);
66 CStdString CGUIViewStateWindowPictures::GetLockType()
71 CStdString CGUIViewStateWindowPictures::GetExtensions()
73 if (g_guiSettings.GetBool("pictures.showvideos"))
74 return g_settings.m_pictureExtensions+"|"+g_settings.m_videoExtensions;
76 return g_settings.m_pictureExtensions;
79 VECSOURCES& CGUIViewStateWindowPictures::GetSources()
81 AddAddonsSource("image", g_localizeStrings.Get(1039), "DefaultAddonPicture.png");
82 AddOrReplace(g_settings.m_pictureSources, CGUIViewState::GetSources());
83 return g_settings.m_pictureSources;