xbmc
GUIDialogInfoProviderSettings.h
1 /*
2  * Copyright (C) 2017-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "addons/Addon.h"
12 #include "addons/Scraper.h"
13 #include "settings/dialogs/GUIDialogSettingsManualBase.h"
14 
15 #include <map>
16 #include <utility>
17 
18 class CFileItemList;
19 
20 // Enumeration of what combination of items to apply the scraper settings
21 enum INFOPROVIDERAPPLYOPTIONS
22 {
23  INFOPROVIDER_DEFAULT = 0x0000,
24  INFOPROVIDER_ALLVIEW = 0x0001,
25  INFOPROVIDER_THISITEM = 0x0002
26 };
27 
29 {
30 public:
32 
33  // specialization of CGUIWindow
34  bool HasListItems() const override { return true; }
35 
36  const ADDON::ScraperPtr& GetAlbumScraper() const { return m_albumscraper; }
37  void SetAlbumScraper(ADDON::ScraperPtr scraper) { m_albumscraper = std::move(scraper); }
38  const ADDON::ScraperPtr& GetArtistScraper() const { return m_artistscraper; }
39  void SetArtistScraper(ADDON::ScraperPtr scraper) { m_artistscraper = std::move(scraper); }
40 
47  static int Show(ADDON::ScraperPtr& scraper);
48 
53  static bool Show();
54 
55 protected:
56  // specializations of CGUIWindow
57  void OnInitWindow() override;
58 
59  // implementations of ISettingCallback
60  void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
61  void OnSettingAction(const std::shared_ptr<const CSetting>& setting) override;
62 
63  // specialization of CGUIDialogSettingsBase
64  bool AllowResettingSettings() const override { return false; }
65  bool Save() override;
66  void SetupView() override;
67 
68  // specialization of CGUIDialogSettingsManualBase
69  void InitializeSettings() override;
70 
71 private:
72  void SetLabel2(const std::string &settingid, const std::string &label);
73  void ToggleState(const std::string &settingid, bool enabled);
74  using CGUIDialogSettingsManualBase::SetFocus;
75  void SetFocus(const std::string &settingid);
76  void ResetDefaults();
77 
81  ADDON::ScraperPtr m_albumscraper;
85  ADDON::ScraperPtr m_artistscraper;
86 
87  std::string m_strArtistInfoPath;
88  bool m_showSingleScraper = false;
89  CONTENT_TYPE m_singleScraperType = CONTENT_NONE;
90  bool m_fetchInfo;
91  unsigned int m_applyToItems = INFOPROVIDER_THISITEM;
92 };
void OnSettingAction(const std::shared_ptr< const CSetting > &setting) override
The given setting has been activated.
Definition: GUIDialogInfoProviderSettings.cpp:166
Represents a list of files.
Definition: FileItem.h:725
Definition: scraper.py:1
static bool Show()
Show dialog to change the music scraping settings including default information providers for both ar...
Definition: GUIDialogInfoProviderSettings.cpp:51
Definition: GUIDialogInfoProviderSettings.h:28
void OnSettingChanged(const std::shared_ptr< const CSetting > &setting) override
The value of the given setting has changed.
Definition: GUIDialogInfoProviderSettings.cpp:140
Definition: GUIDialogSettingsManualBase.h:37
void OnInitWindow() override
Called on window open.
Definition: GUIDialogInfoProviderSettings.cpp:135