2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
12 \file GUIWindowMusicBase.h
16 #include "music/MusicDatabase.h"
17 #include "music/MusicInfoLoader.h"
18 #include "music/MusicThumbLoader.h"
19 #include "music/infoscanner/MusicInfoScraper.h"
20 #include "windows/GUIMediaWindow.h"
24 enum MusicSelectAction
26 MUSIC_SELECT_ACTION_PLAY
,
27 MUSIC_SELECT_ACTION_RESUME
,
32 \brief The base class for music windows
34 CGUIWindowMusicBase is the base class for
37 class CGUIWindowMusicBase
: public CGUIMediaWindow
, public IBackgroundLoaderObserver
40 CGUIWindowMusicBase(int id
, const std::string
&xmlFile
);
41 ~CGUIWindowMusicBase(void) override
;
42 bool OnMessage(CGUIMessage
& message
) override
;
43 bool OnAction(const CAction
&action
) override
;
44 bool OnBack(int actionID
) override
;
46 void DoScan(const std::string
&strPath
, bool bRescan
= false);
47 void RefreshContent(const std::string
& strContent
);
49 /*! \brief Once a music source is added, store source in library, and prompt
50 the user to scan this folder into the library
51 \param oldName the original music source name
52 \param source details of the music source (just added or edited)
54 static void OnAssignContent(const std::string
& oldName
, const CMediaSource
& source
);
57 void OnInitWindow() override
;
59 \brief Will be called when an popup context menu has been asked for
60 \param itemNumber List/thumb control item that has been clicked on
62 void GetContextButtons(int itemNumber
, CContextButtons
&buttons
) override
;
63 void GetNonContextButtons(CContextButtons
&buttons
);
64 bool OnContextButton(int itemNumber
, CONTEXT_BUTTON button
) override
;
65 bool OnAddMediaSource() override
;
67 \brief Overwrite to update your gui buttons (visible, enable,...)
69 void UpdateButtons() override
;
71 bool GetDirectory(const std::string
&strDirectory
, CFileItemList
&items
) override
;
72 virtual void OnRetrieveMusicInfo(CFileItemList
& items
);
73 void OnPrepareFileItems(CFileItemList
& items
) override
;
75 std::string
GetStartFolder(const std::string
&dir
) override
;
76 void OnItemLoaded(CFileItem
* pItem
) override
{}
78 virtual void OnScan(int iItem
, bool bPromptRescan
= false);
80 bool CheckFilterAdvanced(CFileItemList
&items
) const override
;
81 bool CanContainFilter(const std::string
&strDirectory
) const override
;
83 bool OnSelect(int iItem
) override
;
86 virtual void PlayItem(int iItem
);
87 bool OnPlayMedia(int iItem
, const std::string
&player
= "") override
;
89 void RetrieveMusicInfo();
90 void OnItemInfo(int iItem
);
91 void OnItemInfoAll(const std::string
& strPath
, bool refresh
= false);
92 virtual void OnQueueItem(int iItem
, bool first
= false);
93 enum ALLOW_SELECTION
{ SELECTION_ALLOWED
= 0, SELECTION_AUTO
, SELECTION_FORCED
};
95 void OnRipTrack(int iItem
);
96 void LoadPlayList(const std::string
& strPlayList
) override
;
97 virtual void OnRemoveSource(int iItem
);
99 typedef std::vector
<CFileItem
*>::iterator ivecItems
; ///< CFileItem* vector Iterator
100 CGUIDialogProgress
* m_dlgProgress
; ///< Progress dialog
102 CMusicDatabase m_musicdatabase
;
103 MUSIC_INFO::CMusicInfoLoader m_musicInfoLoader
;
105 CMusicThumbLoader m_thumbLoader
;