]> git.pld-linux.org Git - packages/QtSingleApplication.git/blame - clementine.patch
- pl
[packages/QtSingleApplication.git] / clementine.patch
CommitLineData
d71b6f81
ER
1Additional API from clementine:
2https://github.com/clementine-player/Clementine/blob/master/3rdparty/qtsingleapplication/qtsingleapplication.patch
3
4https://github.com/clementine-player/Clementine/issues/291#issuecomment-29984507
5qtsingleapplication: "Open With" on the file browser, and passing filenames as arguments in the command line
6Controlling playback with the commandline as well (--pause, --play, etc.)
7
3e0bb370
ER
8--- QtSingleApplication-2.6.1/src/qtlocalpeer.cpp~ 2015-02-23 00:06:20.000000000 +0200
9+++ QtSingleApplication-2.6.1/src/qtlocalpeer.cpp 2015-02-23 00:08:51.179884397 +0200
10@@ -42,6 +42,7 @@
ec2fcb4a 11 #include "qtlocalpeer.h"
3e0bb370
ER
12 #include <QCoreApplication>
13 #include <QTime>
ec2fcb4a
ER
14+#include <QtDebug>
15
16 #if defined(Q_OS_WIN)
3e0bb370 17 #include <QLibrary>
ec2fcb4a
ER
18@@ -138,6 +137,11 @@
19
20 bool QtLocalPeer::sendMessage(const QString &message, int timeout)
21 {
22+ return sendMessage(message.toUtf8(), timeout);
23+}
24+
25+bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
26+{
27 if (!isClient())
28 return false;
29
30@@ -160,9 +164,8 @@
31 if (!connOk)
32 return false;
33
34- QByteArray uMsg(message.toUtf8());
35 QDataStream ds(&socket);
36- ds.writeBytes(uMsg.constData(), uMsg.size());
37+ ds.writeBytes(message.constData(), message.size());
38 bool res = socket.waitForBytesWritten(timeout);
39 res &= socket.waitForReadyRead(timeout); // wait for ack
40 res &= (socket.read(qstrlen(ack)) == ack);
3e0bb370 41@@ -189,10 +190,10 @@
ec2fcb4a
ER
42 delete socket;
43 return;
44 }
45- QString message(QString::fromUtf8(uMsg));
46 socket->write(ack, qstrlen(ack));
47 socket->waitForBytesWritten(1000);
3e0bb370 48 socket->waitForDisconnected(1000); // make sure client reads ack
ec2fcb4a
ER
49 delete socket;
50- emit messageReceived(message); //### (might take a long time to return)
51+ emit messageReceived(uMsg); //### (might take a long time to return)
52+ emit messageReceived(QString::fromUtf8(uMsg));
53 }
3e0bb370
ER
54--- QtSingleApplication-2.6.1/src/qtlocalpeer.h~ 2015-02-23 00:12:20.000000000 +0200
55+++ QtSingleApplication-2.6.1/src/qtlocalpeer.h 2015-02-23 00:19:44.407242485 +0200
56@@ -55,11 +55,13 @@
ec2fcb4a
ER
57 QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
58 bool isClient();
59 bool sendMessage(const QString &message, int timeout);
60+ bool sendMessage(const QByteArray &message, int timeout);
61 QString applicationId() const
62 { return id; }
63
64 Q_SIGNALS:
65 void messageReceived(const QString &message);
66+ void messageReceived(const QByteArray &message);
67
68 protected Q_SLOTS:
69 void receiveConnection();
3e0bb370 70--- qtsingleapplication-2.6_1-opensource/src/qtlockedfile_win.cpp 2009-12-16 10:43:33.000000000 +0000
d71b6f81 71+++ qtsingleapplication/qtlockedfile_win.cpp 2010-07-10 16:26:33.000000000 +0100
ec2fcb4a
ER
72@@ -65,7 +65,7 @@
73
74 Qt::HANDLE mutex;
75 if (doCreate) {
76- QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
77+ QT_WA( { mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16()); },
78 { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
79 if (!mutex) {
80 qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
81@@ -73,7 +73,7 @@
82 }
83 }
84 else {
85- QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
86+ QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); },
87 { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
88 if (!mutex) {
89 if (GetLastError() != ERROR_FILE_NOT_FOUND)
3e0bb370 90--- qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.cpp 2009-12-16 10:43:33.000000000 +0000
d71b6f81 91+++ qtsingleapplication/qtsingleapplication.cpp 2010-07-10 16:23:53.000000000 +0100
ec2fcb4a
ER
92@@ -144,6 +144,7 @@
93 actWin = 0;
94 peer = new QtLocalPeer(this, appId);
95 connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
96+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
97 }
98
99
100@@ -265,6 +266,11 @@
101 return peer->sendMessage(message, timeout);
102 }
103
104+bool QtSingleApplication::sendMessage(const QByteArray &message, int timeout)
105+{
106+ return peer->sendMessage(message, timeout);
107+}
108+
109
110 /*!
111 Returns the application identifier. Two processes with the same
112@@ -291,10 +297,14 @@
113 void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
114 {
115 actWin = aw;
116- if (activateOnMessage)
117+ if (activateOnMessage) {
118 connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
119- else
120+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
121+ }
122+ else {
123 disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
124+ disconnect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
125+ }
126 }
127
128
3e0bb370 129--- qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.h 2009-12-16 10:43:33.000000000 +0000
d71b6f81 130+++ qtsingleapplication/qtsingleapplication.h 2010-07-10 16:23:53.000000000 +0100
ec2fcb4a
ER
131@@ -91,11 +91,13 @@
132
133 public Q_SLOTS:
134 bool sendMessage(const QString &message, int timeout = 5000);
135+ bool sendMessage(const QByteArray &message, int timeout = 5000);
136 void activateWindow();
137
138
139 Q_SIGNALS:
140 void messageReceived(const QString &message);
141+ void messageReceived(const QByteArray &message);
142
143
144 private:
3e0bb370 145--- qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.cpp 2009-12-16 10:43:33.000000000 +0000
d71b6f81 146+++ qtsingleapplication/qtsinglecoreapplication.cpp 2010-07-10 16:32:33.000000000 +0100
ec2fcb4a
ER
147@@ -81,6 +81,7 @@
148 {
149 peer = new QtLocalPeer(this);
150 connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
151+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
152 }
153
154
155@@ -94,6 +95,7 @@
156 {
157 peer = new QtLocalPeer(this, appId);
158 connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
159+ connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
160 }
161
162
163@@ -133,6 +135,11 @@
164 return peer->sendMessage(message, timeout);
165 }
166
167+bool QtSingleCoreApplication::sendMessage(const QByteArray &message, int timeout)
168+{
169+ return peer->sendMessage(message, timeout);
170+}
171+
172
173 /*!
174 Returns the application identifier. Two processes with the same
3e0bb370 175--- qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.h 2009-12-16 10:43:33.000000000 +0000
d71b6f81 176+++ qtsingleapplication/qtsinglecoreapplication.h 2010-07-10 16:32:33.000000000 +0100
ec2fcb4a
ER
177@@ -62,10 +62,12 @@
178
179 public Q_SLOTS:
180 bool sendMessage(const QString &message, int timeout = 5000);
181+ bool sendMessage(const QByteArray &message, int timeout = 5000);
182
183
184 Q_SIGNALS:
185 void messageReceived(const QString &message);
186+ void messageReceived(const QByteArray &message);
187
188
189 private:
This page took 0.093008 seconds and 4 git commands to generate.