Skip to content

Commit

Permalink
皮肤“Groove音乐风格(Windows11)”更新
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyang219 committed Jul 23, 2024
1 parent 626155d commit 263d688
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 57 deletions.
18 changes: 16 additions & 2 deletions MusicPlayer2/CPlayerUIBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2857,9 +2857,14 @@ void CPlayerUIBase::DrawTabElement(CRect rect, UiElement::TabElement* tab_elemen
}
else if (item_str == "now_playing")
{
if (draw_icon) icon = IconMgr::IT_Play_In_Playlist;
if (draw_icon) icon = IconMgr::IT_Album_Cover;
if (item_text.empty()) item_text = theApp.m_str_table.LoadText(L"UI_TXT_PLAYSTATUS_PLAYING");
}
else if (item_str == "play_queue")
{
if (draw_icon) icon = IconMgr::IT_Play_In_Playlist;
if (item_text.empty()) item_text = theApp.m_str_table.LoadText(L"UI_TXT_PLAY_QUEUE");
}
else if (item_str == "recently_played")
{
if (draw_icon) icon = IconMgr::IT_History;
Expand Down Expand Up @@ -2919,7 +2924,10 @@ void CPlayerUIBase::DrawTabElement(CRect rect, UiElement::TabElement* tab_elemen
int icon_width{};
int text_width{};
if (draw_icon)
icon_width = DPI(24);
{
int item_height{ tab_element->orientation == UiElement::TabElement::Horizontal ? rect.Height() : DPI(tab_element->item_height) };
icon_width = (std::max)(DPI(24), item_height - DPI(4));
}
if (draw_text)
text_width = m_draw.GetTextExtent(item_text.c_str()).cx;
CRect item_rect{ rect };
Expand Down Expand Up @@ -2970,9 +2978,15 @@ void CPlayerUIBase::DrawTabElement(CRect rect, UiElement::TabElement* tab_elemen
{
CRect text_rect{ item_rect };
if (tab_element->icon_type != UiElement::TabElement::TEXT_ONLY)
{
text_rect.left += icon_width;
}
else
{
text_rect.MoveToX(text_rect.left + DPI(4));
if (tab_element->orientation == UiElement::TabElement::Vertical)
text_rect.left += DPI(8);
}
m_draw.DrawWindowText(text_rect, item_text.c_str(), m_colors.color_text, Alignment::LEFT, true);
}

Expand Down
19 changes: 19 additions & 0 deletions MusicPlayer2/UIElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,7 @@ void UiElement::TabElement::FindStackElement()
{
if (pParent != nullptr)
{
//查找与自己同级的StackElement
for (const auto& ele : pParent->childLst)
{
StackElement* _stack_element = dynamic_cast<StackElement*>(ele.get());
Expand All @@ -1623,6 +1624,24 @@ void UiElement::TabElement::FindStackElement()
}
}

//如果没有找到,则查找整个界面第一个StackElement
if (stack_element == nullptr)
{
Element* root = RootElement();
if (root != nullptr)
{
root->IterateAllElements([&](Element* ele)->bool {
StackElement* _stack_element = dynamic_cast<StackElement*>(ele);
if (_stack_element != nullptr)
{
stack_element = _stack_element;
return true;
}
return false;
});
}
}

find_stack_element = true;
}
}
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/language/English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ UI_TXT_SF2_NAME_FAILDE = "<Load failed>"
UI_TXT_ALBUM_COVER = "Album cover"
UI_TXT_SPECTRUM = "Spectrum analysis"
UI_TXT_LYRICS = "Lyrics"
UI_TXT_PLAY_QUEUE = "Paly queue"
UI_TXT_BTN_MEDIA_LIB = "Media Library..."
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/language/Simplified_Chinese.ini
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ UI_TXT_SF2_NAME_FAILDE = "<加载失败>"
UI_TXT_ALBUM_COVER = "专辑封面"
UI_TXT_SPECTRUM = "频谱分析"
UI_TXT_LYRICS = "歌词"
UI_TXT_PLAY_QUEUE = "播放队列"
UI_TXT_BTN_MEDIA_LIB = "媒体库..."
Expand Down
164 changes: 110 additions & 54 deletions MusicPlayer2/skins/03_grooveMusicWin11.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,58 @@
<verticalLayout>
<horizontalLayout>
<verticalLayout width="48" margin-top="4" margin-bottom="4">
<button key="menu" width="40" height="40" margin="2"/>
<button key="find" width="40" height="40" margin="2" hide-height="211"/>
<button key="equalizer" width="40" height="40" margin="2" hide-height="256"/>
<button key="info" width="40" height="40" margin="2"/>
<button key="mediaLib" width="40" height="40" margin="2"/>
<placeHolder/>
<button key="settings" width="40" height="40" margin="2"/>
<tabElement margin="4" orientation="vertical" icon_type="icon_only" item_space="4" item_height="36" item_list="now_playing,play_queue,recently_played,folder,playlist,artist,album"/>
<button key="settings" width="40" height="36" margin="2"/>
</verticalLayout>
<verticalLayout margin-top="8" margin-left="16" margin-right="16">
<rectangle no_corner_radius="false" min-height="134">
<horizontalLayout>
<albumCover square="true" margin="8" width="30%"/>
<verticalLayout margin="8">
<text type="title" style="scroll" height="38" font_size="12"/>
<text type="artist" style="scroll" height="24" font_size="10"/>
<text type="album" style="scroll" height="24" font_size="10"/>
<spectrum draw_reflex="true" fixed_width="true" margin-top="8" max-height="80"/>
<text type="format" style="scroll" height="24"/>
</verticalLayout>
</horizontalLayout>
</rectangle>
<stackElement margin="4">
<lyrics/>
<stackElement margin-top="8" margin-left="16" margin-right="16">
<!--正在播放-->
<verticalLayout>
<rectangle no_corner_radius="false" min-height="134">
<horizontalLayout>
<albumCover square="true" margin="8" width="30%"/>
<verticalLayout margin="8">
<text type="title" style="scroll" height="38" font_size="12"/>
<text type="artist" style="scroll" height="24" font_size="10"/>
<text type="album" style="scroll" height="24" font_size="10"/>
<spectrum draw_reflex="true" fixed_width="true" margin-top="8" max-height="80"/>
<text type="format" style="scroll" height="24"/>
</verticalLayout>
</horizontalLayout>
</rectangle>
<lyrics/>
</verticalLayout>
<!--播放队列-->
<verticalLayout>
<text type="userDefine" text="%(UI_TXT_PLAY_QUEUE)" height="56" font_size="12"/>
<playlistIndicator height="30" margin-bottom="4"/>
<playlist item_height="30"/>
</stackElement>
</verticalLayout>
</verticalLayout>
<!--最近播放-->
<verticalLayout>
<text type="userDefine" text="%(TXT_RECENT_PLAYED)" height="56" font_size="12"/>
<recentPlayedList/>
</verticalLayout>
<!--文件夹-->
<verticalLayout>
<text type="userDefine" text="%(TXT_FOLDER)" height="56" font_size="12"/>
<mediaLibFolder/>
</verticalLayout>
<!--播放列表-->
<verticalLayout>
<text type="userDefine" text="%(TXT_PLAYLIST)" height="56" font_size="12"/>
<mediaLibPlaylist/>
</verticalLayout>
<!--艺术家-->
<verticalLayout>
<text type="userDefine" text="%(TXT_ARTIST)" height="56" font_size="12"/>
<mediaLibItemList type="artist"/>
</verticalLayout>
<!--唱片集-->
<verticalLayout>
<text type="userDefine" text="%(TXT_ALBUM)" height="56" font_size="12"/>
<mediaLibItemList type="album"/>
</verticalLayout>
</stackElement>
</horizontalLayout>
<rectangle height="100" no_corner_radius="true">
<verticalLayout margin="6">
Expand All @@ -52,8 +78,8 @@
<horizontalLayout margin-right="4">
<placeHolder/>
<volume show_text="true" width="64" height="28" margin="2"/>
<button key="skin" width="28" height="28" margin="2"/>
<button key="switchDisplay" width="28" height="28" margin="2"/>
<button key="info" width="28" height="28" margin="2"/>
<button key="mediaLib" width="28" height="28" margin="2"/>
<button key="showPlaylist" width="28" height="28" margin="2"/>
</horizontalLayout>
</horizontalLayout>
Expand All @@ -67,44 +93,74 @@
<verticalLayout>
<horizontalLayout>
<verticalLayout width="48" margin-top="4" margin-bottom="4">
<button key="menu" width="40" height="40" margin="2"/>
<button key="find" width="40" height="40" margin="2" hide-height="211"/>
<button key="equalizer" width="40" height="40" margin="2" hide-height="256"/>
<button key="info" width="40" height="40" margin="2"/>
<button key="mediaLib" width="40" height="40" margin="2"/>
<placeHolder/>
<button key="settings" width="40" height="40" margin="2"/>
<tabElement margin="4" orientation="vertical" icon_type="icon_only" item_space="4" item_height="36" item_list="now_playing,play_queue,recently_played,folder,playlist,artist,album"/>
<button key="settings" width="40" height="40" margin="2"/>
</verticalLayout>
<verticalLayout margin="8">
<rectangle no_corner_radius="false" min-height="134">
<horizontalLayout>
<albumCover square="true" margin="8" width="30%"/>
<verticalLayout margin="8">
<text type="title" style="scroll" height="38" font_size="12"/>
<text type="artist" style="scroll" height="24" font_size="10"/>
<text type="album" style="scroll" height="24" font_size="10"/>
<spectrum draw_reflex="true" fixed_width="true" margin-top="8" max-height="80"/>
<text type="format" style="scroll" height="24"/>
</verticalLayout>
</horizontalLayout>
</rectangle>
<stackElement margin="4">
<lyrics/>
<stackElement margin-top="8" margin-left="8" margin-right="8">
<!--正在播放-->
<verticalLayout margin="8">
<rectangle no_corner_radius="false" min-height="134">
<horizontalLayout>
<albumCover square="true" margin="8" width="30%"/>
<verticalLayout margin="8">
<text type="title" style="scroll" height="38" font_size="12"/>
<text type="artist" style="scroll" height="24" font_size="10"/>
<text type="album" style="scroll" height="24" font_size="10"/>
<spectrum draw_reflex="true" fixed_width="true" margin-top="8" max-height="80"/>
<text type="format" style="scroll" height="24"/>
</verticalLayout>
</horizontalLayout>
</rectangle>
<lyrics margin="4"/>
</verticalLayout>
<!--播放队列-->
<verticalLayout>
<text type="userDefine" text="%(UI_TXT_PLAY_QUEUE)" height="56" font_size="12"/>
<playlistIndicator height="30" margin-bottom="4"/>
<playlist item_height="30"/>
</stackElement>
</verticalLayout>
</horizontalLayout>
</verticalLayout>
<!--最近播放-->
<verticalLayout>
<text type="userDefine" text="%(TXT_RECENT_PLAYED)" height="56" font_size="12"/>
<recentPlayedList/>
</verticalLayout>
<!--文件夹-->
<verticalLayout>
<text type="userDefine" text="%(TXT_FOLDER)" height="56" font_size="12"/>
<mediaLibFolder/>
</verticalLayout>
<!--播放列表-->
<verticalLayout>
<text type="userDefine" text="%(TXT_PLAYLIST)" height="56" font_size="12"/>
<mediaLibPlaylist/>
</verticalLayout>
<!--艺术家-->
<verticalLayout>
<text type="userDefine" text="%(TXT_ARTIST)" height="56" font_size="12"/>
<mediaLibItemList type="artist"/>
</verticalLayout>
<!--唱片集-->
<verticalLayout>
<text type="userDefine" text="%(TXT_ALBUM)" height="56" font_size="12"/>
<mediaLibItemList type="album"/>
</verticalLayout>
</stackElement>
</horizontalLayout>
<rectangle height="88" no_corner_radius="true">
<button key="switchDisplay" width="28" height="28" margin-right="16" margin-top="-40"/>
<verticalLayout margin="4">
<progressBar show_play_time="true" play_time_both_side="true" margin-left="8" margin-right="8"/>
<horizontalLayout height="60">
<button key="repeatMode" width="28" height="28" margin="2"/>
<button key="favorite" width="28" height="28" margin="2"/>
<albumCover width="60"/>
<verticalLayout margin="4">
<text type="title" style="scroll" height="24" font_size="10"/>
<text type="artist" style="scroll" height="24"/>
</verticalLayout>
<button key="previous" width="40" height="40" bigIcon="true" margin="2"/>
<button key="playPause" width="40" height="40" bigIcon="true" margin="2"/>
<button key="next" width="40" height="40" bigIcon="true" margin="2"/>
<volume show_text="false" width="28" height="28" margin="2"/>
<button key="repeatMode" width="28" height="28" margin="2"/>
<button key="favorite" width="28" height="28" margin="2"/>
<button key="showPlaylist" width="28" height="28" margin="2"/>
</horizontalLayout>
</verticalLayout>
Expand Down
2 changes: 1 addition & 1 deletion MusicPlayer2/skins/skin.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@
</xs:annotation>
<xs:attribute name="item_list" type="xs:string">
<xs:annotation>
<xs:documentation>标签列表,标签只能在“album_cover,spectrum,lyrics,now_playing,recently_played,folder,playlist,artist,album,genre,year,file_type,bitrate,rating”中选,多个标签使用半角逗号隔开。</xs:documentation>
<xs:documentation>标签列表,标签只能在“album_cover,spectrum,lyrics,now_playing,play_queue,recently_played,folder,playlist,artist,album,genre,year,file_type,bitrate,rating”中选,多个标签使用半角逗号隔开。</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="icon_type" default="icon_and_text">
Expand Down

0 comments on commit 263d688

Please sign in to comment.