mirror of
https://github.com/QuasarApp/Patronum.git
synced 2025-04-26 23:54:32 +00:00
fix the d option
This commit is contained in:
parent
51bddbff8d
commit
a7b22dac24
@ -58,10 +58,10 @@ void ServiceBase::handleReceiveData(const QSet<Feature> &data) {
|
||||
}
|
||||
|
||||
if (commandList.size()) {
|
||||
QStringList stringList;
|
||||
QString stringList;
|
||||
|
||||
for (const auto&i : list) {
|
||||
stringList += i.toString();
|
||||
stringList += i.toString() + " ";
|
||||
}
|
||||
|
||||
QVariantMap result;
|
||||
|
@ -60,6 +60,12 @@ public:
|
||||
*/
|
||||
virtual bool connectToTarget() = 0;
|
||||
|
||||
/**
|
||||
* @brief isRunning This method shold be return true if the service is running else false.
|
||||
* @return return true if the service is running else false.
|
||||
*/
|
||||
virtual bool isRunning() = 0;
|
||||
|
||||
State state() const;
|
||||
|
||||
protected:
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "localsocket.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <quasarapp.h>
|
||||
@ -95,6 +96,10 @@ bool LocalSocket::connectToTarget() {
|
||||
return m_socket->isValid();
|
||||
}
|
||||
|
||||
bool LocalSocket::isRunning() {
|
||||
return (m_server && m_server->isListening()) || QFile::exists(m_target);
|
||||
}
|
||||
|
||||
void LocalSocket::handleStateChanged(QLocalSocket::LocalSocketState socketState) {
|
||||
|
||||
if (socketState == QLocalSocket::LocalSocketState::ConnectedState) {
|
||||
|
@ -34,14 +34,15 @@ public:
|
||||
|
||||
// ISocketWraper interface
|
||||
public:
|
||||
bool send(const QByteArray &data);
|
||||
bool isValid() const;
|
||||
bool listen();
|
||||
bool connectToTarget();
|
||||
bool send(const QByteArray &data) override;
|
||||
bool isValid() const override;
|
||||
bool listen() override;
|
||||
bool connectToTarget() override;
|
||||
bool isRunning() override;
|
||||
|
||||
signals:
|
||||
void sigReceve(QByteArray data);
|
||||
void sigStateChanged(State state);
|
||||
void sigReceve(QByteArray data) override;
|
||||
void sigStateChanged(State state) override;
|
||||
|
||||
private:
|
||||
QLocalSocket *m_socket = nullptr;
|
||||
|
@ -120,6 +120,12 @@ bool ServicePrivate::start() {
|
||||
}
|
||||
|
||||
bool ServicePrivate::startDeamon() {
|
||||
if (_socket->isRunning()) {
|
||||
QuasarAppUtils::Params::log("Failed to start a service because an another service alredy started",
|
||||
QuasarAppUtils::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
QProcess proc;
|
||||
proc.setProgram(QuasarAppUtils::Params::getCurrentExecutable());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user