TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
ttkguiapplication.cpp
Go to the documentation of this file.
1 #include "ttkguiapplication.h"
2 #include "ttklocalpeer.h"
3 
4 #include <QWidget>
5 
9 class TTKGuiApplicationPrivate : public TTKPrivate<TTKGuiApplication>
10 {
11 public:
14 
16 };
17 
19  : m_peer(nullptr)
20 {
21 
22 }
23 
25 {
26  delete m_peer;
27 }
28 
29 
30 
31 TTKGuiApplication::TTKGuiApplication(int &argc, char **argv)
32  : QGuiApplication(argc, argv)
33 {
35  initialize();
36 }
37 
38 TTKGuiApplication::TTKGuiApplication(const QString &id, int &argc, char **argv)
39  : QGuiApplication(argc, argv)
40 {
42  initialize(id);
43 }
44 
46 {
48  return d->m_peer->isClient();
49 }
50 
51 QString TTKGuiApplication::id() const
52 {
54  return d->m_peer->applicationId();
55 }
56 
57 bool TTKGuiApplication::sendMessage(const QString &message, int timeout)
58 {
60  return d->m_peer->sendMessage(message, timeout);
61 }
62 
63 void TTKGuiApplication::initialize(const QString &id)
64 {
66  d->m_peer = new TTKLocalPeer(this, id);
67  connect(d->m_peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
68 }
void initialize(const QString &id={})
The class of the ttk local peer.
Definition: ttklocalpeer.h:29
The class of the ttk gui application.
void messageReceived(const QString &message)
bool isRunning() const
TTKGuiApplication(int &argc, char **argv)
The class of the ttk gui application private.
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
QString id() const
#define TTK_D(Class)
Definition: ttkprivate.h:41