Skip to content

Commit

Permalink
fix: 初次启动音乐不添加歌曲时托盘菜单中的播放未置灰,单首歌播放时工具栏上下按钮没置灰
Browse files Browse the repository at this point in the history
首次启动未获取当前歌曲数目

Log: 初次启动按钮状态正常
Bug: https://pms.uniontech.com/bug-view-119251.html
  • Loading branch information
wyu71 authored and lzwind committed Mar 24, 2022
1 parent 439380b commit 63f02c0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/music-player/icons/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@
<file>texts/music_singer_24px.svg</file>
<file>texts/sort_rank_texts_36px.svg</file>
<file>icons/dcc_collectiondis_36px.svg</file>
<file>texts/music_next_light_36px.svg</file>
<file>texts/music_last_light_36px.svg</file>
</qresource>
</RCC>
15 changes: 15 additions & 0 deletions src/music-player/icons/texts/music_last_light_36px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/music-player/icons/texts/music_next_light_36px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions src/music-player/mainFrame/footerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void FooterWidget::initUI(QWidget *parent)
// layout->setContentsMargins(0, 0, 10, 0);
// mainVBoxlayout->addWidget(downWidget);

m_btPrev = new DButtonBoxButton(QIcon::fromTheme("music_last"), "", this);
m_btPrev = new DButtonBoxButton(QIcon(":/icons/deepin/builtin/texts/music_last_36px.svg"), "", this);
m_btPrev->setIconSize(QSize(36, 36));
m_btPrev->setObjectName("FooterActionPrev");
m_btPrev->setFixedSize(40, 50);
Expand All @@ -136,7 +136,7 @@ void FooterWidget::initUI(QWidget *parent)
AC_SET_OBJECT_NAME(m_btPlay, AC_Play);
AC_SET_ACCESSIBLE_NAME(m_btPlay, AC_Play);

m_btNext = new DButtonBoxButton(QIcon::fromTheme("music_next"), "", this);
m_btNext = new DButtonBoxButton(QIcon(":/icons/deepin/builtin/texts/music_next_36px.svg"), "", this);
m_btNext->setIconSize(QSize(36, 36));
m_btNext->setObjectName("FooterActionNext");
m_btNext->setFixedSize(40, 50);
Expand Down Expand Up @@ -883,6 +883,9 @@ void FooterWidget::slotTheme(int type)
pl.setColor(DPalette::FrameBorder, framecolor);
pl.setColor(DPalette::Shadow, framecolor);
DApplicationHelper::instance()->setPalette(m_ctlWidget, pl);

m_btPrev->setIcon(QIcon(":/icons/deepin/builtin/texts/music_last_36px.svg"));
m_btNext->setIcon(QIcon(":/icons/deepin/builtin/texts/music_next_36px.svg"));
} else {
QColor maskColor(32, 32, 32);
maskColor.setAlphaF(0.80);
Expand Down Expand Up @@ -919,6 +922,9 @@ void FooterWidget::slotTheme(int type)
pl.setColor(DPalette::FrameBorder, framecolor);
pl.setColor(DPalette::Shadow, framecolor);
DApplicationHelper::instance()->setPalette(m_ctlWidget, pl);

m_btPrev->setIcon(QIcon(":/icons/deepin/builtin/texts/music_last_light_36px.svg"));
m_btNext->setIcon(QIcon(":/icons/deepin/builtin/texts/music_next_light_36px.svg"));
}

m_waveform->setThemeType(type);
Expand Down
2 changes: 1 addition & 1 deletion src/music-player/mainFrame/mainframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void MainFrame::initMenuAndShortcut()

//初始化托盘
auto playAction = new QAction(tr("Play/Pause"), this);
playAction->setEnabled(m_importWidget == nullptr);
playAction->setEnabled(DataBaseService::getInstance()->allMusicInfos().size() > 0);
auto prevAction = new QAction(tr("Previous"), this);
prevAction->setEnabled(false);
auto nextAction = new QAction(tr("Next"), this);
Expand Down

0 comments on commit 63f02c0

Please sign in to comment.