TTKMusicPlayer  3.7.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 "musiclrcdefines.h"
5 
6 #include <QButtonGroup>
7 
10 {
11  setObjectName(className());
12  setStyleSheet(QString("#%1{%2}").arg(className(), 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  QButtonGroup *buttonGroup = new QButtonGroup(this);
33  buttonGroup->addButton(createPushButton(0), 0);
34  buttonGroup->addButton(createPushButton(1), 8);
35  buttonGroup->addButton(createPushButton(2), 1);
36  buttonGroup->addButton(createPushButton(3), 7);
37  QtButtonGroupConnect(buttonGroup, parent, changeCurrentLrcColor, TTK_SLOT);
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  QPushButton *button = new QPushButton(this);
86  switch(index)
87  {
88  case 0: button->setIcon(QIcon(":/color/lb_yellow")); break;
89  case 1: button->setIcon(QIcon(":/color/lb_indigo")); break;
90  case 2: button->setIcon(QIcon(":/color/lb_blue")); break;
91  case 3: button->setIcon(QIcon(":/color/lb_orange")); break;
92  default: break;
93  }
94  button->setGeometry(80 + index * 20, 25, 16, 16);
95  button->setCursor(QCursor(Qt::PointingHandCursor));
96 #ifdef Q_OS_UNIX
97  button->setFocusPolicy(Qt::NoFocus);
98 #endif
99  return button;
100 }
101 
103 {
105  const MusicLrcDefines lrc;
106  int v = lrc.findInteriorLrcIndex(line->lrcSize());
107  v = lrc.findInteriorNextSize(v);
108  line->setLrcSize(v);
109 }
110 
112 {
114  const MusicLrcDefines lrc;
115  int v = lrc.findInteriorLrcIndex(line->lrcSize());
116  v = lrc.findInteriorPreSize(v);
117  line->setLrcSize(v);
118 }
119 
121 {
123  if(line->isShowArtistBackground())
124  {
125  line->artistBackgroundChanged();
126  }
127 }
128 
130 {
132  if(!line->isShowArtistBackground())
133  {
134  line->artistBackgroundChanged();
135  }
136 }
137 
139 {
140  MusicAbstractFloatWidget::show();
141  animationEnter();
142 }
143 
145 {
146  animationLeave();
147  TTK_SIGNLE_SHOT(m_animation->duration(), this, widgetClose, TTK_SIGNAL);
148 }
#define TTK_SIGNAL
Definition: ttkqtglobal.h:164
static const QString ColorStyle06
Definition: musicuiobject.h:52
QPushButton * createPushButton(int index)
The class of the interior lrc container.
static const QString BackgroundStyle05
Definition: musicuiobject.h:93
virtual void leaveEvent(QEvent *event) overridefinal
static constexpr const char * InteriorLrcSmaller
static constexpr const char * InteriorFloatSetting
static const QString CustomStyle02
int findInteriorLrcIndex(int size) const
The class of the float widget base.
static const QString PushButtonStyle06
int findInteriorNextSize(int index) const
QPropertyAnimation * m_animation
#define TTK_SIGNLE_SHOT(...)
Definition: ttkqtglobal.h:177
static constexpr const char * InteriorLrcBigger
#define TTK_SLOT
Definition: ttkqtglobal.h:165
MusicLrcFloatSettingWidget(QWidget *parent=nullptr)
#define QtButtonGroupConnect(p, q, f, s)
Button group connect.
Definition: ttkqtcompat.h:101
The class of the lrc defines.
int findInteriorPreSize(int index) const
void resizeGeometry(int width, int height)
#define TTKObjectCast(x, y)
Definition: ttkqtglobal.h:60