TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musiclrcfloatsettingwidget.cpp
Go to the documentation of this file.
4 #include "musiclrchelper.h"
5 #include "ttkclickedgroup.h"
6 #include "ttkclickedlabel.h"
7 
10 {
11  setObjectName(MusicLrcFloatSettingWidget::metaObject()->className());
12  setStyleSheet(QString("#%1{ %2 }").arg(objectName(), TTK::UI::BackgroundStyle05));
13 
14  QLabel *colorLabel = new QLabel(tr("Color"), this);
15  QLabel *sizeLabel = new QLabel(tr("Size"), this);
16  QLabel *backLabel = new QLabel(tr("Background"), this);
17 
18  const QString &labelStyle = TTK::UI::ColorStyle06 + TTK::UI::CustomStyle02 + "image:url(:/lrc/lb_shadow);";
19 
20  colorLabel->setStyleSheet(labelStyle);
21  sizeLabel->setStyleSheet(labelStyle);
22  backLabel->setStyleSheet(labelStyle);
23 
24  colorLabel->setAlignment(Qt::AlignCenter);
25  sizeLabel->setAlignment(Qt::AlignCenter);
26  backLabel->setAlignment(Qt::AlignCenter);
27 
28  colorLabel->setGeometry(10, 23, 70, 20);
29  sizeLabel->setGeometry(10, 70, 70, 20);
30  backLabel->setGeometry(10, 115, 70, 20);
31 
32  TTKClickedGroup *clickedGroup = new TTKClickedGroup(this);
33  clickedGroup->addWidget(createButtonLabel(0), 0);
34  clickedGroup->addWidget(createButtonLabel(1), 8);
35  clickedGroup->addWidget(createButtonLabel(2), 1);
36  clickedGroup->addWidget(createButtonLabel(3), 7);
37  connect(clickedGroup, SIGNAL(clicked(int)), parent, SLOT(changeCurrentLrcColor(int)));
38 
39  QPushButton *sizeBigerButton = new QPushButton(this);
40  QPushButton *sizeSmallerButton = new QPushButton(this);
41  sizeBigerButton->setStyleSheet(TTK::UI::InteriorLrcBigger);
42  sizeSmallerButton->setStyleSheet(TTK::UI::InteriorLrcSmaller);
43  sizeBigerButton->setGeometry(85, 70, 24, 24);
44  sizeSmallerButton->setGeometry(125, 70, 24, 24);
45  sizeBigerButton->setCursor(QCursor(Qt::PointingHandCursor));
46  sizeSmallerButton->setCursor(QCursor(Qt::PointingHandCursor));
47  connect(sizeBigerButton, SIGNAL(clicked()), SLOT(lrcSizeUpChanged()));
48  connect(sizeSmallerButton, SIGNAL(clicked()), SLOT(lrcSizeLowChanged()));
49 
50  QPushButton *musicBackButton = new QPushButton(tr("Defualt"), this);
51  musicBackButton->setCursor(QCursor(Qt::PointingHandCursor));
52  connect(musicBackButton,SIGNAL(clicked()), SLOT(lrcMusicBackgroundChanged()));
53  QPushButton *artBackButton = new QPushButton(tr("Art"), this);
54  artBackButton->setCursor(QCursor(Qt::PointingHandCursor));
55  connect(artBackButton, SIGNAL(clicked()), SLOT(lrcArtBackgroundChanged()));
56  musicBackButton->setStyleSheet(TTK::UI::InteriorFloatSetting + TTK::UI::PushButtonStyle06);
57  artBackButton->setStyleSheet(TTK::UI::InteriorFloatSetting + TTK::UI::PushButtonStyle06);
58  musicBackButton->setGeometry(15, 150, 60, 22);
59  artBackButton->setGeometry(90, 150, 60, 22);
60 
61  QPushButton *settingButton = new QPushButton(tr("More"), this);
62  settingButton->setCursor(QCursor(Qt::PointingHandCursor));
63  connect(settingButton, SIGNAL(clicked()), parent, SIGNAL(showCurrentLrcSetting()));
64  settingButton->setStyleSheet(TTK::UI::InteriorFloatSetting + TTK::UI::PushButtonStyle06);
65  settingButton->setGeometry(15, 175, 60, 22);
66 
67 #ifdef Q_OS_UNIX
68  sizeBigerButton->setFocusPolicy(Qt::NoFocus);
69  sizeSmallerButton->setFocusPolicy(Qt::NoFocus);
70  musicBackButton->setFocusPolicy(Qt::NoFocus);
71  artBackButton->setFocusPolicy(Qt::NoFocus);
72  settingButton->setFocusPolicy(Qt::NoFocus);
73 #endif
74 }
75 
76 void MusicLrcFloatSettingWidget::resizeGeometry(int width, int height)
77 {
78  m_rectEnter = QRect(513 + width, 120 + height / 2, 165, 210);
79  m_rectLeave = QRect(673 + width, 171 + height / 2, 165, 105);
80  setGeometry(m_rectLeave);
81 }
82 
84 {
85  MusicAbstractFloatWidget::show();
87 }
88 
90 {
92  const MusicLrcHelper lrc;
93  int v = lrc.findInteriorLrcIndex(line->lrcSize());
94  v = lrc.findInteriorNextSize(v);
95  line->setLrcSize(v);
96 }
97 
99 {
101  const MusicLrcHelper lrc;
102  int v = lrc.findInteriorLrcIndex(line->lrcSize());
103  v = lrc.findInteriorPreSize(v);
104  line->setLrcSize(v);
105 }
106 
108 {
110  if(line->isShowArtistBackground())
111  {
112  line->artistBackgroundChanged();
113  }
114 }
115 
117 {
119  if(!line->isShowArtistBackground())
120  {
121  line->artistBackgroundChanged();
122  }
123 }
124 
126 {
127  animationLeave();
128  TTK_SIGNLE_SHOT(m_animation->duration(), this, widgetClose, TTK_SIGNAL);
129 }
130 
132 {
133  TTKClickedLabel *label = new TTKClickedLabel(this);
134  switch(index)
135  {
136  case 0: label->setPixmap(QPixmap(":/color/lb_yellow")); break;
137  case 1: label->setPixmap(QPixmap(":/color/lb_indigo")); break;
138  case 2: label->setPixmap(QPixmap(":/color/lb_blue")); break;
139  case 3: label->setPixmap(QPixmap(":/color/lb_orange")); break;
140  default: break;
141  }
142 
143  label->setGeometry(80 + index * 20, 25, 16, 16);
144  return label;
145 }
#define TTK_SIGNAL
Definition: ttkqtglobal.h:176
static const QString ColorStyle06
Definition: musicuiobject.h:52
The class of the interior lrc container.
static const QString BackgroundStyle05
Definition: musicuiobject.h:94
int findInteriorNextSize(int index) const
virtual void leaveEvent(QEvent *event) overridefinal
static constexpr const char * InteriorLrcSmaller
static constexpr const char * InteriorFloatSetting
The class of the label widget that can click.
static const QString CustomStyle02
void addWidget(QWidget *widget, int id=-1)
The class of the float widget base.
static const QString PushButtonStyle06
QPropertyAnimation * m_animation
#define TTK_SIGNLE_SHOT(...)
Definition: ttkqtglobal.h:189
static constexpr const char * InteriorLrcBigger
MusicLrcFloatSettingWidget(QWidget *parent=nullptr)
The class of the lrc helper.
void resizeGeometry(int width, int height)
int findInteriorLrcIndex(int size) const
The class of the label widget click group mapper.
int findInteriorPreSize(int index) const
#define TTKObjectCast(x, y)
Definition: ttkqtglobal.h:82