TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicconnectionpool.cpp
Go to the documentation of this file.
1 #include "musicconnectionpool.h"
2 #include "musicplayer.h"
3 #include "musiclrcmakerwidget.h"
5 #include "musicequalizerdialog.h"
11 
12 void MusicConnectionPool::removeValue(const QObject *object)
13 {
14  for(auto it = m_parameters.constBegin(); it != m_parameters.constEnd(); ++it)
15  {
16  if(it.value() == object)
17  {
18  m_parameters.take(it.key());
19  break;
20  }
21  }
22 }
23 
24 void MusicConnectionPool::connect(const QString &from, const QString &to)
25 {
26  const QObject *first = m_parameters.value(from);
27  const QObject *second = m_parameters.value(to);
28  if(first == nullptr || second == nullptr)
29  {
30  return;
31  }
32 
33  if(from == MusicPlayer::className() && to == MusicLrcMakerWidget::className())
34  {
35  QObject::connect(first, SIGNAL(positionChanged(qint64)), second, SLOT(positionChanged(qint64)));
36  QObject::connect(first, SIGNAL(durationChanged(qint64)), second, SLOT(durationChanged(qint64)));
37  }
38  else if(from == MusicEqualizerDialog::className() && to == MusicPlayer::className())
39  {
40  QObject::connect(first, SIGNAL(setEnabledEffect(bool)), second, SLOT(setEnabledEffect(bool)));
41  QObject::connect(first, SIGNAL(setEqualizerEffect(TTKIntList)), second, SLOT(setEqualizerEffect(TTKIntList)));
42  }
43  else if(from == MusicLrcLocalLinkWidget::className() && to == MusicDownloadStatusModule::className())
44  {
45  QObject::connect(first, SIGNAL(currentLrcChanged(QString)), second, SLOT(showDownloadInfoFinished(QString)));
46  }
47  else if(from == MusicVideoQualityPopWidget::className() && to == MusicVideoSearchTableWidget::className())
48  {
49  QObject::connect(first, SIGNAL(queryMediaProps(TTK::MusicSongPropertyList&)), second, SLOT(queryMediaProps(TTK::MusicSongPropertyList&)));
50  }
51  else if((from == MusicCloudManagerTableWidget::className() && to == MusicCloudUploadTableWidget::className()))
52  {
53  QObject::connect(first, SIGNAL(uploadFileError(MusicCloudDataItem)), second, SLOT(uploadFileError(MusicCloudDataItem)));
54  QObject::connect(second, SIGNAL(reuploadFilesToServer(QStringList)), first, SLOT(reuploadFilesToServer(QStringList)));
55  }
56 }
The class of the cloud data item.
QList< int > TTKIntList
Definition: ttkqtglobal.h:200
QMap< QString, QObject * > m_parameters
void connect(const QString &from, const QString &to)
void removeValue(const QObject *object)