mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-27 17:49:19 +01:00
Add a char* overload to QtSingleApplication - from http://pkgs.fedoraproject.org/gitweb/?p=qtsingleapplication.git;a=shortlog;h=refs/heads/f14/master
This commit is contained in:
parent
0c95f7c234
commit
c7bd0d3b01
5
3rdparty/qtsingleapplication/qtlocalpeer.cpp
vendored
5
3rdparty/qtsingleapplication/qtlocalpeer.cpp
vendored
@ -140,6 +140,11 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
||||
return sendMessage(message.toUtf8(), timeout);
|
||||
}
|
||||
|
||||
bool QtLocalPeer::sendMessage(const char* message, int timeout)
|
||||
{
|
||||
return sendMessage(QByteArray(message), timeout);
|
||||
}
|
||||
|
||||
bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
|
||||
{
|
||||
if (!isClient())
|
||||
|
2
3rdparty/qtsingleapplication/qtlocalpeer.h
vendored
2
3rdparty/qtsingleapplication/qtlocalpeer.h
vendored
@ -60,12 +60,14 @@ public:
|
||||
bool isClient();
|
||||
bool sendMessage(const QString &message, int timeout);
|
||||
bool sendMessage(const QByteArray &message, int timeout);
|
||||
bool sendMessage(const char* message, int timeout);
|
||||
QString applicationId() const
|
||||
{ return id; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
void messageReceived(const QByteArray &message);
|
||||
void messageReceived(const char* message);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void receiveConnection();
|
||||
|
@ -145,6 +145,7 @@ void QtSingleApplication::sysInit(const QString &appId)
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
|
||||
}
|
||||
|
||||
|
||||
@ -271,6 +272,11 @@ bool QtSingleApplication::sendMessage(const QByteArray &message, int timeout)
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
bool QtSingleApplication::sendMessage(const char* message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the application identifier. Two processes with the same
|
||||
@ -300,10 +306,12 @@ void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessag
|
||||
if (activateOnMessage) {
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), this, SLOT(activateWindow()));
|
||||
}
|
||||
else {
|
||||
disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
|
||||
disconnect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
|
||||
disconnect(peer, SIGNAL(messageReceived(const char*)), this, SLOT(activateWindow()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,12 +92,14 @@ public:
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
bool sendMessage(const QByteArray &message, int timeout = 5000);
|
||||
bool sendMessage(const char* message, int timeout = 5000);
|
||||
void activateWindow();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
void messageReceived(const QByteArray &message);
|
||||
void messageReceived(const char* message);
|
||||
|
||||
|
||||
private:
|
||||
|
@ -82,6 +82,7 @@ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv)
|
||||
peer = new QtLocalPeer(this);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
|
||||
}
|
||||
|
||||
|
||||
@ -96,6 +97,7 @@ QtSingleCoreApplication::QtSingleCoreApplication(const QString &appId, int &argc
|
||||
peer = new QtLocalPeer(this, appId);
|
||||
connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
|
||||
connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
|
||||
connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
|
||||
}
|
||||
|
||||
|
||||
@ -140,6 +142,11 @@ bool QtSingleCoreApplication::sendMessage(const QByteArray &message, int timeout
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
bool QtSingleCoreApplication::sendMessage(const char* message, int timeout)
|
||||
{
|
||||
return peer->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns the application identifier. Two processes with the same
|
||||
|
@ -63,11 +63,13 @@ public:
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QString &message, int timeout = 5000);
|
||||
bool sendMessage(const QByteArray &message, int timeout = 5000);
|
||||
bool sendMessage(const char* message, int timeout = 5000);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString &message);
|
||||
void messageReceived(const QByteArray &message);
|
||||
void messageReceived(const char* message);
|
||||
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user