aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRazzeee <razzeee@gmail.com>2016-11-28 14:05:20 +0100
committerGitHub <noreply@github.com>2016-11-28 14:05:20 +0100
commit809912d51df7fa2d6c8020bc1effdc196a2c0fef (patch)
treeb56aa6980c6899c5e40b46c9c3ed7600adfb8136
parent531b432da2369ece94b75454291c5fce38b83613 (diff)
parent58422c2370826dcc03301218e4e5b25f0c3c3cc8 (diff)
Merge pull request #10951 from DaveTBlake/SongInfoRoleList
Song Info Dialog contributors in control list
-rw-r--r--addons/skin.estuary/xml/DialogMusicInfo.xml34
-rw-r--r--addons/skin.estuary/xml/Variables.xml2
-rw-r--r--xbmc/music/dialogs/GUIDialogSongInfo.cpp76
-rw-r--r--xbmc/music/dialogs/GUIDialogSongInfo.h1
4 files changed, 98 insertions, 15 deletions
diff --git a/addons/skin.estuary/xml/DialogMusicInfo.xml b/addons/skin.estuary/xml/DialogMusicInfo.xml
index c499abf2e9..0cc624e9f0 100644
--- a/addons/skin.estuary/xml/DialogMusicInfo.xml
+++ b/addons/skin.estuary/xml/DialogMusicInfo.xml
@@ -157,6 +157,40 @@
<ondown>130</ondown>
<onup>9000</onup>
<orientation>horizontal</orientation>
+ <itemlayout height="72.5" width="595" condition="Container.Content(songs)">
+ <control type="image">
+ <top>-10</top>
+ <width>595</width>
+ <height>100</height>
+ <texture border="40">buttons/button-nofo.png</texture>
+ </control>
+ <control type="label">
+ <left>40</left>
+ <top>10</top>
+ <width>546</width>
+ <height>60</height>
+ <font>font12</font>
+ <aligny>center</aligny>
+ <label>$INFO[ListItem.Label,[COLOR grey], - [/COLOR]]$INFO[ListItem.Label2]</label>
+ </control>
+ </itemlayout>
+ <focusedlayout height="72.5" width="595" condition="Container.Content(songs)">
+ <control type="image">
+ <top>-10</top>
+ <width>595</width>
+ <height>100</height>
+ <texture border="40" colordiffuse="button_focus">buttons/button-fo.png</texture>
+ </control>
+ <control type="label">
+ <left>40</left>
+ <top>10</top>
+ <width>546</width>
+ <height>60</height>
+ <font>font12</font>
+ <aligny>center</aligny>
+ <label>$INFO[ListItem.Label,[COLOR white], - [/COLOR]]$INFO[ListItem.Label2]</label>
+ </control>
+ </focusedlayout>
<itemlayout height="72.5" width="595" condition="Container.Content(albums)">
<control type="image">
<top>-10</top>
diff --git a/addons/skin.estuary/xml/Variables.xml b/addons/skin.estuary/xml/Variables.xml
index e6b460ce29..5d4d6f65dc 100644
--- a/addons/skin.estuary/xml/Variables.xml
+++ b/addons/skin.estuary/xml/Variables.xml
@@ -31,7 +31,7 @@
<value>$INFO[ListItem.Label2]</value>
</variable>
<variable name="MusicInfoTextboxVar">
- <value condition="String.IsEqual(ListItem.DbType,song)">$INFO[ListItem.ContributorAndRole,[B]$LOCALIZE[31128][/B][CR][COLOR=white],[/COLOR]]</value>
+ <value condition="String.IsEqual(ListItem.DbType,song)">$INFO[ListItem.Comment,[B]$LOCALIZE[569][/B][CR][COLOR=white],[/COLOR]]</value>
<value condition="String.IsEqual(ListItem.DbType,album)">$INFO[ListItem.Property(Album_Description),[COLOR=white],[/COLOR]]</value>
<value condition="String.IsEqual(ListItem.DbType,artist)">$INFO[ListItem.Property(Artist_Description),[COLOR=white],[/COLOR]]</value>
</variable>
diff --git a/xbmc/music/dialogs/GUIDialogSongInfo.cpp b/xbmc/music/dialogs/GUIDialogSongInfo.cpp
index 8be349cc21..2518d43d1f 100644
--- a/xbmc/music/dialogs/GUIDialogSongInfo.cpp
+++ b/xbmc/music/dialogs/GUIDialogSongInfo.cpp
@@ -80,9 +80,13 @@ bool CGUIDialogSongInfo::OnMessage(CGUIMessage& message)
db.Close();
}
}
+ CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST);
+ OnMessage(msg);
break;
}
case GUI_MSG_WINDOW_INIT:
+ CGUIDialog::OnMessage(message);
+ Update();
m_cancelled = false;
break;
@@ -111,6 +115,32 @@ bool CGUIDialogSongInfo::OnMessage(CGUIMessage& message)
OnGetThumb();
return true;
}
+ else if (iControl == CONTROL_LIST)
+ {
+ int iAction = message.GetParam1();
+ if ((ACTION_SELECT_ITEM == iAction || ACTION_MOUSE_LEFT_CLICK == iAction))
+ {
+ CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
+ g_windowManager.SendMessage(msg);
+ int iItem = msg.GetParam1();
+ if (iItem < 0 || iItem >= static_cast<int>(m_song->GetMusicInfoTag()->GetContributors().size()))
+ break;
+ int idArtist = m_song->GetMusicInfoTag()->GetContributors()[iItem].GetArtistId();
+ if (idArtist > 0)
+ {
+ CGUIWindowMusicBase *window = (CGUIWindowMusicBase *)g_windowManager.GetWindow(WINDOW_MUSIC_NAV);
+ if (window)
+ {
+ CFileItem item(*m_song);
+ std::string path = StringUtils::Format("musicdb://artists/%li", idArtist);
+ item.SetPath(path);
+ item.m_bIsFolder = true;
+ window->OnItemInfo(&item, true);
+ }
+ }
+ return true;
+ }
+ }
}
break;
}
@@ -147,20 +177,25 @@ bool CGUIDialogSongInfo::OnBack(int actionID)
void CGUIDialogSongInfo::OnInitWindow()
{
- CMusicDatabase db;
- db.Open();
-
- // no known db info - check if parent dir is an album
- if (m_song->GetMusicInfoTag()->GetDatabaseId() == -1)
+ // Normally have album id from song
+ m_albumId = m_song->GetMusicInfoTag()->GetAlbumId();
+ if (m_albumId < 0)
{
- std::string path = URIUtils::GetDirectory(m_song->GetPath());
- m_albumId = db.GetAlbumIdByPath(path);
- }
- else
- {
- CAlbum album;
- db.GetAlbumFromSong(m_song->GetMusicInfoTag()->GetDatabaseId(),album);
- m_albumId = album.idAlbum;
+ CMusicDatabase db;
+ db.Open();
+
+ // no known db info - check if parent dir is an album
+ if (m_song->GetMusicInfoTag()->GetDatabaseId() == -1)
+ {
+ std::string path = URIUtils::GetDirectory(m_song->GetPath());
+ m_albumId = db.GetAlbumIdByPath(path);
+ }
+ else
+ {
+ CAlbum album;
+ db.GetAlbumFromSong(m_song->GetMusicInfoTag()->GetDatabaseId(), album);
+ m_albumId = album.idAlbum;
+ }
}
CONTROL_ENABLE_ON_CONDITION(CONTROL_ALBUMINFO, m_albumId > -1);
@@ -171,7 +206,6 @@ void CGUIDialogSongInfo::OnInitWindow()
CONTROL_ENABLE(CONTROL_USERRATING);
SET_CONTROL_HIDDEN(CONTROL_BTN_REFRESH);
- SET_CONTROL_HIDDEN(CONTROL_LIST);
SET_CONTROL_LABEL(CONTROL_USERRATING, 38023);
SET_CONTROL_LABEL(CONTROL_BTN_GET_THUMB, 13405);
SET_CONTROL_LABEL(CONTROL_ALBUMINFO, 10523);
@@ -179,6 +213,20 @@ void CGUIDialogSongInfo::OnInitWindow()
CGUIDialog::OnInitWindow();
}
+void CGUIDialogSongInfo::Update()
+{
+ CFileItemList items;
+ for (const auto& contributor : m_song->GetMusicInfoTag()->GetContributors())
+ {
+ auto item = std::make_shared<CFileItem>(contributor.GetRoleDesc());
+ item->SetLabel2(contributor.GetArtist());
+ item->GetMusicInfoTag()->SetDatabaseId(contributor.GetArtistId(), "artist");
+ items.Add(std::move(item));
+ }
+ CGUIMessage message(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, &items);
+ OnMessage(message);
+}
+
void CGUIDialogSongInfo::SetUserrating(int userrating)
{
if (userrating < 0) userrating = 0;
diff --git a/xbmc/music/dialogs/GUIDialogSongInfo.h b/xbmc/music/dialogs/GUIDialogSongInfo.h
index de06f4b613..fb05e05b11 100644
--- a/xbmc/music/dialogs/GUIDialogSongInfo.h
+++ b/xbmc/music/dialogs/GUIDialogSongInfo.h
@@ -40,6 +40,7 @@ public:
virtual CFileItemPtr GetCurrentListItem(int offset = 0);
protected:
virtual void OnInitWindow();
+ void Update();
bool DownloadThumbnail(const std::string &thumbFile);
void OnGetThumb();
void SetUserrating(int userrating);