TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicvoicepopwidget.cpp
Go to the documentation of this file.
1 #include "musicvoicepopwidget.h"
3 #include "musicwidgetheaders.h"
5 #include "musicqmmputils.h"
6 #include "ttkclickedslider.h"
7 
8 #include <QTimer>
9 
11  : MusicToolMenuWidget(parent),
12  m_menuShown(false)
13 {
14  initialize();
15 
16  disconnect(this, SIGNAL(clicked()), this, SLOT(popupMenu()));
17  connect(this, SIGNAL(clicked()), SLOT(updateVoiceRemove()));
18 }
19 
21 {
22  delete m_slider;
23 }
24 
26 {
27  MusicToolMenuWidget::leaveEvent(event);
29 }
30 
32 {
33  MusicToolMenuWidget::enterEvent(event);
34  if(!m_menuShown && styleSheet().contains(TTK::UI::InteriorMicrophoneOn))
35  {
36  int value = 100;
37  TTK::TTKQmmp::updateVoiceConfig(false, value);
38  m_slider->setValue(value);
39 
40  m_menuShown = true;
41  popupMenu();
43  }
44 }
45 
47 {
48  m_menuShown = false;
49 }
50 
52 {
54 }
55 
57 {
58  const bool state = TTK::TTKQmmp::isEffectEnabled("muffler");
59  setStyleSheet((v ? state : !state) ? TTK::UI::InteriorMicrophone : TTK::UI::InteriorMicrophoneOn);
60 
61  if(v)
62  {
63  TTK::TTKQmmp::setEffectEnabled("muffler", !state);
64  }
65 }
66 
68 {
70 
71  setFixedSize(30, 30);
72  setCursor(Qt::PointingHandCursor);
73  setStyleSheet(TTK::UI::InteriorMicrophone);
74  setToolTip(tr("VoiceRemove"));
75 
76  m_containWidget->setFixedSize(20, 100);
77  QHBoxLayout *layout = new QHBoxLayout(m_containWidget);
78  layout->setContentsMargins(0, 9, 0, 9);
79  layout->setSpacing(0);
80 
81  m_slider = new TTKClickedSlider(Qt::Vertical, this);
82  m_slider->setCursor(QCursor(Qt::PointingHandCursor));
83  m_slider->setRange(0, 100);
84  m_slider->setStyleSheet(TTK::UI::SliderStyle02);
85  connect(m_slider, SIGNAL(valueChanged(int)), SLOT(valueChanged(int)));
86 
87  layout->addWidget(m_slider);
88  m_containWidget->setLayout(layout);
89 }
#define QtEnterEvent
Event enter.
Definition: ttkqtcompat.h:178
The class of the tool menu base widget.
void valueChanged(int value)
MusicToolMenu * m_menu
TTK_MODULE_EXPORT void updateVoiceConfig(bool update, int &value)
void updateVoiceRemove(bool v=true)
The class of the slider that can clicked any position.
static const QString SliderStyle02
static constexpr const char * InteriorMicrophone
#define TTK_SIGNLE_SHOT(...)
Definition: ttkqtglobal.h:189
MusicVoicePopWidget(QWidget *parent=nullptr)
TTK_MODULE_EXPORT void setEffectEnabled(const QString &name, bool enabled)
virtual void enterEvent(QtEnterEvent *event) overridefinal
#define TTK_SLOT
Definition: ttkqtglobal.h:177
#define TTK_DN_S2MS
Definition: ttkglobal.h:355
TTKClickedSlider * m_slider
static constexpr const char * InteriorMicrophoneOn
TTK_MODULE_EXPORT bool isEffectEnabled(const QString &name)
virtual void leaveEvent(QEvent *event) overridefinal
state
Definition: http_parser.c:279