summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/GUIDialogAddonSettings.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/GUIDialogAddonSettings.h')
-rw-r--r--xbmc/addons/GUIDialogAddonSettings.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/xbmc/addons/GUIDialogAddonSettings.h b/xbmc/addons/GUIDialogAddonSettings.h
new file mode 100644
index 0000000..9c9c156
--- /dev/null
+++ b/xbmc/addons/GUIDialogAddonSettings.h
@@ -0,0 +1,91 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2013 Team XBMC
4 * http://xbmc.org
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "dialogs/GUIDialogBoxBase.h"
23#include "addons/Addon.h"
24
25class CGUIDialogAddonSettings : public CGUIDialogBoxBase
26{
27public:
28 CGUIDialogAddonSettings(void);
29 virtual ~CGUIDialogAddonSettings(void);
30 virtual bool OnMessage(CGUIMessage& message);
31 virtual bool OnAction(const CAction& action);
32 /*! \brief Show the addon settings dialog, allowing the user to configure an addon
33 \param addon the addon to configure
34 \param saveToDisk whether the changes should be saved to disk or just made local to the addon. Defaults to true
35 \return true if settings were changed and the dialog confirmed, false otherwise.
36 */
37 static bool ShowAndGetInput(const ADDON::AddonPtr &addon, bool saveToDisk = true);
38 virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions);
39
40 std::string GetCurrentID() const;
41protected:
42 virtual void OnInitWindow();
43 virtual int GetDefaultLabelID(int controlId) const;
44
45private:
46 /*! \brief return a (localized) addon string.
47 \param value either a character string (which is used directly) or a number to lookup in the addons strings.xml
48 \param subsetting whether the character string should be prefixed by "- ", defaults to false
49 \return the localized addon string
50 */
51 std::string GetString(const char *value, bool subSetting = false) const;
52
53 /*! \brief return a the values for a fileenum setting
54 \param path the path to use for files
55 \param mask the mask to use
56 \param options any options, such as "hideext" to hide extensions
57 \return the filenames in the path that match the mask
58 */
59 std::vector<std::string> GetFileEnumValues(const std::string &path, const std::string &mask, const std::string &options) const;
60
61 /*! \brief Translate list of addon IDs to list of addon names
62 \param addonIDslist comma seperated list of addon IDs
63 \return comma seperated list of addon names
64 */
65 std::string GetAddonNames(const std::string& addonIDslist) const;
66
67 void CreateSections();
68 void FreeSections();
69 void CreateControls();
70 void FreeControls();
71 void UpdateFromControls();
72 void EnableControls();
73 void SetDefaultSettings();
74 bool GetCondition(const std::string &condition, const int controlId);
75
76 void SaveSettings(void);
77 bool ShowVirtualKeyboard(int iControl);
78 bool TranslateSingleString(const std::string &strCondition, std::vector<std::string> &enableVec);
79
80 const TiXmlElement *GetFirstSetting() const;
81
82 ADDON::AddonPtr m_addon;
83 std::map<std::string,std::string> m_buttonValues;
84 bool m_saveToDisk; // whether the addon settings should be saved to disk or just stored locally in the addon
85
86 unsigned int m_currentSection;
87 unsigned int m_totalSections;
88
89 std::map<std::string,std::string> m_settings; // local storage of values
90};
91