TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
ttkcoreapplication.h.cpp
Go to the documentation of this file.
1 #include "ttkcoreapplication.h"
2 #include "ttklocalpeer.h"
3 
7 class TTKCoreApplicationPrivate : public TTKPrivate<TTKCoreApplication>
8 {
9 public:
12 
14 };
15 
17  : m_peer(nullptr)
18 {
19 
20 }
21 
23 {
24  delete m_peer;
25 }
26 
27 
28 
30  : QCoreApplication(argc, argv)
31 {
33  initialize();
34 }
35 
36 TTKCoreApplication::TTKCoreApplication(const QString &id, int &argc, char **argv)
37  : QCoreApplication(argc, argv)
38 {
40  initialize(id);
41 }
42 
44 {
46  return d->m_peer->isClient();
47 }
48 
49 QString TTKCoreApplication::id() const
50 {
52  return d->m_peer->applicationId();
53 }
54 
55 bool TTKCoreApplication::sendMessage(const QString &message, int timeout)
56 {
58  return d->m_peer->sendMessage(message, timeout);
59 }
60 
61 void TTKCoreApplication::initialize(const QString &id)
62 {
64  d->m_peer = new TTKLocalPeer(this, id);
65  connect(d->m_peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
66 }
void messageReceived(const QString &message)
The class of the ttk local peer.
Definition: ttklocalpeer.h:29
The class of the ttk core application.
The class of the ttk core application private.
void initialize(const QString &id={})
TTKCoreApplication(int &argc, char **argv)
bool sendMessage(const QString &message, int timeout=5000)
#define TTK_INIT_PRIVATE(Class)
Definition: ttkprivate.h:33
The class of the ttk private base.
Definition: ttkprivate.h:48
#define TTK_D(Class)
Definition: ttkprivate.h:41