TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musiclrccontainer.cpp
Go to the documentation of this file.
1 #include "musiclrccontainer.h"
2 #include "musiclrcsearchwidget.h"
3 #include "musiclrcmakerwidget.h"
4 
5 #include <QActionGroup>
6 
8  : QWidget(parent),
9  m_linkLocalLrc(true),
10  m_currentTime(0),
11  m_totalTime(0),
12  m_lrcAnalysis(nullptr),
13  m_lrcSearchWidget(nullptr)
14 {
15 
16 }
17 
19 {
20  delete m_lrcSearchWidget;
21 }
22 
24 {
25  const QString &t = (m_containerType == LRC_DESKTOP_TPYE ? LRC_DESKTOP_PREFIX : QString());
26 
27  for(MusicLrcManager *manager : qAsConst(m_lrcManagers))
28  {
29  manager->setFontFamily(G_SETTING_PTR->value(t + "LrcFamily").toInt());
30  manager->setFontType(G_SETTING_PTR->value(t + "LrcType").toInt());
31  manager->setFontTransparent(G_SETTING_PTR->value(t + "LrcColorTransparent").toInt());
32  manager->setLrcFontSize(G_SETTING_PTR->value(t + "LrcSize").toInt());
33  }
34 
35  if(G_SETTING_PTR->value(t + "LrcColor").toInt() != -1)
36  {
37  const MusicLrcColor::Color index = TTKStaticCast(MusicLrcColor::Color, G_SETTING_PTR->value(t + "LrcColor").toInt());
39  }
40  else
41  {
42  const MusicLrcColor cl(TTK::readColorConfig(G_SETTING_PTR->value(t + "LrcFrontgroundColor").toString()),
43  TTK::readColorConfig(G_SETTING_PTR->value(t + "LrcBackgroundColor").toString()));
45  }
46 }
47 
49 {
51 }
52 
54 {
55  for(MusicLrcManager *manager : qAsConst(m_lrcManagers))
56  {
57  manager->setLinearGradientColor(color);
58  }
59 
62 }
63 
64 void MusicLrcContainer::setCurrentTime(qint64 time, qint64 total)
65 {
66  m_currentTime = time;
67  m_totalTime = total;
68 }
69 
71 {
72  return m_totalTime;
73 }
74 
76 {
78  Q_EMIT showCurrentLrcSetting();
79 }
80 
82 {
83  switch(action->data().toInt())
84  {
101  default: break;
102  }
103 }
104 
106 {
108 }
109 
111 {
112  delete m_lrcSearchWidget;
116 }
117 
119 {
123 }
124 
126 {
128  for(MusicLrcManager *manager : qAsConst(m_lrcManagers))
129  {
130  manager->setVisible(m_linkLocalLrc);
131  }
132 }
133 
135 {
136  qDeleteAll(m_lrcManagers);
137  m_lrcManagers.clear();
138 }
#define TTKStaticCast(x, y)
Definition: ttkglobal.h:159
The class of the lrc manager base.
The class of the lrc color.
static constexpr const char * LRC_DESKTOP_TPYE
void linearGradientColorChanged()
void setCurrentTime(qint64 time, qint64 total)
void setCurrentSongName(const QString &name)
void showCurrentLrcColorSetting()
MusicLrcColor::Color m_index
static constexpr const char * LRC_DESKTOP_PREFIX
#define TTKGenerateSingleWidget(...)
void setCurrentSongName(const QString &name) const
#define qAsConst
Definition: ttkqtglobal.h:53
virtual void applyParameter()
The class of the lrc search widget.
The class of the lrc maker widget.
void durationChanged(qint64 duration)
MusicLrcSearchWidget * m_lrcSearchWidget
MusicLrcContainer(QWidget *parent=nullptr)
void changeCurrentLrcColor(QAction *action)
void showCurrentLrcSetting()
MusicLrcColor mapIndexToColor(MusicLrcColor::Color index)
QList< MusicLrcManager * > m_lrcManagers
qint64 totalTime() const
void setLinearGradientColor(MusicLrcColor::Color color)
QList< QColor > readColorConfig(const QString &value)
#define G_SETTING_PTR