TTKMusicPlayer  4.2.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 
6  : QWidget(parent),
7  m_linkLocalLrc(true),
8  m_currentTime(0),
9  m_totalTime(0),
10  m_lrcAnalysis(nullptr),
11  m_lrcSearchWidget(nullptr)
12 {
13 
14 }
15 
17 {
18  delete m_lrcSearchWidget;
19 }
20 
22 {
23  const QString &t = (m_containerType == LRC_DESKTOP_TPYE ? LRC_DESKTOP_PREFIX : QString());
24 
25  for(MusicLrcManager *manager : qAsConst(m_lrcManagers))
26  {
27  manager->setFontFamily(G_SETTING_PTR->value(t + "LrcFamily").toInt());
28  manager->setFontType(G_SETTING_PTR->value(t + "LrcType").toInt());
29  manager->setFontTransparent(G_SETTING_PTR->value(t + "LrcColorTransparent").toInt());
30  manager->setLrcFontSize(G_SETTING_PTR->value(t + "LrcSize").toInt());
31  }
32 
33  if(G_SETTING_PTR->value(t + "LrcColor").toInt() != -1)
34  {
36  }
37  else
38  {
39  setLinearGradientColor({TTK::readColorConfig(G_SETTING_PTR->value(t + "LrcFrontgroundColor").toString()),
40  TTK::readColorConfig(G_SETTING_PTR->value(t + "LrcBackgroundColor").toString())});
41  }
42 }
43 
45 {
47 }
48 
50 {
51  for(MusicLrcManager *manager : qAsConst(m_lrcManagers))
52  {
53  manager->setLinearGradientColor(color);
54  }
55 
58 }
59 
60 void MusicLrcContainer::setCurrentTime(qint64 time, qint64 total) noexcept
61 {
62  m_currentTime = time;
63  m_totalTime = total;
64 }
65 
67 {
68  return m_totalTime;
69 }
70 
72 {
74  Q_EMIT showCurrentLrcSetting();
75 }
76 
78 {
79  switch(action->data().toInt())
80  {
97  default: break;
98  }
99 }
100 
102 {
104 }
105 
107 {
108  delete m_lrcSearchWidget;
112 }
113 
115 {
119 }
120 
122 {
124  for(MusicLrcManager *manager : qAsConst(m_lrcManagers))
125  {
126  manager->setVisible(m_linkLocalLrc);
127  }
128 }
129 
131 {
132  qDeleteAll(m_lrcManagers);
133  m_lrcManagers.clear();
134 }
#define TTKStaticCast(x, y)
Definition: ttkglobal.h:231
The class of the lrc manager base.
The class of the lrc color.
static constexpr const char * LRC_DESKTOP_TPYE
void linearGradientColorChanged()
void setCurrentSongName(const QString &name)
void showCurrentLrcColorSetting()
MusicLrcColor::Color m_index
void setCurrentTime(qint64 time, qint64 total) noexcept
static constexpr const char * LRC_DESKTOP_PREFIX
#define TTKGenerateSingleWidget(...)
void setCurrentSongName(const QString &name) const
#define qAsConst
Definition: ttkqtglobal.h:57
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)
qint64 totalTime() const noexcept
void showCurrentLrcSetting()
MusicLrcColor mapIndexToColor(MusicLrcColor::Color index)
QList< MusicLrcManager * > m_lrcManagers
#define const
Definition: zconf.h:233
void setLinearGradientColor(MusicLrcColor::Color color)
QList< QColor > readColorConfig(const QString &value)
#define G_SETTING_PTR